@player-tools/fluent 0.13.0--canary.221.5662
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/dist/cjs/index.cjs +2257 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/index.legacy-esm.js +2143 -0
- package/dist/index.mjs +2143 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +36 -0
- package/src/core/base-builder/__tests__/fluent-builder-base.test.ts +2257 -0
- package/src/core/base-builder/__tests__/id-generator.test.ts +658 -0
- package/src/core/base-builder/__tests__/registry.test.ts +411 -0
- package/src/core/base-builder/__tests__/switch.test.ts +501 -0
- package/src/core/base-builder/__tests__/template.test.ts +449 -0
- package/src/core/base-builder/__tests__/value-extraction.test.ts +200 -0
- package/src/core/base-builder/conditional/index.ts +64 -0
- package/src/core/base-builder/context.ts +151 -0
- package/src/core/base-builder/fluent-builder-base.ts +261 -0
- package/src/core/base-builder/guards.ts +137 -0
- package/src/core/base-builder/id/generator.ts +286 -0
- package/src/core/base-builder/id/registry.ts +152 -0
- package/src/core/base-builder/index.ts +60 -0
- package/src/core/base-builder/resolution/path-resolver.ts +108 -0
- package/src/core/base-builder/resolution/pipeline.ts +96 -0
- package/src/core/base-builder/resolution/steps/asset-id.ts +77 -0
- package/src/core/base-builder/resolution/steps/asset-wrappers.ts +64 -0
- package/src/core/base-builder/resolution/steps/builders.ts +85 -0
- package/src/core/base-builder/resolution/steps/mixed-arrays.ts +117 -0
- package/src/core/base-builder/resolution/steps/static-values.ts +35 -0
- package/src/core/base-builder/resolution/steps/switches.ts +63 -0
- package/src/core/base-builder/resolution/steps/templates.ts +30 -0
- package/src/core/base-builder/resolution/value-resolver.ts +308 -0
- package/src/core/base-builder/storage/auxiliary-storage.ts +82 -0
- package/src/core/base-builder/storage/value-storage.ts +280 -0
- package/src/core/base-builder/types.ts +184 -0
- package/src/core/base-builder/utils.ts +10 -0
- package/src/core/flow/__tests__/index.test.ts +292 -0
- package/src/core/flow/index.ts +141 -0
- package/src/core/index.ts +8 -0
- package/src/core/mocks/generated/action.builder.ts +109 -0
- package/src/core/mocks/generated/choice.builder.ts +161 -0
- package/src/core/mocks/generated/choiceItem.builder.ts +133 -0
- package/src/core/mocks/generated/collection.builder.ts +117 -0
- package/src/core/mocks/generated/index.ts +7 -0
- package/src/core/mocks/generated/info.builder.ts +80 -0
- package/src/core/mocks/generated/input.builder.ts +75 -0
- package/src/core/mocks/generated/text.builder.ts +63 -0
- package/src/core/mocks/index.ts +1 -0
- package/src/core/mocks/types/action.ts +92 -0
- package/src/core/mocks/types/choice.ts +129 -0
- package/src/core/mocks/types/collection.ts +140 -0
- package/src/core/mocks/types/info.ts +7 -0
- package/src/core/mocks/types/input.ts +7 -0
- package/src/core/mocks/types/text.ts +5 -0
- package/src/core/schema/__tests__/index.test.ts +127 -0
- package/src/core/schema/index.ts +195 -0
- package/src/core/schema/types.ts +7 -0
- package/src/core/switch/__tests__/index.test.ts +156 -0
- package/src/core/switch/index.ts +76 -0
- package/src/core/tagged-template/README.md +448 -0
- package/src/core/tagged-template/__tests__/extract-bindings-from-schema.test.ts +207 -0
- package/src/core/tagged-template/__tests__/index.test.ts +190 -0
- package/src/core/tagged-template/__tests__/schema-std-integration.test.ts +580 -0
- package/src/core/tagged-template/binding.ts +95 -0
- package/src/core/tagged-template/expression.ts +92 -0
- package/src/core/tagged-template/extract-bindings-from-schema.ts +120 -0
- package/src/core/tagged-template/index.ts +5 -0
- package/src/core/tagged-template/std.ts +472 -0
- package/src/core/tagged-template/types.ts +123 -0
- package/src/core/template/__tests__/index.test.ts +380 -0
- package/src/core/template/index.ts +191 -0
- package/src/core/utils/index.ts +160 -0
- package/src/fp/README.md +411 -0
- package/src/fp/__tests__/index.test.ts +1178 -0
- package/src/fp/index.ts +386 -0
- package/src/gen/common.ts +2 -0
- package/src/gen/plugin.mjs +315 -0
- package/src/index.ts +5 -0
- package/src/types.ts +203 -0
- package/types/core/base-builder/conditional/index.d.ts +21 -0
- package/types/core/base-builder/context.d.ts +39 -0
- package/types/core/base-builder/fluent-builder-base.d.ts +132 -0
- package/types/core/base-builder/guards.d.ts +58 -0
- package/types/core/base-builder/id/generator.d.ts +69 -0
- package/types/core/base-builder/id/registry.d.ts +93 -0
- package/types/core/base-builder/index.d.ts +8 -0
- package/types/core/base-builder/resolution/path-resolver.d.ts +15 -0
- package/types/core/base-builder/resolution/pipeline.d.ts +25 -0
- package/types/core/base-builder/resolution/steps/asset-id.d.ts +14 -0
- package/types/core/base-builder/resolution/steps/asset-wrappers.d.ts +14 -0
- package/types/core/base-builder/resolution/steps/builders.d.ts +14 -0
- package/types/core/base-builder/resolution/steps/mixed-arrays.d.ts +14 -0
- package/types/core/base-builder/resolution/steps/static-values.d.ts +14 -0
- package/types/core/base-builder/resolution/steps/switches.d.ts +15 -0
- package/types/core/base-builder/resolution/steps/templates.d.ts +14 -0
- package/types/core/base-builder/resolution/value-resolver.d.ts +37 -0
- package/types/core/base-builder/storage/auxiliary-storage.d.ts +50 -0
- package/types/core/base-builder/storage/value-storage.d.ts +82 -0
- package/types/core/base-builder/types.d.ts +141 -0
- package/types/core/base-builder/utils.d.ts +2 -0
- package/types/core/flow/index.d.ts +23 -0
- package/types/core/index.d.ts +8 -0
- package/types/core/mocks/index.d.ts +2 -0
- package/types/core/mocks/types/action.d.ts +58 -0
- package/types/core/mocks/types/choice.d.ts +95 -0
- package/types/core/mocks/types/collection.d.ts +102 -0
- package/types/core/mocks/types/info.d.ts +7 -0
- package/types/core/mocks/types/input.d.ts +7 -0
- package/types/core/mocks/types/text.d.ts +5 -0
- package/types/core/schema/index.d.ts +34 -0
- package/types/core/schema/types.d.ts +5 -0
- package/types/core/switch/index.d.ts +21 -0
- package/types/core/tagged-template/binding.d.ts +19 -0
- package/types/core/tagged-template/expression.d.ts +11 -0
- package/types/core/tagged-template/extract-bindings-from-schema.d.ts +7 -0
- package/types/core/tagged-template/index.d.ts +6 -0
- package/types/core/tagged-template/std.d.ts +174 -0
- package/types/core/tagged-template/types.d.ts +69 -0
- package/types/core/template/index.d.ts +97 -0
- package/types/core/utils/index.d.ts +47 -0
- package/types/fp/index.d.ts +149 -0
- package/types/gen/common.d.ts +3 -0
- package/types/index.d.ts +3 -0
- package/types/types.d.ts +163 -0
|
@@ -0,0 +1,2257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
AND: () => and,
|
|
24
|
+
FLUENT_BUILDER_SYMBOL: () => FLUENT_BUILDER_SYMBOL,
|
|
25
|
+
FluentBuilderBase: () => FluentBuilderBase,
|
|
26
|
+
IDRegistry: () => IDRegistry,
|
|
27
|
+
NAND: () => nand,
|
|
28
|
+
NOR: () => nor,
|
|
29
|
+
NOT: () => not,
|
|
30
|
+
OR: () => or,
|
|
31
|
+
SchemaGenerator: () => SchemaGenerator,
|
|
32
|
+
SchemaTypeName: () => SchemaTypeName,
|
|
33
|
+
TEMPLATE_MARKER: () => TEMPLATE_MARKER,
|
|
34
|
+
TaggedTemplateValueSymbol: () => TaggedTemplateValueSymbol,
|
|
35
|
+
XOR: () => xor,
|
|
36
|
+
add: () => add,
|
|
37
|
+
and: () => and,
|
|
38
|
+
binding: () => binding,
|
|
39
|
+
call: () => call,
|
|
40
|
+
conditional: () => conditional,
|
|
41
|
+
createIdRegistry: () => createIdRegistry,
|
|
42
|
+
createInspectMethod: () => createInspectMethod,
|
|
43
|
+
createNestedContext: () => createNestedContext,
|
|
44
|
+
createSwitchContext: () => createSwitchContext,
|
|
45
|
+
createTemplateContext: () => createTemplateContext,
|
|
46
|
+
determineSlotName: () => determineSlotName,
|
|
47
|
+
div: () => divide,
|
|
48
|
+
divide: () => divide,
|
|
49
|
+
eq: () => equal,
|
|
50
|
+
equal: () => equal,
|
|
51
|
+
expression: () => expression,
|
|
52
|
+
extractBindingsFromSchema: () => extractBindingsFromSchema,
|
|
53
|
+
extractValue: () => extractValue,
|
|
54
|
+
flow: () => flow,
|
|
55
|
+
genId: () => genId,
|
|
56
|
+
generateAssetId: () => generateAssetId,
|
|
57
|
+
globalIdRegistry: () => globalIdRegistry,
|
|
58
|
+
greaterThan: () => greaterThan,
|
|
59
|
+
greaterThanOrEqual: () => greaterThanOrEqual,
|
|
60
|
+
gt: () => greaterThan,
|
|
61
|
+
gte: () => greaterThanOrEqual,
|
|
62
|
+
ifElse: () => conditional,
|
|
63
|
+
isAsset: () => isAsset,
|
|
64
|
+
isAssetWrapper: () => isAssetWrapper,
|
|
65
|
+
isAssetWrapperValue: () => isAssetWrapperValue,
|
|
66
|
+
isAssetWrapperWithAsset: () => isAssetWrapperWithAsset,
|
|
67
|
+
isBuilderArray: () => isBuilderArray,
|
|
68
|
+
isFluentBuilder: () => isFluentBuilder,
|
|
69
|
+
isPlainObject: () => isPlainObject,
|
|
70
|
+
isStringOrUndefined: () => isStringOrUndefined,
|
|
71
|
+
isSwitchResult: () => isSwitchResult,
|
|
72
|
+
isTaggedTemplateValue: () => isTaggedTemplateValue,
|
|
73
|
+
isTemplate: () => isTemplate,
|
|
74
|
+
lessThan: () => lessThan,
|
|
75
|
+
lessThanOrEqual: () => lessThanOrEqual,
|
|
76
|
+
literal: () => literal,
|
|
77
|
+
lt: () => lessThan,
|
|
78
|
+
lte: () => lessThanOrEqual,
|
|
79
|
+
minus: () => subtract,
|
|
80
|
+
mod: () => modulo,
|
|
81
|
+
modulo: () => modulo,
|
|
82
|
+
multiply: () => multiply,
|
|
83
|
+
nand: () => nand,
|
|
84
|
+
needsAssetWrapper: () => needsAssetWrapper,
|
|
85
|
+
neq: () => notEqual,
|
|
86
|
+
nor: () => nor,
|
|
87
|
+
not: () => not,
|
|
88
|
+
notEqual: () => notEqual,
|
|
89
|
+
or: () => or,
|
|
90
|
+
peekId: () => peekId,
|
|
91
|
+
plus: () => add,
|
|
92
|
+
resetGlobalIdSet: () => resetGlobalIdSet,
|
|
93
|
+
resolveAndWrapAsset: () => resolveAndWrapAsset,
|
|
94
|
+
resolveValue: () => resolveValue,
|
|
95
|
+
safeFromMixedType: () => safeFromMixedType,
|
|
96
|
+
safeToArray: () => safeToArray,
|
|
97
|
+
safeToBoolean: () => safeToBoolean,
|
|
98
|
+
safeToNumber: () => safeToNumber,
|
|
99
|
+
safeToObject: () => safeToObject,
|
|
100
|
+
safeToString: () => safeToString,
|
|
101
|
+
strictEq: () => strictEqual,
|
|
102
|
+
strictEqual: () => strictEqual,
|
|
103
|
+
strictNeq: () => strictNotEqual,
|
|
104
|
+
strictNotEqual: () => strictNotEqual,
|
|
105
|
+
subtract: () => subtract,
|
|
106
|
+
switch_: () => switch_,
|
|
107
|
+
template: () => template,
|
|
108
|
+
ternary: () => conditional,
|
|
109
|
+
times: () => multiply,
|
|
110
|
+
xor: () => xor
|
|
111
|
+
});
|
|
112
|
+
module.exports = __toCommonJS(src_exports);
|
|
113
|
+
|
|
114
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/types.ts
|
|
115
|
+
var FLUENT_BUILDER_SYMBOL = Symbol.for("fluent-builder");
|
|
116
|
+
|
|
117
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/guards.ts
|
|
118
|
+
function isFluentBuilder(value) {
|
|
119
|
+
if (value === null || typeof value !== "object") {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
if (!(FLUENT_BUILDER_SYMBOL in value)) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
const obj = value;
|
|
126
|
+
return obj[FLUENT_BUILDER_SYMBOL] === true && typeof obj.build === "function";
|
|
127
|
+
}
|
|
128
|
+
function isBuilderArray(value) {
|
|
129
|
+
return Array.isArray(value) && value.every(isFluentBuilder);
|
|
130
|
+
}
|
|
131
|
+
function isPlainObject(value) {
|
|
132
|
+
if (!value || typeof value !== "object") return false;
|
|
133
|
+
const proto = Object.getPrototypeOf(value);
|
|
134
|
+
return proto === Object.prototype || proto === null;
|
|
135
|
+
}
|
|
136
|
+
function isAsset(value) {
|
|
137
|
+
if (!value || typeof value !== "object") return false;
|
|
138
|
+
const obj = value;
|
|
139
|
+
return "type" in obj && typeof obj.type === "string";
|
|
140
|
+
}
|
|
141
|
+
function isAssetWrapper(value) {
|
|
142
|
+
if (!value || typeof value !== "object") return false;
|
|
143
|
+
const obj = value;
|
|
144
|
+
return "asset" in obj && typeof obj.asset === "object" && obj.asset !== null;
|
|
145
|
+
}
|
|
146
|
+
function isAssetWrapperWithAsset(value) {
|
|
147
|
+
return isAssetWrapper(value) && isAsset(value.asset);
|
|
148
|
+
}
|
|
149
|
+
function isAssetWrapperValue(value) {
|
|
150
|
+
return typeof value === "object" && value !== null && "asset" in value && Object.keys(value).length === 1;
|
|
151
|
+
}
|
|
152
|
+
function needsAssetWrapper(value) {
|
|
153
|
+
if (isAssetWrapper(value)) return false;
|
|
154
|
+
if (isFluentBuilder(value)) return false;
|
|
155
|
+
return isAsset(value);
|
|
156
|
+
}
|
|
157
|
+
function isSwitchResult(value) {
|
|
158
|
+
if (typeof value !== "object" || value === null) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
const obj = value;
|
|
162
|
+
return "staticSwitch" in obj || "dynamicSwitch" in obj;
|
|
163
|
+
}
|
|
164
|
+
function isStringOrUndefined(value) {
|
|
165
|
+
return value === void 0 || typeof value === "string";
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/id/registry.ts
|
|
169
|
+
var IDRegistry = class {
|
|
170
|
+
usedIds;
|
|
171
|
+
isEnabled;
|
|
172
|
+
constructor(enabled = true) {
|
|
173
|
+
this.usedIds = /* @__PURE__ */ new Set();
|
|
174
|
+
this.isEnabled = enabled;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Ensures the given ID is unique, modifying it if necessary.
|
|
178
|
+
* If the ID already exists, appends a numeric suffix (-1, -2, etc.)
|
|
179
|
+
* until a unique ID is found.
|
|
180
|
+
*
|
|
181
|
+
* Special handling for template placeholders:
|
|
182
|
+
* - IDs ending with `_index_`, `_row_`, etc. are allowed as duplicates
|
|
183
|
+
* - IDs with placeholders followed by segments (e.g., `_index_.field`) enforce uniqueness
|
|
184
|
+
*
|
|
185
|
+
* @param baseId - The desired ID
|
|
186
|
+
* @returns A unique ID (either the original or modified with suffix)
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* const registry = new IDRegistry();
|
|
191
|
+
* registry.ensureUnique("my-id"); // "my-id"
|
|
192
|
+
* registry.ensureUnique("my-id"); // "my-id-1"
|
|
193
|
+
* registry.ensureUnique("list-_index_"); // "list-_index_" (allowed duplicate)
|
|
194
|
+
* registry.ensureUnique("list-_index_"); // "list-_index_" (allowed duplicate)
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
ensureUnique(baseId) {
|
|
198
|
+
if (!this.isEnabled) {
|
|
199
|
+
return baseId;
|
|
200
|
+
}
|
|
201
|
+
if (this.isTemplatePlaceholderID(baseId)) {
|
|
202
|
+
return baseId;
|
|
203
|
+
}
|
|
204
|
+
if (!this.usedIds.has(baseId)) {
|
|
205
|
+
this.usedIds.add(baseId);
|
|
206
|
+
return baseId;
|
|
207
|
+
}
|
|
208
|
+
let counter = 1;
|
|
209
|
+
let uniqueId = `${baseId}-${counter}`;
|
|
210
|
+
while (this.usedIds.has(uniqueId)) {
|
|
211
|
+
counter++;
|
|
212
|
+
uniqueId = `${baseId}-${counter}`;
|
|
213
|
+
}
|
|
214
|
+
this.usedIds.add(uniqueId);
|
|
215
|
+
return uniqueId;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Checks if an ID has already been used.
|
|
219
|
+
*
|
|
220
|
+
* @param id - The ID to check
|
|
221
|
+
* @returns true if the ID has been used, false otherwise
|
|
222
|
+
*/
|
|
223
|
+
has(id) {
|
|
224
|
+
return this.usedIds.has(id);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Clears all registered IDs from the registry.
|
|
228
|
+
* Useful for resetting state between test runs or separate flows.
|
|
229
|
+
*/
|
|
230
|
+
reset() {
|
|
231
|
+
this.usedIds.clear();
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Enables or disables the uniqueness checking.
|
|
235
|
+
* When disabled, all IDs pass through unchanged.
|
|
236
|
+
*
|
|
237
|
+
* @param enabled - Whether to enable uniqueness checking
|
|
238
|
+
*/
|
|
239
|
+
setEnabled(enabled) {
|
|
240
|
+
this.isEnabled = enabled;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Returns the number of unique IDs currently registered.
|
|
244
|
+
*
|
|
245
|
+
* @returns The count of registered IDs
|
|
246
|
+
*/
|
|
247
|
+
size() {
|
|
248
|
+
return this.usedIds.size;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Returns a snapshot of all registered IDs.
|
|
252
|
+
* Useful for debugging and testing.
|
|
253
|
+
*
|
|
254
|
+
* @returns An array of all registered IDs
|
|
255
|
+
*/
|
|
256
|
+
getRegisteredIds() {
|
|
257
|
+
return Array.from(this.usedIds);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Checks if an ID contains template placeholders that should be exempt from uniqueness checks.
|
|
261
|
+
* Template placeholders are patterns like `_index_`, `_index1_`, `_row_` that are replaced at runtime.
|
|
262
|
+
*
|
|
263
|
+
* IDs ending with just a placeholder (e.g., "parent-_index_") are allowed as duplicates.
|
|
264
|
+
* IDs with placeholders followed by additional segments (e.g., "parent-_index_-field") are not.
|
|
265
|
+
*
|
|
266
|
+
* @param id - The ID to check
|
|
267
|
+
* @returns true if the ID should be exempt from uniqueness checks
|
|
268
|
+
*/
|
|
269
|
+
isTemplatePlaceholderID(id) {
|
|
270
|
+
const templatePlaceholderPattern = /_(?:index|row|item)\d*_$/;
|
|
271
|
+
return templatePlaceholderPattern.test(id);
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
var globalIdRegistry = new IDRegistry();
|
|
275
|
+
function createIdRegistry(enabled = true) {
|
|
276
|
+
return new IDRegistry(enabled);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/id/generator.ts
|
|
280
|
+
var resetGlobalIdSet = () => {
|
|
281
|
+
globalIdRegistry.reset();
|
|
282
|
+
};
|
|
283
|
+
var _generateBaseId = (context, functionName) => {
|
|
284
|
+
if (!context) {
|
|
285
|
+
throw new Error(
|
|
286
|
+
`${functionName}: Context is undefined. Please provide a valid BaseBuildContext object.`
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
const { parentId, branch } = context;
|
|
290
|
+
let baseId;
|
|
291
|
+
if (!branch) {
|
|
292
|
+
baseId = parentId || "";
|
|
293
|
+
} else {
|
|
294
|
+
switch (branch.type) {
|
|
295
|
+
case "custom":
|
|
296
|
+
baseId = parentId || "";
|
|
297
|
+
break;
|
|
298
|
+
case "slot":
|
|
299
|
+
if (!branch.name) {
|
|
300
|
+
throw new Error(
|
|
301
|
+
`${functionName}: Slot branch requires a 'name' property. Context: ${JSON.stringify(context)}`
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
baseId = `${parentId ? `${parentId}-` : ""}${branch.name}`;
|
|
305
|
+
break;
|
|
306
|
+
case "array-item":
|
|
307
|
+
if (typeof branch.index !== "number") {
|
|
308
|
+
throw new Error(
|
|
309
|
+
`${functionName}: Array-item branch requires a numeric 'index' property. Got: ${typeof branch.index}. Context: ${JSON.stringify(context)}`
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
if (branch.index < 0) {
|
|
313
|
+
throw new Error(
|
|
314
|
+
`${functionName}: Array-item index must be non-negative. Got: ${branch.index}. Context: ${JSON.stringify(context)}`
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
baseId = `${parentId}-${branch.index}`;
|
|
318
|
+
break;
|
|
319
|
+
case "template":
|
|
320
|
+
if (branch.depth !== void 0 && branch.depth < 0) {
|
|
321
|
+
throw new Error(
|
|
322
|
+
`${functionName}: Template depth must be non-negative. Got: ${branch.depth}. Context: ${JSON.stringify(context)}`
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
baseId = `${parentId}-_index${branch.depth || ""}_`;
|
|
326
|
+
break;
|
|
327
|
+
case "switch":
|
|
328
|
+
if (typeof branch.index !== "number") {
|
|
329
|
+
throw new Error(
|
|
330
|
+
`${functionName}: Switch branch requires a numeric 'index' property. Got: ${typeof branch.index}. Context: ${JSON.stringify(context)}`
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
if (branch.index < 0) {
|
|
334
|
+
throw new Error(
|
|
335
|
+
`${functionName}: Switch index must be non-negative. Got: ${branch.index}. Context: ${JSON.stringify(context)}`
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
if (!branch.kind || !["static", "dynamic"].includes(branch.kind)) {
|
|
339
|
+
throw new Error(
|
|
340
|
+
`${functionName}: Switch branch requires 'kind' to be 'static' or 'dynamic'. Got: ${branch.kind}. Context: ${JSON.stringify(context)}`
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
baseId = `${parentId}-${branch.kind}Switch-${branch.index}`;
|
|
344
|
+
break;
|
|
345
|
+
default: {
|
|
346
|
+
const exhaustiveCheck = branch;
|
|
347
|
+
throw new Error(
|
|
348
|
+
`${functionName}: Unhandled branch type: ${JSON.stringify(exhaustiveCheck)}`
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return baseId;
|
|
354
|
+
};
|
|
355
|
+
var peekId = (context) => {
|
|
356
|
+
return _generateBaseId(context, "peekId");
|
|
357
|
+
};
|
|
358
|
+
var genId = (context) => {
|
|
359
|
+
const baseId = _generateBaseId(context, "genId");
|
|
360
|
+
const { parentId, branch } = context;
|
|
361
|
+
if (!parentId && !branch) {
|
|
362
|
+
console.warn(
|
|
363
|
+
"genId: Context appears incomplete (no parentId or branch). This may result in an empty or invalid ID. Consider using context helper functions from 'fluent/utils/context'."
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
if (parentId === "") {
|
|
367
|
+
console.warn(
|
|
368
|
+
"genId: parentId is an empty string. This may indicate a missing or improperly initialized context."
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
const uniqueId = globalIdRegistry.ensureUnique(baseId);
|
|
372
|
+
if (process.env.NODE_ENV !== "production" && uniqueId !== baseId) {
|
|
373
|
+
console.warn(
|
|
374
|
+
`genId: ID collision detected. Original: "${baseId}", Modified to: "${uniqueId}". Consider providing more specific IDs to avoid collisions.`
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
return uniqueId;
|
|
378
|
+
};
|
|
379
|
+
function determineSlotName(parameterName, assetMetadata) {
|
|
380
|
+
if (!assetMetadata) {
|
|
381
|
+
return parameterName;
|
|
382
|
+
}
|
|
383
|
+
const { type, binding: binding2, value } = assetMetadata;
|
|
384
|
+
if (type === "action" && value) {
|
|
385
|
+
const cleanValue = value.replace(/^\{\{|\}\}$/g, "");
|
|
386
|
+
const segments = cleanValue.split(".");
|
|
387
|
+
const lastSegment = segments[segments.length - 1];
|
|
388
|
+
return lastSegment ? `${type}-${lastSegment}` : type;
|
|
389
|
+
}
|
|
390
|
+
if (type !== "action" && binding2) {
|
|
391
|
+
const cleanBinding = binding2.replace(/^\{\{|\}\}$/g, "");
|
|
392
|
+
const segments = cleanBinding.split(".");
|
|
393
|
+
const lastSegment = segments[segments.length - 1];
|
|
394
|
+
if (lastSegment) {
|
|
395
|
+
return `${type || parameterName}-${lastSegment}`;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return type || parameterName;
|
|
399
|
+
}
|
|
400
|
+
function generateAssetId(params) {
|
|
401
|
+
const {
|
|
402
|
+
context,
|
|
403
|
+
parameterName = "asset",
|
|
404
|
+
assetMetadata,
|
|
405
|
+
explicitId
|
|
406
|
+
} = params;
|
|
407
|
+
if (explicitId) {
|
|
408
|
+
return explicitId;
|
|
409
|
+
}
|
|
410
|
+
if (context && "parentId" in context) {
|
|
411
|
+
const slotName2 = determineSlotName(parameterName, assetMetadata);
|
|
412
|
+
if (context.branch) {
|
|
413
|
+
const baseId = genId(context);
|
|
414
|
+
return genId({
|
|
415
|
+
...context,
|
|
416
|
+
parentId: baseId,
|
|
417
|
+
branch: { type: "slot", name: slotName2 }
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
if (context.parentId) {
|
|
421
|
+
return genId({
|
|
422
|
+
...context,
|
|
423
|
+
branch: { type: "slot", name: slotName2 }
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
const slotName = determineSlotName(parameterName, assetMetadata);
|
|
428
|
+
return slotName;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/context.ts
|
|
432
|
+
function buildContextParams(parentContext, parameterName, index) {
|
|
433
|
+
const params = {
|
|
434
|
+
parentContext,
|
|
435
|
+
parameterName
|
|
436
|
+
};
|
|
437
|
+
if (index !== void 0) {
|
|
438
|
+
return { ...params, index };
|
|
439
|
+
}
|
|
440
|
+
return params;
|
|
441
|
+
}
|
|
442
|
+
function createNestedContext({
|
|
443
|
+
parentContext,
|
|
444
|
+
parameterName,
|
|
445
|
+
index,
|
|
446
|
+
assetMetadata
|
|
447
|
+
}) {
|
|
448
|
+
if (parentContext.nestedContextGenerator) {
|
|
449
|
+
const contextParams = buildContextParams(
|
|
450
|
+
parentContext,
|
|
451
|
+
parameterName,
|
|
452
|
+
index
|
|
453
|
+
);
|
|
454
|
+
const generated = parentContext.nestedContextGenerator(contextParams);
|
|
455
|
+
return generated;
|
|
456
|
+
}
|
|
457
|
+
const slotName = determineSlotName(parameterName, assetMetadata);
|
|
458
|
+
let generatedId;
|
|
459
|
+
let branch;
|
|
460
|
+
if (parentContext && "parentId" in parentContext) {
|
|
461
|
+
if (index !== void 0) {
|
|
462
|
+
generatedId = peekId({
|
|
463
|
+
parentId: parentContext.parentId,
|
|
464
|
+
branch: { type: "slot", name: slotName }
|
|
465
|
+
});
|
|
466
|
+
branch = { type: "array-item", index };
|
|
467
|
+
} else {
|
|
468
|
+
generatedId = genId({
|
|
469
|
+
parentId: parentContext.parentId,
|
|
470
|
+
branch: { type: "slot", name: slotName }
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
const newContext = index !== void 0 ? {
|
|
475
|
+
...parentContext,
|
|
476
|
+
parameterName,
|
|
477
|
+
index,
|
|
478
|
+
...generatedId ? { parentId: generatedId } : {},
|
|
479
|
+
...assetMetadata ? { assetMetadata } : {},
|
|
480
|
+
...branch ? { branch } : {}
|
|
481
|
+
} : {
|
|
482
|
+
...parentContext,
|
|
483
|
+
parameterName,
|
|
484
|
+
...generatedId ? { parentId: generatedId } : {},
|
|
485
|
+
...assetMetadata ? { assetMetadata } : {}
|
|
486
|
+
};
|
|
487
|
+
return newContext;
|
|
488
|
+
}
|
|
489
|
+
function createTemplateContext({
|
|
490
|
+
parentContext,
|
|
491
|
+
depth = 0
|
|
492
|
+
}) {
|
|
493
|
+
const parentId = genId(parentContext);
|
|
494
|
+
const templateContext = {
|
|
495
|
+
...parentContext,
|
|
496
|
+
parentId,
|
|
497
|
+
branch: {
|
|
498
|
+
type: "template",
|
|
499
|
+
depth
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
return templateContext;
|
|
503
|
+
}
|
|
504
|
+
function createSwitchContext({
|
|
505
|
+
parentContext,
|
|
506
|
+
index,
|
|
507
|
+
kind
|
|
508
|
+
}) {
|
|
509
|
+
const switchContext = {
|
|
510
|
+
...parentContext,
|
|
511
|
+
branch: {
|
|
512
|
+
type: "switch",
|
|
513
|
+
index,
|
|
514
|
+
kind
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
return switchContext;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/tagged-template/types.ts
|
|
521
|
+
var TaggedTemplateValueSymbol = Symbol(
|
|
522
|
+
"TaggedTemplateValue"
|
|
523
|
+
);
|
|
524
|
+
function isTaggedTemplateValue(value) {
|
|
525
|
+
return typeof value === "object" && value !== null && TaggedTemplateValueSymbol in value;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/tagged-template/binding.ts
|
|
529
|
+
function binding(strings, ...expressions) {
|
|
530
|
+
let indexCounter = 0;
|
|
531
|
+
const processValue = (val) => {
|
|
532
|
+
if (!val.includes("_index_")) return val;
|
|
533
|
+
return val.replace(/_index_/g, () => {
|
|
534
|
+
const suffix = indexCounter > 0 ? indexCounter : "";
|
|
535
|
+
indexCounter++;
|
|
536
|
+
return `_index${suffix}_`;
|
|
537
|
+
});
|
|
538
|
+
};
|
|
539
|
+
let result = "";
|
|
540
|
+
const len = strings.length;
|
|
541
|
+
for (let i = 0; i < len; i++) {
|
|
542
|
+
result += processValue(strings[i]);
|
|
543
|
+
if (i < expressions.length) {
|
|
544
|
+
const expr = expressions[i];
|
|
545
|
+
if (isTaggedTemplateValue(expr)) {
|
|
546
|
+
const refStr = expr.toRefString();
|
|
547
|
+
if (refStr.startsWith("@[")) {
|
|
548
|
+
result += expr.toRefString({ nestedContext: "binding" });
|
|
549
|
+
} else {
|
|
550
|
+
result += expr.toString();
|
|
551
|
+
}
|
|
552
|
+
} else if (typeof expr === "string") {
|
|
553
|
+
result += processValue(expr);
|
|
554
|
+
} else {
|
|
555
|
+
result += String(expr);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
const templateValue = {
|
|
560
|
+
[TaggedTemplateValueSymbol]: true,
|
|
561
|
+
_phantomType: void 0,
|
|
562
|
+
toValue() {
|
|
563
|
+
return result;
|
|
564
|
+
},
|
|
565
|
+
toRefString(options) {
|
|
566
|
+
if (options?.nestedContext === "binding") {
|
|
567
|
+
return result;
|
|
568
|
+
}
|
|
569
|
+
return `{{${result}}}`;
|
|
570
|
+
},
|
|
571
|
+
toString() {
|
|
572
|
+
return `{{${result}}}`;
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
return templateValue;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/tagged-template/expression.ts
|
|
579
|
+
function expression(strings, ...expressions) {
|
|
580
|
+
const validateSyntax = (expr) => {
|
|
581
|
+
let openParens = 0;
|
|
582
|
+
let position = 0;
|
|
583
|
+
for (const char of expr) {
|
|
584
|
+
if (char === "(") openParens++;
|
|
585
|
+
if (char === ")") openParens--;
|
|
586
|
+
position++;
|
|
587
|
+
if (openParens < 0) {
|
|
588
|
+
throw new Error(
|
|
589
|
+
`Error: Unexpected ) at character ${position} in expression:
|
|
590
|
+
${expr.slice(
|
|
591
|
+
0,
|
|
592
|
+
position
|
|
593
|
+
)}\u2588${expr.slice(position)}`
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
if (openParens > 0) {
|
|
598
|
+
throw new Error(
|
|
599
|
+
`Error: Expected ) at character ${position} in expression:
|
|
600
|
+
${expr}\u2588`
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
let result = "";
|
|
605
|
+
const len = strings.length;
|
|
606
|
+
for (let i = 0; i < len; i++) {
|
|
607
|
+
result += strings[i];
|
|
608
|
+
if (i < expressions.length) {
|
|
609
|
+
const expr = expressions[i];
|
|
610
|
+
if (isTaggedTemplateValue(expr)) {
|
|
611
|
+
result += expr.toRefString({ nestedContext: "expression" });
|
|
612
|
+
} else {
|
|
613
|
+
result += String(expr);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
validateSyntax(result);
|
|
618
|
+
return {
|
|
619
|
+
[TaggedTemplateValueSymbol]: true,
|
|
620
|
+
toValue() {
|
|
621
|
+
return result;
|
|
622
|
+
},
|
|
623
|
+
toRefString(options) {
|
|
624
|
+
if (options?.nestedContext === "binding") {
|
|
625
|
+
return `\`${result}\``;
|
|
626
|
+
} else if (options?.nestedContext === "expression") {
|
|
627
|
+
return result;
|
|
628
|
+
}
|
|
629
|
+
return `@[${result}]@`;
|
|
630
|
+
},
|
|
631
|
+
toString() {
|
|
632
|
+
return `@[${result}]@`;
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/tagged-template/extract-bindings-from-schema.ts
|
|
638
|
+
function extractBindingsFromSchema(schema) {
|
|
639
|
+
const primitiveTypes = /* @__PURE__ */ new Set(["StringType", "NumberType", "BooleanType"]);
|
|
640
|
+
const isPrimitive = (typeName) => {
|
|
641
|
+
return primitiveTypes.has(typeName);
|
|
642
|
+
};
|
|
643
|
+
const createBinding = (typeName, path) => {
|
|
644
|
+
if (typeName === "StringType") {
|
|
645
|
+
return binding`${path}`;
|
|
646
|
+
}
|
|
647
|
+
if (typeName === "NumberType") {
|
|
648
|
+
return binding`${path}`;
|
|
649
|
+
}
|
|
650
|
+
if (typeName === "BooleanType") {
|
|
651
|
+
return binding`${path}`;
|
|
652
|
+
}
|
|
653
|
+
return binding`${path}`;
|
|
654
|
+
};
|
|
655
|
+
const processDataType = (dataType, schema2, path, visited = /* @__PURE__ */ new Set()) => {
|
|
656
|
+
const typeName = dataType.type;
|
|
657
|
+
if (visited.has(typeName)) {
|
|
658
|
+
return createBinding("StringType", path);
|
|
659
|
+
}
|
|
660
|
+
if ("isArray" in dataType && dataType.isArray) {
|
|
661
|
+
const arrayPath = path ? `${path}._current_` : "_current_";
|
|
662
|
+
if (isPrimitive(typeName)) {
|
|
663
|
+
if (typeName === "StringType") {
|
|
664
|
+
return { name: createBinding(typeName, arrayPath) };
|
|
665
|
+
} else {
|
|
666
|
+
return { value: createBinding(typeName, arrayPath) };
|
|
667
|
+
}
|
|
668
|
+
} else {
|
|
669
|
+
const typeNode2 = schema2[typeName];
|
|
670
|
+
if (typeNode2) {
|
|
671
|
+
const newVisited = new Set(visited);
|
|
672
|
+
newVisited.add(typeName);
|
|
673
|
+
return processNode(
|
|
674
|
+
typeNode2,
|
|
675
|
+
schema2,
|
|
676
|
+
arrayPath,
|
|
677
|
+
newVisited
|
|
678
|
+
);
|
|
679
|
+
}
|
|
680
|
+
return createBinding("StringType", arrayPath);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
if ("isRecord" in dataType && dataType.isRecord) {
|
|
684
|
+
const typeNode2 = schema2[typeName];
|
|
685
|
+
if (typeNode2) {
|
|
686
|
+
const newVisited = new Set(visited);
|
|
687
|
+
newVisited.add(typeName);
|
|
688
|
+
return processNode(typeNode2, schema2, path, newVisited);
|
|
689
|
+
}
|
|
690
|
+
return createBinding("StringType", path);
|
|
691
|
+
}
|
|
692
|
+
if (isPrimitive(typeName)) {
|
|
693
|
+
return createBinding(typeName, path);
|
|
694
|
+
}
|
|
695
|
+
const typeNode = schema2[typeName];
|
|
696
|
+
if (typeNode) {
|
|
697
|
+
const newVisited = new Set(visited);
|
|
698
|
+
newVisited.add(typeName);
|
|
699
|
+
return processNode(typeNode, schema2, path, newVisited);
|
|
700
|
+
}
|
|
701
|
+
return createBinding("StringType", path);
|
|
702
|
+
};
|
|
703
|
+
const processNode = (node, schema2, basePath, visited = /* @__PURE__ */ new Set()) => {
|
|
704
|
+
const result = {};
|
|
705
|
+
Object.entries(node).forEach(([key, dataType]) => {
|
|
706
|
+
const path = basePath ? `${basePath}.${key}` : key;
|
|
707
|
+
result[key] = processDataType(dataType, schema2, path, visited);
|
|
708
|
+
});
|
|
709
|
+
return result;
|
|
710
|
+
};
|
|
711
|
+
return processNode(schema.ROOT, schema, "");
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/tagged-template/std.ts
|
|
715
|
+
function and(...args) {
|
|
716
|
+
const expressions = args.map((arg) => {
|
|
717
|
+
if (isTaggedTemplateValue(arg)) {
|
|
718
|
+
const expr = arg.toRefString({ nestedContext: "expression" });
|
|
719
|
+
if (expr.includes(" || ") && !expr.startsWith("(")) {
|
|
720
|
+
return `(${expr})`;
|
|
721
|
+
}
|
|
722
|
+
return expr;
|
|
723
|
+
}
|
|
724
|
+
return String(arg);
|
|
725
|
+
});
|
|
726
|
+
return expression`${expressions.join(" && ")}`;
|
|
727
|
+
}
|
|
728
|
+
function or(...args) {
|
|
729
|
+
const expressions = args.map((arg) => {
|
|
730
|
+
if (isTaggedTemplateValue(arg)) {
|
|
731
|
+
return arg.toRefString({ nestedContext: "expression" });
|
|
732
|
+
}
|
|
733
|
+
return String(arg);
|
|
734
|
+
});
|
|
735
|
+
return expression`${expressions.join(" || ")}`;
|
|
736
|
+
}
|
|
737
|
+
function not(value) {
|
|
738
|
+
const expr = isTaggedTemplateValue(value) ? value.toRefString({ nestedContext: "expression" }) : String(value);
|
|
739
|
+
return expression`!${expr}`;
|
|
740
|
+
}
|
|
741
|
+
function nor(...args) {
|
|
742
|
+
return not(or(...args));
|
|
743
|
+
}
|
|
744
|
+
function nand(...args) {
|
|
745
|
+
return not(and(...args));
|
|
746
|
+
}
|
|
747
|
+
function xor(left, right) {
|
|
748
|
+
const leftExpr = isTaggedTemplateValue(left) ? left.toRefString({ nestedContext: "expression" }) : String(left);
|
|
749
|
+
const rightExpr = isTaggedTemplateValue(right) ? right.toRefString({ nestedContext: "expression" }) : String(right);
|
|
750
|
+
return expression`(${leftExpr} && !${rightExpr}) || (!${leftExpr} && ${rightExpr})`;
|
|
751
|
+
}
|
|
752
|
+
function equal(left, right) {
|
|
753
|
+
const leftExpr = isTaggedTemplateValue(left) ? left.toRefString({ nestedContext: "expression" }) : JSON.stringify(left);
|
|
754
|
+
const rightExpr = isTaggedTemplateValue(right) ? right.toRefString({ nestedContext: "expression" }) : JSON.stringify(right);
|
|
755
|
+
return expression`${leftExpr} == ${rightExpr}`;
|
|
756
|
+
}
|
|
757
|
+
function strictEqual(left, right) {
|
|
758
|
+
const leftExpr = isTaggedTemplateValue(left) ? left.toRefString({ nestedContext: "expression" }) : JSON.stringify(left);
|
|
759
|
+
const rightExpr = isTaggedTemplateValue(right) ? right.toRefString({ nestedContext: "expression" }) : JSON.stringify(right);
|
|
760
|
+
return expression`${leftExpr} === ${rightExpr}`;
|
|
761
|
+
}
|
|
762
|
+
function notEqual(left, right) {
|
|
763
|
+
const leftExpr = isTaggedTemplateValue(left) ? left.toRefString({ nestedContext: "expression" }) : JSON.stringify(left);
|
|
764
|
+
const rightExpr = isTaggedTemplateValue(right) ? right.toRefString({ nestedContext: "expression" }) : JSON.stringify(right);
|
|
765
|
+
return expression`${leftExpr} != ${rightExpr}`;
|
|
766
|
+
}
|
|
767
|
+
function strictNotEqual(left, right) {
|
|
768
|
+
const leftExpr = isTaggedTemplateValue(left) ? left.toRefString({ nestedContext: "expression" }) : JSON.stringify(left);
|
|
769
|
+
const rightExpr = isTaggedTemplateValue(right) ? right.toRefString({ nestedContext: "expression" }) : JSON.stringify(right);
|
|
770
|
+
return expression`${leftExpr} !== ${rightExpr}`;
|
|
771
|
+
}
|
|
772
|
+
function greaterThan(left, right) {
|
|
773
|
+
const leftExpr = isTaggedTemplateValue(left) ? left.toRefString({ nestedContext: "expression" }) : JSON.stringify(left);
|
|
774
|
+
const rightExpr = isTaggedTemplateValue(right) ? right.toRefString({ nestedContext: "expression" }) : JSON.stringify(right);
|
|
775
|
+
return expression`${leftExpr} > ${rightExpr}`;
|
|
776
|
+
}
|
|
777
|
+
function greaterThanOrEqual(left, right) {
|
|
778
|
+
const leftExpr = isTaggedTemplateValue(left) ? left.toRefString({ nestedContext: "expression" }) : JSON.stringify(left);
|
|
779
|
+
const rightExpr = isTaggedTemplateValue(right) ? right.toRefString({ nestedContext: "expression" }) : JSON.stringify(right);
|
|
780
|
+
return expression`${leftExpr} >= ${rightExpr}`;
|
|
781
|
+
}
|
|
782
|
+
function lessThan(left, right) {
|
|
783
|
+
const leftExpr = isTaggedTemplateValue(left) ? left.toRefString({ nestedContext: "expression" }) : JSON.stringify(left);
|
|
784
|
+
const rightExpr = isTaggedTemplateValue(right) ? right.toRefString({ nestedContext: "expression" }) : JSON.stringify(right);
|
|
785
|
+
return expression`${leftExpr} < ${rightExpr}`;
|
|
786
|
+
}
|
|
787
|
+
function lessThanOrEqual(left, right) {
|
|
788
|
+
const leftExpr = isTaggedTemplateValue(left) ? left.toRefString({ nestedContext: "expression" }) : JSON.stringify(left);
|
|
789
|
+
const rightExpr = isTaggedTemplateValue(right) ? right.toRefString({ nestedContext: "expression" }) : JSON.stringify(right);
|
|
790
|
+
return expression`${leftExpr} <= ${rightExpr}`;
|
|
791
|
+
}
|
|
792
|
+
function add(...args) {
|
|
793
|
+
const expressions = args.map((arg) => {
|
|
794
|
+
if (isTaggedTemplateValue(arg)) {
|
|
795
|
+
return arg.toRefString({ nestedContext: "expression" });
|
|
796
|
+
}
|
|
797
|
+
return String(arg);
|
|
798
|
+
});
|
|
799
|
+
return expression`${expressions.join(" + ")}`;
|
|
800
|
+
}
|
|
801
|
+
function subtract(left, right) {
|
|
802
|
+
const leftExpr = isTaggedTemplateValue(left) ? left.toRefString({ nestedContext: "expression" }) : String(left);
|
|
803
|
+
const rightExpr = isTaggedTemplateValue(right) ? right.toRefString({ nestedContext: "expression" }) : String(right);
|
|
804
|
+
return expression`${leftExpr} - ${rightExpr}`;
|
|
805
|
+
}
|
|
806
|
+
function multiply(...args) {
|
|
807
|
+
const expressions = args.map((arg) => {
|
|
808
|
+
if (isTaggedTemplateValue(arg)) {
|
|
809
|
+
return arg.toRefString({ nestedContext: "expression" });
|
|
810
|
+
}
|
|
811
|
+
return String(arg);
|
|
812
|
+
});
|
|
813
|
+
return expression`${expressions.join(" * ")}`;
|
|
814
|
+
}
|
|
815
|
+
function divide(left, right) {
|
|
816
|
+
const leftExpr = isTaggedTemplateValue(left) ? left.toRefString({ nestedContext: "expression" }) : String(left);
|
|
817
|
+
const rightExpr = isTaggedTemplateValue(right) ? right.toRefString({ nestedContext: "expression" }) : String(right);
|
|
818
|
+
return expression`${leftExpr} / ${rightExpr}`;
|
|
819
|
+
}
|
|
820
|
+
function modulo(left, right) {
|
|
821
|
+
const leftExpr = isTaggedTemplateValue(left) ? left.toRefString({ nestedContext: "expression" }) : String(left);
|
|
822
|
+
const rightExpr = isTaggedTemplateValue(right) ? right.toRefString({ nestedContext: "expression" }) : String(right);
|
|
823
|
+
return expression`${leftExpr} % ${rightExpr}`;
|
|
824
|
+
}
|
|
825
|
+
function conditional(condition, ifTrue, ifFalse) {
|
|
826
|
+
const conditionExpr = isTaggedTemplateValue(condition) ? condition.toRefString({ nestedContext: "expression" }) : String(condition);
|
|
827
|
+
const trueExpr = isTaggedTemplateValue(ifTrue) ? ifTrue.toRefString({ nestedContext: "expression" }) : JSON.stringify(ifTrue);
|
|
828
|
+
const falseExpr = isTaggedTemplateValue(ifFalse) ? ifFalse.toRefString({ nestedContext: "expression" }) : JSON.stringify(ifFalse);
|
|
829
|
+
return expression`${conditionExpr} ? ${trueExpr} : ${falseExpr}`;
|
|
830
|
+
}
|
|
831
|
+
function call(functionName, ...args) {
|
|
832
|
+
const argExpressions = args.map((arg) => {
|
|
833
|
+
if (isTaggedTemplateValue(arg)) {
|
|
834
|
+
return arg.toRefString({
|
|
835
|
+
nestedContext: "expression"
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
return JSON.stringify(arg);
|
|
839
|
+
});
|
|
840
|
+
return expression`${functionName}(${argExpressions.join(", ")})`;
|
|
841
|
+
}
|
|
842
|
+
function literal(value) {
|
|
843
|
+
return expression`${JSON.stringify(value)}`;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/resolution/value-resolver.ts
|
|
847
|
+
function extractObject(value, options) {
|
|
848
|
+
const visited = options.visited ?? /* @__PURE__ */ new WeakSet();
|
|
849
|
+
if (visited.has(value)) {
|
|
850
|
+
return value;
|
|
851
|
+
}
|
|
852
|
+
visited.add(value);
|
|
853
|
+
const result = {};
|
|
854
|
+
for (const [key, val] of Object.entries(value)) {
|
|
855
|
+
result[key] = extractValue(val, { propertyKey: key, visited });
|
|
856
|
+
}
|
|
857
|
+
return result;
|
|
858
|
+
}
|
|
859
|
+
function extractValue(value, options = {}) {
|
|
860
|
+
const { propertyKey, visited = /* @__PURE__ */ new WeakSet() } = options;
|
|
861
|
+
if (isTaggedTemplateValue(value)) {
|
|
862
|
+
if (propertyKey === "data" || propertyKey === "binding") {
|
|
863
|
+
return value.toValue();
|
|
864
|
+
}
|
|
865
|
+
return value.toString();
|
|
866
|
+
}
|
|
867
|
+
if (Array.isArray(value)) {
|
|
868
|
+
if (visited.has(value)) {
|
|
869
|
+
return value;
|
|
870
|
+
}
|
|
871
|
+
visited.add(value);
|
|
872
|
+
return value.map((item) => extractValue(item, { visited }));
|
|
873
|
+
}
|
|
874
|
+
if (isPlainObject(value) && !isFluentBuilder(value) && !isAssetWrapper(value)) {
|
|
875
|
+
return extractObject(value, { visited });
|
|
876
|
+
}
|
|
877
|
+
return value;
|
|
878
|
+
}
|
|
879
|
+
function wrapAsset(asset, context, slotName) {
|
|
880
|
+
if (!context) {
|
|
881
|
+
return { asset };
|
|
882
|
+
}
|
|
883
|
+
if (asset.id) {
|
|
884
|
+
return { asset: { ...asset } };
|
|
885
|
+
}
|
|
886
|
+
const parentId = peekId(context);
|
|
887
|
+
const slotCtx = {
|
|
888
|
+
parentId,
|
|
889
|
+
branch: { type: "slot", name: slotName }
|
|
890
|
+
};
|
|
891
|
+
return {
|
|
892
|
+
asset: {
|
|
893
|
+
...asset,
|
|
894
|
+
id: genId(slotCtx)
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
function resolveValue(value, options = {}) {
|
|
899
|
+
const { context, propertyName, visited = /* @__PURE__ */ new WeakSet() } = options;
|
|
900
|
+
if (isTaggedTemplateValue(value)) {
|
|
901
|
+
if (propertyName === "data" || propertyName === "binding") {
|
|
902
|
+
return value.toValue();
|
|
903
|
+
}
|
|
904
|
+
return value.toString();
|
|
905
|
+
}
|
|
906
|
+
if (value === null || value === void 0) {
|
|
907
|
+
return value;
|
|
908
|
+
}
|
|
909
|
+
if (isFluentBuilder(value)) {
|
|
910
|
+
return value.build(context);
|
|
911
|
+
}
|
|
912
|
+
if (isAssetWrapper(value)) {
|
|
913
|
+
if (visited.has(value)) return value;
|
|
914
|
+
visited.add(value);
|
|
915
|
+
const innerAsset = value.asset;
|
|
916
|
+
const resolvedAsset = resolveValue(innerAsset, {
|
|
917
|
+
context,
|
|
918
|
+
propertyName,
|
|
919
|
+
visited
|
|
920
|
+
});
|
|
921
|
+
return { asset: resolvedAsset };
|
|
922
|
+
}
|
|
923
|
+
if (Array.isArray(value)) {
|
|
924
|
+
if (visited.has(value)) return value;
|
|
925
|
+
visited.add(value);
|
|
926
|
+
return value.filter((item) => item !== null && item !== void 0).map((item, index) => {
|
|
927
|
+
const arrayContext = context ? createNestedContext({
|
|
928
|
+
parentContext: context,
|
|
929
|
+
parameterName: propertyName || "array",
|
|
930
|
+
index
|
|
931
|
+
}) : void 0;
|
|
932
|
+
return resolveValue(item, {
|
|
933
|
+
context: arrayContext,
|
|
934
|
+
propertyName: String(index),
|
|
935
|
+
visited
|
|
936
|
+
});
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
if (isPlainObject(value) && !isAsset(value)) {
|
|
940
|
+
if (visited.has(value)) return value;
|
|
941
|
+
visited.add(value);
|
|
942
|
+
const resolved = {};
|
|
943
|
+
for (const [key, val] of Object.entries(value)) {
|
|
944
|
+
const nestedContext = context ? createNestedContext({ parentContext: context, parameterName: key }) : void 0;
|
|
945
|
+
resolved[key] = resolveValue(val, {
|
|
946
|
+
context: nestedContext,
|
|
947
|
+
propertyName: key,
|
|
948
|
+
visited
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
return resolved;
|
|
952
|
+
}
|
|
953
|
+
return value;
|
|
954
|
+
}
|
|
955
|
+
function resolveAndWrapAsset(value, options) {
|
|
956
|
+
const { context, slotName, visited = /* @__PURE__ */ new WeakSet() } = options;
|
|
957
|
+
if (value === null || value === void 0) {
|
|
958
|
+
return value;
|
|
959
|
+
}
|
|
960
|
+
if (isAssetWrapper(value)) {
|
|
961
|
+
if (visited.has(value)) return value;
|
|
962
|
+
visited.add(value);
|
|
963
|
+
const resolvedAsset = resolveValue(value.asset, {
|
|
964
|
+
context,
|
|
965
|
+
propertyName: slotName,
|
|
966
|
+
visited
|
|
967
|
+
});
|
|
968
|
+
return { asset: resolvedAsset };
|
|
969
|
+
}
|
|
970
|
+
if (isFluentBuilder(value)) {
|
|
971
|
+
if (!context) {
|
|
972
|
+
const built2 = value.build(void 0);
|
|
973
|
+
if (isAssetWrapper(built2)) {
|
|
974
|
+
return built2;
|
|
975
|
+
}
|
|
976
|
+
if (isAsset(built2)) {
|
|
977
|
+
return { asset: built2 };
|
|
978
|
+
}
|
|
979
|
+
return built2;
|
|
980
|
+
}
|
|
981
|
+
const parentId = peekId(context);
|
|
982
|
+
const slotContext = {
|
|
983
|
+
...context,
|
|
984
|
+
parentId,
|
|
985
|
+
branch: { type: "slot", name: slotName }
|
|
986
|
+
};
|
|
987
|
+
const built = value.build(slotContext);
|
|
988
|
+
if (isAssetWrapper(built)) {
|
|
989
|
+
return built;
|
|
990
|
+
}
|
|
991
|
+
if (isAsset(built)) {
|
|
992
|
+
return { asset: built };
|
|
993
|
+
}
|
|
994
|
+
return built;
|
|
995
|
+
}
|
|
996
|
+
if (isAsset(value)) {
|
|
997
|
+
return wrapAsset(value, context, slotName);
|
|
998
|
+
}
|
|
999
|
+
return resolveValue(value, { context, propertyName: slotName, visited });
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/storage/value-storage.ts
|
|
1003
|
+
var ValueStorage = class _ValueStorage {
|
|
1004
|
+
values = {};
|
|
1005
|
+
builders = /* @__PURE__ */ new Map();
|
|
1006
|
+
mixedArrays = /* @__PURE__ */ new Map();
|
|
1007
|
+
constructor(initial) {
|
|
1008
|
+
if (initial) {
|
|
1009
|
+
this.values = { ...initial };
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Sets a property value, intelligently routing it to the appropriate storage
|
|
1014
|
+
*
|
|
1015
|
+
* This method performs runtime type checking to determine how to store the value:
|
|
1016
|
+
* - FluentBuilder instances → builders Map
|
|
1017
|
+
* - Arrays with builders → mixedArrays Map
|
|
1018
|
+
* - Objects with builders → builders Map
|
|
1019
|
+
* - Everything else → values (static storage)
|
|
1020
|
+
*/
|
|
1021
|
+
set(key, value) {
|
|
1022
|
+
const keyStr = String(key);
|
|
1023
|
+
if (isFluentBuilder(value)) {
|
|
1024
|
+
this.builders.set(keyStr, value);
|
|
1025
|
+
delete this.values[key];
|
|
1026
|
+
this.mixedArrays.delete(keyStr);
|
|
1027
|
+
} else if (Array.isArray(value)) {
|
|
1028
|
+
this.handleArrayValue(key, keyStr, value);
|
|
1029
|
+
} else if (typeof value === "object" && value !== null && this.containsBuilder(value)) {
|
|
1030
|
+
this.builders.set(keyStr, value);
|
|
1031
|
+
delete this.values[key];
|
|
1032
|
+
this.mixedArrays.delete(keyStr);
|
|
1033
|
+
} else {
|
|
1034
|
+
this.setStaticValue(key, keyStr, value);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Handles array value storage, detecting mixed arrays with builders
|
|
1039
|
+
*/
|
|
1040
|
+
handleArrayValue(key, keyStr, value) {
|
|
1041
|
+
const builderIndices = /* @__PURE__ */ new Set();
|
|
1042
|
+
const objectIndices = /* @__PURE__ */ new Set();
|
|
1043
|
+
value.forEach((item, index) => {
|
|
1044
|
+
if (isFluentBuilder(item)) {
|
|
1045
|
+
builderIndices.add(index);
|
|
1046
|
+
} else if (typeof item === "object" && item !== null && this.containsBuilder(item)) {
|
|
1047
|
+
objectIndices.add(index);
|
|
1048
|
+
}
|
|
1049
|
+
});
|
|
1050
|
+
const hasBuilders = builderIndices.size > 0 || objectIndices.size > 0;
|
|
1051
|
+
if (hasBuilders) {
|
|
1052
|
+
this.mixedArrays.set(keyStr, {
|
|
1053
|
+
array: value,
|
|
1054
|
+
builderIndices,
|
|
1055
|
+
objectIndices
|
|
1056
|
+
});
|
|
1057
|
+
delete this.values[key];
|
|
1058
|
+
} else {
|
|
1059
|
+
this.setStaticValue(key, keyStr, value);
|
|
1060
|
+
this.mixedArrays.delete(keyStr);
|
|
1061
|
+
}
|
|
1062
|
+
this.builders.delete(keyStr);
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Sets a static value with proper type handling
|
|
1066
|
+
*/
|
|
1067
|
+
setStaticValue(key, keyStr, value) {
|
|
1068
|
+
this.values[key] = value;
|
|
1069
|
+
this.builders.delete(keyStr);
|
|
1070
|
+
this.mixedArrays.delete(keyStr);
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* Checks if an object contains any builders recursively
|
|
1074
|
+
* Handles circular references gracefully
|
|
1075
|
+
*/
|
|
1076
|
+
containsBuilder(obj, visited = /* @__PURE__ */ new WeakSet()) {
|
|
1077
|
+
if (isFluentBuilder(obj)) return true;
|
|
1078
|
+
if (!obj || typeof obj !== "object") return false;
|
|
1079
|
+
if (visited.has(obj)) return false;
|
|
1080
|
+
visited.add(obj);
|
|
1081
|
+
if (Array.isArray(obj)) {
|
|
1082
|
+
return obj.some((item) => this.containsBuilder(item, visited));
|
|
1083
|
+
}
|
|
1084
|
+
const proto = Object.getPrototypeOf(obj);
|
|
1085
|
+
if (proto === Object.prototype || proto === null) {
|
|
1086
|
+
return Object.values(obj).some(
|
|
1087
|
+
(val) => this.containsBuilder(val, visited)
|
|
1088
|
+
);
|
|
1089
|
+
}
|
|
1090
|
+
return false;
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Checks if a property has been set
|
|
1094
|
+
*/
|
|
1095
|
+
has(key) {
|
|
1096
|
+
const keyStr = String(key);
|
|
1097
|
+
return key in this.values || this.builders.has(keyStr) || this.mixedArrays.has(keyStr);
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Peeks at a property value without resolving builders
|
|
1101
|
+
* Returns the raw value if it's static, the array if it's mixed, or undefined if it's a builder
|
|
1102
|
+
*/
|
|
1103
|
+
peek(key) {
|
|
1104
|
+
const keyStr = String(key);
|
|
1105
|
+
const mixedArray = this.mixedArrays.get(keyStr);
|
|
1106
|
+
if (mixedArray) {
|
|
1107
|
+
return mixedArray.array;
|
|
1108
|
+
}
|
|
1109
|
+
if (this.builders.has(keyStr)) {
|
|
1110
|
+
return void 0;
|
|
1111
|
+
}
|
|
1112
|
+
return this.values[key];
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Gets builder for a property if one is set
|
|
1116
|
+
*/
|
|
1117
|
+
peekBuilder(key) {
|
|
1118
|
+
const keyStr = String(key);
|
|
1119
|
+
const entry = this.builders.get(keyStr);
|
|
1120
|
+
if (!entry) return void 0;
|
|
1121
|
+
if (isFluentBuilder(entry)) {
|
|
1122
|
+
return entry;
|
|
1123
|
+
}
|
|
1124
|
+
return void 0;
|
|
1125
|
+
}
|
|
1126
|
+
/**
|
|
1127
|
+
* Gets the type of value stored for a property
|
|
1128
|
+
*/
|
|
1129
|
+
getValueType(key) {
|
|
1130
|
+
const keyStr = String(key);
|
|
1131
|
+
if (this.mixedArrays.has(keyStr)) {
|
|
1132
|
+
return "mixed-array";
|
|
1133
|
+
}
|
|
1134
|
+
if (this.builders.has(keyStr)) {
|
|
1135
|
+
return "builder";
|
|
1136
|
+
}
|
|
1137
|
+
if (key in this.values) {
|
|
1138
|
+
return "static";
|
|
1139
|
+
}
|
|
1140
|
+
return "unset";
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Gets all static values for the build pipeline
|
|
1144
|
+
*/
|
|
1145
|
+
getValues() {
|
|
1146
|
+
return this.values;
|
|
1147
|
+
}
|
|
1148
|
+
/**
|
|
1149
|
+
* Gets all builder entries for the build pipeline
|
|
1150
|
+
*/
|
|
1151
|
+
getBuilders() {
|
|
1152
|
+
return this.builders;
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Gets all mixed array entries for the build pipeline
|
|
1156
|
+
*/
|
|
1157
|
+
getMixedArrays() {
|
|
1158
|
+
return this.mixedArrays;
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Unsets a property, removing it from storage
|
|
1162
|
+
*/
|
|
1163
|
+
unset(key) {
|
|
1164
|
+
const keyStr = String(key);
|
|
1165
|
+
delete this.values[key];
|
|
1166
|
+
this.builders.delete(keyStr);
|
|
1167
|
+
this.mixedArrays.delete(keyStr);
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Clears all properties from storage
|
|
1171
|
+
*/
|
|
1172
|
+
clear() {
|
|
1173
|
+
this.values = {};
|
|
1174
|
+
this.builders.clear();
|
|
1175
|
+
this.mixedArrays.clear();
|
|
1176
|
+
}
|
|
1177
|
+
/**
|
|
1178
|
+
* Clones the storage, creating an independent copy
|
|
1179
|
+
*/
|
|
1180
|
+
clone() {
|
|
1181
|
+
const cloned = new _ValueStorage();
|
|
1182
|
+
cloned.values = { ...this.values };
|
|
1183
|
+
cloned.builders = new Map(this.builders);
|
|
1184
|
+
cloned.mixedArrays = new Map(
|
|
1185
|
+
Array.from(this.mixedArrays.entries()).map(([key, metadata]) => [
|
|
1186
|
+
key,
|
|
1187
|
+
{
|
|
1188
|
+
array: metadata.array,
|
|
1189
|
+
builderIndices: new Set(metadata.builderIndices),
|
|
1190
|
+
objectIndices: new Set(metadata.objectIndices)
|
|
1191
|
+
}
|
|
1192
|
+
])
|
|
1193
|
+
);
|
|
1194
|
+
return cloned;
|
|
1195
|
+
}
|
|
1196
|
+
};
|
|
1197
|
+
|
|
1198
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/storage/auxiliary-storage.ts
|
|
1199
|
+
var AuxiliaryStorage = class _AuxiliaryStorage {
|
|
1200
|
+
data = /* @__PURE__ */ new Map();
|
|
1201
|
+
/**
|
|
1202
|
+
* Sets auxiliary data with a given key
|
|
1203
|
+
*/
|
|
1204
|
+
set(key, value) {
|
|
1205
|
+
this.data.set(key, value);
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Gets auxiliary data with type assertion
|
|
1209
|
+
* The caller is responsible for knowing the correct type
|
|
1210
|
+
*/
|
|
1211
|
+
get(key) {
|
|
1212
|
+
const value = this.data.get(key);
|
|
1213
|
+
return value;
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Pushes an item to an auxiliary data array
|
|
1217
|
+
* Creates the array if it doesn't exist
|
|
1218
|
+
*/
|
|
1219
|
+
push(key, item) {
|
|
1220
|
+
const existing = this.data.get(key);
|
|
1221
|
+
if (Array.isArray(existing)) {
|
|
1222
|
+
existing.push(item);
|
|
1223
|
+
} else {
|
|
1224
|
+
this.data.set(key, [item]);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1228
|
+
* Gets an auxiliary data array
|
|
1229
|
+
* Returns empty array if doesn't exist or isn't an array
|
|
1230
|
+
*/
|
|
1231
|
+
getArray(key) {
|
|
1232
|
+
const existing = this.data.get(key);
|
|
1233
|
+
return Array.isArray(existing) ? existing : [];
|
|
1234
|
+
}
|
|
1235
|
+
/**
|
|
1236
|
+
* Checks if auxiliary data exists for a key
|
|
1237
|
+
*/
|
|
1238
|
+
has(key) {
|
|
1239
|
+
return this.data.has(key);
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Deletes auxiliary data for a key
|
|
1243
|
+
*/
|
|
1244
|
+
delete(key) {
|
|
1245
|
+
return this.data.delete(key);
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Clears all auxiliary data
|
|
1249
|
+
*/
|
|
1250
|
+
clear() {
|
|
1251
|
+
this.data.clear();
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* Clones the auxiliary storage, creating an independent copy
|
|
1255
|
+
*/
|
|
1256
|
+
clone() {
|
|
1257
|
+
const cloned = new _AuxiliaryStorage();
|
|
1258
|
+
cloned.data = new Map(this.data);
|
|
1259
|
+
return cloned;
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
|
|
1263
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/resolution/steps/static-values.ts
|
|
1264
|
+
function resolveStaticValues(storage, result, context) {
|
|
1265
|
+
const values = storage.getValues();
|
|
1266
|
+
for (const [key, value] of Object.entries(values)) {
|
|
1267
|
+
if (!isAssetWrapperValue(value)) {
|
|
1268
|
+
const extracted = extractValue(value, { propertyKey: key });
|
|
1269
|
+
result[key] = resolveValue(extracted, { context, propertyName: key });
|
|
1270
|
+
} else {
|
|
1271
|
+
result[key] = value;
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/resolution/steps/asset-id.ts
|
|
1277
|
+
function generateAssetIdForBuilder(storage, result, context) {
|
|
1278
|
+
const hasIdSet = storage.has("id");
|
|
1279
|
+
const hasType = storage.has("type") || "type" in result;
|
|
1280
|
+
const hasIdField = "id" in result;
|
|
1281
|
+
if (!hasIdSet && hasType) {
|
|
1282
|
+
const typeValue = result.type;
|
|
1283
|
+
const assetValue = result.value;
|
|
1284
|
+
const assetBinding = result.binding;
|
|
1285
|
+
if (!isStringOrUndefined(typeValue)) {
|
|
1286
|
+
return;
|
|
1287
|
+
}
|
|
1288
|
+
if (!isStringOrUndefined(assetValue)) {
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
if (!isStringOrUndefined(assetBinding)) {
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
const assetMetadata = {
|
|
1295
|
+
type: typeValue,
|
|
1296
|
+
...assetValue ? { value: assetValue } : {},
|
|
1297
|
+
...assetBinding ? { binding: assetBinding } : {}
|
|
1298
|
+
};
|
|
1299
|
+
const generatedId = generateAssetId({
|
|
1300
|
+
context,
|
|
1301
|
+
parameterName: typeValue,
|
|
1302
|
+
assetMetadata,
|
|
1303
|
+
explicitId: void 0
|
|
1304
|
+
});
|
|
1305
|
+
if (generatedId) {
|
|
1306
|
+
result.id = generatedId;
|
|
1307
|
+
}
|
|
1308
|
+
} else if (!hasIdSet && hasIdField && !hasType && context && context.branch) {
|
|
1309
|
+
const generatedId = generateAssetId({
|
|
1310
|
+
context,
|
|
1311
|
+
parameterName: "item",
|
|
1312
|
+
assetMetadata: void 0,
|
|
1313
|
+
explicitId: void 0
|
|
1314
|
+
});
|
|
1315
|
+
if (generatedId) {
|
|
1316
|
+
result.id = generatedId;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/resolution/steps/asset-wrappers.ts
|
|
1322
|
+
function resolveAssetWrappers(storage, result, nestedParentContext) {
|
|
1323
|
+
if (!nestedParentContext) {
|
|
1324
|
+
return;
|
|
1325
|
+
}
|
|
1326
|
+
const values = storage.getValues();
|
|
1327
|
+
for (const key of Object.keys(values)) {
|
|
1328
|
+
const value = values[key];
|
|
1329
|
+
if (isAssetWrapperValue(value)) {
|
|
1330
|
+
const unwrapped = value.asset;
|
|
1331
|
+
if (Array.isArray(unwrapped)) {
|
|
1332
|
+
result[key] = resolveAssetWrapperArray(
|
|
1333
|
+
unwrapped,
|
|
1334
|
+
nestedParentContext,
|
|
1335
|
+
key
|
|
1336
|
+
);
|
|
1337
|
+
} else {
|
|
1338
|
+
result[key] = resolveAndWrapAsset(unwrapped, {
|
|
1339
|
+
context: nestedParentContext,
|
|
1340
|
+
slotName: key
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
function resolveAssetWrapperArray(array, context, key) {
|
|
1347
|
+
return array.filter((item) => item !== null && item !== void 0).map((item, index) => {
|
|
1348
|
+
const slotName = `${key}-${index}`;
|
|
1349
|
+
return resolveAndWrapAsset(item, { context, slotName });
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/resolution/steps/mixed-arrays.ts
|
|
1354
|
+
function resolveMixedArrays(storage, result, nestedParentContext) {
|
|
1355
|
+
const mixedArrays = storage.getMixedArrays();
|
|
1356
|
+
mixedArrays.forEach((metadata, key) => {
|
|
1357
|
+
const { array, builderIndices, objectIndices } = metadata;
|
|
1358
|
+
const currentValue = result[key];
|
|
1359
|
+
if (isAssetWrapperValue(currentValue)) {
|
|
1360
|
+
resolveMixedArrayAsAssetWrapper(
|
|
1361
|
+
result,
|
|
1362
|
+
key,
|
|
1363
|
+
currentValue,
|
|
1364
|
+
nestedParentContext
|
|
1365
|
+
);
|
|
1366
|
+
} else {
|
|
1367
|
+
resolveMixedArrayNormal(
|
|
1368
|
+
result,
|
|
1369
|
+
key,
|
|
1370
|
+
array,
|
|
1371
|
+
builderIndices,
|
|
1372
|
+
objectIndices,
|
|
1373
|
+
nestedParentContext
|
|
1374
|
+
);
|
|
1375
|
+
}
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
function resolveMixedArrayAsAssetWrapper(result, key, wrapperValue, nestedParentContext) {
|
|
1379
|
+
const unwrappedArray = wrapperValue.asset;
|
|
1380
|
+
if (Array.isArray(unwrappedArray)) {
|
|
1381
|
+
result[key] = unwrappedArray.filter((item) => item !== null && item !== void 0).map((item, index) => {
|
|
1382
|
+
const slotName = `${key}-${index}`;
|
|
1383
|
+
return resolveAndWrapAsset(item, {
|
|
1384
|
+
context: nestedParentContext,
|
|
1385
|
+
slotName
|
|
1386
|
+
});
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
function resolveMixedArrayNormal(result, key, array, builderIndices, objectIndices, nestedParentContext) {
|
|
1391
|
+
const resolvedArray = [];
|
|
1392
|
+
array.forEach((item, index) => {
|
|
1393
|
+
if (item === null || item === void 0) {
|
|
1394
|
+
return;
|
|
1395
|
+
}
|
|
1396
|
+
if (builderIndices.has(index) && isFluentBuilder(item)) {
|
|
1397
|
+
const nestedContext = nestedParentContext ? createNestedContext({
|
|
1398
|
+
parentContext: nestedParentContext,
|
|
1399
|
+
parameterName: key,
|
|
1400
|
+
index
|
|
1401
|
+
}) : void 0;
|
|
1402
|
+
resolvedArray.push(item.build(nestedContext));
|
|
1403
|
+
} else if (objectIndices.has(index)) {
|
|
1404
|
+
const nestedContext = nestedParentContext ? createNestedContext({
|
|
1405
|
+
parentContext: nestedParentContext,
|
|
1406
|
+
parameterName: key,
|
|
1407
|
+
index
|
|
1408
|
+
}) : void 0;
|
|
1409
|
+
resolvedArray.push(resolveValue(item, { context: nestedContext }));
|
|
1410
|
+
} else {
|
|
1411
|
+
resolvedArray.push(item);
|
|
1412
|
+
}
|
|
1413
|
+
});
|
|
1414
|
+
result[key] = resolvedArray;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/resolution/steps/builders.ts
|
|
1418
|
+
function resolveBuilders(storage, result, nestedParentContext) {
|
|
1419
|
+
const builders = storage.getBuilders();
|
|
1420
|
+
builders.forEach((value, key) => {
|
|
1421
|
+
if (isAssetWrapperValue(value)) {
|
|
1422
|
+
resolveBuilderAsAssetWrapper(result, key, value, nestedParentContext);
|
|
1423
|
+
} else {
|
|
1424
|
+
resolveBuilderNormal(result, key, value, nestedParentContext);
|
|
1425
|
+
}
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1428
|
+
function resolveBuilderAsAssetWrapper(result, key, wrapperValue, nestedParentContext) {
|
|
1429
|
+
const unwrapped = wrapperValue.asset;
|
|
1430
|
+
if (nestedParentContext) {
|
|
1431
|
+
if (Array.isArray(unwrapped)) {
|
|
1432
|
+
result[key] = unwrapped.filter((item) => item !== null && item !== void 0).map((item, index) => {
|
|
1433
|
+
const slotName = `${key}-${index}`;
|
|
1434
|
+
return resolveAndWrapAsset(item, {
|
|
1435
|
+
context: nestedParentContext,
|
|
1436
|
+
slotName
|
|
1437
|
+
});
|
|
1438
|
+
});
|
|
1439
|
+
} else {
|
|
1440
|
+
result[key] = resolveAndWrapAsset(unwrapped, {
|
|
1441
|
+
context: nestedParentContext,
|
|
1442
|
+
slotName: key
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
} else {
|
|
1446
|
+
result[key] = resolveValue(wrapperValue, {});
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
function resolveBuilderNormal(result, key, value, nestedParentContext) {
|
|
1450
|
+
const nestedContext = nestedParentContext ? createNestedContext({
|
|
1451
|
+
parentContext: nestedParentContext,
|
|
1452
|
+
parameterName: key
|
|
1453
|
+
}) : void 0;
|
|
1454
|
+
result[key] = resolveValue(value, { context: nestedContext });
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/resolution/path-resolver.ts
|
|
1458
|
+
function setValueAtPath(obj, path, value) {
|
|
1459
|
+
if (path.length === 0) return;
|
|
1460
|
+
if (path.length === 1) {
|
|
1461
|
+
obj[path[0]] = value;
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1464
|
+
const [currentKey, ...restPath] = path;
|
|
1465
|
+
const nextKey = restPath[0];
|
|
1466
|
+
const currentValue = obj[currentKey];
|
|
1467
|
+
const isAssetWrapperWithArray = isAssetWrapperValue(currentValue) && Array.isArray(currentValue.asset);
|
|
1468
|
+
if (isAssetWrapperWithArray && typeof nextKey === "number") {
|
|
1469
|
+
setValueInAssetWrapperArray(
|
|
1470
|
+
obj,
|
|
1471
|
+
currentKey,
|
|
1472
|
+
currentValue,
|
|
1473
|
+
nextKey,
|
|
1474
|
+
restPath,
|
|
1475
|
+
value
|
|
1476
|
+
);
|
|
1477
|
+
} else if (Array.isArray(currentValue) && typeof nextKey === "number") {
|
|
1478
|
+
setValueInArray(obj, currentKey, currentValue, nextKey, restPath, value);
|
|
1479
|
+
} else {
|
|
1480
|
+
setValueInObject(obj, currentKey, restPath, value);
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
function setValueInAssetWrapperArray(obj, currentKey, wrappedArray, nextKey, restPath, value) {
|
|
1484
|
+
const arrayResult = [...wrappedArray.asset];
|
|
1485
|
+
if (restPath.length === 1) {
|
|
1486
|
+
arrayResult[nextKey] = value;
|
|
1487
|
+
} else {
|
|
1488
|
+
const nestedObj = arrayResult[nextKey] ?? {};
|
|
1489
|
+
setValueAtPath(nestedObj, restPath.slice(1), value);
|
|
1490
|
+
arrayResult[nextKey] = nestedObj;
|
|
1491
|
+
}
|
|
1492
|
+
obj[currentKey] = { asset: arrayResult };
|
|
1493
|
+
}
|
|
1494
|
+
function setValueInArray(obj, currentKey, array, nextKey, restPath, value) {
|
|
1495
|
+
const arrayResult = [...array];
|
|
1496
|
+
if (restPath.length === 1) {
|
|
1497
|
+
arrayResult[nextKey] = value;
|
|
1498
|
+
} else {
|
|
1499
|
+
const nestedObj = arrayResult[nextKey] ?? {};
|
|
1500
|
+
setValueAtPath(nestedObj, restPath.slice(1), value);
|
|
1501
|
+
arrayResult[nextKey] = nestedObj;
|
|
1502
|
+
}
|
|
1503
|
+
obj[currentKey] = arrayResult;
|
|
1504
|
+
}
|
|
1505
|
+
function setValueInObject(obj, currentKey, restPath, value) {
|
|
1506
|
+
const nestedObj = obj[currentKey] ?? {};
|
|
1507
|
+
setValueAtPath(nestedObj, restPath, value);
|
|
1508
|
+
obj[currentKey] = nestedObj;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/resolution/steps/switches.ts
|
|
1512
|
+
function resolveSwitches(auxiliaryStorage, result, nestedParentContext, arrayProperties) {
|
|
1513
|
+
const switches = auxiliaryStorage.getArray("__switches__");
|
|
1514
|
+
if (switches.length === 0 || !nestedParentContext) {
|
|
1515
|
+
return;
|
|
1516
|
+
}
|
|
1517
|
+
let globalCaseIndex = 0;
|
|
1518
|
+
switches.forEach(({ path, switchFn }) => {
|
|
1519
|
+
const propertyName = String(path[0]);
|
|
1520
|
+
const switchParentId = nestedParentContext.parentId ? `${nestedParentContext.parentId}-${propertyName}` : propertyName;
|
|
1521
|
+
const switchContext = {
|
|
1522
|
+
...nestedParentContext,
|
|
1523
|
+
parentId: switchParentId,
|
|
1524
|
+
branch: void 0
|
|
1525
|
+
};
|
|
1526
|
+
let switchResult = switchFn(switchContext, globalCaseIndex);
|
|
1527
|
+
if (isSwitchResult(switchResult)) {
|
|
1528
|
+
const switchCases = switchResult.staticSwitch ?? switchResult.dynamicSwitch;
|
|
1529
|
+
if (Array.isArray(switchCases)) {
|
|
1530
|
+
globalCaseIndex += switchCases.length;
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
if (arrayProperties.has(propertyName)) {
|
|
1534
|
+
switchResult = [switchResult];
|
|
1535
|
+
}
|
|
1536
|
+
setValueAtPath(result, path, switchResult);
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/resolution/steps/templates.ts
|
|
1541
|
+
function resolveTemplates(auxiliaryStorage, result, context) {
|
|
1542
|
+
const templateFns = auxiliaryStorage.getArray(
|
|
1543
|
+
"__templates__"
|
|
1544
|
+
);
|
|
1545
|
+
if (templateFns.length === 0 || !context) {
|
|
1546
|
+
return;
|
|
1547
|
+
}
|
|
1548
|
+
const templates = templateFns.map((fn) => fn(context));
|
|
1549
|
+
result.template = templates;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/resolution/pipeline.ts
|
|
1553
|
+
function createNestedParentContext(result, context) {
|
|
1554
|
+
if (!context) {
|
|
1555
|
+
return void 0;
|
|
1556
|
+
}
|
|
1557
|
+
const parentId = "id" in result && typeof result.id === "string" ? result.id : void 0;
|
|
1558
|
+
return {
|
|
1559
|
+
...context,
|
|
1560
|
+
parentId,
|
|
1561
|
+
branch: void 0
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
function executeBuildPipeline(valueStorage, auxiliaryStorage, defaults, context, arrayProperties) {
|
|
1565
|
+
const result = defaults ? { ...defaults } : {};
|
|
1566
|
+
resolveStaticValues(valueStorage, result, context);
|
|
1567
|
+
generateAssetIdForBuilder(valueStorage, result, context);
|
|
1568
|
+
const nestedParentContext = createNestedParentContext(result, context);
|
|
1569
|
+
resolveAssetWrappers(valueStorage, result, nestedParentContext);
|
|
1570
|
+
resolveMixedArrays(valueStorage, result, nestedParentContext);
|
|
1571
|
+
resolveBuilders(valueStorage, result, nestedParentContext);
|
|
1572
|
+
resolveSwitches(
|
|
1573
|
+
auxiliaryStorage,
|
|
1574
|
+
result,
|
|
1575
|
+
nestedParentContext,
|
|
1576
|
+
arrayProperties
|
|
1577
|
+
);
|
|
1578
|
+
resolveTemplates(auxiliaryStorage, result, context);
|
|
1579
|
+
return result;
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/conditional/index.ts
|
|
1583
|
+
function resolveValueOrFunction(value) {
|
|
1584
|
+
if (typeof value === "function" && !isFluentBuilder(value)) {
|
|
1585
|
+
return value();
|
|
1586
|
+
}
|
|
1587
|
+
return value;
|
|
1588
|
+
}
|
|
1589
|
+
function shouldWrapInAssetWrapper(value) {
|
|
1590
|
+
if (isAssetWrapperValue(value)) {
|
|
1591
|
+
return false;
|
|
1592
|
+
}
|
|
1593
|
+
if (isFluentBuilder(value)) {
|
|
1594
|
+
return true;
|
|
1595
|
+
}
|
|
1596
|
+
if (isAsset(value)) {
|
|
1597
|
+
return true;
|
|
1598
|
+
}
|
|
1599
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
1600
|
+
const firstItem = value[0];
|
|
1601
|
+
return isFluentBuilder(firstItem) || isAsset(firstItem);
|
|
1602
|
+
}
|
|
1603
|
+
return false;
|
|
1604
|
+
}
|
|
1605
|
+
function maybeWrapAsset(value) {
|
|
1606
|
+
if (shouldWrapInAssetWrapper(value)) {
|
|
1607
|
+
return { asset: value };
|
|
1608
|
+
}
|
|
1609
|
+
return value;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/switch/index.ts
|
|
1613
|
+
function processCaseExpression(exp) {
|
|
1614
|
+
if (typeof exp === "boolean") {
|
|
1615
|
+
return exp;
|
|
1616
|
+
}
|
|
1617
|
+
if (isTaggedTemplateValue(exp)) {
|
|
1618
|
+
return exp.toString();
|
|
1619
|
+
}
|
|
1620
|
+
return String(exp);
|
|
1621
|
+
}
|
|
1622
|
+
var switch_ = ({
|
|
1623
|
+
cases,
|
|
1624
|
+
isDynamic = false
|
|
1625
|
+
}) => (ctx, caseOffset = 0) => {
|
|
1626
|
+
const switchType = isDynamic ? "dynamic" : "static";
|
|
1627
|
+
return {
|
|
1628
|
+
[`${switchType}Switch`]: cases.map((c, index) => {
|
|
1629
|
+
const caseParentCtx = {
|
|
1630
|
+
...ctx,
|
|
1631
|
+
parentId: ctx.parentId,
|
|
1632
|
+
branch: {
|
|
1633
|
+
type: "switch",
|
|
1634
|
+
kind: switchType,
|
|
1635
|
+
index: caseOffset + index
|
|
1636
|
+
}
|
|
1637
|
+
};
|
|
1638
|
+
const asset = isFluentBuilder(c.asset) && "build" in c.asset ? c.asset.build(caseParentCtx) : c.asset;
|
|
1639
|
+
return {
|
|
1640
|
+
case: processCaseExpression(c.case),
|
|
1641
|
+
asset: {
|
|
1642
|
+
...asset,
|
|
1643
|
+
id: asset.id ?? genId(caseParentCtx)
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1646
|
+
})
|
|
1647
|
+
};
|
|
1648
|
+
};
|
|
1649
|
+
|
|
1650
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/fluent-builder-base.ts
|
|
1651
|
+
var FluentBuilderBase = class {
|
|
1652
|
+
[FLUENT_BUILDER_SYMBOL] = true;
|
|
1653
|
+
valueStorage;
|
|
1654
|
+
auxiliaryStorage;
|
|
1655
|
+
context;
|
|
1656
|
+
/**
|
|
1657
|
+
* Creates a new builder instance
|
|
1658
|
+
* @param initial - Optional initial values
|
|
1659
|
+
*/
|
|
1660
|
+
constructor(initial) {
|
|
1661
|
+
this.valueStorage = new ValueStorage(initial);
|
|
1662
|
+
this.auxiliaryStorage = new AuxiliaryStorage();
|
|
1663
|
+
}
|
|
1664
|
+
/**
|
|
1665
|
+
* Accessor for generated builders to access values
|
|
1666
|
+
* This maintains backward compatibility with generated code
|
|
1667
|
+
*/
|
|
1668
|
+
get values() {
|
|
1669
|
+
return this.valueStorage.getValues();
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* Setter for generated builders to set values in bulk
|
|
1673
|
+
* Used by withAdditionalProperties() in generated builders
|
|
1674
|
+
*/
|
|
1675
|
+
set values(newValues) {
|
|
1676
|
+
Object.entries(newValues).forEach(([key, value]) => {
|
|
1677
|
+
this.valueStorage.set(key, value);
|
|
1678
|
+
});
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Sets a property value, intelligently routing it to the appropriate storage
|
|
1682
|
+
* @param key - The property key to set
|
|
1683
|
+
* @param value - The value to set
|
|
1684
|
+
* @returns This builder instance for chaining
|
|
1685
|
+
*/
|
|
1686
|
+
set(key, value) {
|
|
1687
|
+
this.valueStorage.set(key, value);
|
|
1688
|
+
return this;
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Builds the final object with defaults and nested builder resolution
|
|
1692
|
+
* Executes the complete 8-step build pipeline
|
|
1693
|
+
*
|
|
1694
|
+
* @param defaults - Optional default values
|
|
1695
|
+
* @param context - Optional build context
|
|
1696
|
+
*/
|
|
1697
|
+
buildWithDefaults(defaults, context) {
|
|
1698
|
+
const arrayProperties = this.getArrayPropertiesMetadata();
|
|
1699
|
+
return executeBuildPipeline(
|
|
1700
|
+
this.valueStorage,
|
|
1701
|
+
this.auxiliaryStorage,
|
|
1702
|
+
defaults,
|
|
1703
|
+
context,
|
|
1704
|
+
arrayProperties
|
|
1705
|
+
);
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* Gets array property metadata from the builder class
|
|
1709
|
+
* Generated builders include a static __arrayProperties__ set
|
|
1710
|
+
*/
|
|
1711
|
+
getArrayPropertiesMetadata() {
|
|
1712
|
+
const constructor = this.constructor;
|
|
1713
|
+
return constructor.__arrayProperties__ ?? /* @__PURE__ */ new Set();
|
|
1714
|
+
}
|
|
1715
|
+
/**
|
|
1716
|
+
* Conditionally sets a property based on a predicate
|
|
1717
|
+
*
|
|
1718
|
+
* Accepts unwrapped Asset builders and automatically wraps them in AssetWrapper format.
|
|
1719
|
+
*
|
|
1720
|
+
* @param predicate - Function to determine if the property should be set
|
|
1721
|
+
* @param property - The property key
|
|
1722
|
+
* @param value - The value, builder, or function returning either
|
|
1723
|
+
*
|
|
1724
|
+
* @example
|
|
1725
|
+
* action()
|
|
1726
|
+
* .if(() => showLabel, "label", text().withValue("Submit"))
|
|
1727
|
+
*/
|
|
1728
|
+
if(predicate, property, value) {
|
|
1729
|
+
if (predicate(this)) {
|
|
1730
|
+
const resolved = resolveValueOrFunction(value);
|
|
1731
|
+
const wrapped = maybeWrapAsset(resolved);
|
|
1732
|
+
this.set(property, wrapped);
|
|
1733
|
+
}
|
|
1734
|
+
return this;
|
|
1735
|
+
}
|
|
1736
|
+
/**
|
|
1737
|
+
* Conditionally sets a property choosing between two values
|
|
1738
|
+
*
|
|
1739
|
+
* Accepts unwrapped Asset builders and automatically wraps them in AssetWrapper format.
|
|
1740
|
+
*
|
|
1741
|
+
* @param predicate - Function to determine which value to use
|
|
1742
|
+
* @param property - The property key
|
|
1743
|
+
* @param trueValue - Value to use if predicate is true
|
|
1744
|
+
* @param falseValue - Value to use if predicate is false
|
|
1745
|
+
*
|
|
1746
|
+
* @example
|
|
1747
|
+
* action()
|
|
1748
|
+
* .ifElse(
|
|
1749
|
+
* () => isActive,
|
|
1750
|
+
* "label",
|
|
1751
|
+
* text().withValue("Deactivate"),
|
|
1752
|
+
* text().withValue("Activate")
|
|
1753
|
+
* )
|
|
1754
|
+
*/
|
|
1755
|
+
ifElse(predicate, property, trueValue, falseValue) {
|
|
1756
|
+
const valueToUse = predicate(this) ? trueValue : falseValue;
|
|
1757
|
+
const resolved = resolveValueOrFunction(valueToUse);
|
|
1758
|
+
const wrapped = maybeWrapAsset(resolved);
|
|
1759
|
+
this.set(property, wrapped);
|
|
1760
|
+
return this;
|
|
1761
|
+
}
|
|
1762
|
+
/**
|
|
1763
|
+
* Checks if a property has been set
|
|
1764
|
+
*/
|
|
1765
|
+
has(key) {
|
|
1766
|
+
return this.valueStorage.has(key);
|
|
1767
|
+
}
|
|
1768
|
+
/**
|
|
1769
|
+
* Peeks at a property value without resolving builders
|
|
1770
|
+
*/
|
|
1771
|
+
peek(key) {
|
|
1772
|
+
return this.valueStorage.peek(key);
|
|
1773
|
+
}
|
|
1774
|
+
/**
|
|
1775
|
+
* Gets builder for a property if one is set
|
|
1776
|
+
*/
|
|
1777
|
+
peekBuilder(key) {
|
|
1778
|
+
return this.valueStorage.peekBuilder(key);
|
|
1779
|
+
}
|
|
1780
|
+
/**
|
|
1781
|
+
* Gets the type of value stored for a property
|
|
1782
|
+
*/
|
|
1783
|
+
getValueType(key) {
|
|
1784
|
+
return this.valueStorage.getValueType(key);
|
|
1785
|
+
}
|
|
1786
|
+
/**
|
|
1787
|
+
* Clones the builder, creating an independent copy with the same state
|
|
1788
|
+
*/
|
|
1789
|
+
clone() {
|
|
1790
|
+
const cloned = new this.constructor();
|
|
1791
|
+
cloned.valueStorage = this.valueStorage.clone();
|
|
1792
|
+
cloned.auxiliaryStorage = this.auxiliaryStorage.clone();
|
|
1793
|
+
if (this.context) {
|
|
1794
|
+
cloned.context = this.context;
|
|
1795
|
+
}
|
|
1796
|
+
return cloned;
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* Unsets a property, removing it from the builder
|
|
1800
|
+
*/
|
|
1801
|
+
unset(key) {
|
|
1802
|
+
this.valueStorage.unset(key);
|
|
1803
|
+
return this;
|
|
1804
|
+
}
|
|
1805
|
+
/**
|
|
1806
|
+
* Clears all properties from the builder, resetting it to initial state
|
|
1807
|
+
*/
|
|
1808
|
+
clear() {
|
|
1809
|
+
this.valueStorage.clear();
|
|
1810
|
+
return this;
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Adds a template to this builder
|
|
1814
|
+
*/
|
|
1815
|
+
template(templateFn) {
|
|
1816
|
+
this.auxiliaryStorage.push("__templates__", templateFn);
|
|
1817
|
+
return this;
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* Adds a switch to this builder at a specific path
|
|
1821
|
+
*/
|
|
1822
|
+
switch(path, switchFnArgs) {
|
|
1823
|
+
this.auxiliaryStorage.push("__switches__", {
|
|
1824
|
+
path,
|
|
1825
|
+
switchFn: switch_(switchFnArgs)
|
|
1826
|
+
});
|
|
1827
|
+
return this;
|
|
1828
|
+
}
|
|
1829
|
+
};
|
|
1830
|
+
|
|
1831
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/base-builder/utils.ts
|
|
1832
|
+
function createInspectMethod(builderName, properties) {
|
|
1833
|
+
return `${builderName} { properties: ${JSON.stringify(
|
|
1834
|
+
properties,
|
|
1835
|
+
null,
|
|
1836
|
+
2
|
|
1837
|
+
)} }`;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/template/index.ts
|
|
1841
|
+
var TEMPLATE_MARKER = Symbol.for("fluent-builder-template");
|
|
1842
|
+
function isTemplate(fn) {
|
|
1843
|
+
return typeof fn === "function" && TEMPLATE_MARKER in fn;
|
|
1844
|
+
}
|
|
1845
|
+
var template = ({
|
|
1846
|
+
data,
|
|
1847
|
+
output,
|
|
1848
|
+
value,
|
|
1849
|
+
dynamic = false
|
|
1850
|
+
}) => {
|
|
1851
|
+
const templateFn = (parentCtx) => {
|
|
1852
|
+
const resolvedOutput = output || inferOutputFromContext(parentCtx);
|
|
1853
|
+
if (!resolvedOutput) {
|
|
1854
|
+
throw new Error(
|
|
1855
|
+
"Template output must be provided or inferrable from context. When using template in asset arrays, ensure the array property can be inferred (e.g., collection().withValues([template(...)]) infers 'values' as output)."
|
|
1856
|
+
);
|
|
1857
|
+
}
|
|
1858
|
+
const templateValueCtx = {
|
|
1859
|
+
parentId: genId(parentCtx),
|
|
1860
|
+
branch: {
|
|
1861
|
+
type: "template",
|
|
1862
|
+
depth: 0
|
|
1863
|
+
}
|
|
1864
|
+
};
|
|
1865
|
+
let resolvedAsset;
|
|
1866
|
+
if (isFluentBuilder(value)) {
|
|
1867
|
+
resolvedAsset = value.build(templateValueCtx);
|
|
1868
|
+
} else if (typeof value === "function") {
|
|
1869
|
+
const builderResult = value(templateValueCtx);
|
|
1870
|
+
if (typeof builderResult === "function") {
|
|
1871
|
+
resolvedAsset = builderResult(
|
|
1872
|
+
templateValueCtx
|
|
1873
|
+
);
|
|
1874
|
+
} else {
|
|
1875
|
+
resolvedAsset = builderResult;
|
|
1876
|
+
}
|
|
1877
|
+
} else {
|
|
1878
|
+
if (typeof value === "object" && value !== null) {
|
|
1879
|
+
resolvedAsset = { ...value };
|
|
1880
|
+
} else {
|
|
1881
|
+
resolvedAsset = value;
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
return {
|
|
1885
|
+
data: isTaggedTemplateValue(data) ? data.toString() : data,
|
|
1886
|
+
output: resolvedOutput,
|
|
1887
|
+
value: {
|
|
1888
|
+
asset: resolvedAsset
|
|
1889
|
+
},
|
|
1890
|
+
...dynamic && { dynamic }
|
|
1891
|
+
};
|
|
1892
|
+
};
|
|
1893
|
+
templateFn[TEMPLATE_MARKER] = true;
|
|
1894
|
+
return templateFn;
|
|
1895
|
+
};
|
|
1896
|
+
function inferOutputFromContext(parentCtx) {
|
|
1897
|
+
if (parentCtx.branch?.type === "slot") {
|
|
1898
|
+
const slotName = parentCtx.branch.name;
|
|
1899
|
+
const match = slotName.match(/^([a-zA-Z_][a-zA-Z0-9_]*)-\d+$/);
|
|
1900
|
+
if (match) {
|
|
1901
|
+
return match[1];
|
|
1902
|
+
}
|
|
1903
|
+
if (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(slotName)) {
|
|
1904
|
+
return slotName;
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
return void 0;
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/flow/index.ts
|
|
1911
|
+
function isBuilder(value) {
|
|
1912
|
+
return typeof value === "object" && value !== null && "build" in value && typeof value.build === "function";
|
|
1913
|
+
}
|
|
1914
|
+
function isBuilderFunction(value) {
|
|
1915
|
+
return typeof value === "function";
|
|
1916
|
+
}
|
|
1917
|
+
function flow(options) {
|
|
1918
|
+
const flowId = options.id || "root";
|
|
1919
|
+
const viewsNamespace = `${flowId}-views`;
|
|
1920
|
+
const processedViews = (() => {
|
|
1921
|
+
const processViews = () => {
|
|
1922
|
+
const results = [];
|
|
1923
|
+
for (let index = 0; index < options.views.length; index++) {
|
|
1924
|
+
const viewOrFn = options.views[index];
|
|
1925
|
+
const ctx = {
|
|
1926
|
+
parentId: viewsNamespace,
|
|
1927
|
+
branch: {
|
|
1928
|
+
type: "array-item",
|
|
1929
|
+
index
|
|
1930
|
+
},
|
|
1931
|
+
...options.context ?? {}
|
|
1932
|
+
};
|
|
1933
|
+
if (isBuilder(viewOrFn)) {
|
|
1934
|
+
results.push(viewOrFn.build(ctx));
|
|
1935
|
+
} else if (isBuilderFunction(viewOrFn)) {
|
|
1936
|
+
results.push(viewOrFn(ctx));
|
|
1937
|
+
} else {
|
|
1938
|
+
results.push(viewOrFn);
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
return results;
|
|
1942
|
+
};
|
|
1943
|
+
return processViews();
|
|
1944
|
+
})();
|
|
1945
|
+
const {
|
|
1946
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1947
|
+
views: _views,
|
|
1948
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1949
|
+
context: _context,
|
|
1950
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1951
|
+
autogenRunner: _autogenRunner,
|
|
1952
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1953
|
+
autogenInputData: _autogenInputData,
|
|
1954
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1955
|
+
autogenContext: _autogenContext,
|
|
1956
|
+
...restOptions
|
|
1957
|
+
} = options;
|
|
1958
|
+
return {
|
|
1959
|
+
...restOptions,
|
|
1960
|
+
id: flowId,
|
|
1961
|
+
views: processedViews,
|
|
1962
|
+
...options.data && { data: options.data },
|
|
1963
|
+
...options.schema && { schema: options.schema },
|
|
1964
|
+
navigation: options.navigation
|
|
1965
|
+
};
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/schema/index.ts
|
|
1969
|
+
var import_tapable_ts = require("tapable-ts");
|
|
1970
|
+
var import_dequal = require("dequal");
|
|
1971
|
+
var SchemaTypeName = Symbol.for("Schema Rename");
|
|
1972
|
+
var isTypeDef = (property) => {
|
|
1973
|
+
return property.type !== void 0;
|
|
1974
|
+
};
|
|
1975
|
+
var SchemaGenerator = class {
|
|
1976
|
+
children = [];
|
|
1977
|
+
generatedDataTypes = /* @__PURE__ */ new Map();
|
|
1978
|
+
typeNameCache = /* @__PURE__ */ new Map();
|
|
1979
|
+
logger;
|
|
1980
|
+
hooks = {
|
|
1981
|
+
createSchemaNode: new import_tapable_ts.SyncWaterfallHook()
|
|
1982
|
+
};
|
|
1983
|
+
constructor(logger) {
|
|
1984
|
+
this.logger = logger ?? console;
|
|
1985
|
+
}
|
|
1986
|
+
/**
|
|
1987
|
+
* Converts an object to a `Schema.Schema` representation
|
|
1988
|
+
* Optimized to minimize object operations and memory allocations
|
|
1989
|
+
*/
|
|
1990
|
+
toSchema = (schema) => {
|
|
1991
|
+
this.children.length = 0;
|
|
1992
|
+
this.generatedDataTypes.clear();
|
|
1993
|
+
this.typeNameCache.clear();
|
|
1994
|
+
const newSchema = {
|
|
1995
|
+
ROOT: {}
|
|
1996
|
+
};
|
|
1997
|
+
const rootKeys = Object.keys(schema);
|
|
1998
|
+
for (let i = 0; i < rootKeys.length; i++) {
|
|
1999
|
+
const property = rootKeys[i];
|
|
2000
|
+
const subType = schema[property];
|
|
2001
|
+
newSchema.ROOT[property] = this.hooks.createSchemaNode.call(
|
|
2002
|
+
this.processChild(property, subType),
|
|
2003
|
+
subType
|
|
2004
|
+
);
|
|
2005
|
+
}
|
|
2006
|
+
while (this.children.length > 0) {
|
|
2007
|
+
const { name, child } = this.children.pop();
|
|
2008
|
+
const typeDef = {};
|
|
2009
|
+
const childKeys = Object.keys(child);
|
|
2010
|
+
for (let i = 0; i < childKeys.length; i++) {
|
|
2011
|
+
const property = childKeys[i];
|
|
2012
|
+
const subType = child[property];
|
|
2013
|
+
typeDef[property] = this.hooks.createSchemaNode.call(
|
|
2014
|
+
this.processChild(property, subType),
|
|
2015
|
+
subType
|
|
2016
|
+
);
|
|
2017
|
+
}
|
|
2018
|
+
newSchema[name] = typeDef;
|
|
2019
|
+
}
|
|
2020
|
+
return newSchema;
|
|
2021
|
+
};
|
|
2022
|
+
processChild(property, subType) {
|
|
2023
|
+
if (isTypeDef(subType)) {
|
|
2024
|
+
return subType;
|
|
2025
|
+
}
|
|
2026
|
+
let intermediateType;
|
|
2027
|
+
let child;
|
|
2028
|
+
if (Array.isArray(subType)) {
|
|
2029
|
+
if (subType.length > 1) {
|
|
2030
|
+
this.logger.warn(
|
|
2031
|
+
`Type ${property} has multiple types in array, should only contain one top level object type. Only taking first defined type`
|
|
2032
|
+
);
|
|
2033
|
+
}
|
|
2034
|
+
const subTypeName = subType[0][SchemaTypeName] ?? property;
|
|
2035
|
+
intermediateType = this.makePlaceholderArrayType(subTypeName);
|
|
2036
|
+
child = subType[0];
|
|
2037
|
+
} else {
|
|
2038
|
+
const subTypeName = subType[SchemaTypeName] ?? property;
|
|
2039
|
+
intermediateType = this.makePlaceholderType(subTypeName);
|
|
2040
|
+
child = subType;
|
|
2041
|
+
}
|
|
2042
|
+
const typeName = intermediateType.type;
|
|
2043
|
+
if (this.generatedDataTypes.has(typeName)) {
|
|
2044
|
+
const generatedType = this.generatedDataTypes.get(typeName);
|
|
2045
|
+
if (!(0, import_dequal.dequal)(child, this.generatedDataTypes.get(typeName)?.node)) {
|
|
2046
|
+
generatedType.count += 1;
|
|
2047
|
+
const newTypeName = `${typeName}${generatedType.count}`;
|
|
2048
|
+
intermediateType = {
|
|
2049
|
+
...intermediateType,
|
|
2050
|
+
type: newTypeName
|
|
2051
|
+
};
|
|
2052
|
+
this.logger.warn(
|
|
2053
|
+
`WARNING: Generated two intermediate types with the name: ${typeName} that are of different shapes, using artificial type ${newTypeName}`
|
|
2054
|
+
);
|
|
2055
|
+
this.generatedDataTypes.set(newTypeName, {
|
|
2056
|
+
node: subType,
|
|
2057
|
+
count: 1
|
|
2058
|
+
});
|
|
2059
|
+
this.children.push({ name: newTypeName, child });
|
|
2060
|
+
return intermediateType;
|
|
2061
|
+
}
|
|
2062
|
+
} else {
|
|
2063
|
+
this.generatedDataTypes.set(typeName, {
|
|
2064
|
+
node: subType,
|
|
2065
|
+
count: 1
|
|
2066
|
+
});
|
|
2067
|
+
}
|
|
2068
|
+
this.children.push({ name: intermediateType.type, child });
|
|
2069
|
+
return intermediateType;
|
|
2070
|
+
}
|
|
2071
|
+
/**
|
|
2072
|
+
* Cached type name generation
|
|
2073
|
+
*/
|
|
2074
|
+
makePlaceholderType = (typeName) => {
|
|
2075
|
+
let cachedName = this.typeNameCache.get(typeName);
|
|
2076
|
+
if (!cachedName) {
|
|
2077
|
+
cachedName = `${typeName}Type`;
|
|
2078
|
+
this.typeNameCache.set(typeName, cachedName);
|
|
2079
|
+
}
|
|
2080
|
+
return { type: cachedName };
|
|
2081
|
+
};
|
|
2082
|
+
/**
|
|
2083
|
+
* Cached array type name generation
|
|
2084
|
+
*/
|
|
2085
|
+
makePlaceholderArrayType(typeName) {
|
|
2086
|
+
let cachedName = this.typeNameCache.get(typeName);
|
|
2087
|
+
if (!cachedName) {
|
|
2088
|
+
cachedName = `${typeName}Type`;
|
|
2089
|
+
this.typeNameCache.set(typeName, cachedName);
|
|
2090
|
+
}
|
|
2091
|
+
return {
|
|
2092
|
+
type: cachedName,
|
|
2093
|
+
isArray: true
|
|
2094
|
+
};
|
|
2095
|
+
}
|
|
2096
|
+
};
|
|
2097
|
+
|
|
2098
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/fluent/src/core/utils/index.ts
|
|
2099
|
+
function safeToString(value) {
|
|
2100
|
+
if (isTaggedTemplateValue(value)) {
|
|
2101
|
+
return value.toString();
|
|
2102
|
+
}
|
|
2103
|
+
return String(value);
|
|
2104
|
+
}
|
|
2105
|
+
function safeToBoolean(value) {
|
|
2106
|
+
if (isTaggedTemplateValue(value)) {
|
|
2107
|
+
return value.toString() === "true";
|
|
2108
|
+
}
|
|
2109
|
+
return Boolean(value);
|
|
2110
|
+
}
|
|
2111
|
+
function safeToNumber(value) {
|
|
2112
|
+
if (isTaggedTemplateValue(value)) {
|
|
2113
|
+
return Number(value.toString());
|
|
2114
|
+
}
|
|
2115
|
+
return Number(value);
|
|
2116
|
+
}
|
|
2117
|
+
function safeToArray(value) {
|
|
2118
|
+
if (isTaggedTemplateValue(value)) {
|
|
2119
|
+
return [value.toString()];
|
|
2120
|
+
}
|
|
2121
|
+
if (Array.isArray(value)) {
|
|
2122
|
+
return value.map((item) => {
|
|
2123
|
+
if (isTaggedTemplateValue(item)) {
|
|
2124
|
+
return item.toString();
|
|
2125
|
+
} else if (Array.isArray(item)) {
|
|
2126
|
+
return safeToArray(item);
|
|
2127
|
+
} else if (item && typeof item === "object" && !isTaggedTemplateValue(item)) {
|
|
2128
|
+
return safeToObject(item);
|
|
2129
|
+
}
|
|
2130
|
+
return item;
|
|
2131
|
+
});
|
|
2132
|
+
}
|
|
2133
|
+
return [value];
|
|
2134
|
+
}
|
|
2135
|
+
function safeToObject(value) {
|
|
2136
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
2137
|
+
return value;
|
|
2138
|
+
}
|
|
2139
|
+
return Object.fromEntries(
|
|
2140
|
+
Object.entries(value).map(([key, val]) => {
|
|
2141
|
+
if (isTaggedTemplateValue(val)) {
|
|
2142
|
+
return [key, val.toString()];
|
|
2143
|
+
} else if (Array.isArray(val)) {
|
|
2144
|
+
return [key, safeToArray(val)];
|
|
2145
|
+
} else if (val && typeof val === "object" && !isTaggedTemplateValue(val)) {
|
|
2146
|
+
return [key, safeToObject(val)];
|
|
2147
|
+
}
|
|
2148
|
+
return [key, val];
|
|
2149
|
+
})
|
|
2150
|
+
);
|
|
2151
|
+
}
|
|
2152
|
+
function safeFromMixedType(value) {
|
|
2153
|
+
if (isTaggedTemplateValue(value)) {
|
|
2154
|
+
return value.toString();
|
|
2155
|
+
}
|
|
2156
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
2157
|
+
return safeToObject(
|
|
2158
|
+
value
|
|
2159
|
+
);
|
|
2160
|
+
}
|
|
2161
|
+
if (Array.isArray(value)) {
|
|
2162
|
+
return safeToArray(value);
|
|
2163
|
+
}
|
|
2164
|
+
return value;
|
|
2165
|
+
}
|
|
2166
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2167
|
+
0 && (module.exports = {
|
|
2168
|
+
AND,
|
|
2169
|
+
FLUENT_BUILDER_SYMBOL,
|
|
2170
|
+
FluentBuilderBase,
|
|
2171
|
+
IDRegistry,
|
|
2172
|
+
NAND,
|
|
2173
|
+
NOR,
|
|
2174
|
+
NOT,
|
|
2175
|
+
OR,
|
|
2176
|
+
SchemaGenerator,
|
|
2177
|
+
SchemaTypeName,
|
|
2178
|
+
TEMPLATE_MARKER,
|
|
2179
|
+
TaggedTemplateValueSymbol,
|
|
2180
|
+
XOR,
|
|
2181
|
+
add,
|
|
2182
|
+
and,
|
|
2183
|
+
binding,
|
|
2184
|
+
call,
|
|
2185
|
+
conditional,
|
|
2186
|
+
createIdRegistry,
|
|
2187
|
+
createInspectMethod,
|
|
2188
|
+
createNestedContext,
|
|
2189
|
+
createSwitchContext,
|
|
2190
|
+
createTemplateContext,
|
|
2191
|
+
determineSlotName,
|
|
2192
|
+
div,
|
|
2193
|
+
divide,
|
|
2194
|
+
eq,
|
|
2195
|
+
equal,
|
|
2196
|
+
expression,
|
|
2197
|
+
extractBindingsFromSchema,
|
|
2198
|
+
extractValue,
|
|
2199
|
+
flow,
|
|
2200
|
+
genId,
|
|
2201
|
+
generateAssetId,
|
|
2202
|
+
globalIdRegistry,
|
|
2203
|
+
greaterThan,
|
|
2204
|
+
greaterThanOrEqual,
|
|
2205
|
+
gt,
|
|
2206
|
+
gte,
|
|
2207
|
+
ifElse,
|
|
2208
|
+
isAsset,
|
|
2209
|
+
isAssetWrapper,
|
|
2210
|
+
isAssetWrapperValue,
|
|
2211
|
+
isAssetWrapperWithAsset,
|
|
2212
|
+
isBuilderArray,
|
|
2213
|
+
isFluentBuilder,
|
|
2214
|
+
isPlainObject,
|
|
2215
|
+
isStringOrUndefined,
|
|
2216
|
+
isSwitchResult,
|
|
2217
|
+
isTaggedTemplateValue,
|
|
2218
|
+
isTemplate,
|
|
2219
|
+
lessThan,
|
|
2220
|
+
lessThanOrEqual,
|
|
2221
|
+
literal,
|
|
2222
|
+
lt,
|
|
2223
|
+
lte,
|
|
2224
|
+
minus,
|
|
2225
|
+
mod,
|
|
2226
|
+
modulo,
|
|
2227
|
+
multiply,
|
|
2228
|
+
nand,
|
|
2229
|
+
needsAssetWrapper,
|
|
2230
|
+
neq,
|
|
2231
|
+
nor,
|
|
2232
|
+
not,
|
|
2233
|
+
notEqual,
|
|
2234
|
+
or,
|
|
2235
|
+
peekId,
|
|
2236
|
+
plus,
|
|
2237
|
+
resetGlobalIdSet,
|
|
2238
|
+
resolveAndWrapAsset,
|
|
2239
|
+
resolveValue,
|
|
2240
|
+
safeFromMixedType,
|
|
2241
|
+
safeToArray,
|
|
2242
|
+
safeToBoolean,
|
|
2243
|
+
safeToNumber,
|
|
2244
|
+
safeToObject,
|
|
2245
|
+
safeToString,
|
|
2246
|
+
strictEq,
|
|
2247
|
+
strictEqual,
|
|
2248
|
+
strictNeq,
|
|
2249
|
+
strictNotEqual,
|
|
2250
|
+
subtract,
|
|
2251
|
+
switch_,
|
|
2252
|
+
template,
|
|
2253
|
+
ternary,
|
|
2254
|
+
times,
|
|
2255
|
+
xor
|
|
2256
|
+
});
|
|
2257
|
+
//# sourceMappingURL=index.cjs.map
|