@mark1russell7/stack-endurance 0.6.2 → 0.6.3

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/build/add-on.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { l as EnduranceLayer } from "./layer-DnyqqdlU.js";
1
+ import { l as EnduranceLayer } from "./layer-DhGakJvy.js";
2
2
  import { StackJoiner } from "@mark1russell7/system-stack";
3
3
  /**
4
4
  * This function gives the endurance add-on.
package/build/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as Draw, c as Endurance, d as IsoDate, f as Prior, h as Survival, i as DirectUse, l as EnduranceLayer, m as Store, n as Converter, o as DrawEndurance, p as Resource, r as Cut, s as ENDURANCE_SCHEMA, t as CaseCuts, u as Gift } from "./layer-DnyqqdlU.js";
1
+ import { a as Draw, c as Endurance, d as IsoDate, f as Prior, h as Survival, i as DirectUse, l as EnduranceLayer, m as Store, n as Converter, o as DrawEndurance, p as Resource, r as Cut, s as ENDURANCE_SCHEMA, t as CaseCuts, u as Gift } from "./layer-DhGakJvy.js";
2
2
  import { Fault, LayerParse, LayerPiece, PathOptions, Stack, curveFault } from "@mark1russell7/system-stack";
3
3
  /** The options of the queries of a case. */
4
4
  export interface CaseOptions {
@@ -318,5 +318,5 @@ export declare const SAMPLE_ENDURANCE_STACK: Stack;
318
318
  * - The filled bottles are past their due date, so they give nothing.
319
319
  */
320
320
  export declare const SAMPLE_ENDURANCE: EnduranceLayer;
321
- export { type CaseCuts, Converter, type Cut, DirectUse, Draw, DrawEndurance, ENDURANCE_SCHEMA, Endurance, EnduranceLayer, Gift, IsoDate, Prior, Resource, Store, type Survival, curveFault };
321
+ export { type CaseCuts, Converter, type Cut, DirectUse, Draw, DrawEndurance, ENDURANCE_SCHEMA, Endurance, EnduranceLayer, Gift, IsoDate, type Prior, Resource, Store, type Survival, curveFault };
322
322
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { CaseCuts, CaseCuts as CaseCuts$1, Cut, Survival } from "@mark1russell7/system-stack";
1
+ import { CaseCuts, CaseCuts as CaseCuts$1, Cut, Prior, Prior as Prior$1, Survival } from "@mark1russell7/system-stack";
2
2
  /** The name of the format of an endurance layer. It is the key of the layer in `Stack.layers`. */
3
3
  declare const ENDURANCE_SCHEMA = "endurance/1";
4
4
  /** A date as `YYYY-MM-DD`. */
@@ -70,18 +70,6 @@ interface Converter {
70
70
  /** The need or the resource that one run gives, and its amount. A chain of converters cannot make a resource from itself. */
71
71
  readonly gives: Gift;
72
72
  }
73
- /** The yearly prior of one case at one place. */
74
- interface Prior {
75
- readonly case: string;
76
- readonly place: string;
77
- /** The events in one year in the area (`lambda`), 0 or more. */
78
- readonly perYear: number;
79
- /** The share of the events of the area that reach the place (`q`), from 0 to 1. */
80
- readonly reach: number;
81
- readonly source: string;
82
- /** The date of the data of the source. */
83
- readonly asOf: IsoDate;
84
- }
85
73
  /** The days that one draw holds, and the resources that are used up at that time. */
86
74
  interface DrawEndurance {
87
75
  readonly days: number;
@@ -111,7 +99,7 @@ interface EnduranceLayer {
111
99
  readonly direct?: readonly DirectUse[] | undefined;
112
100
  readonly converters?: readonly Converter[] | undefined;
113
101
  readonly cases?: readonly CaseCuts$1[] | undefined;
114
- readonly priors?: readonly Prior[] | undefined;
102
+ readonly priors?: readonly Prior$1[] | undefined;
115
103
  }
116
104
  export { Draw as a, Endurance as c, IsoDate as d, Prior as f, Survival as h, DirectUse as i, EnduranceLayer as l, Store as m, Converter as n, DrawEndurance as o, Resource as p, Cut as r, ENDURANCE_SCHEMA as s, CaseCuts as t, Gift as u };
117
- //# sourceMappingURL=layer-DnyqqdlU.d.ts.map
105
+ //# sourceMappingURL=layer-DhGakJvy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer-DhGakJvy.d.ts","names":["CaseCuts","Prior"],"sources":["../src/layer.ts"],"mappings":";;cAQa;;KAGD;;UAGK;WACN;WACA;;;UAIM;WACN;;WAEA;;WAEA;;WAEA,MAAM;;WAEN;;;;;;;UAQM;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;UAIM;WACN;WACA;WACA;;;KAIC;WAAkB;WAAuB;WAA2B;;WAA8B;WAA2B;WAAuB;;;;;;;UAO/I;WACN;;WAEA;;WAEA;aAA2B;aAA2B;;;WAEtD,OAAO;;;UAOD;WACN;;;;;WAKA;;WAEA,OAAO,SAAS;;;UAIV;WACN;WACA,IAAI;;WAEJ,OAAO,SAAS,eAAe;;;UAIzB;WACN,eAAe;;WAEf;WACA,oBAAoB;WACpB,iBAAiB;WACjB,gBAAgB;WAChB,kBAAkB;WAClB,sBAAsB;WACtB,iBAAiBA;WACjB,kBAAkBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"layer-a3Fr70Uh.js","names":[],"sources":["../src/layer.ts"],"sourcesContent":["// The records of the endurance add-on. They are one layer of a stack, with the key `endurance/1` in `Stack.layers`.\n// A store holds an amount of a resource. A draw takes a need each day. A converter changes resources into a need.\n// A case cuts some parts for a time. The queries give the days that each draw holds, and the days that it does not get its need.\n// The add-on names no topic: the resources, the needs and the levels are data. The unit of time is the day.\n\nimport type { CaseCuts } from \"@mark1russell7/system-stack\";\n\n/** The name of the format of an endurance layer. It is the key of the layer in `Stack.layers`. */\nexport const ENDURANCE_SCHEMA = \"endurance/1\";\n\n/** A date as `YYYY-MM-DD`. */\nexport type IsoDate = string;\n\n/** A resource of a store, with its unit, for example `L`, `kg` or `Wh`. */\nexport interface Resource {\n readonly code: string;\n readonly unit: string;\n}\n\n/** A store: an amount of one resource. */\nexport interface Store {\n readonly id: string;\n /** The `code` of the resource. */\n readonly resource: string;\n /** The amount, in the unit of the resource. */\n readonly amount: number;\n /** The due date. On this date and after it, the store gives nothing. A store with no due date does not expire. */\n readonly due?: IsoDate | undefined;\n /** The `id` of the part of the stack that holds the store. When the part stops, the store gives nothing. */\n readonly part?: string | undefined;\n}\n\n/**\n * A draw: a need that a load takes each day from its supply.\n * Examples are the power of a rack and the drinking water of a building.\n * When the supply part stops, the draw takes the need from the stores.\n */\nexport interface Draw {\n /** The code of the need. One draw has each code. */\n readonly need: string;\n /** The level of the draw. It is one of the `levels` of the layer. */\n readonly level: string;\n /** The amount of the need for each day. */\n readonly perDay: number;\n /** The count of the users of the draw, for example the persons or the machines. The shortfall counts each user. The default is 1. */\n readonly users?: number | undefined;\n /** The `id` of the part of the stack that supplies the need when no case stops it. */\n readonly supply: string;\n}\n\n/** The direct use of a resource for a need: 1 unit of the resource gives `amount` of the need. */\nexport interface DirectUse {\n readonly resource: string;\n readonly need: string;\n readonly amount: number;\n}\n\n/** The gift of one run of a converter: an amount of a need, or an amount of a resource, in its unit. */\nexport type Gift = { readonly need: string; readonly resource?: never; readonly amount: number } | { readonly resource: string; readonly need?: never; readonly amount: number };\n\n/**\n * A converter: a device or an action that changes resources into a need or into a resource.\n * Example: a stove cooks 1 kg of dry rice with 2 L of water and 0.05 kg of fuel, and gives 3600 kcal.\n * Example: a generator changes 1 L of fuel into 3000 Wh of the battery. Then a direct use of the battery can take that energy.\n */\nexport interface Converter {\n readonly id: string;\n /** The `id` of the device in the stack. The converter stops when the device stops. */\n readonly device?: string | undefined;\n /** The resources that one run takes. */\n readonly takes: readonly { readonly resource: string; readonly amount: number }[];\n /** The need or the resource that one run gives, and its amount. A chain of converters cannot make a resource from itself. */\n readonly gives: Gift;\n}\n\n// The core holds the records of the cuts of a case, so that each add-on shares them. This entry gives them again.\nexport type { CaseCuts, Cut, Survival } from \"@mark1russell7/system-stack\";\n\n/** The yearly prior of one case at one place. */\nexport interface Prior {\n readonly case: string;\n readonly place: string;\n /** The events in one year in the area (`lambda`), 0 or more. */\n readonly perYear: number;\n /** The share of the events of the area that reach the place (`q`), from 0 to 1. */\n readonly reach: number;\n readonly source: string;\n /** The date of the data of the source. */\n readonly asOf: IsoDate;\n}\n\n/** The days that one draw holds, and the resources that are used up at that time. */\nexport interface DrawEndurance {\n readonly days: number;\n /**\n * The inputs of the draw that are used up at `days`, through each chain of converters, in the order of their codes. A higher draw can use up an input first.\n * A resource that only converters make, with no store of the layer, is not in the list.\n */\n readonly binding: readonly string[];\n /** The amount of each resource that the draw takes in its days, by the code of the resource. A resource with no take is not in the record. */\n readonly takes: Readonly<Record<string, number>>;\n}\n\n/** The days that each draw holds when a case stops its supply. A draw whose supply works is not in `needs`. */\nexport interface Endurance {\n readonly case: string;\n readonly at: IsoDate;\n /** The result of each draw, by the code of its need. */\n readonly needs: Readonly<Record<string, DrawEndurance>>;\n}\n\n/** An endurance layer: the levels, the resources, the stores, the draws, the uses and the converters, the cases and their priors. */\nexport interface EnduranceLayer {\n readonly schema: typeof ENDURANCE_SCHEMA;\n /** The levels of the draws, the most important first, for example `[\"critical\", \"normal\"]`. A higher level takes the resources first. */\n readonly levels: readonly string[];\n readonly resources: readonly Resource[];\n readonly stores: readonly Store[];\n readonly draws: readonly Draw[];\n readonly direct?: readonly DirectUse[] | undefined;\n readonly converters?: readonly Converter[] | undefined;\n readonly cases?: readonly CaseCuts[] | undefined;\n readonly priors?: readonly Prior[] | undefined;\n}\n"],"mappings":";;AAQA,MAAa,mBAAmB"}
1
+ {"version":3,"file":"layer-a3Fr70Uh.js","names":[],"sources":["../src/layer.ts"],"sourcesContent":["// The records of the endurance add-on. They are one layer of a stack, with the key `endurance/1` in `Stack.layers`.\n// A store holds an amount of a resource. A draw takes a need each day. A converter changes resources into a need.\n// A case cuts some parts for a time. The queries give the days that each draw holds, and the days that it does not get its need.\n// The add-on names no topic: the resources, the needs and the levels are data. The unit of time is the day.\n\nimport type { CaseCuts, Prior } from \"@mark1russell7/system-stack\";\n\n/** The name of the format of an endurance layer. It is the key of the layer in `Stack.layers`. */\nexport const ENDURANCE_SCHEMA = \"endurance/1\";\n\n/** A date as `YYYY-MM-DD`. */\nexport type IsoDate = string;\n\n/** A resource of a store, with its unit, for example `L`, `kg` or `Wh`. */\nexport interface Resource {\n readonly code: string;\n readonly unit: string;\n}\n\n/** A store: an amount of one resource. */\nexport interface Store {\n readonly id: string;\n /** The `code` of the resource. */\n readonly resource: string;\n /** The amount, in the unit of the resource. */\n readonly amount: number;\n /** The due date. On this date and after it, the store gives nothing. A store with no due date does not expire. */\n readonly due?: IsoDate | undefined;\n /** The `id` of the part of the stack that holds the store. When the part stops, the store gives nothing. */\n readonly part?: string | undefined;\n}\n\n/**\n * A draw: a need that a load takes each day from its supply.\n * Examples are the power of a rack and the drinking water of a building.\n * When the supply part stops, the draw takes the need from the stores.\n */\nexport interface Draw {\n /** The code of the need. One draw has each code. */\n readonly need: string;\n /** The level of the draw. It is one of the `levels` of the layer. */\n readonly level: string;\n /** The amount of the need for each day. */\n readonly perDay: number;\n /** The count of the users of the draw, for example the persons or the machines. The shortfall counts each user. The default is 1. */\n readonly users?: number | undefined;\n /** The `id` of the part of the stack that supplies the need when no case stops it. */\n readonly supply: string;\n}\n\n/** The direct use of a resource for a need: 1 unit of the resource gives `amount` of the need. */\nexport interface DirectUse {\n readonly resource: string;\n readonly need: string;\n readonly amount: number;\n}\n\n/** The gift of one run of a converter: an amount of a need, or an amount of a resource, in its unit. */\nexport type Gift = { readonly need: string; readonly resource?: never; readonly amount: number } | { readonly resource: string; readonly need?: never; readonly amount: number };\n\n/**\n * A converter: a device or an action that changes resources into a need or into a resource.\n * Example: a stove cooks 1 kg of dry rice with 2 L of water and 0.05 kg of fuel, and gives 3600 kcal.\n * Example: a generator changes 1 L of fuel into 3000 Wh of the battery. Then a direct use of the battery can take that energy.\n */\nexport interface Converter {\n readonly id: string;\n /** The `id` of the device in the stack. The converter stops when the device stops. */\n readonly device?: string | undefined;\n /** The resources that one run takes. */\n readonly takes: readonly { readonly resource: string; readonly amount: number }[];\n /** The need or the resource that one run gives, and its amount. A chain of converters cannot make a resource from itself. */\n readonly gives: Gift;\n}\n\n// The core holds the records of the cuts of a case, so that each add-on shares them. This entry gives them again.\nexport type { CaseCuts, Cut, Prior, Survival } from \"@mark1russell7/system-stack\";\n\n/** The days that one draw holds, and the resources that are used up at that time. */\nexport interface DrawEndurance {\n readonly days: number;\n /**\n * The inputs of the draw that are used up at `days`, through each chain of converters, in the order of their codes. A higher draw can use up an input first.\n * A resource that only converters make, with no store of the layer, is not in the list.\n */\n readonly binding: readonly string[];\n /** The amount of each resource that the draw takes in its days, by the code of the resource. A resource with no take is not in the record. */\n readonly takes: Readonly<Record<string, number>>;\n}\n\n/** The days that each draw holds when a case stops its supply. A draw whose supply works is not in `needs`. */\nexport interface Endurance {\n readonly case: string;\n readonly at: IsoDate;\n /** The result of each draw, by the code of its need. */\n readonly needs: Readonly<Record<string, DrawEndurance>>;\n}\n\n/** An endurance layer: the levels, the resources, the stores, the draws, the uses and the converters, the cases and their priors. */\nexport interface EnduranceLayer {\n readonly schema: typeof ENDURANCE_SCHEMA;\n /** The levels of the draws, the most important first, for example `[\"critical\", \"normal\"]`. A higher level takes the resources first. */\n readonly levels: readonly string[];\n readonly resources: readonly Resource[];\n readonly stores: readonly Store[];\n readonly draws: readonly Draw[];\n readonly direct?: readonly DirectUse[] | undefined;\n readonly converters?: readonly Converter[] | undefined;\n readonly cases?: readonly CaseCuts[] | undefined;\n readonly priors?: readonly Prior[] | undefined;\n}\n"],"mappings":";;AAQA,MAAa,mBAAmB"}
package/build/schema.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { l as EnduranceLayer } from "./layer-DnyqqdlU.js";
1
+ import { l as EnduranceLayer } from "./layer-DhGakJvy.js";
2
2
  import { z } from "zod";
3
3
  /**
4
4
  * The schema of an endurance layer. It examines the form of the record: the fields and their types.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@mark1russell7/stack-endurance",
4
- "version": "0.6.2",
4
+ "version": "0.6.3",
5
5
  "description": "Stores, draws and converters of a system stack: the days that each draw holds when a case cuts its supply, and the shortfall of each level in one year. An add-on of system-stack.",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -51,7 +51,7 @@
51
51
  "dependencies": {
52
52
  "@mark1russell7/collections": "^0.11.2",
53
53
  "@mark1russell7/rigor-generators": "^0.2.0",
54
- "@mark1russell7/system-stack": "0.1.9",
54
+ "@mark1russell7/system-stack": "0.1.10",
55
55
  "zod": "^4.6.7"
56
56
  },
57
57
  "devDependencies": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"layer-DnyqqdlU.d.ts","names":["CaseCuts"],"sources":["../src/layer.ts"],"mappings":";;cAQa;;KAGD;;UAGK;WACN;WACA;;;UAIM;WACN;;WAEA;;WAEA;;WAEA,MAAM;;WAEN;;;;;;;UAQM;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;UAIM;WACN;WACA;WACA;;;KAIC;WAAkB;WAAuB;WAA2B;;WAA8B;WAA2B;WAAuB;;;;;;;UAO/I;WACN;;WAEA;;WAEA;aAA2B;aAA2B;;;WAEtD,OAAO;;;UAOD;WACN;WACA;;WAEA;;WAEA;WACA;;WAEA,MAAM;;;UAIA;WACN;;;;;WAKA;;WAEA,OAAO,SAAS;;;UAIV;WACN;WACA,IAAI;;WAEJ,OAAO,SAAS,eAAe;;;UAIzB;WACN,eAAe;;WAEf;WACA,oBAAoB;WACpB,iBAAiB;WACjB,gBAAgB;WAChB,kBAAkB;WAClB,sBAAsB;WACtB,iBAAiBA;WACjB,kBAAkB"}