@mark1russell7/stack-placement 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +201 -2
- package/build/add-on.d.ts +12 -0
- package/build/add-on.d.ts.map +1 -0
- package/build/add-on.js +23 -0
- package/build/add-on.js.map +1 -0
- package/build/index.d.ts +277 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +477 -0
- package/build/index.js.map +1 -0
- package/build/join-BHqjGNJL.js +157 -0
- package/build/join-BHqjGNJL.js.map +1 -0
- package/build/layer--Zwbckrx.d.ts +73 -0
- package/build/layer--Zwbckrx.d.ts.map +1 -0
- package/build/layer-BSj5LGH9.js +6 -0
- package/build/layer-BSj5LGH9.js.map +1 -0
- package/build/schema.d.ts +21 -0
- package/build/schema.d.ts.map +1 -0
- package/build/schema.js +57 -0
- package/build/schema.js.map +1 -0
- package/package.json +77 -3
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { t as PLACEMENT_SCHEMA } from "./layer-BSj5LGH9.js";
|
|
2
|
+
import { joinRecords, joinSetting, partNeeds } from "@mark1russell7/system-stack";
|
|
3
|
+
// src/check.ts
|
|
4
|
+
/**
|
|
5
|
+
* These are the codes of the gate.
|
|
6
|
+
*
|
|
7
|
+
* - `part-unknown` (error): the part of the layer is not a part of the base stack.
|
|
8
|
+
* - `slot-twice` (error): two or more slots have one `id`.
|
|
9
|
+
* - `slot-part` (error): the `id` of a slot is a part of the base stack. A candidate gives that part.
|
|
10
|
+
* - `slot-unneeded` (warning): no part of the base stack names the `id` of a slot in a need.
|
|
11
|
+
* - `slot-no-candidate` (error): a slot has no candidate.
|
|
12
|
+
* - `candidate-twice` (error): two or more candidates of a slot have one key.
|
|
13
|
+
* - `candidate-part` (error): the stack of a candidate has no part with the `id` of its slot.
|
|
14
|
+
* - `cost-range` (error): a cost is not a finite number of 0 or more.
|
|
15
|
+
* - `shared-twice` (error): two or more shared fragments have one `id`.
|
|
16
|
+
* - `shared-unknown` (error): a candidate uses a shared fragment that the layer does not have.
|
|
17
|
+
* - `shared-unused` (warning): no candidate uses a shared fragment.
|
|
18
|
+
* - `limit-range` (error): a limit of cost is not a finite number of 0 or more. Or the limit of chance is not from 0 to 1.
|
|
19
|
+
*/
|
|
20
|
+
const PLACEMENT_CODES = [
|
|
21
|
+
"part-unknown",
|
|
22
|
+
"slot-twice",
|
|
23
|
+
"slot-part",
|
|
24
|
+
"slot-unneeded",
|
|
25
|
+
"slot-no-candidate",
|
|
26
|
+
"candidate-twice",
|
|
27
|
+
"candidate-part",
|
|
28
|
+
"cost-range",
|
|
29
|
+
"shared-twice",
|
|
30
|
+
"shared-unknown",
|
|
31
|
+
"shared-unused",
|
|
32
|
+
"limit-range"
|
|
33
|
+
];
|
|
34
|
+
/** This function tells if a value is a finite number, 0 or more. */
|
|
35
|
+
function isZeroOrMore(value) {
|
|
36
|
+
return Number.isFinite(value) && value >= 0;
|
|
37
|
+
}
|
|
38
|
+
/** This function gives each `id` that two or more items of a list have, in the order of their first item. */
|
|
39
|
+
function twice(ids) {
|
|
40
|
+
const counts = /* @__PURE__ */ new Map();
|
|
41
|
+
for (const id of ids) counts.set(id, (counts.get(id) ?? 0) + 1);
|
|
42
|
+
return [...counts].filter(([, count]) => count > 1).map(([id]) => id);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* This function gives each fault of a placement layer for its base stack. A list with no error tells that the gate passes.
|
|
46
|
+
*
|
|
47
|
+
* The gate examines the slots, the candidates, the shared fragments, the costs and the limits. It does not examine the
|
|
48
|
+
* layers of a fragment: the gates of their add-ons examine each placed stack. The faults are in the order of the layer.
|
|
49
|
+
* The function is pure.
|
|
50
|
+
*
|
|
51
|
+
* @param layer - The placement layer
|
|
52
|
+
* @param stack - The base stack, with the layer
|
|
53
|
+
* @returns The faults
|
|
54
|
+
*/
|
|
55
|
+
function checkPlacement(layer, stack) {
|
|
56
|
+
const faults = [];
|
|
57
|
+
const add = (level, code, at, message) => {
|
|
58
|
+
faults.push({
|
|
59
|
+
level,
|
|
60
|
+
code,
|
|
61
|
+
at,
|
|
62
|
+
message
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const parts = new Set(stack.parts.map((part) => part.id));
|
|
66
|
+
const needed = new Set(stack.parts.flatMap((part) => partNeeds(part)));
|
|
67
|
+
if (!parts.has(layer.part)) add("error", "part-unknown", layer.part, `The part "${layer.part}" of the placement is not a part of the stack.`);
|
|
68
|
+
for (const id of twice(layer.slots.map((slot) => slot.id))) add("error", "slot-twice", id, `Two or more slots have the id "${id}".`);
|
|
69
|
+
const shared = layer.shared ?? [];
|
|
70
|
+
const sharedIds = new Set(shared.map((item) => item.id));
|
|
71
|
+
const used = /* @__PURE__ */ new Set();
|
|
72
|
+
for (const slot of layer.slots) {
|
|
73
|
+
if (parts.has(slot.id)) add("error", "slot-part", slot.id, `The slot "${slot.id}" is a part of the stack. A candidate of the slot gives that part.`);
|
|
74
|
+
else if (!needed.has(slot.id)) add("warning", "slot-unneeded", slot.id, `No part of the stack names the slot "${slot.id}" in a need.`);
|
|
75
|
+
if (slot.candidates.length === 0) add("error", "slot-no-candidate", slot.id, `The slot "${slot.id}" has no candidate.`);
|
|
76
|
+
for (const key of twice(slot.candidates.map((candidate) => candidate.key))) add("error", "candidate-twice", slot.id, `Two or more candidates of the slot "${slot.id}" have the key "${key}".`);
|
|
77
|
+
for (const candidate of slot.candidates) {
|
|
78
|
+
const at = `${slot.id}/${candidate.key}`;
|
|
79
|
+
if (!candidate.stack.parts.some((part) => part.id === slot.id)) add("error", "candidate-part", at, `The candidate "${candidate.key}" of the slot "${slot.id}" has no part "${slot.id}".`);
|
|
80
|
+
if (!isZeroOrMore(candidate.cost)) add("error", "cost-range", at, `The cost of the candidate "${candidate.key}" of the slot "${slot.id}" is ${String(candidate.cost)}. It must be 0 or more.`);
|
|
81
|
+
for (const id of candidate.uses ?? []) {
|
|
82
|
+
used.add(id);
|
|
83
|
+
if (!sharedIds.has(id)) add("error", "shared-unknown", at, `The candidate "${candidate.key}" of the slot "${slot.id}" uses the shared fragment "${id}". The layer has no shared fragment "${id}".`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
for (const id of twice(shared.map((item) => item.id))) add("error", "shared-twice", id, `Two or more shared fragments have the id "${id}".`);
|
|
88
|
+
for (const item of shared) {
|
|
89
|
+
if (item.cost !== void 0 && !isZeroOrMore(item.cost)) add("error", "cost-range", item.id, `The cost of the shared fragment "${item.id}" is ${String(item.cost)}. It must be 0 or more.`);
|
|
90
|
+
if (!used.has(item.id)) add("warning", "shared-unused", item.id, `No candidate uses the shared fragment "${item.id}".`);
|
|
91
|
+
}
|
|
92
|
+
const limits = layer.limits ?? {};
|
|
93
|
+
for (const name of ["cost", "bound"]) {
|
|
94
|
+
const value = limits[name];
|
|
95
|
+
if (value !== void 0 && !isZeroOrMore(value)) add("error", "limit-range", name, `The limit "${name}" is ${String(value)}. It must be 0 or more.`);
|
|
96
|
+
}
|
|
97
|
+
if (limits.chance !== void 0 && !(limits.chance >= 0 && limits.chance <= 1)) add("error", "limit-range", "chance", `The limit "chance" is ${String(limits.chance)}. It must be from 0 to 1.`);
|
|
98
|
+
return faults;
|
|
99
|
+
}
|
|
100
|
+
// src/join.ts
|
|
101
|
+
/**
|
|
102
|
+
* This function joins the placement layers of the fragments of a stack into one layer.
|
|
103
|
+
*
|
|
104
|
+
* - The layer has one part and one currency. A fragment with a different value is a fault.
|
|
105
|
+
* - Each limit has one value. A fragment with no value takes the value of the others.
|
|
106
|
+
* - The slots and the shared fragments are in the order of the fragments. A slot or a shared fragment of two or more fragments is a fault.
|
|
107
|
+
*
|
|
108
|
+
* The function is pure, and it changes no layer. The gate `checkPlacement` examines the joined layer afterward.
|
|
109
|
+
*
|
|
110
|
+
* @param pieces - The layers, with the name of the fragment of each one, in the order of the fragments.
|
|
111
|
+
* @returns The joined layer, or the faults of the join. An empty list of layers is a fault.
|
|
112
|
+
*/
|
|
113
|
+
function joinPlacement(pieces) {
|
|
114
|
+
const part = joinSetting(pieces, (layer) => layer.part, "part of the placement");
|
|
115
|
+
const currency = joinSetting(pieces, (layer) => layer.currency, "currency");
|
|
116
|
+
const cost = joinSetting(pieces, (layer) => layer.limits?.cost, "limit of the expected cost");
|
|
117
|
+
const bound = joinSetting(pieces, (layer) => layer.limits?.bound, "limit of the cost from the spend layer");
|
|
118
|
+
const chance = joinSetting(pieces, (layer) => layer.limits?.chance, "limit of the chance");
|
|
119
|
+
const slots = joinRecords(pieces, (layer) => layer.slots, (slot) => slot.id, "slot");
|
|
120
|
+
const shared = joinRecords(pieces, (layer) => layer.shared, (item) => item.id, "shared fragment");
|
|
121
|
+
if (part.value === void 0 || currency.value === void 0) return {
|
|
122
|
+
ok: false,
|
|
123
|
+
errors: ["The join of placement layers got no layer."]
|
|
124
|
+
};
|
|
125
|
+
const errors = [
|
|
126
|
+
...part.errors,
|
|
127
|
+
...currency.errors,
|
|
128
|
+
...cost.errors,
|
|
129
|
+
...bound.errors,
|
|
130
|
+
...chance.errors,
|
|
131
|
+
...slots.errors,
|
|
132
|
+
...shared.errors
|
|
133
|
+
];
|
|
134
|
+
if (errors.length > 0) return {
|
|
135
|
+
ok: false,
|
|
136
|
+
errors
|
|
137
|
+
};
|
|
138
|
+
const limits = {
|
|
139
|
+
...cost.value === void 0 ? {} : { cost: cost.value },
|
|
140
|
+
...bound.value === void 0 ? {} : { bound: bound.value },
|
|
141
|
+
...chance.value === void 0 ? {} : { chance: chance.value }
|
|
142
|
+
};
|
|
143
|
+
return {
|
|
144
|
+
ok: true,
|
|
145
|
+
layer: {
|
|
146
|
+
schema: PLACEMENT_SCHEMA,
|
|
147
|
+
part: part.value,
|
|
148
|
+
currency: currency.value,
|
|
149
|
+
slots: slots.items,
|
|
150
|
+
...pieces.some((piece) => piece.layer.shared !== void 0) ? { shared: shared.items } : {},
|
|
151
|
+
...pieces.some((piece) => piece.layer.limits !== void 0) ? { limits } : {}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
export { PLACEMENT_CODES as n, checkPlacement as r, joinPlacement as t };
|
|
156
|
+
|
|
157
|
+
//# sourceMappingURL=join-BHqjGNJL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join-BHqjGNJL.js","names":[],"sources":["../src/check.ts","../src/join.ts"],"sourcesContent":["import { partNeeds, type Fault, type Stack } from \"@mark1russell7/system-stack\";\nimport type { PlacementLayer } from \"./layer.ts\";\n\n// The gate of a placement layer: the meaning of a layer with a correct form, for its base stack.\n\n/**\n * These are the codes of the gate.\n *\n * - `part-unknown` (error): the part of the layer is not a part of the base stack.\n * - `slot-twice` (error): two or more slots have one `id`.\n * - `slot-part` (error): the `id` of a slot is a part of the base stack. A candidate gives that part.\n * - `slot-unneeded` (warning): no part of the base stack names the `id` of a slot in a need.\n * - `slot-no-candidate` (error): a slot has no candidate.\n * - `candidate-twice` (error): two or more candidates of a slot have one key.\n * - `candidate-part` (error): the stack of a candidate has no part with the `id` of its slot.\n * - `cost-range` (error): a cost is not a finite number of 0 or more.\n * - `shared-twice` (error): two or more shared fragments have one `id`.\n * - `shared-unknown` (error): a candidate uses a shared fragment that the layer does not have.\n * - `shared-unused` (warning): no candidate uses a shared fragment.\n * - `limit-range` (error): a limit of cost is not a finite number of 0 or more. Or the limit of chance is not from 0 to 1.\n */\nexport const PLACEMENT_CODES: readonly [\n \"part-unknown\",\n \"slot-twice\",\n \"slot-part\",\n \"slot-unneeded\",\n \"slot-no-candidate\",\n \"candidate-twice\",\n \"candidate-part\",\n \"cost-range\",\n \"shared-twice\",\n \"shared-unknown\",\n \"shared-unused\",\n \"limit-range\",\n] = [\n \"part-unknown\",\n \"slot-twice\",\n \"slot-part\",\n \"slot-unneeded\",\n \"slot-no-candidate\",\n \"candidate-twice\",\n \"candidate-part\",\n \"cost-range\",\n \"shared-twice\",\n \"shared-unknown\",\n \"shared-unused\",\n \"limit-range\",\n];\n\n/** A code of `PLACEMENT_CODES`. */\nexport type PlacementCode = (typeof PLACEMENT_CODES)[number];\n\n/** A fault of the gate of a placement layer. */\nexport interface PlacementFault extends Fault {\n readonly code: PlacementCode;\n}\n\n/** This function tells if a value is a finite number, 0 or more. */\nfunction isZeroOrMore(value: number): boolean {\n return Number.isFinite(value) && value >= 0;\n}\n\n/** This function gives each `id` that two or more items of a list have, in the order of their first item. */\nfunction twice(ids: readonly string[]): string[] {\n const counts = new Map<string, number>();\n for (const id of ids) counts.set(id, (counts.get(id) ?? 0) + 1);\n return [...counts].filter(([, count]) => count > 1).map(([id]) => id);\n}\n\n/**\n * This function gives each fault of a placement layer for its base stack. A list with no error tells that the gate passes.\n *\n * The gate examines the slots, the candidates, the shared fragments, the costs and the limits. It does not examine the\n * layers of a fragment: the gates of their add-ons examine each placed stack. The faults are in the order of the layer.\n * The function is pure.\n *\n * @param layer - The placement layer\n * @param stack - The base stack, with the layer\n * @returns The faults\n */\nexport function checkPlacement(layer: PlacementLayer, stack: Stack): PlacementFault[] {\n const faults: PlacementFault[] = [];\n const add = (level: PlacementFault[\"level\"], code: PlacementCode, at: string, message: string): void => {\n faults.push({ level, code, at, message });\n };\n const parts = new Set(stack.parts.map((part) => part.id));\n const needed = new Set(stack.parts.flatMap((part) => partNeeds(part)));\n if (!parts.has(layer.part)) add(\"error\", \"part-unknown\", layer.part, `The part \"${layer.part}\" of the placement is not a part of the stack.`);\n for (const id of twice(layer.slots.map((slot) => slot.id))) add(\"error\", \"slot-twice\", id, `Two or more slots have the id \"${id}\".`);\n const shared = layer.shared ?? [];\n const sharedIds = new Set(shared.map((item) => item.id));\n const used = new Set<string>();\n for (const slot of layer.slots) {\n if (parts.has(slot.id)) add(\"error\", \"slot-part\", slot.id, `The slot \"${slot.id}\" is a part of the stack. A candidate of the slot gives that part.`);\n else if (!needed.has(slot.id)) add(\"warning\", \"slot-unneeded\", slot.id, `No part of the stack names the slot \"${slot.id}\" in a need.`);\n if (slot.candidates.length === 0) add(\"error\", \"slot-no-candidate\", slot.id, `The slot \"${slot.id}\" has no candidate.`);\n for (const key of twice(slot.candidates.map((candidate) => candidate.key))) add(\"error\", \"candidate-twice\", slot.id, `Two or more candidates of the slot \"${slot.id}\" have the key \"${key}\".`);\n for (const candidate of slot.candidates) {\n const at = `${slot.id}/${candidate.key}`;\n if (!candidate.stack.parts.some((part) => part.id === slot.id)) add(\"error\", \"candidate-part\", at, `The candidate \"${candidate.key}\" of the slot \"${slot.id}\" has no part \"${slot.id}\".`);\n if (!isZeroOrMore(candidate.cost)) add(\"error\", \"cost-range\", at, `The cost of the candidate \"${candidate.key}\" of the slot \"${slot.id}\" is ${String(candidate.cost)}. It must be 0 or more.`);\n for (const id of candidate.uses ?? []) {\n used.add(id);\n if (!sharedIds.has(id)) add(\"error\", \"shared-unknown\", at, `The candidate \"${candidate.key}\" of the slot \"${slot.id}\" uses the shared fragment \"${id}\". The layer has no shared fragment \"${id}\".`);\n }\n }\n }\n for (const id of twice(shared.map((item) => item.id))) add(\"error\", \"shared-twice\", id, `Two or more shared fragments have the id \"${id}\".`);\n for (const item of shared) {\n if (item.cost !== undefined && !isZeroOrMore(item.cost)) add(\"error\", \"cost-range\", item.id, `The cost of the shared fragment \"${item.id}\" is ${String(item.cost)}. It must be 0 or more.`);\n if (!used.has(item.id)) add(\"warning\", \"shared-unused\", item.id, `No candidate uses the shared fragment \"${item.id}\".`);\n }\n const limits = layer.limits ?? {};\n for (const name of [\"cost\", \"bound\"] as const) {\n const value = limits[name];\n if (value !== undefined && !isZeroOrMore(value)) add(\"error\", \"limit-range\", name, `The limit \"${name}\" is ${String(value)}. It must be 0 or more.`);\n }\n if (limits.chance !== undefined && !(limits.chance >= 0 && limits.chance <= 1)) add(\"error\", \"limit-range\", \"chance\", `The limit \"chance\" is ${String(limits.chance)}. It must be from 0 to 1.`);\n return faults;\n}\n","import { joinRecords, joinSetting, type LayerParse, type LayerPiece } from \"@mark1russell7/system-stack\";\nimport { PLACEMENT_SCHEMA, type PlacementLayer, type PlacementLimits } from \"./layer.ts\";\n\n// The join of the placement layers of the fragments of a stack, for example one file of slots for each owner.\n\n/**\n * This function joins the placement layers of the fragments of a stack into one layer.\n *\n * - The layer has one part and one currency. A fragment with a different value is a fault.\n * - Each limit has one value. A fragment with no value takes the value of the others.\n * - The slots and the shared fragments are in the order of the fragments. A slot or a shared fragment of two or more fragments is a fault.\n *\n * The function is pure, and it changes no layer. The gate `checkPlacement` examines the joined layer afterward.\n *\n * @param pieces - The layers, with the name of the fragment of each one, in the order of the fragments.\n * @returns The joined layer, or the faults of the join. An empty list of layers is a fault.\n */\nexport function joinPlacement(pieces: readonly LayerPiece<PlacementLayer>[]): LayerParse<PlacementLayer> {\n const part = joinSetting(pieces, (layer) => layer.part, \"part of the placement\");\n const currency = joinSetting(pieces, (layer) => layer.currency, \"currency\");\n const cost = joinSetting(pieces, (layer) => layer.limits?.cost, \"limit of the expected cost\");\n const bound = joinSetting(pieces, (layer) => layer.limits?.bound, \"limit of the cost from the spend layer\");\n const chance = joinSetting(pieces, (layer) => layer.limits?.chance, \"limit of the chance\");\n const slots = joinRecords(\n pieces,\n (layer) => layer.slots,\n (slot) => slot.id,\n \"slot\",\n );\n const shared = joinRecords(\n pieces,\n (layer) => layer.shared,\n (item) => item.id,\n \"shared fragment\",\n );\n if (part.value === undefined || currency.value === undefined) return { ok: false, errors: [\"The join of placement layers got no layer.\"] };\n const errors = [...part.errors, ...currency.errors, ...cost.errors, ...bound.errors, ...chance.errors, ...slots.errors, ...shared.errors];\n if (errors.length > 0) return { ok: false, errors };\n const limits: PlacementLimits = {\n ...(cost.value === undefined ? {} : { cost: cost.value }),\n ...(bound.value === undefined ? {} : { bound: bound.value }),\n ...(chance.value === undefined ? {} : { chance: chance.value }),\n };\n return {\n ok: true,\n layer: {\n schema: PLACEMENT_SCHEMA,\n part: part.value,\n currency: currency.value,\n slots: slots.items,\n ...(pieces.some((piece) => piece.layer.shared !== undefined) ?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,KAAa,SAAS,UAAU,KAAA,GAAW,OAAO;EAAE,IAAI;EAAO,QAAQ,CAAC,4CAA4C;CAAE;CACzI,MAAM,SAAS;EAAC,GAAG,KAAK;EAAQ,GAAG,SAAS;EAAQ,GAAG,KAAK;EAAQ,GAAG,MAAM;EAAQ,GAAG,OAAO;EAAQ,GAAG,MAAM;EAAQ,GAAG,OAAO;CAAM;CACxI,IAAI,OAAO,SAAS,GAAG,OAAO;EAAE,IAAI;EAAO;CAAO;CAClD,MAAM,SAA0B;EAC9B,GAAI,KAAK,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM;EACvD,GAAI,MAAM,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,MAAM,MAAM;EAC1D,GAAI,OAAO,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,OAAO,MAAM;CAC/D;CACA,OAAO;EACL,IAAI;EACJ,OAAO;GACL,QAAQ;GACR,MAAM,KAAK;GACX,UAAU,SAAS;GACnB,OAAO,MAAM;GACb,GAAI,OAAO,MAAM,UAAU,MAAM,MAAM,WAAW,KAAA,CAAS,IAAI,EAAE,QAAQ,OAAO,MAAM,IAAI,CAAC;GAC3F,GAAI,OAAO,MAAM,UAAU,MAAM,MAAM,WAAW,KAAA,CAAS,IAAI,EAAE,OAAO,IAAI,CAAC;EAC/E;CACF;AACF"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Stack } from "@mark1russell7/system-stack";
|
|
2
|
+
/** The name of the format of a placement layer. It is the key of the layer in `Stack.layers`. */
|
|
3
|
+
declare const PLACEMENT_SCHEMA = "placement/1";
|
|
4
|
+
/**
|
|
5
|
+
* One candidate of a slot: a stack fragment that gives the part of the slot, and its cost.
|
|
6
|
+
*
|
|
7
|
+
* - The fragment has the part with the `id` of the slot, and each part that only this candidate has.
|
|
8
|
+
* - The layers of the fragment give the records of its parts, for example the chances of `risk/1` and the costs of `spend/1`.
|
|
9
|
+
* - A part of two or more candidates, for example a provider or a region, is in a shared fragment. The candidate names it in `uses`.
|
|
10
|
+
*/
|
|
11
|
+
interface Candidate {
|
|
12
|
+
/** The key of the candidate. Each candidate of a slot has a different key. A choice names the candidate with it. */
|
|
13
|
+
readonly key: string;
|
|
14
|
+
/** The stack fragment of the candidate. */
|
|
15
|
+
readonly stack: Stack;
|
|
16
|
+
/** The expected cost of the candidate in a month, in the currency of the layer. */
|
|
17
|
+
readonly cost: number;
|
|
18
|
+
/** The `id` of each shared fragment that the candidate needs. */
|
|
19
|
+
readonly uses?: readonly string[] | undefined;
|
|
20
|
+
/** The source of the candidate for a reader, for example the `id` of an offer. */
|
|
21
|
+
readonly source?: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
/** One slot of a stack: a part that the stack needs, and the candidates that can give it. */
|
|
24
|
+
interface Slot {
|
|
25
|
+
/** The `id` of the part of the slot. A part of the base stack names it in a need. */
|
|
26
|
+
readonly id: string;
|
|
27
|
+
/** The candidates of the slot. */
|
|
28
|
+
readonly candidates: readonly Candidate[];
|
|
29
|
+
/** With `true`, a choice can leave the slot empty. Then the stack has no part of the slot, and a need of that part does not hold. */
|
|
30
|
+
readonly optional?: boolean | undefined;
|
|
31
|
+
}
|
|
32
|
+
/** A shared fragment: the parts that two or more candidates need, for example a provider, a region or an account. */
|
|
33
|
+
interface Shared {
|
|
34
|
+
/** The `id` of the fragment. A candidate names it in `uses`. */
|
|
35
|
+
readonly id: string;
|
|
36
|
+
/** The stack fragment with the shared parts and their layers. */
|
|
37
|
+
readonly stack: Stack;
|
|
38
|
+
/** The expected cost of the fragment in a month. A placed stack counts it one time. The default is 0. */
|
|
39
|
+
readonly cost?: number | undefined;
|
|
40
|
+
}
|
|
41
|
+
/** The limits of a placement. A choice that breaks a limit is not on the front. */
|
|
42
|
+
interface PlacementLimits {
|
|
43
|
+
/** The largest expected cost of a month. */
|
|
44
|
+
readonly cost?: number | undefined;
|
|
45
|
+
/** The largest cost of a month from the spend layer of the placed stack. A service with no bound breaks this limit. */
|
|
46
|
+
readonly bound?: number | undefined;
|
|
47
|
+
/** The smallest chance that the part of the layer works, from 0 to 1. */
|
|
48
|
+
readonly chance?: number | undefined;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A placement layer: the slots of a stack, the candidates of each slot, and the limits.
|
|
52
|
+
* A choice of one candidate for each slot gives one placed stack. `planPlacement` finds the best choices.
|
|
53
|
+
*/
|
|
54
|
+
interface PlacementLayer {
|
|
55
|
+
readonly schema: typeof PLACEMENT_SCHEMA;
|
|
56
|
+
/** The `id` of the part to keep in work, for example a function of the system. It is a part of the base stack. */
|
|
57
|
+
readonly part: string;
|
|
58
|
+
/** The currency of each cost, for example `USD`. */
|
|
59
|
+
readonly currency: string;
|
|
60
|
+
/** The slots, in the order of the stages of the search. */
|
|
61
|
+
readonly slots: readonly Slot[];
|
|
62
|
+
/** The shared fragments. */
|
|
63
|
+
readonly shared?: readonly Shared[] | undefined;
|
|
64
|
+
/** The limits. */
|
|
65
|
+
readonly limits?: PlacementLimits | undefined;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A choice: the key of the candidate of each slot, by the `id` of the slot.
|
|
69
|
+
* The value `null` leaves an optional slot empty. A slot that the choice does not name is also empty.
|
|
70
|
+
*/
|
|
71
|
+
type Choice = Readonly<Record<string, string | null>>;
|
|
72
|
+
export { PlacementLimits as a, PlacementLayer as i, Choice as n, Shared as o, PLACEMENT_SCHEMA as r, Slot as s, Candidate as t };
|
|
73
|
+
//# sourceMappingURL=layer--Zwbckrx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer--Zwbckrx.d.ts","names":[],"sources":["../src/layer.ts"],"mappings":";;cAKa;;;;;;;;UASI;;WAEN;;WAEA,OAAO;;WAEP;;WAEA;;WAEA;;;UAIM;;WAEN;;WAEA,qBAAqB;;WAErB;;;UAIM;;WAEN;;WAEA,OAAO;;WAEP;;;UAIM;;WAEN;;WAEA;;WAEA;;;;;;UAOM;WACN,eAAe;;WAEf;;WAEA;;WAEA,gBAAgB;;WAEhB,kBAAkB;;WAElB,SAAS;;;;;;KAOR,SAAS,SAAS"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-BSj5LGH9.js","names":[],"sources":["../src/layer.ts"],"sourcesContent":["import type { Stack } from \"@mark1russell7/system-stack\";\n\n// The format of a placement layer: the slots of a stack, the candidates of each slot, the shared fragments and the limits.\n\n/** The name of the format of a placement layer. It is the key of the layer in `Stack.layers`. */\nexport const PLACEMENT_SCHEMA = \"placement/1\";\n\n/**\n * One candidate of a slot: a stack fragment that gives the part of the slot, and its cost.\n *\n * - The fragment has the part with the `id` of the slot, and each part that only this candidate has.\n * - The layers of the fragment give the records of its parts, for example the chances of `risk/1` and the costs of `spend/1`.\n * - A part of two or more candidates, for example a provider or a region, is in a shared fragment. The candidate names it in `uses`.\n */\nexport interface Candidate {\n /** The key of the candidate. Each candidate of a slot has a different key. A choice names the candidate with it. */\n readonly key: string;\n /** The stack fragment of the candidate. */\n readonly stack: Stack;\n /** The expected cost of the candidate in a month, in the currency of the layer. */\n readonly cost: number;\n /** The `id` of each shared fragment that the candidate needs. */\n readonly uses?: readonly string[] | undefined;\n /** The source of the candidate for a reader, for example the `id` of an offer. */\n readonly source?: string | undefined;\n}\n\n/** One slot of a stack: a part that the stack needs, and the candidates that can give it. */\nexport interface Slot {\n /** The `id` of the part of the slot. A part of the base stack names it in a need. */\n readonly id: string;\n /** The candidates of the slot. */\n readonly candidates: readonly Candidate[];\n /** With `true`, a choice can leave the slot empty. Then the stack has no part of the slot, and a need of that part does not hold. */\n readonly optional?: boolean | undefined;\n}\n\n/** A shared fragment: the parts that two or more candidates need, for example a provider, a region or an account. */\nexport interface Shared {\n /** The `id` of the fragment. A candidate names it in `uses`. */\n readonly id: string;\n /** The stack fragment with the shared parts and their layers. */\n readonly stack: Stack;\n /** The expected cost of the fragment in a month. A placed stack counts it one time. The default is 0. */\n readonly cost?: number | undefined;\n}\n\n/** The limits of a placement. A choice that breaks a limit is not on the front. */\nexport interface PlacementLimits {\n /** The largest expected cost of a month. */\n readonly cost?: number | undefined;\n /** The largest cost of a month from the spend layer of the placed stack. A service with no bound breaks this limit. */\n readonly bound?: number | undefined;\n /** The smallest chance that the part of the layer works, from 0 to 1. */\n readonly chance?: number | undefined;\n}\n\n/**\n * A placement layer: the slots of a stack, the candidates of each slot, and the limits.\n * A choice of one candidate for each slot gives one placed stack. `planPlacement` finds the best choices.\n */\nexport interface PlacementLayer {\n readonly schema: typeof PLACEMENT_SCHEMA;\n /** The `id` of the part to keep in work, for example a function of the system. It is a part of the base stack. */\n readonly part: string;\n /** The currency of each cost, for example `USD`. */\n readonly currency: string;\n /** The slots, in the order of the stages of the search. */\n readonly slots: readonly Slot[];\n /** The shared fragments. */\n readonly shared?: readonly Shared[] | undefined;\n /** The limits. */\n readonly limits?: PlacementLimits | undefined;\n}\n\n/**\n * A choice: the key of the candidate of each slot, by the `id` of the slot.\n * The value `null` leaves an optional slot empty. A slot that the choice does not name is also empty.\n */\nexport type Choice = Readonly<Record<string, string | null>>;\n"],"mappings":";;AAKA,MAAa,mBAAmB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { i as PlacementLayer } from "./layer--Zwbckrx.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
/**
|
|
4
|
+
* The schema of a placement layer. It examines the form of the record: the fields, their types and the finite numbers.
|
|
5
|
+
* It refuses a field that the format does not have. `checkPlacement` examines the meaning of a layer with a correct form.
|
|
6
|
+
*/
|
|
7
|
+
export declare const placementSchema: z.ZodType<PlacementLayer>;
|
|
8
|
+
/** The result of the read of a placement layer: the layer, or the faults of its form. */
|
|
9
|
+
export type PlacementParse = {
|
|
10
|
+
readonly ok: true;
|
|
11
|
+
readonly layer: PlacementLayer;
|
|
12
|
+
} | {
|
|
13
|
+
readonly ok: false;
|
|
14
|
+
readonly errors: readonly string[];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* This function reads the JSON of a placement layer. It gives the layer, or the faults of its form.
|
|
18
|
+
* Each fault names its place in the record, for example `slots.0.candidates.1.cost`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parsePlacement(value: unknown): PlacementParse;
|
|
21
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":[],"sources":["../src/schema.ts"],"mappings":";;;;;;qBAuCa,iBAAiB,EAAE,QAAQ;;YAU5B;WAA4B;WAAmB,OAAO;;WAA8B;WAAoB;;;;;;wBAMpG,eAAe,iBAAiB"}
|
package/build/schema.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { t as PLACEMENT_SCHEMA } from "./layer-BSj5LGH9.js";
|
|
2
|
+
import { formErrors, stackSchema } from "@mark1russell7/system-stack/schema";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
// src/schema.ts
|
|
5
|
+
const id = z.string().min(1);
|
|
6
|
+
const candidate = z.strictObject({
|
|
7
|
+
key: id,
|
|
8
|
+
stack: stackSchema,
|
|
9
|
+
cost: z.number(),
|
|
10
|
+
uses: z.array(id).readonly().optional(),
|
|
11
|
+
source: z.string().optional()
|
|
12
|
+
});
|
|
13
|
+
const slot = z.strictObject({
|
|
14
|
+
id,
|
|
15
|
+
candidates: z.array(candidate).readonly(),
|
|
16
|
+
optional: z.boolean().optional()
|
|
17
|
+
});
|
|
18
|
+
const shared = z.strictObject({
|
|
19
|
+
id,
|
|
20
|
+
stack: stackSchema,
|
|
21
|
+
cost: z.number().optional()
|
|
22
|
+
});
|
|
23
|
+
const limits = z.strictObject({
|
|
24
|
+
cost: z.number().optional(),
|
|
25
|
+
bound: z.number().optional(),
|
|
26
|
+
chance: z.number().optional()
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* The schema of a placement layer. It examines the form of the record: the fields, their types and the finite numbers.
|
|
30
|
+
* It refuses a field that the format does not have. `checkPlacement` examines the meaning of a layer with a correct form.
|
|
31
|
+
*/
|
|
32
|
+
const placementSchema = z.strictObject({
|
|
33
|
+
schema: z.literal(PLACEMENT_SCHEMA),
|
|
34
|
+
part: id,
|
|
35
|
+
currency: id,
|
|
36
|
+
slots: z.array(slot).readonly(),
|
|
37
|
+
shared: z.array(shared).readonly().optional(),
|
|
38
|
+
limits: limits.optional()
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* This function reads the JSON of a placement layer. It gives the layer, or the faults of its form.
|
|
42
|
+
* Each fault names its place in the record, for example `slots.0.candidates.1.cost`.
|
|
43
|
+
*/
|
|
44
|
+
function parsePlacement(value) {
|
|
45
|
+
const read = placementSchema.safeParse(value);
|
|
46
|
+
if (read.success) return {
|
|
47
|
+
ok: true,
|
|
48
|
+
layer: read.data
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
ok: false,
|
|
52
|
+
errors: formErrors(PLACEMENT_SCHEMA, read.error.issues)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export { parsePlacement, placementSchema };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { formErrors, stackSchema } from \"@mark1russell7/system-stack/schema\";\nimport { z } from \"zod\";\nimport { PLACEMENT_SCHEMA, type PlacementLayer } from \"./layer.ts\";\n\n// The zod schema of a placement layer, and the read of its JSON. This module is the entry `/schema` of the package.\n// The root entry has no zod, so a page that only runs the plan gets no schema library.\n\nconst id = z.string().min(1);\n\nconst candidate = z.strictObject({\n key: id,\n stack: stackSchema,\n cost: z.number(),\n uses: z.array(id).readonly().optional(),\n source: z.string().optional(),\n});\n\nconst slot = z.strictObject({\n id,\n candidates: z.array(candidate).readonly(),\n optional: z.boolean().optional(),\n});\n\nconst shared = z.strictObject({\n id,\n stack: stackSchema,\n cost: z.number().optional(),\n});\n\nconst limits = z.strictObject({\n cost: z.number().optional(),\n bound: z.number().optional(),\n chance: z.number().optional(),\n});\n\n/**\n * The schema of a placement layer. It examines the form of the record: the fields, their types and the finite numbers.\n * It refuses a field that the format does not have. `checkPlacement` examines the meaning of a layer with a correct form.\n */\nexport const placementSchema: z.ZodType<PlacementLayer> = z.strictObject({\n schema: z.literal(PLACEMENT_SCHEMA),\n part: id,\n currency: id,\n slots: z.array(slot).readonly(),\n shared: z.array(shared).readonly().optional(),\n limits: limits.optional(),\n});\n\n/** The result of the read of a placement layer: the layer, or the faults of its form. */\nexport type PlacementParse = { readonly ok: true; readonly layer: PlacementLayer } | { readonly ok: false; readonly errors: readonly string[] };\n\n/**\n * This function reads the JSON of a placement layer. It gives the layer, or the faults of its form.\n * Each fault names its place in the record, for example `slots.0.candidates.1.cost`.\n */\nexport function parsePlacement(value: unknown): PlacementParse {\n const read = placementSchema.safeParse(value);\n if (read.success) return { ok: true, layer: read.data };\n return { ok: false, errors: formErrors(PLACEMENT_SCHEMA, read.error.issues) };\n}\n"],"mappings":";;;;AAOA,MAAM,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AAE3B,MAAM,YAAY,EAAE,aAAa;CAC/B,KAAK;CACL,OAAO;CACP,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CACtC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;AAC9B,CAAC;AAED,MAAM,OAAO,EAAE,aAAa;CAC1B;CACA,YAAY,EAAE,MAAM,SAAS,CAAC,CAAC,SAAS;CACxC,UAAU,EAAE,QAAQ,CAAC,CAAC,SAAS;AACjC,CAAC;AAED,MAAM,SAAS,EAAE,aAAa;CAC5B;CACA,OAAO;CACP,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;AAC5B,CAAC;AAED,MAAM,SAAS,EAAE,aAAa;CAC5B,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;CAC1B,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;CAC3B,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;AAC9B,CAAC;;;;;AAMD,MAAa,kBAA6C,EAAE,aAAa;CACvE,QAAQ,EAAE,QAAQ,gBAAgB;CAClC,MAAM;CACN,UAAU;CACV,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC,SAAS;CAC9B,QAAQ,EAAE,MAAM,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CAC5C,QAAQ,OAAO,SAAS;AAC1B,CAAC;;;;;AASD,SAAgB,eAAe,OAAgC;CAC7D,MAAM,OAAO,gBAAgB,UAAU,KAAK;CAC5C,IAAI,KAAK,SAAS,OAAO;EAAE,IAAI;EAAM,OAAO,KAAK;CAAK;CACtD,OAAO;EAAE,IAAI;EAAO,QAAQ,WAAW,kBAAkB,KAAK,MAAM,MAAM;CAAE;AAC9E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,80 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/package",
|
|
2
3
|
"name": "@mark1russell7/stack-placement",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "The placement of the parts of a system stack as a query: a candidate for each slot, the chance that a function works, the cost, and the front of the two. An add-on of system-stack.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/mark1russell7/system-stack.git",
|
|
10
|
+
"directory": "packages/stack-placement"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://mark1russell7.github.io/system-stack/",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/mark1russell7/system-stack/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"placement",
|
|
18
|
+
"reliability",
|
|
19
|
+
"redundancy",
|
|
20
|
+
"pareto-front",
|
|
21
|
+
"cost",
|
|
22
|
+
"path-set",
|
|
23
|
+
"strategy-search",
|
|
24
|
+
"system-stack"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"main": "./build/index.js",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./build/index.d.ts",
|
|
32
|
+
"import": "./build/index.js",
|
|
33
|
+
"default": "./build/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./schema": {
|
|
36
|
+
"types": "./build/schema.d.ts",
|
|
37
|
+
"import": "./build/schema.js",
|
|
38
|
+
"default": "./build/schema.js"
|
|
39
|
+
},
|
|
40
|
+
"./add-on": {
|
|
41
|
+
"types": "./build/add-on.d.ts",
|
|
42
|
+
"import": "./build/add-on.js",
|
|
43
|
+
"default": "./build/add-on.js"
|
|
44
|
+
},
|
|
45
|
+
"./package.json": "./package.json"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"build"
|
|
49
|
+
],
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@mark1russell7/strategy-search": "^0.1.1",
|
|
52
|
+
"@mark1russell7/strategy-space": "^0.1.1",
|
|
53
|
+
"@mark1russell7/system-stack": "0.1.5",
|
|
54
|
+
"zod": "^4.6.7"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@mark1russell7/cue": "^2.0.0",
|
|
58
|
+
"@mark1russell7/stack-risk": "0.1.3",
|
|
59
|
+
"@mark1russell7/stack-spend": "0.1.8",
|
|
60
|
+
"@types/node": "^26.6.5",
|
|
61
|
+
"@vitest/coverage-v8": "^5.0.3",
|
|
62
|
+
"fast-check": "^4.10.2",
|
|
63
|
+
"tsdown": "^0.23.1",
|
|
64
|
+
"typescript": "^7.0.2",
|
|
65
|
+
"vitest": "^5.0.3"
|
|
66
|
+
},
|
|
67
|
+
"engines": {
|
|
68
|
+
"node": ">=22"
|
|
69
|
+
},
|
|
70
|
+
"publishConfig": {
|
|
71
|
+
"access": "public"
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"build": "tsdown",
|
|
75
|
+
"test": "vitest run",
|
|
76
|
+
"test:watch": "vitest",
|
|
77
|
+
"typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.test.json"
|
|
78
|
+
},
|
|
79
|
+
"types": "./build/index.d.ts"
|
|
6
80
|
}
|