@routier/core 0.2.1 → 0.4.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 (161) hide show
  1. package/LICENSE +21 -0
  2. package/{readme.md → README.md} +3 -3
  3. package/dist/assertions/index.cjs +191 -0
  4. package/dist/assertions/index.cjs.map +1 -0
  5. package/dist/assertions/index.js +43 -63
  6. package/dist/assertions/index.js.map +1 -1
  7. package/dist/capabilities/index.cjs +820 -0
  8. package/dist/capabilities/index.cjs.map +1 -0
  9. package/dist/capabilities/index.js +584 -558
  10. package/dist/capabilities/index.js.map +1 -1
  11. package/dist/codegen/handlers/CloneHandlerBuilder.d.ts +10 -1
  12. package/dist/codegen/handlers/clone/CloneArrayHandler.d.ts +3 -0
  13. package/dist/codegen/handlers/clone/CloneDateHandler.d.ts +13 -0
  14. package/dist/codegen/handlers/clone/CloneValueHandler.d.ts +16 -0
  15. package/dist/codegen/handlers/compare/CompareComputedHandler.d.ts +10 -0
  16. package/dist/codegen/handlers/compare/CompareFunctionHandler.d.ts +10 -0
  17. package/dist/codegen/handlers/deserialize/DeserializeArrayHandler.d.ts +14 -0
  18. package/dist/codegen/handlers/enableChangeTracking/EnableChangeTrackingArrayHandler.d.ts +11 -0
  19. package/dist/codegen/handlers/enrichment/EnrichmentArrayHandler.d.ts +11 -0
  20. package/dist/codegen/handlers/freeze/FreezeArrayHandler.d.ts +6 -0
  21. package/dist/codegen/handlers/hash/HashArrayHandler.d.ts +10 -0
  22. package/dist/codegen/handlers/hash/HashFileHandler.d.ts +24 -0
  23. package/dist/codegen/handlers/hash/HashObjectHandler.d.ts +10 -0
  24. package/dist/codegen/handlers/hash/HashTransformHandler.d.ts +23 -0
  25. package/dist/codegen/handlers/merge/MergeArrayHandler.d.ts +20 -0
  26. package/dist/codegen/handlers/merge/MergeObjectHandler.d.ts +10 -0
  27. package/dist/codegen/handlers/serialize/SerializeArrayHandler.d.ts +19 -0
  28. package/dist/codegen/handlers/strip/StripComputedHandler.d.ts +10 -0
  29. package/dist/codegen/handlers/strip/StripFunctionHandler.d.ts +9 -0
  30. package/dist/codegen/handlers/types.d.ts +55 -1
  31. package/dist/codegen/index.cjs +618 -0
  32. package/dist/codegen/index.cjs.map +1 -0
  33. package/dist/codegen/index.js +99 -127
  34. package/dist/codegen/index.js.map +1 -1
  35. package/dist/collections/MemoryDataCollection.d.ts +15 -1
  36. package/dist/collections/TagCollection.d.ts +0 -1
  37. package/dist/collections/index.cjs +702 -0
  38. package/dist/collections/index.cjs.map +1 -0
  39. package/dist/collections/index.js +282 -276
  40. package/dist/collections/index.js.map +1 -1
  41. package/dist/errors/OptimisticConcurrencyError.d.ts +18 -0
  42. package/dist/errors/PluginDestroyedError.d.ts +10 -0
  43. package/dist/errors/index.cjs +132 -0
  44. package/dist/errors/index.cjs.map +1 -0
  45. package/dist/errors/index.d.ts +2 -0
  46. package/dist/errors/index.js +61 -19
  47. package/dist/errors/index.js.map +1 -1
  48. package/dist/expressions/evaluate.d.ts +53 -0
  49. package/dist/expressions/index.cjs +2087 -0
  50. package/dist/expressions/index.cjs.map +1 -0
  51. package/dist/expressions/index.d.ts +1 -1
  52. package/dist/expressions/index.js +1727 -1082
  53. package/dist/expressions/index.js.map +1 -1
  54. package/dist/expressions/parser.d.ts +19 -0
  55. package/dist/expressions/types.d.ts +87 -2
  56. package/dist/index.cjs +14377 -0
  57. package/dist/index.cjs.map +1 -0
  58. package/dist/index.js +12374 -7931
  59. package/dist/index.js.map +1 -1
  60. package/dist/performance/index.cjs +217 -0
  61. package/dist/performance/index.cjs.map +1 -0
  62. package/dist/performance/index.js +120 -55
  63. package/dist/performance/index.js.map +1 -1
  64. package/dist/pipeline/index.cjs +576 -0
  65. package/dist/pipeline/index.cjs.map +1 -0
  66. package/dist/pipeline/index.js +223 -161
  67. package/dist/pipeline/index.js.map +1 -1
  68. package/dist/plugins/BatchingDbPlugin.d.ts +139 -0
  69. package/dist/plugins/CacheDbPlugin.d.ts +70 -0
  70. package/dist/plugins/ConcurrencyDbPlugin.d.ts +78 -0
  71. package/dist/plugins/EphemeralDataPlugin.d.ts +57 -1
  72. package/dist/plugins/RetryDbPlugin.d.ts +77 -0
  73. package/dist/plugins/index.cjs +6551 -0
  74. package/dist/plugins/index.cjs.map +1 -0
  75. package/dist/plugins/index.d.ts +5 -0
  76. package/dist/plugins/index.js +6271 -1170
  77. package/dist/plugins/index.js.map +1 -1
  78. package/dist/plugins/query/QueryOptionsCollection.d.ts +34 -0
  79. package/dist/plugins/query/explain.d.ts +82 -0
  80. package/dist/plugins/query/formatExplanation.d.ts +9 -0
  81. package/dist/plugins/query/index.d.ts +4 -0
  82. package/dist/plugins/query/join.d.ts +210 -0
  83. package/dist/plugins/query/similarity.d.ts +38 -0
  84. package/dist/plugins/query/types.d.ts +75 -1
  85. package/dist/plugins/translators/DataTranslator.d.ts +28 -0
  86. package/dist/plugins/translators/JsonTranslator.d.ts +27 -0
  87. package/dist/plugins/translators/SqlTranslator.d.ts +45 -0
  88. package/dist/plugins/translators/TupleTranslator.d.ts +45 -0
  89. package/dist/plugins/translators/index.d.ts +1 -0
  90. package/dist/plugins/types.d.ts +125 -3
  91. package/dist/plugins/wire/handler.d.ts +122 -0
  92. package/dist/plugins/wire/index.d.ts +4 -0
  93. package/dist/plugins/wire/persist.d.ts +43 -0
  94. package/dist/plugins/wire/query.d.ts +49 -0
  95. package/dist/plugins/wire/types.d.ts +139 -0
  96. package/dist/results/index.cjs +174 -0
  97. package/dist/results/index.cjs.map +1 -0
  98. package/dist/results/index.js +29 -44
  99. package/dist/results/index.js.map +1 -1
  100. package/dist/schema/PropertyInfo.d.ts +31 -2
  101. package/dist/schema/SchemaDefinition.d.ts +23 -1
  102. package/dist/schema/builder.d.ts +35 -1
  103. package/dist/schema/communication/broadcast.d.ts +17 -1
  104. package/dist/schema/index.cjs +6911 -0
  105. package/dist/schema/index.cjs.map +1 -0
  106. package/dist/schema/index.d.ts +2 -0
  107. package/dist/schema/index.js +5330 -4541
  108. package/dist/schema/index.js.map +1 -1
  109. package/dist/schema/property/base/SchemaBase.d.ts +48 -2
  110. package/dist/schema/property/modifiers/SchemaNullable.d.ts +10 -0
  111. package/dist/schema/property/modifiers/SchemaOptional.d.ts +19 -0
  112. package/dist/schema/property/modifiers/SchemaSearchable.d.ts +34 -0
  113. package/dist/schema/property/modifiers/index.d.ts +1 -0
  114. package/dist/schema/property/types/SchemaFile.d.ts +60 -0
  115. package/dist/schema/property/types/SchemaString.d.ts +21 -1
  116. package/dist/schema/property/types/SchemaVector.d.ts +61 -0
  117. package/dist/schema/property/types/index.d.ts +2 -0
  118. package/dist/schema/table/SchemaTransform.d.ts +40 -0
  119. package/dist/schema/table/index.d.ts +1 -0
  120. package/dist/schema/types.d.ts +166 -8
  121. package/dist/schema/utils/propertyKind.d.ts +4 -0
  122. package/dist/types/index.cjs +23 -0
  123. package/dist/types/index.cjs.map +1 -0
  124. package/dist/types/index.js +0 -14
  125. package/dist/types/index.js.map +1 -1
  126. package/dist/utilities/index.cjs +1013 -0
  127. package/dist/utilities/index.cjs.map +1 -0
  128. package/dist/utilities/index.js +541 -379
  129. package/dist/utilities/index.js.map +1 -1
  130. package/dist/utilities/logger.d.ts +48 -0
  131. package/package.json +156 -98
  132. package/dist/codegen/SlotPath.test.d.ts +0 -1
  133. package/dist/codegen/blocks.test.d.ts +0 -1
  134. package/dist/codegen/utils.test.d.ts +0 -1
  135. package/dist/collections/Changes.test.d.ts +0 -1
  136. package/dist/collections/IdSet.test.d.ts +0 -1
  137. package/dist/collections/MemoryDataCollection.test.d.ts +0 -1
  138. package/dist/collections/TagCollection.contract.test.d.ts +0 -1
  139. package/dist/collections/TagCollection.test.d.ts +0 -1
  140. package/dist/expressions/parser.test.d.ts +0 -1
  141. package/dist/expressions/sql.d.ts +0 -28
  142. package/dist/expressions/sql.test.d.ts +0 -1
  143. package/dist/expressions/utils.test.d.ts +0 -1
  144. package/dist/pipeline/SyncronousQueue.test.d.ts +0 -1
  145. package/dist/plugins/EphemeralDataPlugin.test.d.ts +0 -1
  146. package/dist/plugins/query/Query.test.d.ts +0 -1
  147. package/dist/plugins/query/QueryOptionsCollection.test.d.ts +0 -1
  148. package/dist/plugins/translators/JsonTranslator.test.d.ts +0 -1
  149. package/dist/plugins/translators/SqlTranslator.test.d.ts +0 -1
  150. package/dist/plugins/translators/TranslatedValues.test.d.ts +0 -1
  151. package/dist/results/Result.test.d.ts +0 -1
  152. package/dist/results/utils.test.d.ts +0 -1
  153. package/dist/schema/PropertyInfo.test.d.ts +0 -1
  154. package/dist/schema/communication/broadcast.test.d.ts +0 -1
  155. package/dist/schema/schemaGeneration.test.d.ts +0 -1
  156. package/dist/schema/utils/standardJsonSchema.test.d.ts +0 -1
  157. package/dist/utilities/arrays.test.d.ts +0 -1
  158. package/dist/utilities/dates.test.d.ts +0 -1
  159. package/dist/utilities/runtime.test.d.ts +0 -1
  160. package/dist/utilities/strings.test.d.ts +0 -1
  161. package/dist/utilities/uuid.test.d.ts +0 -1
@@ -1,15 +1,69 @@
1
- import { CodeBuilder, ContainerBlock } from '..';
1
+ import { CodeBuilder, ContainerBlock, IfBuilder, SlotBlock } from '..';
2
2
  import { PropertyInfo } from '../../schema/PropertyInfo';
3
3
  import { SlotPath } from '../SlotPath';
4
4
  export interface IHandler {
5
5
  setNext(handler: IHandler): IHandler;
6
6
  handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null;
7
7
  }
8
+ /**
9
+ * Terminal link for chains that apply only to a subset of properties (keys,
10
+ * identities). Returning the builder marks every other property as
11
+ * deliberately skipped, so a null return from any chain always means a real
12
+ * coverage gap.
13
+ */
14
+ export declare class NotApplicableHandler implements IHandler {
15
+ setNext(handler: IHandler): IHandler;
16
+ handle(_: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null;
17
+ }
8
18
  export declare abstract class PropertyInfoHandler implements IHandler {
9
19
  private _next;
10
20
  setNext(handler: IHandler): IHandler;
11
21
  handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null;
12
22
  protected buildSlotPath(property: PropertyInfo<any>, path: SlotPath): SlotPath;
23
+ /**
24
+ * Dotted property path from the root entity (e.g. `nested.inner`), used as the
25
+ * change-tracking path prefix so nested writes record against the root's
26
+ * `__tracking__` under their full path.
27
+ */
28
+ protected getTrackingPath(property: PropertyInfo<any>): string;
29
+ /**
30
+ * Emits `if (<root>.a == null) <root>.a = {};` for every ancestor of a
31
+ * nested property, so assignments through the target object never throw when a
32
+ * parent object is absent. The guards run root-down, so grandparents are
33
+ * materialized before their children.
34
+ */
35
+ protected emitDestinationAncestorGuards(property: PropertyInfo<any>, block: IfBuilder, options?: {
36
+ root?: string;
37
+ useFromPropertyName?: boolean;
38
+ }): void;
39
+ /**
40
+ * Emits the guarded nested-property assignment shared by the serialize handlers:
41
+ * reads the parent through an optional-chained selector (the entity may be a
42
+ * partial — a delta payload or a create payload with absent nested parents),
43
+ * materializes every `result` ancestor, then assigns `valueExpression` to the
44
+ * property's storage-side path.
45
+ */
46
+ protected emitSerializeNestedAssignment(property: PropertyInfo<any>, slot: SlotBlock, valueExpression: string): void;
47
+ /**
48
+ * Emits the source → destination copy for one property in the merge generator,
49
+ * materializing destination ancestors first.
50
+ *
51
+ * With `onlyWhenChanged`, the assignment is skipped when both sides already hold
52
+ * the same value (compared via `valueOf`, so equal Dates match). This preserves
53
+ * reference identity on the destination when a merge carries no new information —
54
+ * callers hold on to entity instances (e.g. a Date returned from add) and must not
55
+ * see them silently replaced by an equal copy.
56
+ */
57
+ protected emitMergeCopy(property: PropertyInfo<any>, builder: CodeBuilder, options?: {
58
+ onlyWhenChanged?: boolean;
59
+ }): void;
60
+ /**
61
+ * Slot path of the ObjectBuilder that renders `property` inside the enriched
62
+ * literal. Builders are registered as `[enriched.<path>]` under their parent
63
+ * builder, so the lookup path must include every ancestor segment — a flat
64
+ * root-level lookup only works for depth-1 properties.
65
+ */
66
+ protected buildEnrichedObjectSlotPath(property: PropertyInfo<any>, base: SlotPath): SlotPath;
13
67
  protected setEnrichedProperty(property: PropertyInfo<any>, root: CodeBuilder): void;
14
68
  protected toNamedFunction(stringifiedFunction: string, parent: ContainerBlock): {
15
69
  builder: import("..").FunctionBuilder;
@@ -0,0 +1,618 @@
1
+ (() => {
2
+ "use strict";
3
+ var __webpack_modules__ = ({
4
+ 980(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
5
+ __webpack_require__.d(__webpack_exports__, {
6
+ $j: () => (ArrayBuilder),
7
+ E2: () => (SlotBlock),
8
+ Nl: () => (CodeBuilder),
9
+ No: () => (AndBuilder),
10
+ O_: () => (FunctionFactoryBuilder),
11
+ Tl: () => (ObjectBuilder),
12
+ Zm: () => (IfBuilder),
13
+ eB: () => (Block),
14
+ fe: () => (StringBuilder),
15
+ hL: () => (AssignmentBuilder),
16
+ j7: () => (ContainerBlock),
17
+ kF: () => (FunctionBuilder),
18
+ ot: () => (VariableBuilder),
19
+ qY: () => (RawBuilder)
20
+ });
21
+ /* import */ var _utilities__rspack_import_0 = __webpack_require__(618);
22
+
23
+ class Block {
24
+ name;
25
+ _lines = [];
26
+ _indent = "";
27
+ _parent;
28
+ constructor(name, parentIndent = "", parent){
29
+ this.name = name != null ? name : (0,_utilities__rspack_import_0/* .uuid */.u)();
30
+ this._indent = parentIndent;
31
+ this._parent = parent;
32
+ }
33
+ indexOf(name) {
34
+ return this._lines.findIndex((w)=>typeof w !== "string" && w.name === name);
35
+ }
36
+ getLines() {
37
+ return this._lines;
38
+ }
39
+ getParent() {
40
+ return this._parent;
41
+ }
42
+ getIndent() {
43
+ return this._indent;
44
+ }
45
+ setLines(lines) {
46
+ this._lines = lines;
47
+ }
48
+ setParent(block) {
49
+ this._parent = block;
50
+ }
51
+ setIndent(indent) {
52
+ this._indent = indent;
53
+ }
54
+ getOrDefault(name) {
55
+ if (name.includes('.') === false) {
56
+ return this._lines.find((w)=>typeof w !== "string" && w.name === name);
57
+ }
58
+ const split = name.match(/(\[[^\]]+\]|[^.]+)/g);
59
+ // oxlint-disable-next-line no-this-alias
60
+ let result = this;
61
+ for (const item of split){
62
+ const found = result._lines.find((w)=>typeof w !== "string" && w.name === item);
63
+ if (found == null) {
64
+ if ("getValue" in result && result.getValue instanceof Block && result.getValue.name === item) {
65
+ result = result.getValue;
66
+ continue;
67
+ }
68
+ return undefined;
69
+ }
70
+ result = found;
71
+ }
72
+ return result;
73
+ }
74
+ get(name) {
75
+ const found = this.getOrDefault(name);
76
+ if (found == null) {
77
+ throw new Error(`Error finding code block for given path. Path: ${name}`);
78
+ }
79
+ return found;
80
+ }
81
+ has(name) {
82
+ return this._lines.some((w)=>typeof w !== "string" && w.name === name);
83
+ }
84
+ remove(name) {
85
+ this._lines = this._lines.filter((x)=>typeof x === "object" && typeof x.name === "string" && x.name !== name);
86
+ }
87
+ replace(name, line) {
88
+ const foundIndex = this._lines.findIndex((x)=>typeof x !== "string" && x.name === name);
89
+ if (foundIndex === -1) {
90
+ throw new Error(`Cannot find line by name. Name: ${name}`);
91
+ }
92
+ const found = this._lines[foundIndex];
93
+ if (typeof found === "string") {
94
+ // Replace the line
95
+ this._lines.splice(foundIndex, 1, line);
96
+ return;
97
+ }
98
+ line.setLines(found.getLines());
99
+ line.setIndent(found.getIndent());
100
+ line.setParent(found.getParent());
101
+ // Replace the line
102
+ this._lines.splice(foundIndex, 1, line);
103
+ return;
104
+ }
105
+ push(line) {
106
+ this._lines.push(line);
107
+ }
108
+ unshift(line) {
109
+ this._lines.unshift(line);
110
+ }
111
+ indent(text) {
112
+ return this._indent + text;
113
+ }
114
+ }
115
+ class ContainerBlock extends Block {
116
+ if(condition, options) {
117
+ const builder = new IfBuilder(condition, options?.name, this._indent + " ", this);
118
+ if (options?.unshift === true) {
119
+ this.unshift(builder);
120
+ } else {
121
+ this.push(builder);
122
+ }
123
+ return builder;
124
+ }
125
+ raw(raw, options) {
126
+ const builder = new RawBuilder(raw, options?.name, this._indent + " ", this);
127
+ this.push(builder);
128
+ return builder;
129
+ }
130
+ function(name, options) {
131
+ const builder = new FunctionBuilder(name, options?.name, this._indent + " ", this);
132
+ this.push(builder);
133
+ return builder;
134
+ }
135
+ factory(name, options) {
136
+ const builder = new FunctionFactoryBuilder(name, options?.name, this._indent + " ", this);
137
+ this.push(builder);
138
+ return builder;
139
+ }
140
+ variable(declaration, options) {
141
+ const builder = new VariableBuilder(declaration, options?.name, this._indent + " ", this);
142
+ this.push(builder);
143
+ return builder;
144
+ }
145
+ assign(variableName, options) {
146
+ const builder = new AssignmentBuilder(variableName, options?.name, this._indent + " ", this);
147
+ this.push(builder);
148
+ return builder;
149
+ }
150
+ object(options) {
151
+ const builder = new ObjectBuilder(options?.name, this._indent + " ", this);
152
+ this.push(builder);
153
+ return builder;
154
+ }
155
+ slot(name) {
156
+ const builder = new SlotBlock(name, this._indent + " ", this);
157
+ this.push(builder);
158
+ return builder;
159
+ }
160
+ array(accessor, options) {
161
+ const builder = new ArrayBuilder(accessor, options?.name, this._indent + " ", this);
162
+ this.push(builder);
163
+ return builder;
164
+ }
165
+ }
166
+ class StringBuilder extends Block {
167
+ _type;
168
+ constructor(type, name, parentIndent = "", parent){
169
+ super(name, parentIndent, parent);
170
+ this._type = type;
171
+ }
172
+ append(value) {
173
+ this._lines.push(value);
174
+ return this;
175
+ }
176
+ toString() {
177
+ if (this._type === "template") {
178
+ return "`" + this._lines.join("") + "`";
179
+ }
180
+ return `"${this._lines.join("")}"`;
181
+ }
182
+ }
183
+ class SlotBlock extends ContainerBlock {
184
+ constructor(name, parentIndent = "", parent){
185
+ super(name, parentIndent, parent);
186
+ }
187
+ insert(line) {
188
+ this.push(line);
189
+ }
190
+ toString() {
191
+ return this._lines.map((line)=>typeof line === 'string' ? this.indent(line) : line.toString()).join('\n\n');
192
+ }
193
+ }
194
+ class AssignmentBuilder extends ContainerBlock {
195
+ _variableName;
196
+ _value;
197
+ _functionName;
198
+ get getValue() {
199
+ return this._value;
200
+ }
201
+ constructor(variableName, name, parentIndent = "", parent){
202
+ super(name, parentIndent, parent);
203
+ this._variableName = variableName;
204
+ }
205
+ value(value) {
206
+ this._value = value;
207
+ return this;
208
+ }
209
+ and(and, options) {
210
+ this._value = new AndBuilder(and, options?.name, this._indent, this);
211
+ return this;
212
+ }
213
+ object(options) {
214
+ const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);
215
+ this._value = objectBuilder;
216
+ return objectBuilder;
217
+ }
218
+ call(functionName, options) {
219
+ this._functionName = functionName;
220
+ const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);
221
+ this._value = objectBuilder;
222
+ return objectBuilder;
223
+ }
224
+ string(type, options) {
225
+ const stringBuilder = new StringBuilder(type, options?.name, this._indent, this);
226
+ this._value = stringBuilder;
227
+ return stringBuilder;
228
+ }
229
+ toString() {
230
+ if (this._value == null) {
231
+ throw new Error("Value cannot be null for AssignmentBuilder Builder");
232
+ }
233
+ if (this._functionName != null) {
234
+ return this.indent(`${this._variableName} = ${this._functionName}(${this._value.toString()});`);
235
+ }
236
+ return this.indent(`${this._variableName} = ${this._value.toString()};`);
237
+ }
238
+ }
239
+ class AndBuilder extends ContainerBlock {
240
+ constructor(and, name, parentIndent = "", parent){
241
+ super(name, parentIndent, parent);
242
+ this._lines.push(and);
243
+ }
244
+ and(and) {
245
+ this._lines.push(and);
246
+ }
247
+ toString() {
248
+ return this._lines.join(" && ");
249
+ }
250
+ }
251
+ class VariableBuilder extends Block {
252
+ _declaration;
253
+ _value;
254
+ get getValue() {
255
+ return this._value;
256
+ }
257
+ constructor(declaration, name, parentIndent = "", parent){
258
+ super(name, parentIndent, parent);
259
+ this._declaration = declaration;
260
+ }
261
+ value(value) {
262
+ this._value = value;
263
+ return this;
264
+ }
265
+ object(options) {
266
+ const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);
267
+ this._value = objectBuilder;
268
+ return objectBuilder;
269
+ }
270
+ array(accessor, options) {
271
+ const arrayBuilder = new ArrayBuilder(accessor, options?.name, this._indent, this);
272
+ this._value = arrayBuilder;
273
+ return arrayBuilder;
274
+ }
275
+ toString() {
276
+ if (this._value == null) {
277
+ throw new Error("Value cannot be null for Variable Builder");
278
+ }
279
+ return this.indent(`const ${this._declaration} = ${this._value.toString()};`);
280
+ }
281
+ }
282
+ class RawBuilder extends ContainerBlock {
283
+ _raw;
284
+ constructor(raw, name, parentIndent = "", parent){
285
+ super(name, parentIndent, parent);
286
+ this._raw = raw;
287
+ }
288
+ toString() {
289
+ return `${this._raw}\n`;
290
+ }
291
+ }
292
+ class ObjectBuilder extends Block {
293
+ property(line) {
294
+ // Add comma to previous line if it exists and isn't a brace
295
+ if (this._lines.length > 0) {
296
+ const lastLine = this._lines[this._lines.length - 1];
297
+ if (typeof lastLine === 'string' && !lastLine.endsWith("{")) {
298
+ this._lines[this._lines.length - 1] = lastLine + ",";
299
+ }
300
+ }
301
+ this.push(line);
302
+ return this;
303
+ }
304
+ nested(propertyName, name) {
305
+ const builder = new ObjectBuilder(name, this._indent + " ", this);
306
+ // Add comma to previous line if it exists and isn't a brace
307
+ if (this._lines.length > 0) {
308
+ const lastLine = this._lines[this._lines.length - 1];
309
+ if (typeof lastLine === 'string' && !lastLine.endsWith("{")) {
310
+ this._lines[this._lines.length - 1] = lastLine + ",";
311
+ }
312
+ }
313
+ // Add the property name and opening brace
314
+ this.push(`${propertyName}: {`);
315
+ // Add the nested builder
316
+ this.push(builder);
317
+ // Add the closing brace
318
+ this.push("}");
319
+ return builder;
320
+ }
321
+ toString() {
322
+ // Check if this is a nested object's content
323
+ const isNestedContent = this._parent instanceof ObjectBuilder;
324
+ if (isNestedContent) {
325
+ // For nested object contents, just return the lines
326
+ return this._lines.map((line)=>typeof line === 'string' ? this.indent(" " + line) : line.toString()).join('\n');
327
+ }
328
+ // For root objects, include the braces
329
+ const lines = [
330
+ "{",
331
+ ...this._lines.map((line)=>typeof line === 'string' ? this.indent(" " + line) : line.toString()),
332
+ this.indent("}")
333
+ ];
334
+ return lines.join('\n');
335
+ }
336
+ }
337
+ class FunctionFactoryBuilder extends ContainerBlock {
338
+ _functionName;
339
+ _params = [];
340
+ _return = false;
341
+ constructor(functionName, sectionName, parentIndent = "", parent){
342
+ super(sectionName, parentIndent, parent);
343
+ this._functionName = functionName;
344
+ }
345
+ getParameters() {
346
+ return [
347
+ ...this._params
348
+ ];
349
+ }
350
+ createParameter(value) {
351
+ const name = `injection${this._params.length}`;
352
+ return {
353
+ name,
354
+ value
355
+ };
356
+ }
357
+ parameters(...params) {
358
+ this._params.push(...params);
359
+ return this;
360
+ }
361
+ return() {
362
+ this._return = true;
363
+ return this;
364
+ }
365
+ appendBody(line) {
366
+ this.push(line);
367
+ return this;
368
+ }
369
+ invoke() {
370
+ const body = this.toString();
371
+ const parameterNames = this._getParameterNames();
372
+ const parameterValues = this._getParameterValues();
373
+ return Function(...parameterNames, body)(...parameterValues);
374
+ }
375
+ _getParameterNames() {
376
+ return this._params.map((w)=>w.name).join(", ");
377
+ }
378
+ _getParameterValues() {
379
+ return this._params.map((w)=>w.value);
380
+ }
381
+ toString() {
382
+ const r = this._return === true ? "return " : "";
383
+ const signature = this._functionName ? `${r}function ${this._functionName}(${this._getParameterNames()})` : `${r}function(${this._getParameterNames()})`;
384
+ const lines = [
385
+ this.indent(signature + " {"),
386
+ ...this._lines.map((line)=>typeof line === 'string' ? this.indent(" " + line) : line.toString()),
387
+ this.indent("}")
388
+ ];
389
+ return lines.join('\n');
390
+ }
391
+ }
392
+ class FunctionBuilder extends ContainerBlock {
393
+ _functionName;
394
+ _params = [];
395
+ _return = false;
396
+ constructor(functionName, sectionName, parentIndent = "", parent){
397
+ super(sectionName, parentIndent, parent);
398
+ this._functionName = functionName;
399
+ }
400
+ parameters(...params) {
401
+ this._params.push(...params);
402
+ return this;
403
+ }
404
+ return() {
405
+ this._return = true;
406
+ return this;
407
+ }
408
+ appendBody(line) {
409
+ this.push(line);
410
+ return this;
411
+ }
412
+ _getParameterKeys() {
413
+ return this._params.map((w)=>typeof w === "object" ? w.name : w).join(", ");
414
+ }
415
+ toCallable() {
416
+ return `${this._functionName}(${this._params.map((w)=>typeof w === "object" ? w.callName : w).join(", ")})`;
417
+ }
418
+ toString() {
419
+ const r = this._return === true ? "return " : "";
420
+ const signature = this._functionName ? `${r}function ${this._functionName}(${this._getParameterKeys()})` : `${r}function(${this._getParameterKeys()})`;
421
+ const lines = [
422
+ this.indent(signature + " {"),
423
+ ...this._lines.map((line)=>typeof line === 'string' ? this.indent(" " + line) : line.toString()),
424
+ this.indent("}")
425
+ ];
426
+ return lines.join('\n');
427
+ }
428
+ }
429
+ class ArrayBuilder extends Block {
430
+ constructor(accessor, name, parentIndent = "", parent){
431
+ super(name, parentIndent, parent);
432
+ this._lines.push(accessor);
433
+ }
434
+ append(accessor) {
435
+ this._lines.push(accessor);
436
+ return this;
437
+ }
438
+ toString() {
439
+ return `[${this._lines.join(",")}]`;
440
+ }
441
+ }
442
+ class IfBuilder extends ContainerBlock {
443
+ _condition;
444
+ constructor(condition, name, parentIndent = "", parent){
445
+ super(name, parentIndent, parent);
446
+ this._condition = condition;
447
+ }
448
+ appendBody(line) {
449
+ this.push(line);
450
+ return this;
451
+ }
452
+ unshiftBody(line) {
453
+ this.unshift(line);
454
+ return this;
455
+ }
456
+ stringifyLine(line) {
457
+ if (typeof line === 'string') {
458
+ return this.indent(" " + line);
459
+ }
460
+ if (Array.isArray(line)) {
461
+ return line.join("\r\n");
462
+ }
463
+ return line.toString();
464
+ }
465
+ toString() {
466
+ // need to join with \r\n because we are not an object
467
+ const lines = [
468
+ this.indent(`if (${this._condition}) {`),
469
+ this._lines.map((x)=>this.stringifyLine(x)).join("\r\n"),
470
+ this.indent("}")
471
+ ];
472
+ return lines.join("\n\n");
473
+ }
474
+ }
475
+ class CodeBuilder extends ContainerBlock {
476
+ toString() {
477
+ return this._lines.map((line)=>typeof line === 'string' ? this.indent(line) : line.toString()).join('\n\n');
478
+ }
479
+ }
480
+
481
+
482
+ },
483
+ 618(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
484
+ __webpack_require__.d(__webpack_exports__, {
485
+ u: () => (uuid)
486
+ });
487
+ const uuid = (length = 16)=>{
488
+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
489
+ const charLength = chars.length;
490
+ let result = '';
491
+ for(let i = 0; i < length; i++){
492
+ result += chars[Math.random() * charLength | 0];
493
+ }
494
+ return result;
495
+ };
496
+ const HEX_CHARS = '0123456789abcdef';
497
+ const UUID_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
498
+ const hasCrypto = typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';
499
+ const hasRandomUUID = typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function';
500
+ const uuidv4 = ()=>{
501
+ if (hasRandomUUID) {
502
+ return crypto.randomUUID();
503
+ }
504
+ return uuidv4Fallback();
505
+ };
506
+ const uuidv4Fallback = ()=>{
507
+ let randomBytes = null;
508
+ if (hasCrypto) {
509
+ randomBytes = crypto.getRandomValues(new Uint8Array(16));
510
+ }
511
+ let byteIndex = 0;
512
+ let uuid = '';
513
+ for(let i = 0; i < UUID_TEMPLATE.length; i++){
514
+ const c = UUID_TEMPLATE[i];
515
+ if (c === '-') {
516
+ uuid += '-';
517
+ continue;
518
+ }
519
+ let r;
520
+ if (hasCrypto && randomBytes) {
521
+ // Each byte gives two hex digits (nibbles)
522
+ r = i % 2 === 0 ? randomBytes[byteIndex] >> 4 : randomBytes[byteIndex++] & 0x0f;
523
+ } else {
524
+ r = Math.floor(Math.random() * 16);
525
+ }
526
+ if (c === 'x') {
527
+ uuid += HEX_CHARS[r];
528
+ } else if (c === 'y') {
529
+ // Variant bits: 8, 9, A, or B
530
+ uuid += HEX_CHARS[r & 0x3 | 0x8];
531
+ } else if (c === '4') {
532
+ uuid += '4';
533
+ }
534
+ }
535
+ return uuid;
536
+ };
537
+
538
+
539
+ },
540
+
541
+ });
542
+ // The module cache
543
+ var __webpack_module_cache__ = {};
544
+
545
+ // The require function
546
+ function __webpack_require__(moduleId) {
547
+
548
+ // Check if module is in cache
549
+ var cachedModule = __webpack_module_cache__[moduleId];
550
+ if (cachedModule !== undefined) {
551
+ return cachedModule.exports;
552
+ }
553
+ // Create a new module (and put it into the cache)
554
+ var module = (__webpack_module_cache__[moduleId] = {
555
+ exports: {}
556
+ });
557
+ // Execute the module function
558
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
559
+
560
+ // Return the exports of the module
561
+ return module.exports;
562
+
563
+ }
564
+
565
+ // webpack/runtime/define_property_getters
566
+ (() => {
567
+ __webpack_require__.d = (exports, definition) => {
568
+ for(var key in definition) {
569
+ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
570
+ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
571
+ }
572
+ }
573
+ };
574
+ })();
575
+ // webpack/runtime/has_own_property
576
+ (() => {
577
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
578
+ })();
579
+ // webpack/runtime/make_namespace_object
580
+ (() => {
581
+ // define __esModule on exports
582
+ __webpack_require__.r = (exports) => {
583
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
584
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
585
+ }
586
+ Object.defineProperty(exports, '__esModule', { value: true });
587
+ };
588
+ })();
589
+ var __webpack_exports__ = {};
590
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
591
+ (() => {
592
+ __webpack_require__.r(__webpack_exports__);
593
+ __webpack_require__.d(__webpack_exports__, {
594
+ AndBuilder: () => (/* reexport safe */ _blocks__rspack_import_0.No),
595
+ ArrayBuilder: () => (/* reexport safe */ _blocks__rspack_import_0.$j),
596
+ AssignmentBuilder: () => (/* reexport safe */ _blocks__rspack_import_0.hL),
597
+ Block: () => (/* reexport safe */ _blocks__rspack_import_0.eB),
598
+ CodeBuilder: () => (/* reexport safe */ _blocks__rspack_import_0.Nl),
599
+ ContainerBlock: () => (/* reexport safe */ _blocks__rspack_import_0.j7),
600
+ FunctionBuilder: () => (/* reexport safe */ _blocks__rspack_import_0.kF),
601
+ FunctionFactoryBuilder: () => (/* reexport safe */ _blocks__rspack_import_0.O_),
602
+ IfBuilder: () => (/* reexport safe */ _blocks__rspack_import_0.Zm),
603
+ ObjectBuilder: () => (/* reexport safe */ _blocks__rspack_import_0.Tl),
604
+ RawBuilder: () => (/* reexport safe */ _blocks__rspack_import_0.qY),
605
+ SlotBlock: () => (/* reexport safe */ _blocks__rspack_import_0.E2),
606
+ StringBuilder: () => (/* reexport safe */ _blocks__rspack_import_0.fe),
607
+ VariableBuilder: () => (/* reexport safe */ _blocks__rspack_import_0.ot)
608
+ });
609
+ /* import */ var _blocks__rspack_import_0 = __webpack_require__(980);
610
+
611
+
612
+
613
+ })();
614
+
615
+ module.exports = __webpack_exports__;
616
+ })()
617
+ ;
618
+ //# sourceMappingURL=index.cjs.map