@magmonium/cli 0.8.29 → 0.8.30
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/bin/cli.js +4 -0
- package/bin/commands/api-ops.js +130 -0
- package/bin/commands/gen-code.js +1 -0
- package/bin/commands/validate.js +583 -0
- package/codegen/index.js +640 -94
- package/codegen/invariant-catalog.js +2788 -0
- package/codegen/swagger-helper.js +478 -0
- package/package.json +1 -1
package/codegen/index.js
CHANGED
|
@@ -230,6 +230,7 @@ __export(index_exports, {
|
|
|
230
230
|
ONE_FUNCTIONS: () => ONE_FUNCTIONS,
|
|
231
231
|
ONE_FUNCTION_CATALOG: () => ONE_FUNCTION_CATALOG,
|
|
232
232
|
ONE_FUNCTION_DATA_PARAM: () => ONE_FUNCTION_DATA_PARAM,
|
|
233
|
+
ONE_FUNCTION_IDS_MAP_PARAM: () => ONE_FUNCTION_IDS_MAP_PARAM,
|
|
233
234
|
ONE_FUNCTION_IDS_PARAM: () => ONE_FUNCTION_IDS_PARAM,
|
|
234
235
|
ONE_FUNCTION_ID_PARAM: () => ONE_FUNCTION_ID_PARAM,
|
|
235
236
|
ONE_FUNCTION_KEY_PARAM: () => ONE_FUNCTION_KEY_PARAM,
|
|
@@ -618,6 +619,7 @@ __export(index_exports, {
|
|
|
618
619
|
customReadme: () => customReadme,
|
|
619
620
|
dataTypeFits: () => dataTypeFits,
|
|
620
621
|
dataTypeMismatch: () => dataTypeMismatch,
|
|
622
|
+
declaredPayload: () => declaredPayload,
|
|
621
623
|
declaresOutputs: () => declaresOutputs,
|
|
622
624
|
declaresShapeInput: () => declaresShapeInput,
|
|
623
625
|
decodeKeySource: () => decodeKeySource,
|
|
@@ -968,6 +970,7 @@ __export(index_exports, {
|
|
|
968
970
|
isNavInstanceFunction: () => isNavInstanceFunction,
|
|
969
971
|
isNavRowShape: () => isNavRowShape,
|
|
970
972
|
isNavVisibilityFunction: () => isNavVisibilityFunction,
|
|
973
|
+
isObjectRepeatSource: () => isObjectRepeatSource,
|
|
971
974
|
isOnChange: () => isOnChange,
|
|
972
975
|
isOneFunctionComputed: () => isOneFunctionComputed,
|
|
973
976
|
isOneFunctionStateComputed: () => isOneFunctionStateComputed,
|
|
@@ -992,6 +995,7 @@ __export(index_exports, {
|
|
|
992
995
|
isPathResolved: () => isPathResolved,
|
|
993
996
|
isPrimitiveType: () => isPrimitiveType,
|
|
994
997
|
isPureFunctionComplete: () => isPureFunctionComplete,
|
|
998
|
+
isReactionAutoCall: () => isReactionAutoCall,
|
|
995
999
|
isRedirectRoute: () => isRedirectRoute,
|
|
996
1000
|
isReferencedByRule: () => isReferencedByRule,
|
|
997
1001
|
isReleaseVersion: () => isReleaseVersion,
|
|
@@ -1138,6 +1142,7 @@ __export(index_exports, {
|
|
|
1138
1142
|
methodArms: () => methodArms,
|
|
1139
1143
|
methodConfirmKeys: () => methodConfirmKeys,
|
|
1140
1144
|
methodSignature: () => methodSignature,
|
|
1145
|
+
methodSpecShapes: () => methodSpecShapes,
|
|
1141
1146
|
methodUsage: () => methodUsage,
|
|
1142
1147
|
methodsPersist: () => methodsPersist,
|
|
1143
1148
|
migrateStored: () => migrateStored,
|
|
@@ -1207,6 +1212,7 @@ __export(index_exports, {
|
|
|
1207
1212
|
needsKey: () => needsKey,
|
|
1208
1213
|
needsValueTranslation: () => needsValueTranslation,
|
|
1209
1214
|
nestMenuItem: () => nestMenuItem,
|
|
1215
|
+
nestedOutcomeCalls: () => nestedOutcomeCalls,
|
|
1210
1216
|
newCardAliases: () => newCardAliases,
|
|
1211
1217
|
newComputedOption: () => newComputedOption,
|
|
1212
1218
|
newInstanceFunctionOption: () => newInstanceFunctionOption,
|
|
@@ -1235,6 +1241,7 @@ __export(index_exports, {
|
|
|
1235
1241
|
normalizeThemeName: () => normalizeThemeName,
|
|
1236
1242
|
normalizeTranslationKey: () => normalizeTranslationKey,
|
|
1237
1243
|
normalizeVariantName: () => normalizeVariantName,
|
|
1244
|
+
objectMemberShapeId: () => objectMemberShapeId,
|
|
1238
1245
|
offersOutputArms: () => offersOutputArms,
|
|
1239
1246
|
oneFunctionArgFits: () => oneFunctionArgFits,
|
|
1240
1247
|
oneFunctionBoundSignature: () => oneFunctionBoundSignature,
|
|
@@ -1250,6 +1257,7 @@ __export(index_exports, {
|
|
|
1250
1257
|
oneFunctionSiteFits: () => oneFunctionSiteFits,
|
|
1251
1258
|
oneParamFixedHeld: () => oneParamFixedHeld,
|
|
1252
1259
|
oneParamStatePathOnly: () => oneParamStatePathOnly,
|
|
1260
|
+
oneParamTakesAnyRow: () => oneParamTakesAnyRow,
|
|
1253
1261
|
oneParamTakesFixed: () => oneParamTakesFixed,
|
|
1254
1262
|
oneParamTypeText: () => oneParamTypeText,
|
|
1255
1263
|
openError: () => openError,
|
|
@@ -1276,6 +1284,7 @@ __export(index_exports, {
|
|
|
1276
1284
|
outcomeNavStatement: () => outcomeNavStatement,
|
|
1277
1285
|
outcomeReadsArgs: () => outcomeReadsArgs,
|
|
1278
1286
|
outcomeReport: () => outcomeReport,
|
|
1287
|
+
outcomeTransformArgFits: () => outcomeTransformArgFits,
|
|
1279
1288
|
outcomeTransformError: () => outcomeTransformError,
|
|
1280
1289
|
outcomeTransformFailure: () => outcomeTransformFailure,
|
|
1281
1290
|
outcomeTransformFunction: () => outcomeTransformFunction,
|
|
@@ -1530,6 +1539,7 @@ __export(index_exports, {
|
|
|
1530
1539
|
scaffoldFiles: () => scaffoldFiles,
|
|
1531
1540
|
scanForCode: () => scanForCode,
|
|
1532
1541
|
scannedOutputArms: () => scannedOutputArms,
|
|
1542
|
+
screenAutoCallDoesAnything: () => screenAutoCallDoesAnything,
|
|
1533
1543
|
screenAutoCallError: () => screenAutoCallError,
|
|
1534
1544
|
screenAutoCallWhen: () => screenAutoCallWhen,
|
|
1535
1545
|
screenComponentSite: () => screenComponentSite,
|
|
@@ -1803,9 +1813,12 @@ __export(index_exports, {
|
|
|
1803
1813
|
validationTest: () => validationTest,
|
|
1804
1814
|
valueSourceOf: () => valueSourceOf,
|
|
1805
1815
|
variableDrift: () => variableDrift,
|
|
1816
|
+
variantCheckCountable: () => variantCheckCountable,
|
|
1806
1817
|
variantCheckError: () => variantCheckError,
|
|
1807
1818
|
variantCheckId: () => variantCheckId,
|
|
1808
1819
|
variantCheckLeaf: () => variantCheckLeaf,
|
|
1820
|
+
variantCheckOperand: () => variantCheckOperand,
|
|
1821
|
+
variantCheckOperatorFits: () => variantCheckOperatorFits,
|
|
1809
1822
|
variantCheckOperators: () => variantCheckOperators,
|
|
1810
1823
|
variantCheckType: () => variantCheckType,
|
|
1811
1824
|
variantError: () => variantError,
|
|
@@ -1822,6 +1835,8 @@ __export(index_exports, {
|
|
|
1822
1835
|
variantsForCode: () => variantsForCode,
|
|
1823
1836
|
variantsForNewControl: () => variantsForNewControl,
|
|
1824
1837
|
variantsReferencing: () => variantsReferencing,
|
|
1838
|
+
watchFields: () => watchFields,
|
|
1839
|
+
watchKey: () => watchKey,
|
|
1825
1840
|
wcClassName: () => wcClassName,
|
|
1826
1841
|
wcSelector: () => wcSelector,
|
|
1827
1842
|
widgetDir: () => widgetDir,
|
|
@@ -1831,6 +1846,7 @@ __export(index_exports, {
|
|
|
1831
1846
|
withCallArgOptional: () => withCallArgOptional,
|
|
1832
1847
|
withCases: () => withCases,
|
|
1833
1848
|
withDefaultRow: () => withDefaultRow,
|
|
1849
|
+
withDerivedWatch: () => withDerivedWatch,
|
|
1834
1850
|
withEmittedTests: () => withEmittedTests,
|
|
1835
1851
|
withEventTransform: () => withEventTransform,
|
|
1836
1852
|
withFormShapes: () => withFormShapes,
|
|
@@ -1943,15 +1959,16 @@ var isLinkedKeySource = (source) => source.source === "input" || source.source =
|
|
|
1943
1959
|
var isLinkedFormModel = (model) => Object.values(model.keys).some(isLinkedKeySource);
|
|
1944
1960
|
var screenAutoCallWhen = (call) => call.when ?? (call.args.some((row) => row.source === "input") || (call.emits ?? []).some(isMovingScreenEmit) || !!call.reads?.length ? "on-change" : "once");
|
|
1945
1961
|
var isMovingScreenEmit = (emit) => emit.value?.kind === "input" || emit.value?.kind === "binding";
|
|
1962
|
+
var screenAutoCallDoesAnything = (call) => !!call.methodId || !!call.emits?.length || !!call.writes?.length || !!call.screenWrites?.length || !!call.screenMethodId;
|
|
1946
1963
|
var screenAutoCallError = (call) => {
|
|
1947
|
-
if (!call
|
|
1964
|
+
if (!screenAutoCallDoesAnything(call)) return "auto-call-empty";
|
|
1948
1965
|
if (screenAutoCallWhen(call) !== "on-change") return void 0;
|
|
1949
1966
|
return call.args.some(
|
|
1950
1967
|
(row) => row.source === "input" || row.source === "binding"
|
|
1951
1968
|
) || (call.emits ?? []).some(isMovingScreenEmit) || !!call.reads?.length ? void 0 : "auto-call-never-fires";
|
|
1952
1969
|
};
|
|
1953
1970
|
var isOutputSelfEmit = (call) => {
|
|
1954
|
-
if (call.methodId || call.reads?.length || call.emits?.length !== 1)
|
|
1971
|
+
if (call.methodId || call.reads?.length || call.emits?.length !== 1 || call.writes?.length || call.screenWrites?.length || call.screenMethodId)
|
|
1955
1972
|
return false;
|
|
1956
1973
|
if (!call.emits[0].value) return false;
|
|
1957
1974
|
const { when: _drop, ...derived } = call;
|
|
@@ -1973,6 +1990,30 @@ var withOutputSelfEmit = (calls, outputId, value, mintId) => {
|
|
|
1973
1990
|
}
|
|
1974
1991
|
];
|
|
1975
1992
|
};
|
|
1993
|
+
var withDerivedWatch = (calls, inputs = {}) => calls.map((call) => {
|
|
1994
|
+
if (screenAutoCallWhen(call) !== "on-change" || isOutputSelfEmit(call))
|
|
1995
|
+
return call;
|
|
1996
|
+
const inputRead = (id) => id ? { root: { kind: "input", id }, path: [] } : void 0;
|
|
1997
|
+
const derived = [
|
|
1998
|
+
...call.args.map(
|
|
1999
|
+
(row) => row.source === "input" ? inputRead(
|
|
2000
|
+
Object.values(inputs).find((one) => one.name === row.input)?.id
|
|
2001
|
+
) : row.source === "binding" ? row.binding : void 0
|
|
2002
|
+
),
|
|
2003
|
+
...(call.emits ?? []).map(
|
|
2004
|
+
(emit) => emit.value?.kind === "input" ? inputRead(emit.value.inputId) : emit.value?.kind === "binding" ? emit.value.binding : void 0
|
|
2005
|
+
)
|
|
2006
|
+
];
|
|
2007
|
+
const reads = [...call.reads ?? []];
|
|
2008
|
+
const seen = new Set(reads.map((read) => JSON.stringify(read)));
|
|
2009
|
+
for (const read of derived) {
|
|
2010
|
+
if (!read || seen.has(JSON.stringify(read))) continue;
|
|
2011
|
+
seen.add(JSON.stringify(read));
|
|
2012
|
+
reads.push(read);
|
|
2013
|
+
}
|
|
2014
|
+
return reads.length === (call.reads ?? []).length ? call : { ...call, reads };
|
|
2015
|
+
});
|
|
2016
|
+
var isReactionAutoCall = (call) => !!call.reads?.length || !!call.writes?.length || !!call.screenWrites?.length || !!call.screenMethodId;
|
|
1976
2017
|
var splitAutoCallEmits = (calls, inputs = {}) => {
|
|
1977
2018
|
const result = [];
|
|
1978
2019
|
const selfFired = /* @__PURE__ */ new Set();
|
|
@@ -1986,7 +2027,7 @@ var splitAutoCallEmits = (calls, inputs = {}) => {
|
|
|
1986
2027
|
};
|
|
1987
2028
|
for (const call of calls) {
|
|
1988
2029
|
const emits = call.emits ?? [];
|
|
1989
|
-
if (!emits.length || !call.methodId && emits.length === 1) {
|
|
2030
|
+
if (!emits.length || !call.methodId && emits.length === 1 || isReactionAutoCall(call)) {
|
|
1990
2031
|
push(call);
|
|
1991
2032
|
continue;
|
|
1992
2033
|
}
|
|
@@ -5255,6 +5296,7 @@ var screenMethodCalls = (method) => method ? [
|
|
|
5255
5296
|
// libs/codegen/src/model/one-function-catalog.ts
|
|
5256
5297
|
var ONE_FUNCTION_ID_PARAM = "id";
|
|
5257
5298
|
var ONE_FUNCTION_IDS_PARAM = "ids";
|
|
5299
|
+
var ONE_FUNCTION_IDS_MAP_PARAM = "idsMap";
|
|
5258
5300
|
var ONE_FUNCTION_MAP_PARAM = "map";
|
|
5259
5301
|
var ONE_FUNCTION_DATA_PARAM = "data";
|
|
5260
5302
|
var ONE_FUNCTION_KEY_PARAM = "key";
|
|
@@ -5295,6 +5337,25 @@ var ONE_FUNCTION_SPECS = {
|
|
|
5295
5337
|
],
|
|
5296
5338
|
returns: { type: "T", cardinality: "many", liftsTo: "many" }
|
|
5297
5339
|
},
|
|
5340
|
+
// `getManyViaMap<T>(id, idsMap: Record<string, string[]>, map:
|
|
5341
|
+
// Record<string, T>): T[]` — `getManyFromMaps` over the ids `idsMap` lists
|
|
5342
|
+
// under one id: a strategy's holding ids, then each holding. Over a
|
|
5343
|
+
// `map-many` its return stays `many`, every id's list joined, as
|
|
5344
|
+
// `getManyFromMaps`' does.
|
|
5345
|
+
getManyViaMap: {
|
|
5346
|
+
params: [
|
|
5347
|
+
ID,
|
|
5348
|
+
{
|
|
5349
|
+
id: ONE_FUNCTION_IDS_MAP_PARAM,
|
|
5350
|
+
name: "idsMap",
|
|
5351
|
+
type: "string",
|
|
5352
|
+
cardinality: "map-many",
|
|
5353
|
+
statePathOnly: true
|
|
5354
|
+
},
|
|
5355
|
+
MAP
|
|
5356
|
+
],
|
|
5357
|
+
returns: { type: "T", cardinality: "many", liftsTo: "many" }
|
|
5358
|
+
},
|
|
5298
5359
|
// `existsInMap(id, map: Record<string, unknown>): boolean` — whether a
|
|
5299
5360
|
// `map` holds anything under an id (ADR 0202). `false` rather than
|
|
5300
5361
|
// `undefined` while either is, so a gate on an unloaded store reads "not
|
|
@@ -5386,6 +5447,57 @@ var ONE_FUNCTION_SPECS = {
|
|
|
5386
5447
|
returns: { type: "T", cardinality: "map-many" },
|
|
5387
5448
|
narrowTo: ["outcome-transform"]
|
|
5388
5449
|
},
|
|
5450
|
+
// `extendMap<T>(data: T[], key: keyof T, map: Record<string, T>):
|
|
5451
|
+
// Record<string, T>` — a flat list of rows landed into a `map`, each row
|
|
5452
|
+
// held under its `key` member: `loadCoins()` answers a list, each row
|
|
5453
|
+
// naming itself in `id`. A row the map already holds is extended — its
|
|
5454
|
+
// members merged over the held row's — and every other entry is kept. The
|
|
5455
|
+
// key is picked from the row's `string` / `number` members.
|
|
5456
|
+
extendMap: {
|
|
5457
|
+
params: [
|
|
5458
|
+
{
|
|
5459
|
+
id: ONE_FUNCTION_DATA_PARAM,
|
|
5460
|
+
name: "data",
|
|
5461
|
+
type: "T",
|
|
5462
|
+
cardinality: "many"
|
|
5463
|
+
},
|
|
5464
|
+
{
|
|
5465
|
+
id: ONE_FUNCTION_KEY_PARAM,
|
|
5466
|
+
name: "key",
|
|
5467
|
+
type: "string",
|
|
5468
|
+
cardinality: "one"
|
|
5469
|
+
},
|
|
5470
|
+
MAP
|
|
5471
|
+
],
|
|
5472
|
+
returns: { type: "T", cardinality: "map" },
|
|
5473
|
+
narrowTo: ["outcome-transform"]
|
|
5474
|
+
},
|
|
5475
|
+
// `setPluckedInMap<T>(id, data: T[], key: string, map: Record<string,
|
|
5476
|
+
// string[]>): Record<string, string[]>` — the `key` member of each row of
|
|
5477
|
+
// one id's list landed as that id's list of ids: `loadHoldings(sid)`
|
|
5478
|
+
// answers a strategy's holdings, `holdingIdsById[sid]` takes their ids.
|
|
5479
|
+
// The list under `id` is replaced, every other entry kept. The key is
|
|
5480
|
+
// picked from the row's `string` / `number` members like `extendMap`'s.
|
|
5481
|
+
setPluckedInMap: {
|
|
5482
|
+
params: [
|
|
5483
|
+
ID,
|
|
5484
|
+
{
|
|
5485
|
+
id: ONE_FUNCTION_DATA_PARAM,
|
|
5486
|
+
name: "data",
|
|
5487
|
+
type: "T",
|
|
5488
|
+
cardinality: "many"
|
|
5489
|
+
},
|
|
5490
|
+
{
|
|
5491
|
+
id: ONE_FUNCTION_KEY_PARAM,
|
|
5492
|
+
name: "key",
|
|
5493
|
+
type: "string",
|
|
5494
|
+
cardinality: "one"
|
|
5495
|
+
},
|
|
5496
|
+
{ ...MAP, type: "string", cardinality: "map-many" }
|
|
5497
|
+
],
|
|
5498
|
+
returns: { type: "string", cardinality: "map-many" },
|
|
5499
|
+
narrowTo: ["outcome-transform"]
|
|
5500
|
+
},
|
|
5389
5501
|
// `pluckStrings<T>(items: T[], key: string): string[]` — the `string`
|
|
5390
5502
|
// values one member of each row holds, in row order: the ids of a list a
|
|
5391
5503
|
// later lookup reads by. `key` is typed in like `mapMany`'s, prefilled with
|
|
@@ -5448,7 +5560,9 @@ var lifts = (spec) => slots(spec).some((slot) => slot.type === "T") && slots(spe
|
|
|
5448
5560
|
var liftOf = (slot) => slot.liftsTo ?? LIFT[slot.cardinality];
|
|
5449
5561
|
var liftedCardinality = (slot, lifted) => lifted && slot.type === "T" ? liftOf(slot) ?? slot.cardinality : slot.cardinality;
|
|
5450
5562
|
var slotDataType = (slot, row) => slot.type === "T" ? row : { type: slot.type };
|
|
5451
|
-
var oneFunctionSiteFits = (spec, reach) => reach === "call-condition" ? spec.returns.type === "boolean" && spec.returns.cardinality === "one" : reach === "outcome-transform" ? spec.returns.type === "T"
|
|
5563
|
+
var oneFunctionSiteFits = (spec, reach) => reach === "call-condition" ? spec.returns.type === "boolean" && spec.returns.cardinality === "one" : reach === "outcome-transform" ? spec.returns.type === "T" || (spec.returns.cardinality === "many" || spec.returns.cardinality === "map-many") && spec.params.some(
|
|
5564
|
+
(param) => param.type === "T" && param.cardinality === "many"
|
|
5565
|
+
) : true;
|
|
5452
5566
|
var REACHES = [
|
|
5453
5567
|
"screen-computed",
|
|
5454
5568
|
"state-computed",
|
|
@@ -5519,7 +5633,8 @@ var liftedBy = (entry2, paramId, cardinality) => {
|
|
|
5519
5633
|
return !!param?.liftsTo && cardinality === param.liftsTo;
|
|
5520
5634
|
};
|
|
5521
5635
|
var oneFunctionLiftedAt = (entry2, cardinality) => entry2.returnsRow && !!entry2.params.some((param) => param.liftsTo) && cardinality !== entry2.returns.cardinality && cardinality === liftOf(entry2.returns);
|
|
5522
|
-
var oneFunctionFitsLanding = (entry2,
|
|
5636
|
+
var oneFunctionFitsLanding = (entry2, landing) => entry2.returnsRow ? landing.cardinality === entry2.returns.cardinality || oneFunctionLiftedAt(entry2, landing.cardinality) : landing.dataType?.type === entry2.returns.type && landing.cardinality === entry2.returns.cardinality;
|
|
5637
|
+
var oneParamTakesAnyRow = (entry2, param) => !entry2.returnsRow && param.type === "T";
|
|
5523
5638
|
var oneFunctionMintsKey = (entry2) => entry2.returnsRow && (entry2.returns.cardinality === "map" || entry2.returns.cardinality === "map-many");
|
|
5524
5639
|
function oneFunctionReturns(entry2, row, heldCardinality) {
|
|
5525
5640
|
const signature = entry2.signature(
|
|
@@ -6892,6 +7007,13 @@ function outcomeTransformFunction(transform, landing, functions) {
|
|
|
6892
7007
|
cardinality: landing.cardinality
|
|
6893
7008
|
});
|
|
6894
7009
|
}
|
|
7010
|
+
function outcomeTransformArgFits(transform, index, held, heldShapes, param, shapes) {
|
|
7011
|
+
const one = outcomeTransformOneFunction(transform);
|
|
7012
|
+
const slot = one?.params[index];
|
|
7013
|
+
if (one && slot && oneParamTakesAnyRow(one, slot))
|
|
7014
|
+
return !!held.dataType && held.cardinality === param.cardinality;
|
|
7015
|
+
return dataTypeFits(held, heldShapes, param, shapes);
|
|
7016
|
+
}
|
|
6895
7017
|
var statePathValue = (path, roots, shapes) => {
|
|
6896
7018
|
const [propertyId, ...keys] = path;
|
|
6897
7019
|
const property = roots[propertyId];
|
|
@@ -7045,7 +7167,9 @@ function outcomeTransformFailure(mapping, method, op, properties, shapes, functi
|
|
|
7045
7167
|
detail: `${label} \u2014 ${bindingLabel(binding)}`
|
|
7046
7168
|
};
|
|
7047
7169
|
}
|
|
7048
|
-
if (!
|
|
7170
|
+
if (!outcomeTransformArgFits(
|
|
7171
|
+
transform,
|
|
7172
|
+
index,
|
|
7049
7173
|
source.value,
|
|
7050
7174
|
source.shapes,
|
|
7051
7175
|
{ dataType: param.dataType, cardinality: param.cardinality },
|
|
@@ -8049,6 +8173,39 @@ var bindingPathKey = (binding) => {
|
|
|
8049
8173
|
const head = root.kind === "alias" ? `alias:${root.repeatId}:${root.alias}` : root.kind === "auth" ? `${root.kind}:${root.property}` : root.kind === "none" ? root.kind : `${root.kind}:${root.id}`;
|
|
8050
8174
|
return binding.path.length ? `${head}.${binding.path.join(".")}` : head;
|
|
8051
8175
|
};
|
|
8176
|
+
var watchKey = (binding, scope) => {
|
|
8177
|
+
if (binding.path.length || binding.transform) return void 0;
|
|
8178
|
+
const root = binding.root;
|
|
8179
|
+
if (root.kind === "input") return scope.inputs?.[root.id]?.name;
|
|
8180
|
+
if (root.kind === "screen_computed")
|
|
8181
|
+
return scope.screenComputeds?.[root.id]?.name;
|
|
8182
|
+
if (root.kind === "screen_variable") return scope.variables?.[root.id]?.name;
|
|
8183
|
+
if (root.kind === "property" || root.kind === "computed")
|
|
8184
|
+
return scope.properties?.[root.id]?.name;
|
|
8185
|
+
return void 0;
|
|
8186
|
+
};
|
|
8187
|
+
var watchFields = (reads, scope) => {
|
|
8188
|
+
const keys = [];
|
|
8189
|
+
const fields = {};
|
|
8190
|
+
for (const binding of reads ?? []) {
|
|
8191
|
+
const key2 = watchKey(binding, scope);
|
|
8192
|
+
if (!key2 || keys.includes(key2)) continue;
|
|
8193
|
+
keys.push(key2);
|
|
8194
|
+
const root = binding.root;
|
|
8195
|
+
const held = root.kind === "input" ? scope.inputs?.[root.id] : root.kind === "property" ? scope.properties?.[root.id] : void 0;
|
|
8196
|
+
if (held) {
|
|
8197
|
+
fields[key2] = { dataType: held.dataType, cardinality: held.cardinality };
|
|
8198
|
+
} else if (root.kind === "screen_variable") {
|
|
8199
|
+
const variable = scope.variables?.[root.id];
|
|
8200
|
+
if (variable)
|
|
8201
|
+
fields[key2] = {
|
|
8202
|
+
dataType: screenVariableDataType(variable),
|
|
8203
|
+
cardinality: variable.cardinality
|
|
8204
|
+
};
|
|
8205
|
+
}
|
|
8206
|
+
}
|
|
8207
|
+
return { keys, fields };
|
|
8208
|
+
};
|
|
8052
8209
|
|
|
8053
8210
|
// libs/codegen/src/model/global-rule-catalog.ts
|
|
8054
8211
|
var GLOBAL_RULE_STORES = {
|
|
@@ -9050,6 +9207,12 @@ var rootShapeId = (binding, scope, seen) => {
|
|
|
9050
9207
|
seen.add(root.repeatId);
|
|
9051
9208
|
const holder = scope.controlMap?.[root.repeatId];
|
|
9052
9209
|
const source = holder?.bindings?.[aliasSourceSlot(holder)];
|
|
9210
|
+
if (source && holder?.type === "repeat" /* REPEAT */ && isObjectRepeatSource(source, scope, seen)) {
|
|
9211
|
+
return objectMemberShapeId(
|
|
9212
|
+
bindingShapeId(source, scope, seen),
|
|
9213
|
+
shapesOf(scope)
|
|
9214
|
+
);
|
|
9215
|
+
}
|
|
9053
9216
|
if (source) return bindingShapeId(source, scope, seen);
|
|
9054
9217
|
return holder?.type === "list" /* LIST */ && toListItemRows(holder.configs?.[LIST_ITEMS_KEY]).length ? LIST_ROW_SHAPE_ID : void 0;
|
|
9055
9218
|
}
|
|
@@ -9195,8 +9358,19 @@ var bindingCardinality = (binding, scope, seen = /* @__PURE__ */ new Set()) => {
|
|
|
9195
9358
|
var isKeyedRepeat = (control, scope) => {
|
|
9196
9359
|
if (control.type !== "repeat" /* REPEAT */) return false;
|
|
9197
9360
|
const source = control.bindings?.[BINDING_SLOT.source];
|
|
9198
|
-
|
|
9199
|
-
|
|
9361
|
+
if (!source) return false;
|
|
9362
|
+
return isMapCardinality(bindingCardinality(source, scope)) || isObjectRepeatSource(source, scope);
|
|
9363
|
+
};
|
|
9364
|
+
var objectMemberShapeId = (shapeId, shapes) => {
|
|
9365
|
+
const keys = shapeId ? shapes[shapeId]?.keys : void 0;
|
|
9366
|
+
if (!keys?.length) return void 0;
|
|
9367
|
+
const first = keys[0].dataType;
|
|
9368
|
+
const memberShapeId = first?.type === "shape" ? first.shapeId : void 0;
|
|
9369
|
+
return memberShapeId && keys.every(
|
|
9370
|
+
(key2) => key2.cardinality === "one" && key2.dataType?.type === "shape" && key2.dataType.shapeId === memberShapeId
|
|
9371
|
+
) ? memberShapeId : void 0;
|
|
9372
|
+
};
|
|
9373
|
+
var isObjectRepeatSource = (source, scope, seen = /* @__PURE__ */ new Set()) => bindingCardinality(source, scope, new Set(seen)) === "one" && !!bindingShapeId(source, scope, new Set(seen));
|
|
9200
9374
|
var aliasDisplayName = (repeatId, alias, scope) => {
|
|
9201
9375
|
const holder = scope.controlMap?.[repeatId];
|
|
9202
9376
|
const spec = aliasNames(holder);
|
|
@@ -9655,6 +9829,9 @@ var holderRowShapeId = (holder, scope, seen = /* @__PURE__ */ new Set()) => {
|
|
|
9655
9829
|
scope,
|
|
9656
9830
|
holder ? /* @__PURE__ */ new Set([...seen, holder.id]) : seen
|
|
9657
9831
|
);
|
|
9832
|
+
if (holder && isObjectRepeat(holder, scope)) {
|
|
9833
|
+
return objectMemberShapeId(shapeId, scope.shapes);
|
|
9834
|
+
}
|
|
9658
9835
|
if (shapeId) return shapeId;
|
|
9659
9836
|
return holder?.type === "list" /* LIST */ && toListItemRows(holder.configs?.[LIST_ITEMS_KEY]).length ? LIST_ROW_SHAPE_ID : void 0;
|
|
9660
9837
|
};
|
|
@@ -9668,6 +9845,10 @@ var asBindingScope = (scope) => ({
|
|
|
9668
9845
|
functions: scope.functions,
|
|
9669
9846
|
controlMap: scope.controlMap
|
|
9670
9847
|
});
|
|
9848
|
+
var isObjectRepeat = (holder, scope) => {
|
|
9849
|
+
const source = holder.bindings?.[aliasSourceSlot(holder)];
|
|
9850
|
+
return holder.type === "repeat" /* REPEAT */ && !!source && isObjectRepeatSource(source, asBindingScope(scope));
|
|
9851
|
+
};
|
|
9671
9852
|
var holderSourceCardinality = (holder, scope) => {
|
|
9672
9853
|
const source = holder.bindings?.[aliasSourceSlot(holder)];
|
|
9673
9854
|
return source ? bindingCardinality(source, asBindingScope(scope)) : void 0;
|
|
@@ -9680,7 +9861,7 @@ var aliasRoots = (scope) => {
|
|
|
9680
9861
|
const spec = aliasNames(holder);
|
|
9681
9862
|
const rowShapeId = holderRowShapeId(holder, scope);
|
|
9682
9863
|
const sourceCardinality = holder.type === "repeat" /* REPEAT */ ? holderSourceCardinality(holder, scope) : void 0;
|
|
9683
|
-
const keyed = sourceCardinality === "map" || sourceCardinality === "map-many";
|
|
9864
|
+
const keyed = sourceCardinality === "map" || sourceCardinality === "map-many" || isObjectRepeat(holder, scope);
|
|
9684
9865
|
return [
|
|
9685
9866
|
{
|
|
9686
9867
|
root: {
|
|
@@ -13904,7 +14085,15 @@ function shapeMemberDiff(spec, specShapes, twin, shapes) {
|
|
|
13904
14085
|
continue;
|
|
13905
14086
|
}
|
|
13906
14087
|
const ours = typeLabel(mine.dataType, mine.cardinality, shapes);
|
|
13907
|
-
|
|
14088
|
+
const sameNestedShape = mine.dataType?.type === "shape" && key2.dataType?.type === "shape" && mine.cardinality === key2.cardinality && dataTypeFits(
|
|
14089
|
+
mine,
|
|
14090
|
+
shapes,
|
|
14091
|
+
key2,
|
|
14092
|
+
specShapes
|
|
14093
|
+
) && dataTypeFits(key2, specShapes, mine, shapes);
|
|
14094
|
+
if (!sameNestedShape && ours !== theirs) {
|
|
14095
|
+
details.push(`${key2.name}: ${ours} \u2192 ${theirs}`);
|
|
14096
|
+
}
|
|
13908
14097
|
}
|
|
13909
14098
|
const answered = new Set(spec.keys.map((key2) => key2.name));
|
|
13910
14099
|
for (const key2 of twin.keys) {
|
|
@@ -14044,7 +14233,7 @@ function importShapes(dataType, from, existing, mintId, overwriteExisting = fals
|
|
|
14044
14233
|
])
|
|
14045
14234
|
);
|
|
14046
14235
|
const pool = () => ({ ...reachable, ...shapes });
|
|
14047
|
-
const importOne = (shapeId, held) => {
|
|
14236
|
+
const importOne = (shapeId, held, parentId) => {
|
|
14048
14237
|
if (reachable[shapeId] && from[shapeId] === reachable[shapeId]) {
|
|
14049
14238
|
return shapeId;
|
|
14050
14239
|
}
|
|
@@ -14078,9 +14267,16 @@ function importShapes(dataType, from, existing, mintId, overwriteExisting = fals
|
|
|
14078
14267
|
)?.id;
|
|
14079
14268
|
const kept = overwriteExisting && held && candidates[held] ? held : void 0;
|
|
14080
14269
|
const reused = byOrigin ?? kept ?? structural ?? named;
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14270
|
+
const copiedForOtherParent = overwriteExisting && !!held && !!parentId && Object.values(candidates).some(
|
|
14271
|
+
(parent) => parent.id !== parentId && parent.keys.some(
|
|
14272
|
+
(key2) => key2.dataType?.type === "shape" && key2.dataType.shapeId === held
|
|
14273
|
+
)
|
|
14274
|
+
);
|
|
14275
|
+
if (!copiedForOtherParent && reused && (!overwriteExisting || reachable[reused])) {
|
|
14276
|
+
return reused;
|
|
14277
|
+
}
|
|
14278
|
+
const id2 = copiedForOtherParent ? mintId() : reused ?? mintId();
|
|
14279
|
+
const heldKeys = overwriteExisting && held ? shapes[held]?.keys ?? [] : shapes[id2]?.keys ?? [];
|
|
14084
14280
|
byName.set(source.name, id2);
|
|
14085
14281
|
const shape = {
|
|
14086
14282
|
id: id2,
|
|
@@ -14100,7 +14296,8 @@ function importShapes(dataType, from, existing, mintId, overwriteExisting = fals
|
|
|
14100
14296
|
const heldKey = heldKeys.find((k) => k.name === key2.name);
|
|
14101
14297
|
const nested = importOne(
|
|
14102
14298
|
key2.dataType.shapeId,
|
|
14103
|
-
heldKey?.dataType.type === "shape" ? heldKey.dataType.shapeId : void 0
|
|
14299
|
+
heldKey?.dataType.type === "shape" ? heldKey.dataType.shapeId : void 0,
|
|
14300
|
+
id2
|
|
14104
14301
|
);
|
|
14105
14302
|
if (!nested) continue;
|
|
14106
14303
|
shape.keys.push({
|
|
@@ -15835,21 +16032,44 @@ function variantCheckType(check, method, op, roots, shapes, functions) {
|
|
|
15835
16032
|
);
|
|
15836
16033
|
return inferred.ok ? inferred.type : void 0;
|
|
15837
16034
|
}
|
|
16035
|
+
var PRIMITIVES2 = ["string", "number", "boolean"];
|
|
15838
16036
|
function variantCheckLeaf(type) {
|
|
15839
16037
|
if (!type || type.cardinality !== "one") return void 0;
|
|
15840
16038
|
return type.dataType.type === "shape" ? void 0 : type.dataType.type;
|
|
15841
16039
|
}
|
|
15842
|
-
var
|
|
16040
|
+
var variantCheckCountable = (type) => type?.cardinality === "many";
|
|
16041
|
+
var LIST_OPERATORS = ["contains", "not_contains"];
|
|
16042
|
+
var variantCheckOperators = (type, count = false) => {
|
|
16043
|
+
if (count && variantCheckCountable(type)) return operatorsFor(void 0, true);
|
|
16044
|
+
if (type?.cardinality === "many") {
|
|
16045
|
+
const unary = operatorsFor(void 0, false, true);
|
|
16046
|
+
return PRIMITIVES2.includes(type.dataType.type) ? [...LIST_OPERATORS, ...unary] : unary;
|
|
16047
|
+
}
|
|
16048
|
+
return operatorsFor(variantCheckLeaf(type), false, !!type);
|
|
16049
|
+
};
|
|
16050
|
+
var variantCheckOperand = (type, count = false) => {
|
|
16051
|
+
if (!type) return void 0;
|
|
16052
|
+
if (count && variantCheckCountable(type)) {
|
|
16053
|
+
return { dataType: { type: "number" }, cardinality: "one" };
|
|
16054
|
+
}
|
|
16055
|
+
return type.cardinality === "many" ? { ...type, cardinality: "one" } : type;
|
|
16056
|
+
};
|
|
16057
|
+
var variantCheckOperatorFits = (check, type) => (!check.count || variantCheckCountable(type)) && variantCheckOperators(type, !!check.count).includes(check.operator);
|
|
15843
16058
|
function variantCheckError(check, method, op, roots, shapes, functions) {
|
|
15844
16059
|
const unsourced = check.source === "store" && !check.path?.length || check.source === "args" && !check.arg || check.source === "compute" && !check.compute || check.source === "response" && !check.code;
|
|
15845
16060
|
if (unsourced) return "variant-check-no-source";
|
|
15846
16061
|
const type = variantCheckType(check, method, op, roots, shapes, functions);
|
|
15847
16062
|
if (!type) return "variant-check-bad-transform";
|
|
15848
|
-
if (!
|
|
16063
|
+
if (!variantCheckOperatorFits(check, type)) {
|
|
15849
16064
|
return "variant-check-bad-operator";
|
|
15850
16065
|
}
|
|
15851
16066
|
if (isUnaryOperator(check.operator)) return void 0;
|
|
15852
|
-
|
|
16067
|
+
const operand = variantCheckOperand(type, check.count) ?? type;
|
|
16068
|
+
return validateLiteral(
|
|
16069
|
+
check.value ?? "",
|
|
16070
|
+
operand.dataType,
|
|
16071
|
+
operand.cardinality
|
|
16072
|
+
);
|
|
15853
16073
|
}
|
|
15854
16074
|
function variantError(variant, method, op, roots, shapes, functions) {
|
|
15855
16075
|
if (variantNameError(method, variant.name, variant.id)) {
|
|
@@ -15872,13 +16092,18 @@ function landsUnconditionally(mapping) {
|
|
|
15872
16092
|
return !mapping.landsWhen;
|
|
15873
16093
|
}
|
|
15874
16094
|
function generateVariantCheckExpression(check, subject, type, optional = false) {
|
|
15875
|
-
|
|
16095
|
+
const counted = !!check.count && variantCheckCountable(type);
|
|
16096
|
+
if (isUnaryOperator(check.operator) && !counted) {
|
|
15876
16097
|
return comparisonSource(subject, check.operator, "");
|
|
15877
16098
|
}
|
|
16099
|
+
const left = counted ? optional ? `(${subject}?.length ?? 0)` : `${subject}.length` : !optional ? subject : type?.cardinality === "many" ? `(${subject} ?? [])` : guardOptional(subject, check.operator);
|
|
15878
16100
|
return comparisonSource(
|
|
15879
|
-
|
|
16101
|
+
left,
|
|
15880
16102
|
check.operator,
|
|
15881
|
-
literalExpression(
|
|
16103
|
+
literalExpression(
|
|
16104
|
+
check.value ?? "",
|
|
16105
|
+
operandDataType(variantCheckOperand(type, check.count))
|
|
16106
|
+
)
|
|
15882
16107
|
);
|
|
15883
16108
|
}
|
|
15884
16109
|
var operandDataType = (type) => type && type.dataType.type !== "shape" ? type.dataType : { type: "string" };
|
|
@@ -15934,11 +16159,16 @@ function checkError2(check, args, properties, shapes, computes, functions) {
|
|
|
15934
16159
|
functions
|
|
15935
16160
|
);
|
|
15936
16161
|
if (!type) return "condition-check-subject";
|
|
15937
|
-
if (!
|
|
16162
|
+
if (!variantCheckOperatorFits(check, type)) {
|
|
15938
16163
|
return "condition-check-operator";
|
|
15939
16164
|
}
|
|
15940
16165
|
if (isUnaryOperator(check.operator)) return void 0;
|
|
15941
|
-
|
|
16166
|
+
const operand = variantCheckOperand(type, check.count) ?? type;
|
|
16167
|
+
return validateLiteral(
|
|
16168
|
+
check.value ?? "",
|
|
16169
|
+
operand.dataType,
|
|
16170
|
+
operand.cardinality
|
|
16171
|
+
) ? "condition-check-value" : void 0;
|
|
15942
16172
|
}
|
|
15943
16173
|
function conditionError(condition, args, functions, properties, shapes, computes = []) {
|
|
15944
16174
|
const valueOf = (binding) => conditionArgValue(binding, args, properties, shapes, computes, functions);
|
|
@@ -16438,9 +16668,18 @@ function formResetRows(outcomes, key2, arm) {
|
|
|
16438
16668
|
function hasCallOutcome(outcome) {
|
|
16439
16669
|
return OUTCOME_ARMS.some((arm) => armHasRows(outcome?.[arm]));
|
|
16440
16670
|
}
|
|
16671
|
+
function nestedOutcomeCalls(outcome) {
|
|
16672
|
+
return OUTCOME_ARMS.flatMap(
|
|
16673
|
+
(arm) => (outcome?.[arm]?.calls ?? []).flatMap(
|
|
16674
|
+
(call) => OUTCOME_ARMS.flatMap(
|
|
16675
|
+
(inner) => (call.outcome?.[inner]?.calls ?? []).map((nested) => nested.id)
|
|
16676
|
+
)
|
|
16677
|
+
)
|
|
16678
|
+
);
|
|
16679
|
+
}
|
|
16441
16680
|
function armHasRows(arm) {
|
|
16442
16681
|
return !!(arm?.writes?.length || arm?.screenWrites?.length || // An arm that only tells the host something happened is an arm (ADR 0143).
|
|
16443
|
-
arm?.emits?.length || arm?.formResets?.length || arm?.closesOverlay || arm?.nav || isOutcomeReportDrawn(arm?.report) || arm?.dialog);
|
|
16682
|
+
arm?.emits?.length || arm?.formResets?.length || arm?.closesOverlay || arm?.nav || isOutcomeReportDrawn(arm?.report) || arm?.dialog || arm?.calls?.some((call) => !!call.methodId || !!call.screenMethodId));
|
|
16444
16683
|
}
|
|
16445
16684
|
function denialDialogOf(arm) {
|
|
16446
16685
|
const dialog = arm?.dialog;
|
|
@@ -17226,7 +17465,7 @@ function patchLiteral(mappings, properties, shapes, functions, subject, cast = f
|
|
|
17226
17465
|
);
|
|
17227
17466
|
if (!fn) return void 0;
|
|
17228
17467
|
const one = oneFunctionOf(mapping.transform.oneFunction);
|
|
17229
|
-
const typeArgs = one && !one.spell ? `<${spell(
|
|
17468
|
+
const typeArgs = one && !one.spell && one.returnsRow ? `<${spell(
|
|
17230
17469
|
property.dataType,
|
|
17231
17470
|
oneFunctionLiftedAt(one, property.cardinality) ? "many" : "one"
|
|
17232
17471
|
)}>` : "";
|
|
@@ -17561,9 +17800,43 @@ function emissionLookup(list, operationOf, shapes) {
|
|
|
17561
17800
|
function emissionShapeLookup(methods, operationOf, shapes) {
|
|
17562
17801
|
return emissionLookup(Object.values(methods), operationOf, shapes);
|
|
17563
17802
|
}
|
|
17803
|
+
function methodSpecShapes(methods, operationOf, shapes) {
|
|
17804
|
+
const ops = Object.values(methods).filter((method) => !isCacheMethod(method)).map(operationOf).filter((op) => !!op);
|
|
17805
|
+
const taken = new Set(
|
|
17806
|
+
Object.values(shapes).map((shape) => shapeInterfaceName(shape.name))
|
|
17807
|
+
);
|
|
17808
|
+
const from = specShapeMap(ops);
|
|
17809
|
+
const offered = {};
|
|
17810
|
+
for (const shape of Object.values(from)) {
|
|
17811
|
+
const name3 = shapeInterfaceName(shape.name);
|
|
17812
|
+
if (taken.has(name3)) continue;
|
|
17813
|
+
taken.add(name3);
|
|
17814
|
+
offered[shape.id] = shape;
|
|
17815
|
+
}
|
|
17816
|
+
return { offered, from };
|
|
17817
|
+
}
|
|
17564
17818
|
function partitionReferencedShapes(roots, lookup, shapes) {
|
|
17565
17819
|
return partitionShapes(roots, lookup, shapes, false);
|
|
17566
17820
|
}
|
|
17821
|
+
function declaredPayload(dataType, cardinality, specShapes, shapes) {
|
|
17822
|
+
const lookup = { ...specShapes, ...shapes };
|
|
17823
|
+
const head = `// ${tsTypeExpression(lookup, dataType, cardinality)}`;
|
|
17824
|
+
if (dataType?.type !== "shape") return head;
|
|
17825
|
+
const { drawn, spec } = partitionShapes([dataType.shapeId], lookup, shapes);
|
|
17826
|
+
const drawnIds = reachableShapes(
|
|
17827
|
+
drawn.map((shape) => shape.id),
|
|
17828
|
+
shapes
|
|
17829
|
+
);
|
|
17830
|
+
const declare = (shape, where) => `// ${shape.name} \u2014 ${where}
|
|
17831
|
+
${generateShapeInterface(lookup, shape, {
|
|
17832
|
+
imports: false
|
|
17833
|
+
})}`;
|
|
17834
|
+
return [
|
|
17835
|
+
head,
|
|
17836
|
+
...spec.map((shape) => declare(shape, "api type")),
|
|
17837
|
+
...drawnIds.map((id) => shapes[id]).sort((a, b) => a.name.localeCompare(b.name)).map((shape) => declare(shape, `StateShape (${TYPE_SEGMENT}/${shape.name})`))
|
|
17838
|
+
].join("\n");
|
|
17839
|
+
}
|
|
17567
17840
|
function signatureShapeIds2(list, operationOf) {
|
|
17568
17841
|
const used = /* @__PURE__ */ new Set();
|
|
17569
17842
|
for (const method of list) {
|
|
@@ -24784,7 +25057,7 @@ function resetTargetQueriesBlock(ctx) {
|
|
|
24784
25057
|
`
|
|
24785
25058
|
).join("");
|
|
24786
25059
|
}
|
|
24787
|
-
function classArmStatements(arm, rows, ctx, selfStore, constants, reads, argsLocal) {
|
|
25060
|
+
function classArmStatements(arm, rows, ctx, selfStore, constants, reads, argsLocal, site) {
|
|
24788
25061
|
const controls = ctx.controlMap ?? {};
|
|
24789
25062
|
const { payload, fieldNames, eventRoot, eventMember } = reads;
|
|
24790
25063
|
const resets = (rows.formResets ?? []).filter((row) => {
|
|
@@ -24856,6 +25129,9 @@ function classArmStatements(arm, rows, ctx, selfStore, constants, reads, argsLoc
|
|
|
24856
25129
|
`this.${resetTargetMember(controls[row.controlId])}()?.reset()`
|
|
24857
25130
|
);
|
|
24858
25131
|
}
|
|
25132
|
+
statements.push(
|
|
25133
|
+
...outcomeCallStatements(rows, site, ctx, selfStore, constants, reads)
|
|
25134
|
+
);
|
|
24859
25135
|
const answer = isOutcomeReportDrawn(rows.report) ? armReportExpr(
|
|
24860
25136
|
rows.report,
|
|
24861
25137
|
{ id: "" },
|
|
@@ -24879,7 +25155,59 @@ function classArmStatements(arm, rows, ctx, selfStore, constants, reads, argsLoc
|
|
|
24879
25155
|
if (nav) statements.push(nav);
|
|
24880
25156
|
return statements;
|
|
24881
25157
|
}
|
|
24882
|
-
|
|
25158
|
+
var withoutOutcomeCalls = (outcome) => outcome && Object.fromEntries(
|
|
25159
|
+
Object.entries(outcome).map(([key2, arm]) => {
|
|
25160
|
+
if (!arm) return [key2, arm];
|
|
25161
|
+
const { calls: _drop, ...rest } = arm;
|
|
25162
|
+
return [key2, rest];
|
|
25163
|
+
})
|
|
25164
|
+
);
|
|
25165
|
+
function outcomeCallStatements(arm, site, ctx, selfStore, constants, reads) {
|
|
25166
|
+
if (!site) return [];
|
|
25167
|
+
const statements = [];
|
|
25168
|
+
for (const call of arm.calls ?? []) {
|
|
25169
|
+
const handler = call.screenMethodId ? ctx.screenMethods?.[call.screenMethodId] : void 0;
|
|
25170
|
+
if (handler) {
|
|
25171
|
+
const args2 = site.handlerArgs(handler, call.args ?? []);
|
|
25172
|
+
if (args2 !== void 0) statements.push(`this.${handler.name}(${args2})`);
|
|
25173
|
+
continue;
|
|
25174
|
+
}
|
|
25175
|
+
const method = call.methodId ? site.methods[call.methodId] : void 0;
|
|
25176
|
+
if (!method || (method.kind ?? "http") !== "http") continue;
|
|
25177
|
+
const args = site.storeArgs(method, call.args ?? []);
|
|
25178
|
+
if (args === void 0) continue;
|
|
25179
|
+
statements.push(
|
|
25180
|
+
...classOutcomeCall(
|
|
25181
|
+
`this.${methodReceiver(method, site.storeProp, ctx)}.${method.name}`,
|
|
25182
|
+
args,
|
|
25183
|
+
method,
|
|
25184
|
+
withoutOutcomeCalls(call.outcome),
|
|
25185
|
+
ctx,
|
|
25186
|
+
selfStore,
|
|
25187
|
+
constants,
|
|
25188
|
+
reads,
|
|
25189
|
+
"outcomeArgs",
|
|
25190
|
+
{ line: " ", close: " " }
|
|
25191
|
+
)
|
|
25192
|
+
);
|
|
25193
|
+
}
|
|
25194
|
+
return statements;
|
|
25195
|
+
}
|
|
25196
|
+
var classOutcomeCallSite = (methods, operationOf, storeProp, ctx, payload, options) => ({
|
|
25197
|
+
methods,
|
|
25198
|
+
storeProp,
|
|
25199
|
+
storeArgs: (method, rows) => isStorageMethod(method) || operationOf(method) ? callArgumentsExpression(
|
|
25200
|
+
methodArgsOf(method, operationOf, ctx),
|
|
25201
|
+
rows,
|
|
25202
|
+
payload,
|
|
25203
|
+
options
|
|
25204
|
+
) : void 0,
|
|
25205
|
+
handlerArgs: (handler, rows) => callArgumentsExpression(screenMethodArgs(handler), rows, payload, {
|
|
25206
|
+
...options,
|
|
25207
|
+
positional: true
|
|
25208
|
+
})
|
|
25209
|
+
});
|
|
25210
|
+
function classOutcomeCall(callee, args, method, outcome, ctx, selfStore, constants, reads, argsLocalName, indent2, site) {
|
|
24883
25211
|
if (!method || (method.kind ?? "http") !== "http" || !hasCallOutcome(outcome))
|
|
24884
25212
|
return [`${callee}(${args})`];
|
|
24885
25213
|
const argsLocal = outcomeReadsArgs(outcome) && args && args !== "{}" ? argsLocalName : void 0;
|
|
@@ -24893,7 +25221,8 @@ function classOutcomeCall(callee, args, method, outcome, ctx, selfStore, constan
|
|
|
24893
25221
|
selfStore,
|
|
24894
25222
|
constants,
|
|
24895
25223
|
reads,
|
|
24896
|
-
argsLocal
|
|
25224
|
+
argsLocal,
|
|
25225
|
+
site
|
|
24897
25226
|
);
|
|
24898
25227
|
if (!lines.length) return "";
|
|
24899
25228
|
return `${ARM_CALLBACK[arm]}: ${armParams(arm)} => {
|
|
@@ -25034,7 +25363,16 @@ function screenMethodsBlock(screenMethods, methods, operationOf, storeProp, ctx,
|
|
|
25034
25363
|
eventMember: screenMethodParamRead
|
|
25035
25364
|
},
|
|
25036
25365
|
mintLocal2("callArgs", taken),
|
|
25037
|
-
several && tested.length ? { line: " ", close: " " } : { line: " ", close: " " }
|
|
25366
|
+
several && tested.length ? { line: " ", close: " " } : { line: " ", close: " " },
|
|
25367
|
+
classOutcomeCallSite(methods, operationOf, storeProp, ctx, payload, {
|
|
25368
|
+
constants,
|
|
25369
|
+
scope: "class",
|
|
25370
|
+
functions: ctx.functions ?? {},
|
|
25371
|
+
...bindings,
|
|
25372
|
+
eventRoot,
|
|
25373
|
+
eventMember: screenMethodParamRead,
|
|
25374
|
+
fields: screenMethodFields(handler)
|
|
25375
|
+
})
|
|
25038
25376
|
);
|
|
25039
25377
|
if (tested.length && several) {
|
|
25040
25378
|
const test = tested.map(([, local]) => `${local} !== undefined`).join(" && ");
|
|
@@ -25065,6 +25403,9 @@ ${statements.map((line) => ` ${line};`).join("\n")}
|
|
|
25065
25403
|
});
|
|
25066
25404
|
return emitted.join("");
|
|
25067
25405
|
}
|
|
25406
|
+
var bindingReadsAlias = (binding) => binding.root.kind === "alias" || transformBindingLeaves(binding.transform).some(
|
|
25407
|
+
(leaf) => leaf.root.kind === "alias"
|
|
25408
|
+
);
|
|
25068
25409
|
function outputOpenEmit(node, output, ctx, storeProp, indent2 = " ", methods = {}, operationOf = () => void 0, aliasArgs = false) {
|
|
25069
25410
|
const open = outputOpenOf(node.outputOpens, output);
|
|
25070
25411
|
if (!open?.screenId) return void 0;
|
|
@@ -25075,9 +25416,7 @@ function outputOpenEmit(node, output, ctx, storeProp, indent2 = " ", methods
|
|
|
25075
25416
|
return void 0;
|
|
25076
25417
|
const payload = nodePayloadShape(node, output, ctx);
|
|
25077
25418
|
const aliasParams = /* @__PURE__ */ new Map();
|
|
25078
|
-
const readsAlias =
|
|
25079
|
-
(leaf) => leaf.root.kind === "alias"
|
|
25080
|
-
);
|
|
25419
|
+
const readsAlias = bindingReadsAlias;
|
|
25081
25420
|
const entries = outputOpenInputEntries(
|
|
25082
25421
|
open,
|
|
25083
25422
|
ref.inputs,
|
|
@@ -26256,7 +26595,44 @@ function classCallStatements(node, key2, payload, eventRoot, methods, operationO
|
|
|
26256
26595
|
eventRoot,
|
|
26257
26596
|
selfStore,
|
|
26258
26597
|
ctx,
|
|
26259
|
-
argsLocal
|
|
26598
|
+
argsLocal,
|
|
26599
|
+
{
|
|
26600
|
+
methods,
|
|
26601
|
+
storeProp,
|
|
26602
|
+
storeArgs: (one, rows) => callArguments(
|
|
26603
|
+
one,
|
|
26604
|
+
operationOf,
|
|
26605
|
+
key2,
|
|
26606
|
+
rows,
|
|
26607
|
+
ctx.constants ?? {},
|
|
26608
|
+
ctx.functions ?? {},
|
|
26609
|
+
ctx.properties ?? {},
|
|
26610
|
+
node.type,
|
|
26611
|
+
callArgBindings(ctx, storeProp, {
|
|
26612
|
+
controlId: node.id,
|
|
26613
|
+
memberPrefix: "this."
|
|
26614
|
+
}),
|
|
26615
|
+
filterGroupEventMember(node),
|
|
26616
|
+
node.configs,
|
|
26617
|
+
screenPayloadOf(node, key2, ctx)
|
|
26618
|
+
),
|
|
26619
|
+
handlerArgs: (handler, rows) => argsExpressionAt(
|
|
26620
|
+
screenMethodArgs(handler),
|
|
26621
|
+
true,
|
|
26622
|
+
key2,
|
|
26623
|
+
rows,
|
|
26624
|
+
ctx.constants ?? {},
|
|
26625
|
+
ctx.functions ?? {},
|
|
26626
|
+
node.type,
|
|
26627
|
+
callArgBindings(ctx, storeProp, {
|
|
26628
|
+
controlId: node.id,
|
|
26629
|
+
memberPrefix: "this."
|
|
26630
|
+
}),
|
|
26631
|
+
filterGroupEventMember(node),
|
|
26632
|
+
node.configs,
|
|
26633
|
+
screenPayloadOf(node, key2, ctx)
|
|
26634
|
+
)
|
|
26635
|
+
}
|
|
26260
26636
|
);
|
|
26261
26637
|
if (!lines.length) return "";
|
|
26262
26638
|
return `${ARM_CALLBACK[arm]}: ${armParams(arm)} => {
|
|
@@ -26284,7 +26660,7 @@ function denialDialogCall(dialog) {
|
|
|
26284
26660
|
];
|
|
26285
26661
|
return `this.modal.ask({ ${options.join(", ")} }).subscribe()`;
|
|
26286
26662
|
}
|
|
26287
|
-
function armStatements(node, output, arm, payload, eventRoot, selfStore, ctx, argsLocal) {
|
|
26663
|
+
function armStatements(node, output, arm, payload, eventRoot, selfStore, ctx, argsLocal, site) {
|
|
26288
26664
|
const controls = ctx.controlMap ?? {};
|
|
26289
26665
|
const rows = node.outputOutcomes?.[output]?.[arm];
|
|
26290
26666
|
if (!rows) return [];
|
|
@@ -26358,6 +26734,14 @@ function armStatements(node, output, arm, payload, eventRoot, selfStore, ctx, ar
|
|
|
26358
26734
|
`${formRefName(controls[row.controlId])}.reset()`
|
|
26359
26735
|
);
|
|
26360
26736
|
}
|
|
26737
|
+
statements.push(
|
|
26738
|
+
...outcomeCallStatements(rows, site, ctx, selfStore, ctx.constants ?? {}, {
|
|
26739
|
+
payload,
|
|
26740
|
+
fieldNames: [],
|
|
26741
|
+
eventRoot,
|
|
26742
|
+
eventMember: filterGroupEventMember(node)
|
|
26743
|
+
})
|
|
26744
|
+
);
|
|
26361
26745
|
const answer = isOutcomeReportDrawn(rows.report) ? armReportExpr(
|
|
26362
26746
|
rows.report,
|
|
26363
26747
|
node,
|
|
@@ -26380,7 +26764,7 @@ function armStatements(node, output, arm, payload, eventRoot, selfStore, ctx, ar
|
|
|
26380
26764
|
if (nav) statements.push(nav);
|
|
26381
26765
|
return statements;
|
|
26382
26766
|
}
|
|
26383
|
-
function outputLinkRead(ctx, storeProp) {
|
|
26767
|
+
function outputLinkRead(ctx, storeProp, aliasParam) {
|
|
26384
26768
|
const selfStore = storeProp ? `this.${storeProp}` : "";
|
|
26385
26769
|
return (arg) => {
|
|
26386
26770
|
switch (arg.source) {
|
|
@@ -26395,6 +26779,8 @@ function outputLinkRead(ctx, storeProp) {
|
|
|
26395
26779
|
false
|
|
26396
26780
|
) : void 0;
|
|
26397
26781
|
case "binding":
|
|
26782
|
+
if (bindingReadsAlias(arg.binding))
|
|
26783
|
+
return aliasParam?.(arg.binding);
|
|
26398
26784
|
return bindingExpression(arg.binding, {
|
|
26399
26785
|
...bindingScope(ctx, storeProp),
|
|
26400
26786
|
memberPrefix: "this."
|
|
@@ -26405,13 +26791,24 @@ function outputLinkRead(ctx, storeProp) {
|
|
|
26405
26791
|
};
|
|
26406
26792
|
}
|
|
26407
26793
|
function outputLinkStatements(node, output, ctx, storeProp) {
|
|
26408
|
-
|
|
26794
|
+
return outputLinkEmit(node, output, ctx, storeProp, false).statements;
|
|
26795
|
+
}
|
|
26796
|
+
function outputLinkEmit(node, output, ctx, storeProp, aliasArgs) {
|
|
26797
|
+
const aliasParams = /* @__PURE__ */ new Map();
|
|
26798
|
+
const read = outputLinkRead(ctx, storeProp, (binding) => {
|
|
26799
|
+
if (!aliasArgs || binding.transform) return void 0;
|
|
26800
|
+
const expr = bindingExpression(binding, bindingScope(ctx, storeProp));
|
|
26801
|
+
if (!expr) return void 0;
|
|
26802
|
+
const param = aliasParams.get(expr) ?? `$row${aliasParams.size}`;
|
|
26803
|
+
aliasParams.set(expr, param);
|
|
26804
|
+
return param;
|
|
26805
|
+
});
|
|
26409
26806
|
const nav = outputNavStatement(
|
|
26410
26807
|
outputNavOf(node.outputNavs, output),
|
|
26411
26808
|
ctx.navMap ?? {},
|
|
26412
26809
|
read
|
|
26413
26810
|
);
|
|
26414
|
-
|
|
26811
|
+
const statements = [
|
|
26415
26812
|
...outputNewTabStatements(
|
|
26416
26813
|
outputNewTabOf(node.outputNewTabs, output),
|
|
26417
26814
|
read,
|
|
@@ -26419,11 +26816,14 @@ function outputLinkStatements(node, output, ctx, storeProp) {
|
|
|
26419
26816
|
),
|
|
26420
26817
|
...nav ? [nav] : []
|
|
26421
26818
|
];
|
|
26819
|
+
return { statements, aliasReads: [...aliasParams.keys()] };
|
|
26422
26820
|
}
|
|
26423
26821
|
function outputLinkCall(node, output, ctx, scope, storeProp) {
|
|
26424
|
-
|
|
26822
|
+
const emit = outputLinkEmit(node, output, ctx, storeProp, true);
|
|
26823
|
+
if (!emit.statements.length) return "";
|
|
26824
|
+
if (scope === "class" && emit.aliasReads.length) return "";
|
|
26425
26825
|
const self = scope === "class" ? "this." : "";
|
|
26426
|
-
return `${self}${outputLinkMemberName(node.id, output)}()`;
|
|
26826
|
+
return `${self}${outputLinkMemberName(node.id, output)}(${emit.aliasReads.join(", ")})`;
|
|
26427
26827
|
}
|
|
26428
26828
|
function outputLinkMembersBlock(tree, ctx, storeProp) {
|
|
26429
26829
|
const emitted = [];
|
|
@@ -26435,10 +26835,17 @@ function outputLinkMembersBlock(tree, ctx, storeProp) {
|
|
|
26435
26835
|
]);
|
|
26436
26836
|
for (const output of [...outputs].sort()) {
|
|
26437
26837
|
if (isOutputArmKey(output) || isMenuActionKey(output)) continue;
|
|
26438
|
-
const
|
|
26838
|
+
const { statements: lines, aliasReads } = outputLinkEmit(
|
|
26839
|
+
node,
|
|
26840
|
+
output,
|
|
26841
|
+
ctx,
|
|
26842
|
+
storeProp,
|
|
26843
|
+
true
|
|
26844
|
+
);
|
|
26439
26845
|
if (!lines.length) continue;
|
|
26846
|
+
const params = aliasReads.map((_, index) => `$row${index}: unknown`).join(", ");
|
|
26440
26847
|
emitted.push(`
|
|
26441
|
-
protected readonly ${outputLinkMemberName(node.id, output)} = (): void => {
|
|
26848
|
+
protected readonly ${outputLinkMemberName(node.id, output)} = (${params}): void => {
|
|
26442
26849
|
${lines.map((line) => ` ${line};`).join("\n")}
|
|
26443
26850
|
};
|
|
26444
26851
|
`);
|
|
@@ -26480,14 +26887,50 @@ function autoCallsBlock(calls, methods, operationOf, storeProp, inputs, constant
|
|
|
26480
26887
|
if (call.methodId && !method) return "";
|
|
26481
26888
|
const op = method ? operationOf(method) : void 0;
|
|
26482
26889
|
if (method && !op) return "";
|
|
26890
|
+
const handler = call.screenMethodId ? ctx?.screenMethods?.[call.screenMethodId] : void 0;
|
|
26891
|
+
if (call.screenMethodId && !handler) return "";
|
|
26483
26892
|
const taken = new Set(Object.values(functions).map((fn) => fn.name));
|
|
26893
|
+
const watchScope = {
|
|
26894
|
+
inputs,
|
|
26895
|
+
screenComputeds: ctx?.screenComputeds,
|
|
26896
|
+
variables: ctx?.variables,
|
|
26897
|
+
properties: ctx?.properties
|
|
26898
|
+
};
|
|
26899
|
+
const { fields } = watchFields(call.reads, watchScope);
|
|
26900
|
+
const watched = /* @__PURE__ */ new Map();
|
|
26901
|
+
const watchKeys = [];
|
|
26902
|
+
for (const binding of call.reads ?? []) {
|
|
26903
|
+
if (binding.root.kind === "alias") return "";
|
|
26904
|
+
const expr = bindingExpression(binding, classScope);
|
|
26905
|
+
if (!expr) return "";
|
|
26906
|
+
if (watched.has(expr)) continue;
|
|
26907
|
+
const key2 = watchKey(binding, watchScope);
|
|
26908
|
+
const local = mintLocal2(key2 ?? localBase2(binding, classScope), taken);
|
|
26909
|
+
watched.set(expr, local);
|
|
26910
|
+
if (key2 && !watchKeys.some(([seen]) => seen === key2))
|
|
26911
|
+
watchKeys.push([key2, local]);
|
|
26912
|
+
}
|
|
26913
|
+
const keyed = watched.size > 0;
|
|
26914
|
+
const payload = keyed ? "record" : "void";
|
|
26915
|
+
const fieldNames = watchKeys.map(([key2]) => key2);
|
|
26916
|
+
const localOfKey = new Map(watchKeys);
|
|
26917
|
+
const eventRoot = keyed ? `{ ${watchKeys.map(([key2, local]) => key2 === local ? key2 : `${key2}: ${local}`).join(", ")} }` : "$event";
|
|
26918
|
+
const eventMember = keyed ? (path, expr) => path.length === 1 ? localOfKey.get(path[0]) ?? expr : expr : void 0;
|
|
26484
26919
|
const localByInput = /* @__PURE__ */ new Map();
|
|
26485
26920
|
const locals = /* @__PURE__ */ new Map();
|
|
26486
|
-
const guarded =
|
|
26487
|
-
const callRows =
|
|
26921
|
+
const guarded = new Set(watched.values());
|
|
26922
|
+
const callRows = [
|
|
26923
|
+
...method ? call.args : [],
|
|
26924
|
+
...handler ? call.screenMethodArgs ?? [] : []
|
|
26925
|
+
];
|
|
26488
26926
|
for (const row of callRows) {
|
|
26489
26927
|
if (row.source !== "input" || !row.input) continue;
|
|
26490
26928
|
const name3 = byName.get(row.input) ?? row.input;
|
|
26929
|
+
const watchedLocal = watched.get(`this.${name3}()`);
|
|
26930
|
+
if (watchedLocal) {
|
|
26931
|
+
locals.set(row, watchedLocal);
|
|
26932
|
+
continue;
|
|
26933
|
+
}
|
|
26491
26934
|
let local = localByInput.get(name3);
|
|
26492
26935
|
if (!local) {
|
|
26493
26936
|
local = mintLocal2(name3, taken);
|
|
@@ -26502,31 +26945,51 @@ function autoCallsBlock(calls, methods, operationOf, storeProp, inputs, constant
|
|
|
26502
26945
|
functions,
|
|
26503
26946
|
taken
|
|
26504
26947
|
);
|
|
26505
|
-
|
|
26948
|
+
const boundExpr = new Map(
|
|
26949
|
+
bound.reads.map(([expr, local]) => [local, expr])
|
|
26950
|
+
);
|
|
26951
|
+
for (const [row, local] of bound.locals) {
|
|
26952
|
+
const expr = boundExpr.get(local);
|
|
26953
|
+
locals.set(row, expr && watched.get(expr) || local);
|
|
26954
|
+
}
|
|
26506
26955
|
for (const local of bound.guarded) guarded.add(local);
|
|
26507
|
-
const
|
|
26956
|
+
const argCtx = {
|
|
26508
26957
|
constants,
|
|
26509
26958
|
scope: "class",
|
|
26510
26959
|
functions,
|
|
26511
26960
|
...bindings,
|
|
26512
|
-
locals
|
|
26513
|
-
|
|
26961
|
+
locals,
|
|
26962
|
+
...keyed ? { eventRoot, eventMember, fields } : {}
|
|
26963
|
+
};
|
|
26964
|
+
const args = method && op ? callArgumentsExpression(
|
|
26965
|
+
methodArgs(method, op),
|
|
26966
|
+
call.args,
|
|
26967
|
+
payload,
|
|
26968
|
+
argCtx
|
|
26969
|
+
) : "";
|
|
26514
26970
|
if (args === void 0) return "";
|
|
26971
|
+
const handlerArgs2 = handler ? callArgumentsExpression(
|
|
26972
|
+
screenMethodArgs(handler),
|
|
26973
|
+
call.screenMethodArgs ?? [],
|
|
26974
|
+
payload,
|
|
26975
|
+
{ ...argCtx, positional: true }
|
|
26976
|
+
) : "";
|
|
26977
|
+
if (handlerArgs2 === void 0) return "";
|
|
26515
26978
|
const read = new Map([
|
|
26516
26979
|
...[...localByInput.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([name3, local]) => [`this.${name3}()`, local]),
|
|
26517
|
-
...bound.reads
|
|
26980
|
+
...bound.reads.filter(([expr]) => !watched.has(expr))
|
|
26518
26981
|
]);
|
|
26519
26982
|
const emitRows = call.emits ?? [];
|
|
26520
26983
|
let emits = emitRows.length ? screenEmitStatements(
|
|
26521
26984
|
outputs,
|
|
26522
26985
|
emitRows,
|
|
26523
|
-
|
|
26524
|
-
|
|
26986
|
+
payload,
|
|
26987
|
+
fieldNames,
|
|
26525
26988
|
inputs,
|
|
26526
26989
|
constants,
|
|
26527
|
-
|
|
26990
|
+
eventRoot,
|
|
26528
26991
|
"class",
|
|
26529
|
-
|
|
26992
|
+
eventMember,
|
|
26530
26993
|
{ scope: bindings.bindingScope ?? {} }
|
|
26531
26994
|
) : [];
|
|
26532
26995
|
if (emitRows.length && !emits.length) return "";
|
|
@@ -26549,7 +27012,7 @@ function autoCallsBlock(calls, methods, operationOf, storeProp, inputs, constant
|
|
|
26549
27012
|
base2 = localBase2(value.binding, bindings.bindingScope ?? {});
|
|
26550
27013
|
}
|
|
26551
27014
|
if (!expr) continue;
|
|
26552
|
-
let local = read.get(expr);
|
|
27015
|
+
let local = watched.get(expr) ?? read.get(expr);
|
|
26553
27016
|
if (!local) {
|
|
26554
27017
|
local = mintLocal2(base2, taken);
|
|
26555
27018
|
read.set(expr, local);
|
|
@@ -26561,24 +27024,45 @@ function autoCallsBlock(calls, methods, operationOf, storeProp, inputs, constant
|
|
|
26561
27024
|
(line) => line.endsWith(spelled) ? line.replace(spelled, hoisted) : line
|
|
26562
27025
|
);
|
|
26563
27026
|
}
|
|
26564
|
-
|
|
26565
|
-
|
|
26566
|
-
|
|
26567
|
-
|
|
26568
|
-
|
|
26569
|
-
|
|
26570
|
-
|
|
26571
|
-
|
|
26572
|
-
|
|
26573
|
-
|
|
26574
|
-
|
|
26575
|
-
|
|
26576
|
-
|
|
26577
|
-
|
|
26578
|
-
const
|
|
26579
|
-
|
|
26580
|
-
|
|
26581
|
-
|
|
27027
|
+
const screenWriteLines = screenWriteStatements(
|
|
27028
|
+
ctx?.variables ?? {},
|
|
27029
|
+
call.screenWrites ?? [],
|
|
27030
|
+
payload,
|
|
27031
|
+
fieldNames,
|
|
27032
|
+
inputs,
|
|
27033
|
+
constants,
|
|
27034
|
+
eventRoot,
|
|
27035
|
+
"class",
|
|
27036
|
+
eventMember,
|
|
27037
|
+
void 0,
|
|
27038
|
+
functions
|
|
27039
|
+
);
|
|
27040
|
+
if (call.screenWrites?.length && !screenWriteLines.length) return "";
|
|
27041
|
+
const patch = ctx?.properties && call.writes?.length ? stateWritePatchExpression(
|
|
27042
|
+
ctx.properties,
|
|
27043
|
+
call.writes,
|
|
27044
|
+
payload,
|
|
27045
|
+
fieldNames,
|
|
27046
|
+
inputs,
|
|
27047
|
+
storeProp ? `this.${storeProp}` : "",
|
|
27048
|
+
constants,
|
|
27049
|
+
eventRoot,
|
|
27050
|
+
"class",
|
|
27051
|
+
eventMember,
|
|
27052
|
+
void 0,
|
|
27053
|
+
functions
|
|
27054
|
+
) : void 0;
|
|
27055
|
+
if (call.writes?.length && !patch) return "";
|
|
27056
|
+
const hoist = (entries, pad2) => entries.map(([expr, local]) => `
|
|
27057
|
+
${pad2}const ${local} = ${expr};`).join("");
|
|
27058
|
+
const guardOf = (entries, pad2) => {
|
|
27059
|
+
const tested = entries.filter(([, local]) => guarded.has(local));
|
|
27060
|
+
return tested.length ? `
|
|
27061
|
+
${pad2}if (${tested.map(([, local]) => `${local} === undefined`).join(" || ")}) return;` : "";
|
|
27062
|
+
};
|
|
27063
|
+
const watchReads = [...watched.entries()];
|
|
27064
|
+
const otherReads = [...read.entries()];
|
|
27065
|
+
const base = method ? `${method.name}Call` : handler ? `${handler.name}Call` : emitRows.length ? `${[...emitRows].map((row) => outputs[row.outputId]?.name ?? "").filter(Boolean).sort()[0] ?? "auto"}Emit` : "reaction";
|
|
26582
27066
|
let member = base;
|
|
26583
27067
|
for (let n = 2; members.has(member); n++) member = `${base}${n}`;
|
|
26584
27068
|
members.add(member);
|
|
@@ -26590,12 +27074,13 @@ ${reads.map(([expr, local]) => ` const ${local} = ${expr};`).join("\n")}` :
|
|
|
26590
27074
|
const flagDecl = once ? `
|
|
26591
27075
|
private ${flag} = false;
|
|
26592
27076
|
` : "";
|
|
26593
|
-
const
|
|
26594
|
-
|
|
26595
|
-
|
|
26596
|
-
|
|
26597
|
-
|
|
26598
|
-
|
|
27077
|
+
const syncLines = [
|
|
27078
|
+
...screenWriteLines,
|
|
27079
|
+
...emits,
|
|
27080
|
+
...patch ? [patch] : [],
|
|
27081
|
+
...handler ? [`this.${handler.name}(${handlerArgs2})`] : []
|
|
27082
|
+
];
|
|
27083
|
+
const callLines = (pad2) => method ? classOutcomeCall(
|
|
26599
27084
|
`this.${storePropOf?.(method.id) ?? storeProp}.${method.name}`,
|
|
26600
27085
|
args,
|
|
26601
27086
|
method,
|
|
@@ -26604,16 +27089,44 @@ ${classOutcomeCall(
|
|
|
26604
27089
|
storeProp ? `this.${storeProp}` : "",
|
|
26605
27090
|
constants,
|
|
26606
27091
|
{
|
|
26607
|
-
payload
|
|
26608
|
-
fieldNames
|
|
26609
|
-
eventRoot
|
|
27092
|
+
payload,
|
|
27093
|
+
fieldNames,
|
|
27094
|
+
eventRoot,
|
|
27095
|
+
...eventMember ? { eventMember } : {},
|
|
26610
27096
|
emitBindings: { scope: bindings.bindingScope ?? {} }
|
|
26611
27097
|
},
|
|
26612
27098
|
mintLocal2("callArgs", taken),
|
|
26613
|
-
{ line:
|
|
26614
|
-
|
|
27099
|
+
{ line: `${pad2} `, close: `${pad2} ` },
|
|
27100
|
+
classOutcomeCallSite(
|
|
27101
|
+
methods,
|
|
27102
|
+
operationOf,
|
|
27103
|
+
storeProp,
|
|
27104
|
+
ctx ?? {},
|
|
27105
|
+
payload,
|
|
27106
|
+
{ ...argCtx, locals: /* @__PURE__ */ new Map() }
|
|
27107
|
+
)
|
|
27108
|
+
).map((line) => `${pad2}${line};`) : [];
|
|
27109
|
+
if (keyed) {
|
|
27110
|
+
const inner = [
|
|
27111
|
+
...syncLines.map((line) => ` ${line};`),
|
|
27112
|
+
...callLines(" ")
|
|
27113
|
+
];
|
|
27114
|
+
return `${flagDecl}
|
|
27115
|
+
private readonly ${member} = effect(() => {${hoist(watchReads, " ")}${guardOf(watchReads, " ")}${latch}
|
|
27116
|
+
untracked(() => {${hoist(otherReads, " ")}${guardOf(otherReads, " ")}
|
|
27117
|
+
${inner.join("\n")}
|
|
27118
|
+
});
|
|
27119
|
+
});
|
|
27120
|
+
`;
|
|
27121
|
+
}
|
|
27122
|
+
const syncBlock = syncLines.length ? `
|
|
27123
|
+
untracked(() => {
|
|
27124
|
+
${syncLines.map((line) => ` ${line};`).join("\n")}
|
|
27125
|
+
});` : "";
|
|
27126
|
+
const callBlock = method ? `
|
|
27127
|
+
${callLines(" ").join("\n")}` : "";
|
|
26615
27128
|
return `${flagDecl}
|
|
26616
|
-
private readonly ${member} = effect(() => {${
|
|
27129
|
+
private readonly ${member} = effect(() => {${hoist(otherReads, " ")}${guardOf(otherReads, " ")}${latch}${syncBlock}${callBlock}
|
|
26617
27130
|
});
|
|
26618
27131
|
`;
|
|
26619
27132
|
}).filter(Boolean);
|
|
@@ -27455,7 +27968,7 @@ function generateTs(tree, naming, featureName, variants = {}, methods = {}, oper
|
|
|
27455
27968
|
featureStoreProp(featureName)
|
|
27456
27969
|
);
|
|
27457
27970
|
const autoCalls = (ctx.autoCalls ?? []).filter(
|
|
27458
|
-
(call) => call.methodId ? !!methods[call.methodId] :
|
|
27971
|
+
(call) => call.methodId ? !!methods[call.methodId] : screenAutoCallDoesAnything(call)
|
|
27459
27972
|
);
|
|
27460
27973
|
const storeProp = featureStoreProp(featureName);
|
|
27461
27974
|
const transformRefs = templateTransformRefs(
|
|
@@ -28426,7 +28939,7 @@ __export(package_exports, {
|
|
|
28426
28939
|
version: () => version
|
|
28427
28940
|
});
|
|
28428
28941
|
var name = "@magmonium/one";
|
|
28429
|
-
var version = "0.4.
|
|
28942
|
+
var version = "0.4.129";
|
|
28430
28943
|
var description = "Magmonium One \u2014 Angular design-system primitives for mm Apps";
|
|
28431
28944
|
var author = "magmonium";
|
|
28432
28945
|
var license = "MIT";
|
|
@@ -28494,7 +29007,7 @@ __export(package_exports2, {
|
|
|
28494
29007
|
version: () => version2
|
|
28495
29008
|
});
|
|
28496
29009
|
var name2 = "@magmonium/cli";
|
|
28497
|
-
var version2 = "0.8.
|
|
29010
|
+
var version2 = "0.8.30";
|
|
28498
29011
|
var description2 = "A powerful and extensible asset compilation tool that can be shared across multiple projects";
|
|
28499
29012
|
var bin = {
|
|
28500
29013
|
"mag-cli": "bin/cli.js"
|
|
@@ -29970,6 +30483,7 @@ var navAssetFiles = (navMap, { appName } = {}) => {
|
|
|
29970
30483
|
const nav = navMap[navId];
|
|
29971
30484
|
return !!(nav && (nav.platform === true || nav.label && nav.label.trim() !== "" || drawsRows(navId) || namesInstance(navId)));
|
|
29972
30485
|
};
|
|
30486
|
+
const isRouteParam = (navId) => navMap[navId]?.presentation === "dynamic";
|
|
29973
30487
|
const landing = landingNavId(navMap);
|
|
29974
30488
|
const menuChildren = (navId) => (navMap[navId]?.children ?? []).flatMap((childId) => {
|
|
29975
30489
|
if (isDefaultNavId(childId)) return menuChildren(childId);
|
|
@@ -29994,9 +30508,9 @@ var navAssetFiles = (navMap, { appName } = {}) => {
|
|
|
29994
30508
|
// out of the Address. An asset for it would be fetched once and used
|
|
29995
30509
|
// for nothing.
|
|
29996
30510
|
!isDefaultNavId(nav.navId) && // Only emit App Navs with labels; Platform Navs always have labels,
|
|
29997
|
-
//
|
|
29998
|
-
// gives.
|
|
29999
|
-
hasLabel(nav.navId)
|
|
30511
|
+
// a row-drawing `dynamic` Nav is exempt for the reason `hasLabel`
|
|
30512
|
+
// gives, and every `dynamic` Nav for the reason `isRouteParam` gives.
|
|
30513
|
+
(hasLabel(nav.navId) || isRouteParam(nav.navId))
|
|
30000
30514
|
).sort((a, b) => a.navId.localeCompare(b.navId)).forEach((nav) => {
|
|
30001
30515
|
files3.push({
|
|
30002
30516
|
path: `navs/${nav.navId}.yml`,
|
|
@@ -31181,6 +31695,7 @@ function sanitizeMethods(methods, properties, functions = {}) {
|
|
|
31181
31695
|
...path ? { path } : {},
|
|
31182
31696
|
...arg ? { arg } : {},
|
|
31183
31697
|
...compute ? { compute } : {},
|
|
31698
|
+
...check.count === true ? { count: true } : {},
|
|
31184
31699
|
...typeof check.value === "string" ? { value: check.value } : {}
|
|
31185
31700
|
}
|
|
31186
31701
|
};
|
|
@@ -31199,8 +31714,12 @@ function sanitizeMethods(methods, properties, functions = {}) {
|
|
|
31199
31714
|
(check) => !!check && typeof check.id === "string" && !!check.id && METHOD_VARIANT_SOURCES.includes(check.source) && RULE_OPERATORS.includes(check.operator) && (check.source !== "store" || Array.isArray(check.path) && check.path.every((segment) => typeof segment === "string") && !!check.path.length && !!properties[check.path[0]]) && (check.source !== "args" || !!check.arg) && (check.source !== "compute" || computes.some((compute) => compute.name === check.compute)) && (check.source !== "response" || typeof check.code === "string" && /^\d{3}$/.test(check.code))
|
|
31200
31715
|
).map((check) => {
|
|
31201
31716
|
const transform = sanitizeTransform(check.transform, functions);
|
|
31202
|
-
const { transform: _drop, ...rest } = check;
|
|
31203
|
-
return
|
|
31717
|
+
const { transform: _drop, count, ...rest } = check;
|
|
31718
|
+
return {
|
|
31719
|
+
...rest,
|
|
31720
|
+
...count === true ? { count: true } : {},
|
|
31721
|
+
...transform ? { transform } : {}
|
|
31722
|
+
};
|
|
31204
31723
|
})
|
|
31205
31724
|
}));
|
|
31206
31725
|
const paramNames = /* @__PURE__ */ new Set();
|
|
@@ -31811,7 +32330,11 @@ function sanitizeAutoCalls(calls, kind) {
|
|
|
31811
32330
|
if (typeof call.id !== "string" || !call.id) continue;
|
|
31812
32331
|
const methodId = hasStore(kind) && typeof call.methodId === "string" && call.methodId ? call.methodId : void 0;
|
|
31813
32332
|
const emits = screenEmitRows({ emits: call.emits }, "emits");
|
|
31814
|
-
|
|
32333
|
+
const writes = hasStore(kind) && Array.isArray(call.writes) ? call.writes : [];
|
|
32334
|
+
const screenWrites = Array.isArray(call.screenWrites) ? call.screenWrites : [];
|
|
32335
|
+
const screenMethodId = typeof call.screenMethodId === "string" && call.screenMethodId ? call.screenMethodId : void 0;
|
|
32336
|
+
if (!methodId && !emits.length && !writes.length && !screenWrites.length && !screenMethodId)
|
|
32337
|
+
continue;
|
|
31815
32338
|
const reads = Array.isArray(call.reads) ? call.reads.filter(
|
|
31816
32339
|
(read) => !!read && typeof read === "object" && !!read.root && Array.isArray(read.path)
|
|
31817
32340
|
) : [];
|
|
@@ -31826,6 +32349,12 @@ function sanitizeAutoCalls(calls, kind) {
|
|
|
31826
32349
|
// Rows answer a method's parameters, so a call-less auto-call keeps none.
|
|
31827
32350
|
args: methodId && Array.isArray(call.args) ? call.args : [],
|
|
31828
32351
|
...emits.length ? { emits } : {},
|
|
32352
|
+
...writes.length ? { writes } : {},
|
|
32353
|
+
...screenWrites.length ? { screenWrites } : {},
|
|
32354
|
+
...screenMethodId ? {
|
|
32355
|
+
screenMethodId,
|
|
32356
|
+
screenMethodArgs: Array.isArray(call.screenMethodArgs) ? call.screenMethodArgs : []
|
|
32357
|
+
} : {},
|
|
31829
32358
|
// Trusted like `args`: a read naming something gone drops at emit and is
|
|
31830
32359
|
// reported as an EmitGap (ADR 0206).
|
|
31831
32360
|
...reads.length ? { reads } : {},
|
|
@@ -32138,8 +32667,8 @@ function sanitizeScreens(screens, features, appFunctions, sharedShapes = {}, enu
|
|
|
32138
32667
|
if (Object.keys(variants).length) meta.variants = variants;
|
|
32139
32668
|
const outputs = sanitizeScreenOutputs(screen.outputs, kind);
|
|
32140
32669
|
if (Object.keys(outputs).length) meta.outputs = outputs;
|
|
32141
|
-
const autoCalls =
|
|
32142
|
-
sanitizeAutoCalls(screen.autoCalls, kind),
|
|
32670
|
+
const autoCalls = withDerivedWatch(
|
|
32671
|
+
splitAutoCallEmits(sanitizeAutoCalls(screen.autoCalls, kind), inputs),
|
|
32143
32672
|
inputs
|
|
32144
32673
|
);
|
|
32145
32674
|
if (autoCalls.length) meta.autoCalls = autoCalls;
|
|
@@ -37006,6 +37535,7 @@ var HISTORY_LABELS = [
|
|
|
37006
37535
|
// the Undo button reads the Fix it takes back (ADR 0192).
|
|
37007
37536
|
"fix-cast",
|
|
37008
37537
|
"fix-prune",
|
|
37538
|
+
"fix-remove-method",
|
|
37009
37539
|
"fix-retype-parameters",
|
|
37010
37540
|
"fix-route-inputs"
|
|
37011
37541
|
];
|
|
@@ -37247,6 +37777,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
37247
37777
|
ONE_FUNCTIONS,
|
|
37248
37778
|
ONE_FUNCTION_CATALOG,
|
|
37249
37779
|
ONE_FUNCTION_DATA_PARAM,
|
|
37780
|
+
ONE_FUNCTION_IDS_MAP_PARAM,
|
|
37250
37781
|
ONE_FUNCTION_IDS_PARAM,
|
|
37251
37782
|
ONE_FUNCTION_ID_PARAM,
|
|
37252
37783
|
ONE_FUNCTION_KEY_PARAM,
|
|
@@ -37635,6 +38166,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
37635
38166
|
customReadme,
|
|
37636
38167
|
dataTypeFits,
|
|
37637
38168
|
dataTypeMismatch,
|
|
38169
|
+
declaredPayload,
|
|
37638
38170
|
declaresOutputs,
|
|
37639
38171
|
declaresShapeInput,
|
|
37640
38172
|
decodeKeySource,
|
|
@@ -37985,6 +38517,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
37985
38517
|
isNavInstanceFunction,
|
|
37986
38518
|
isNavRowShape,
|
|
37987
38519
|
isNavVisibilityFunction,
|
|
38520
|
+
isObjectRepeatSource,
|
|
37988
38521
|
isOnChange,
|
|
37989
38522
|
isOneFunctionComputed,
|
|
37990
38523
|
isOneFunctionStateComputed,
|
|
@@ -38009,6 +38542,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
38009
38542
|
isPathResolved,
|
|
38010
38543
|
isPrimitiveType,
|
|
38011
38544
|
isPureFunctionComplete,
|
|
38545
|
+
isReactionAutoCall,
|
|
38012
38546
|
isRedirectRoute,
|
|
38013
38547
|
isReferencedByRule,
|
|
38014
38548
|
isReleaseVersion,
|
|
@@ -38155,6 +38689,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
38155
38689
|
methodArms,
|
|
38156
38690
|
methodConfirmKeys,
|
|
38157
38691
|
methodSignature,
|
|
38692
|
+
methodSpecShapes,
|
|
38158
38693
|
methodUsage,
|
|
38159
38694
|
methodsPersist,
|
|
38160
38695
|
migrateStored,
|
|
@@ -38224,6 +38759,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
38224
38759
|
needsKey,
|
|
38225
38760
|
needsValueTranslation,
|
|
38226
38761
|
nestMenuItem,
|
|
38762
|
+
nestedOutcomeCalls,
|
|
38227
38763
|
newCardAliases,
|
|
38228
38764
|
newComputedOption,
|
|
38229
38765
|
newInstanceFunctionOption,
|
|
@@ -38252,6 +38788,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
38252
38788
|
normalizeThemeName,
|
|
38253
38789
|
normalizeTranslationKey,
|
|
38254
38790
|
normalizeVariantName,
|
|
38791
|
+
objectMemberShapeId,
|
|
38255
38792
|
offersOutputArms,
|
|
38256
38793
|
oneFunctionArgFits,
|
|
38257
38794
|
oneFunctionBoundSignature,
|
|
@@ -38267,6 +38804,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
38267
38804
|
oneFunctionSiteFits,
|
|
38268
38805
|
oneParamFixedHeld,
|
|
38269
38806
|
oneParamStatePathOnly,
|
|
38807
|
+
oneParamTakesAnyRow,
|
|
38270
38808
|
oneParamTakesFixed,
|
|
38271
38809
|
oneParamTypeText,
|
|
38272
38810
|
openError,
|
|
@@ -38293,6 +38831,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
38293
38831
|
outcomeNavStatement,
|
|
38294
38832
|
outcomeReadsArgs,
|
|
38295
38833
|
outcomeReport,
|
|
38834
|
+
outcomeTransformArgFits,
|
|
38296
38835
|
outcomeTransformError,
|
|
38297
38836
|
outcomeTransformFailure,
|
|
38298
38837
|
outcomeTransformFunction,
|
|
@@ -38547,6 +39086,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
38547
39086
|
scaffoldFiles,
|
|
38548
39087
|
scanForCode,
|
|
38549
39088
|
scannedOutputArms,
|
|
39089
|
+
screenAutoCallDoesAnything,
|
|
38550
39090
|
screenAutoCallError,
|
|
38551
39091
|
screenAutoCallWhen,
|
|
38552
39092
|
screenComponentSite,
|
|
@@ -38820,9 +39360,12 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
38820
39360
|
validationTest,
|
|
38821
39361
|
valueSourceOf,
|
|
38822
39362
|
variableDrift,
|
|
39363
|
+
variantCheckCountable,
|
|
38823
39364
|
variantCheckError,
|
|
38824
39365
|
variantCheckId,
|
|
38825
39366
|
variantCheckLeaf,
|
|
39367
|
+
variantCheckOperand,
|
|
39368
|
+
variantCheckOperatorFits,
|
|
38826
39369
|
variantCheckOperators,
|
|
38827
39370
|
variantCheckType,
|
|
38828
39371
|
variantError,
|
|
@@ -38839,6 +39382,8 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
38839
39382
|
variantsForCode,
|
|
38840
39383
|
variantsForNewControl,
|
|
38841
39384
|
variantsReferencing,
|
|
39385
|
+
watchFields,
|
|
39386
|
+
watchKey,
|
|
38842
39387
|
wcClassName,
|
|
38843
39388
|
wcSelector,
|
|
38844
39389
|
widgetDir,
|
|
@@ -38848,6 +39393,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
38848
39393
|
withCallArgOptional,
|
|
38849
39394
|
withCases,
|
|
38850
39395
|
withDefaultRow,
|
|
39396
|
+
withDerivedWatch,
|
|
38851
39397
|
withEmittedTests,
|
|
38852
39398
|
withEventTransform,
|
|
38853
39399
|
withFormShapes,
|