@swmmrs/swmmrs 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.
Files changed (120) hide show
  1. package/README.md +264 -0
  2. package/dist/README.md +264 -0
  3. package/dist/serial/README.md +264 -0
  4. package/dist/serial/swmmrs.d.ts +395 -0
  5. package/dist/serial/swmmrs.js +3169 -0
  6. package/dist/serial/swmmrs_bg.wasm +0 -0
  7. package/dist/snippets/swmmrs-parallel-5d1c71108133e81d/worker-pool/browser.js +98 -0
  8. package/dist/swmmrs.d.ts +422 -0
  9. package/dist/swmmrs.js +3330 -0
  10. package/dist/swmmrs_bg.wasm +0 -0
  11. package/index.d.ts +2 -0
  12. package/index.js +2 -0
  13. package/lib/swmmrs/client.d.ts +11 -0
  14. package/lib/swmmrs/client.d.ts.map +1 -0
  15. package/lib/swmmrs/client.js +82 -0
  16. package/lib/swmmrs/client.js.map +1 -0
  17. package/lib/swmmrs/enums.d.ts +41 -0
  18. package/lib/swmmrs/enums.d.ts.map +1 -0
  19. package/lib/swmmrs/enums.js +2 -0
  20. package/lib/swmmrs/enums.js.map +1 -0
  21. package/lib/swmmrs/exceptions.d.ts +98 -0
  22. package/lib/swmmrs/exceptions.d.ts.map +1 -0
  23. package/lib/swmmrs/exceptions.js +86 -0
  24. package/lib/swmmrs/exceptions.js.map +1 -0
  25. package/lib/swmmrs/index.d.ts +27 -0
  26. package/lib/swmmrs/index.d.ts.map +1 -0
  27. package/lib/swmmrs/index.js +13 -0
  28. package/lib/swmmrs/index.js.map +1 -0
  29. package/lib/swmmrs/objects/amm.d.ts +114 -0
  30. package/lib/swmmrs/objects/amm.d.ts.map +1 -0
  31. package/lib/swmmrs/objects/amm.js +19 -0
  32. package/lib/swmmrs/objects/amm.js.map +1 -0
  33. package/lib/swmmrs/objects/collections.d.ts +109 -0
  34. package/lib/swmmrs/objects/collections.d.ts.map +1 -0
  35. package/lib/swmmrs/objects/collections.js +158 -0
  36. package/lib/swmmrs/objects/collections.js.map +1 -0
  37. package/lib/swmmrs/objects/definitions.d.ts +215 -0
  38. package/lib/swmmrs/objects/definitions.d.ts.map +1 -0
  39. package/lib/swmmrs/objects/definitions.js +69 -0
  40. package/lib/swmmrs/objects/definitions.js.map +1 -0
  41. package/lib/swmmrs/objects/lids.d.ts +446 -0
  42. package/lib/swmmrs/objects/lids.d.ts.map +1 -0
  43. package/lib/swmmrs/objects/lids.js +90 -0
  44. package/lib/swmmrs/objects/lids.js.map +1 -0
  45. package/lib/swmmrs/objects/links.d.ts +615 -0
  46. package/lib/swmmrs/objects/links.d.ts.map +1 -0
  47. package/lib/swmmrs/objects/links.js +90 -0
  48. package/lib/swmmrs/objects/links.js.map +1 -0
  49. package/lib/swmmrs/objects/nodes.d.ts +494 -0
  50. package/lib/swmmrs/objects/nodes.d.ts.map +1 -0
  51. package/lib/swmmrs/objects/nodes.js +147 -0
  52. package/lib/swmmrs/objects/nodes.js.map +1 -0
  53. package/lib/swmmrs/objects/options.d.ts +112 -0
  54. package/lib/swmmrs/objects/options.d.ts.map +1 -0
  55. package/lib/swmmrs/objects/options.js +27 -0
  56. package/lib/swmmrs/objects/options.js.map +1 -0
  57. package/lib/swmmrs/objects/rtk.d.ts +82 -0
  58. package/lib/swmmrs/objects/rtk.d.ts.map +1 -0
  59. package/lib/swmmrs/objects/rtk.js +19 -0
  60. package/lib/swmmrs/objects/rtk.js.map +1 -0
  61. package/lib/swmmrs/objects/subcatchments.d.ts +575 -0
  62. package/lib/swmmrs/objects/subcatchments.d.ts.map +1 -0
  63. package/lib/swmmrs/objects/subcatchments.js +243 -0
  64. package/lib/swmmrs/objects/subcatchments.js.map +1 -0
  65. package/lib/swmmrs/output.d.ts +412 -0
  66. package/lib/swmmrs/output.d.ts.map +1 -0
  67. package/lib/swmmrs/output.js +507 -0
  68. package/lib/swmmrs/output.js.map +1 -0
  69. package/lib/swmmrs/protocol.d.ts +80 -0
  70. package/lib/swmmrs/protocol.d.ts.map +1 -0
  71. package/lib/swmmrs/protocol.js +2 -0
  72. package/lib/swmmrs/protocol.js.map +1 -0
  73. package/lib/swmmrs/runtime.d.ts +22 -0
  74. package/lib/swmmrs/runtime.d.ts.map +1 -0
  75. package/lib/swmmrs/runtime.js +146 -0
  76. package/lib/swmmrs/runtime.js.map +1 -0
  77. package/lib/swmmrs/scenarios.d.ts +41 -0
  78. package/lib/swmmrs/scenarios.d.ts.map +1 -0
  79. package/lib/swmmrs/scenarios.js +2 -0
  80. package/lib/swmmrs/scenarios.js.map +1 -0
  81. package/lib/swmmrs/simulation.d.ts +249 -0
  82. package/lib/swmmrs/simulation.d.ts.map +1 -0
  83. package/lib/swmmrs/simulation.js +415 -0
  84. package/lib/swmmrs/simulation.js.map +1 -0
  85. package/lib/swmmrs/snapshots.d.ts +192 -0
  86. package/lib/swmmrs/snapshots.d.ts.map +1 -0
  87. package/lib/swmmrs/snapshots.js +2 -0
  88. package/lib/swmmrs/snapshots.js.map +1 -0
  89. package/lib/swmmrs/types.d.ts +123 -0
  90. package/lib/swmmrs/types.d.ts.map +1 -0
  91. package/lib/swmmrs/types.js +2 -0
  92. package/lib/swmmrs/types.js.map +1 -0
  93. package/lib/swmmrs/worker.d.ts +2 -0
  94. package/lib/swmmrs/worker.d.ts.map +1 -0
  95. package/lib/swmmrs/worker.js +488 -0
  96. package/lib/swmmrs/worker.js.map +1 -0
  97. package/package.json +33 -0
  98. package/src/swmmrs/client.ts +76 -0
  99. package/src/swmmrs/enums.ts +73 -0
  100. package/src/swmmrs/exceptions.ts +120 -0
  101. package/src/swmmrs/index.ts +79 -0
  102. package/src/swmmrs/objects/amm.ts +113 -0
  103. package/src/swmmrs/objects/collections.ts +153 -0
  104. package/src/swmmrs/objects/definitions.ts +246 -0
  105. package/src/swmmrs/objects/lids.ts +487 -0
  106. package/src/swmmrs/objects/links.ts +626 -0
  107. package/src/swmmrs/objects/nodes.ts +504 -0
  108. package/src/swmmrs/objects/options.ts +114 -0
  109. package/src/swmmrs/objects/rtk.ts +79 -0
  110. package/src/swmmrs/objects/subcatchments.ts +650 -0
  111. package/src/swmmrs/output.ts +798 -0
  112. package/src/swmmrs/protocol.ts +62 -0
  113. package/src/swmmrs/runtime.ts +188 -0
  114. package/src/swmmrs/scenarios.ts +40 -0
  115. package/src/swmmrs/simulation.ts +406 -0
  116. package/src/swmmrs/snapshots.ts +199 -0
  117. package/src/swmmrs/types.ts +123 -0
  118. package/src/swmmrs/worker.ts +233 -0
  119. package/worker-node.js +142 -0
  120. package/worker.js +1 -0
@@ -0,0 +1,153 @@
1
+ import { ObjectNotFoundError } from "../exceptions.js";
2
+ import type { Call } from "../protocol.js";
3
+ import type { NodeSnapshot, LinkSnapshot, SubcatchmentSnapshot } from "../snapshots.js";
4
+ import { Node, type NodeQualitySnapshot, type NodeStatisticsSnapshot } from "./nodes.js";
5
+ import { Link, type LinkQualitySnapshot, type LinkStatisticsSnapshot } from "./links.js";
6
+ import { Subcatchment, RainGage, type SubcatchmentQualitySnapshot, type SubcatchmentStatisticsSnapshot } from "./subcatchments.js";
7
+
8
+ /**
9
+ * Configured-order handles with synchronous, case-insensitive ID lookup and stable identity.
10
+ * Obtain simulation collections from the owner rather than constructing a replacement view.
11
+ * All access checks the owner lifecycle; no access is valid after close.
12
+ * @typeParam T - Handle type returned by lookup and iteration.
13
+ */
14
+ export class ObjectCollection<T> implements Iterable<T> {
15
+ readonly #ids: readonly string[];
16
+ readonly #byId: Map<string, string>;
17
+ readonly #views = new Map<string, T>();
18
+ readonly #create: (id: string) => T;
19
+ readonly #assertOpen: () => void;
20
+
21
+ /** Construct the shared collection implementation.
22
+ * @param ids - Canonical IDs in configured order; copied on construction.
23
+ * @param create - Factory called once per looked-up canonical ID.
24
+ * @param assertOpen - Lifecycle guard called before collection access.
25
+ */
26
+ constructor(ids: readonly string[], create: (id: string) => T, assertOpen: () => void) {
27
+ this.#ids = Object.freeze([...ids]);
28
+ this.#byId = new Map(ids.map((id) => [id.toLowerCase(), id]));
29
+ this.#create = create;
30
+ this.#assertOpen = assertOpen;
31
+ }
32
+ /** Canonical IDs in configured order; a frozen array. */
33
+ get ids(): readonly string[] { this.#assertOpen(); return this.#ids; }
34
+ /** Number of configured objects. */
35
+ get size(): number { this.#assertOpen(); return this.#ids.length; }
36
+ /** Test membership synchronously.
37
+ * @param id - Case-insensitive object ID.
38
+ * @returns Whether the ID is configured.
39
+ */
40
+ has(id: string): boolean { this.#assertOpen(); return this.#byId.has(id.toLowerCase()); }
41
+ /** Look up a stable handle synchronously.
42
+ * @param id - Case-insensitive object ID.
43
+ * @returns The same handle instance for repeated lookups of one canonical ID.
44
+ * @throws ObjectNotFoundError for an unknown ID; lifecycle errors after close.
45
+ */
46
+ get(id: string): T {
47
+ this.#assertOpen();
48
+ const canonical = this.#byId.get(id.toLowerCase());
49
+ if (canonical === undefined) throw new ObjectNotFoundError({ message: `Unknown object: ${id}`, code: 505, operation: "lookup" });
50
+ let view = this.#views.get(canonical);
51
+ if (view === undefined) { view = this.#create(canonical); this.#views.set(canonical, view); }
52
+ return view;
53
+ }
54
+ /** Look up a configured-order handle synchronously.
55
+ * @param index - Zero-based integer index; negative and fractional values are invalid.
56
+ * @returns The stable handle at the index.
57
+ * @throws RangeError for an out-of-range or noninteger index.
58
+ */
59
+ at(index: number): T {
60
+ this.#assertOpen();
61
+ const id = this.#ids[index];
62
+ if (!Number.isInteger(index) || id === undefined) throw new RangeError(`Object index out of range: ${index}`);
63
+ return this.get(id);
64
+ }
65
+ /** Iterate handles in configured order.
66
+ * @returns Synchronous iterator, checking the owner on each lookup.
67
+ */
68
+ *[Symbol.iterator](): IterableIterator<T> {
69
+ this.#assertOpen();
70
+ for (const id of this.#ids) yield this.get(id);
71
+ }
72
+ }
73
+
74
+ /** Owner-bound node handles. Snapshot selections preserve requested order; omit IDs for all nodes. */
75
+ export class NodeCollection extends ObjectCollection<Node> {
76
+ readonly #call: Call;
77
+ private constructor(ids: readonly string[], call: Call, assertOpen: () => void) {
78
+ super(ids, (id) => Node.create(id, call), assertOpen); this.#call = call;
79
+ }
80
+ /** @internal */
81
+ static create(ids: readonly string[], call: Call, assertOpen: () => void): NodeCollection { return new NodeCollection(ids, call, assertOpen); }
82
+ /** Read node hydraulics in `running`, `complete`, or `ended`.
83
+ * @param ids - Ordered selection; omit for all, use [] for empty columns. Unknown or case-insensitive duplicate IDs reject.
84
+ * @returns Detached columns aligned with canonical `objectIds`, without a timestamp.
85
+ */
86
+ snapshot(ids?: readonly string[]): Promise<NodeSnapshot> { return this.#call("nodes", ids); }
87
+ /** Read node quality in `running`, `complete`, or `ended`.
88
+ * @param ids - Ordered IDs; omit for all or use [] for none. Unknown/duplicate IDs reject.
89
+ * @returns Detached pollutant-major matrices; inner rows follow `objectIds`.
90
+ */
91
+ qualitySnapshot(ids?: readonly string[]): Promise<NodeQualitySnapshot> { return this.#call("nodeQualitySnapshot", ids); }
92
+ /** Read cumulative node statistics in `running` or `complete`, before ending the run.
93
+ * @param ids - Ordered IDs; omit for all or use [] for none. Unknown/duplicate IDs reject.
94
+ * @returns Detached statistics columns aligned with canonical `objectIds`.
95
+ */
96
+ statisticsSnapshot(ids?: readonly string[]): Promise<NodeStatisticsSnapshot> { return this.#call("nodeStatisticsSnapshot", ids); }
97
+ }
98
+ /** Owner-bound link handles. Snapshot selections preserve requested order; omit IDs for all links. */
99
+ export class LinkCollection extends ObjectCollection<Link> {
100
+ readonly #call: Call;
101
+ private constructor(ids: readonly string[], call: Call, assertOpen: () => void) {
102
+ super(ids, (id) => Link.create(id, call), assertOpen); this.#call = call;
103
+ }
104
+ /** @internal */
105
+ static create(ids: readonly string[], call: Call, assertOpen: () => void): LinkCollection { return new LinkCollection(ids, call, assertOpen); }
106
+ /** Read link hydraulics in `running`, `complete`, or `ended`.
107
+ * @param ids - Ordered IDs; omit for all or use [] for none. Unknown/duplicate IDs reject, including case-only duplicates.
108
+ * @returns Detached hydraulic columns aligned with canonical `objectIds`, without a timestamp.
109
+ */
110
+ snapshot(ids?: readonly string[]): Promise<LinkSnapshot> { return this.#call("links", ids); }
111
+ /** Read link quality in `running`, `complete`, or `ended`.
112
+ * @param ids - Ordered IDs; omit for all or use [] for none. Unknown/duplicate IDs reject.
113
+ * @returns Detached pollutant-major matrices; inner rows follow `objectIds`.
114
+ */
115
+ qualitySnapshot(ids?: readonly string[]): Promise<LinkQualitySnapshot> { return this.#call("linkQualitySnapshot", ids); }
116
+ /** Read cumulative link statistics in `running` or `complete`.
117
+ * @param ids - Ordered IDs; omit for all or use [] for none. Unknown/duplicate IDs reject.
118
+ * @returns Detached scalar columns; flow-class durations have one seven-value row per link.
119
+ */
120
+ statisticsSnapshot(ids?: readonly string[]): Promise<LinkStatisticsSnapshot> { return this.#call("linkStatisticsSnapshot", ids); }
121
+ }
122
+ /** Owner-bound subcatchment handles and aligned hydraulic, quality, and statistics reads. */
123
+ export class SubcatchmentCollection extends ObjectCollection<Subcatchment> {
124
+ readonly #call: Call;
125
+ private constructor(ids: readonly string[], call: Call, assertOpen: () => void) {
126
+ super(ids, (id) => Subcatchment.create(id, call), assertOpen); this.#call = call;
127
+ }
128
+ /** @internal */
129
+ static create(ids: readonly string[], call: Call, assertOpen: () => void): SubcatchmentCollection { return new SubcatchmentCollection(ids, call, assertOpen); }
130
+ /** Read runoff results in `running`, `complete`, or `ended`.
131
+ * @param ids - Ordered IDs; omit for all or use [] for none. Unknown/duplicate IDs reject, including case-only duplicates.
132
+ * @returns Detached runoff columns aligned with canonical `objectIds`, without a timestamp.
133
+ */
134
+ snapshot(ids?: readonly string[]): Promise<SubcatchmentSnapshot> { return this.#call("subcatchments", ids); }
135
+ /** Read subcatchment quality in `running`, `complete`, or `ended`.
136
+ * @param ids - Ordered IDs; omit for all or use [] for none. Unknown/duplicate IDs reject.
137
+ * @returns Detached pollutant-major matrices; inner rows follow `objectIds`.
138
+ */
139
+ qualitySnapshot(ids?: readonly string[]): Promise<SubcatchmentQualitySnapshot> { return this.#call("subcatchmentQualitySnapshot", ids); }
140
+ /** Read cumulative runoff statistics in `running` or `complete`.
141
+ * @param ids - Ordered IDs; omit for all or use [] for none. Unknown/duplicate IDs reject.
142
+ * @returns Detached statistics columns aligned with canonical `objectIds`.
143
+ */
144
+ statisticsSnapshot(ids?: readonly string[]): Promise<SubcatchmentStatisticsSnapshot> { return this.#call("subcatchmentStatisticsSnapshot", ids); }
145
+ }
146
+ /** Owner-bound rain-gage handles. Rain gages provide per-object results, not collection snapshots. */
147
+ export class RainGageCollection extends ObjectCollection<RainGage> {
148
+ private constructor(ids: readonly string[], call: Call, assertOpen: () => void) {
149
+ super(ids, (id) => RainGage.create(id, call), assertOpen);
150
+ }
151
+ /** @internal */
152
+ static create(ids: readonly string[], call: Call, assertOpen: () => void): RainGageCollection { return new RainGageCollection(ids, call, assertOpen); }
153
+ }
@@ -0,0 +1,246 @@
1
+ import type { Call } from "../protocol.js";
2
+
3
+ /** Operations used by definition handles. Main extends the worker protocol with these entries. */
4
+ export interface DefinitionOperations {
5
+ aquiferConfiguration: { args: [string]; result: AquiferConfiguration };
6
+ configureAquifer: { args: [string, AquiferPatch]; result: void };
7
+ snowmeltConfiguration: { args: [string]; result: SnowmeltParameterSetConfiguration };
8
+ configureSnowmelt: { args: [string, SnowmeltParameterSetPatch]; result: void };
9
+ snowmeltSurfaceConfiguration: { args: [string, SnowmeltSurfaceName]; result: SnowmeltSurfaceConfiguration };
10
+ configureSnowmeltSurface: {
11
+ args: [string, SnowmeltSurfaceName, SnowmeltSurfacePatch];
12
+ result: void;
13
+ };
14
+ }
15
+
16
+ /** Read-only identity for a configured definition. Generic handles do not expose editable curve/time-series data. */
17
+ export class Definition {
18
+ /** Canonical configured definition ID. */
19
+ readonly id: string;
20
+ protected readonly call: Call;
21
+
22
+ protected constructor(id: string, call: Call) {
23
+ this.id = id;
24
+ this.call = call;
25
+ Object.freeze(this);
26
+ }
27
+
28
+ /** @internal */
29
+ static create(id: string, call: Call): Definition { return new Definition(id, call); }
30
+ }
31
+
32
+ /** Read-only pollutant identity handle. */
33
+ export type Pollutant = Definition;
34
+ /** Read-only land-use identity handle. */
35
+ export type LandUse = Definition;
36
+ /** Read-only time-pattern identity handle. */
37
+ export type TimePattern = Definition;
38
+ /** Read-only curve identity handle. */
39
+ export type Curve = Definition;
40
+ /** Read-only time-series identity handle. */
41
+ export type TimeSeries = Definition;
42
+ /** Read-only control-rule identity handle. */
43
+ export type ControlRule = Definition;
44
+ /** Read-only transect identity handle. */
45
+ export type Transect = Definition;
46
+ /** Read-only custom-shape identity handle. */
47
+ export type CustomShape = Definition;
48
+ /** Read-only street identity handle. */
49
+ export type Street = Definition;
50
+ /** Read-only inlet-design identity handle. */
51
+ export type InletDesign = Definition;
52
+
53
+ /** Detached aquifer declarations in configured project units. */
54
+ export interface AquiferConfiguration {
55
+ /** Soil porosity fraction. */
56
+ readonly porosity: number;
57
+ /** Wilting-point moisture fraction. */
58
+ readonly wiltingPoint: number;
59
+ /** Field-capacity moisture fraction. */
60
+ readonly fieldCapacity: number;
61
+ /** Saturated hydraulic conductivity in project rainfall-rate units. */
62
+ readonly hydraulicConductivity: number;
63
+ /** Native conductivity-response slope. */
64
+ readonly conductivitySlope: number;
65
+ /** Tension-response slope in project length units (ft or m). */
66
+ readonly tensionSlope: number;
67
+ /** Fraction of evaporation drawn from the upper zone. */
68
+ readonly upperEvaporationFraction: number;
69
+ /** Lower-zone evaporation depth in project length units. */
70
+ readonly lowerEvaporationDepth: number;
71
+ /** Lower-zone loss coefficient in in/h or mm/h. */
72
+ readonly lowerLossCoefficient: number;
73
+ /** Aquifer bottom elevation in ft or m. */
74
+ readonly bottomElevation: number;
75
+ /** Initial water-table elevation in ft or m. */
76
+ readonly waterTableElevation: number;
77
+ /** Initial upper-zone moisture fraction. */
78
+ readonly upperMoisture: number;
79
+ /** Canonical upper-evaporation time-pattern ID, or null. */
80
+ readonly upperEvaporationPattern: string | null;
81
+ }
82
+
83
+ /** Sparse aquifer update; omitted fields retain their values. */
84
+ export interface AquiferPatch {
85
+ /** {@inheritDoc AquiferConfiguration.porosity} */
86
+ porosity?: number;
87
+ /** {@inheritDoc AquiferConfiguration.wiltingPoint} */
88
+ wiltingPoint?: number;
89
+ /** {@inheritDoc AquiferConfiguration.fieldCapacity} */
90
+ fieldCapacity?: number;
91
+ /** {@inheritDoc AquiferConfiguration.hydraulicConductivity} */
92
+ hydraulicConductivity?: number;
93
+ /** {@inheritDoc AquiferConfiguration.conductivitySlope} */
94
+ conductivitySlope?: number;
95
+ /** {@inheritDoc AquiferConfiguration.tensionSlope} */
96
+ tensionSlope?: number;
97
+ /** {@inheritDoc AquiferConfiguration.upperEvaporationFraction} */
98
+ upperEvaporationFraction?: number;
99
+ /** {@inheritDoc AquiferConfiguration.lowerEvaporationDepth} */
100
+ lowerEvaporationDepth?: number;
101
+ /** {@inheritDoc AquiferConfiguration.lowerLossCoefficient} */
102
+ lowerLossCoefficient?: number;
103
+ /** {@inheritDoc AquiferConfiguration.bottomElevation} */
104
+ bottomElevation?: number;
105
+ /** {@inheritDoc AquiferConfiguration.waterTableElevation} */
106
+ waterTableElevation?: number;
107
+ /** {@inheritDoc AquiferConfiguration.upperMoisture} */
108
+ upperMoisture?: number;
109
+ /** Clear with null; omission retains the current relationship. */
110
+ upperEvaporationPattern?: string | null;
111
+ }
112
+
113
+ /** Editable aquifer handle obtained from `simulation.aquifers`. */
114
+ export class Aquifer extends Definition {
115
+ private constructor(id: string, call: Call) { super(id, call); }
116
+
117
+ /** @internal */
118
+ static create(id: string, call: Call): Aquifer { return new Aquifer(id, call); }
119
+
120
+ /** Read aquifer declarations in any healthy owner state.
121
+ * @returns Detached aquifer configuration in project units.
122
+ */
123
+ configuration(): Promise<AquiferConfiguration> {
124
+ return this.call("aquiferConfiguration", this.id);
125
+ }
126
+
127
+ /** Atomically update aquifer declarations in `open` or `ended`; accepted edits return the owner to `open`.
128
+ * @param patch - Sparse field values; null clears the optional time-pattern relationship.
129
+ * @returns Resolves after all fields are accepted.
130
+ */
131
+ configure(patch: AquiferPatch): Promise<void> {
132
+ return this.call("configureAquifer", this.id, patch);
133
+ }
134
+ }
135
+
136
+ /** Snowmelt surface selector within a parameter set. */
137
+ export type SnowmeltSurfaceName = "plowable" | "impervious" | "pervious";
138
+
139
+ /** Detached snowmelt-surface declarations. */
140
+ export interface SnowmeltSurfaceConfiguration {
141
+ /** Minimum melt coefficient in in/(h·°F) for US projects or mm/(h·°C) for SI projects. */
142
+ readonly minimumMeltCoefficient: number;
143
+ /** Maximum melt coefficient in in/(h·°F) for US projects or mm/(h·°C) for SI projects. */
144
+ readonly maximumMeltCoefficient: number;
145
+ /** Base melt temperature in °F for US projects or °C for SI projects. */
146
+ readonly baseTemperature: number;
147
+ /** Free-water holding-capacity fraction. */
148
+ readonly freeWaterFraction: number;
149
+ /** Initial snow water-equivalent depth in in or mm. */
150
+ readonly initialSnowDepth: number;
151
+ /** Initial free-water depth in in or mm. */
152
+ readonly initialFreeWater: number;
153
+ /** Snow water-equivalent depth for full coverage in in or mm. */
154
+ readonly snowDepthForFullCoverage: number;
155
+ }
156
+
157
+ /** Sparse snowmelt-surface update; omission retains a field. */
158
+ export interface SnowmeltSurfacePatch {
159
+ /** {@inheritDoc SnowmeltSurfaceConfiguration.minimumMeltCoefficient} */
160
+ minimumMeltCoefficient?: number;
161
+ /** {@inheritDoc SnowmeltSurfaceConfiguration.maximumMeltCoefficient} */
162
+ maximumMeltCoefficient?: number;
163
+ /** {@inheritDoc SnowmeltSurfaceConfiguration.baseTemperature} */
164
+ baseTemperature?: number;
165
+ /** {@inheritDoc SnowmeltSurfaceConfiguration.freeWaterFraction} */
166
+ freeWaterFraction?: number;
167
+ /** {@inheritDoc SnowmeltSurfaceConfiguration.initialSnowDepth} */
168
+ initialSnowDepth?: number;
169
+ /** {@inheritDoc SnowmeltSurfaceConfiguration.initialFreeWater} */
170
+ initialFreeWater?: number;
171
+ /** {@inheritDoc SnowmeltSurfaceConfiguration.snowDepthForFullCoverage} */
172
+ snowDepthForFullCoverage?: number;
173
+ }
174
+
175
+ /** Detached snowmelt parameter set with all three surface records. */
176
+ export interface SnowmeltParameterSetConfiguration {
177
+ /** Plowable fraction of impervious area. */
178
+ readonly plowableFraction: number;
179
+ /** Plowable-surface melt parameters. */
180
+ readonly plowable: SnowmeltSurfaceConfiguration;
181
+ /** Impervious-surface melt parameters. */
182
+ readonly impervious: SnowmeltSurfaceConfiguration;
183
+ /** Pervious-surface melt parameters. */
184
+ readonly pervious: SnowmeltSurfaceConfiguration;
185
+ /** Snow water-equivalent depth triggering plowing, in in or mm. */
186
+ readonly plowDepth: number;
187
+ /** Five removal fractions in native solver destination order. */
188
+ readonly removalFractions: readonly [number, number, number, number, number];
189
+ /** Canonical receiving subcatchment ID, or null. */
190
+ readonly removalSubcatchment: string | null;
191
+ }
192
+
193
+ /** Sparse parameter-set update; use `configureSurface` for individual surface parameters. */
194
+ export interface SnowmeltParameterSetPatch {
195
+ /** {@inheritDoc SnowmeltParameterSetConfiguration.plowableFraction} */
196
+ plowableFraction?: number;
197
+ /** {@inheritDoc SnowmeltParameterSetConfiguration.plowDepth} */
198
+ plowDepth?: number;
199
+ /** {@inheritDoc SnowmeltParameterSetConfiguration.removalFractions} */
200
+ removalFractions?: readonly [number, number, number, number, number];
201
+ /** Clear with null; omission retains the current relationship. */
202
+ removalSubcatchment?: string | null;
203
+ }
204
+
205
+ /** Editable snowmelt parameter-set identity handle. */
206
+ export class SnowmeltParameterSet extends Definition {
207
+ private constructor(id: string, call: Call) { super(id, call); }
208
+
209
+ /** @internal */
210
+ static create(id: string, call: Call): SnowmeltParameterSet {
211
+ return new SnowmeltParameterSet(id, call);
212
+ }
213
+
214
+ /** Read all parameter-set declarations in a healthy owner state.
215
+ * @returns Detached parameter set with three surface records.
216
+ */
217
+ configuration(): Promise<SnowmeltParameterSetConfiguration> {
218
+ return this.call("snowmeltConfiguration", this.id);
219
+ }
220
+
221
+ /** Atomically update set-level declarations in `open` or `ended`; accepted edits return the owner to `open`.
222
+ * @param patch - Sparse set fields; null clears the optional receiving-subcatchment relation.
223
+ * @returns Resolves after the update is accepted.
224
+ */
225
+ configure(patch: SnowmeltParameterSetPatch): Promise<void> {
226
+ return this.call("configureSnowmelt", this.id, patch);
227
+ }
228
+
229
+ /** Read one surface in a healthy owner state.
230
+ * @param surface - Plowable, impervious, or pervious surface selector.
231
+ * @returns Detached surface parameters.
232
+ */
233
+ surfaceConfiguration(surface: SnowmeltSurfaceName): Promise<SnowmeltSurfaceConfiguration> {
234
+ return this.call("snowmeltSurfaceConfiguration", this.id, surface);
235
+ }
236
+
237
+ /** Atomically update one surface in `open` or `ended`; accepted edits return the owner to `open`.
238
+ * @param surface - Surface to update.
239
+ * @param patch - Sparse surface values; omitted fields retain their values.
240
+ * @returns Resolves after all supplied fields are accepted.
241
+ */
242
+ configureSurface(surface: SnowmeltSurfaceName, patch: SnowmeltSurfacePatch): Promise<void> {
243
+ return this.call("configureSnowmeltSurface", this.id, surface, patch);
244
+ }
245
+ }
246
+