@magmonium/cli 0.10.19 → 0.10.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/codegen/index.js +98 -8
  2. package/package.json +1 -1
package/codegen/index.js CHANGED
@@ -25,9 +25,11 @@ __export(index_exports, {
25
25
  ALL_VARIANT: () => ALL_VARIANT,
26
26
  API_SEGMENT: () => API_SEGMENT,
27
27
  APP_CONFIG_SOURCE: () => APP_CONFIG_SOURCE,
28
+ APP_EXPRESSION: () => APP_EXPRESSION,
28
29
  APP_LOGO_VALUE_ASSET: () => APP_LOGO_VALUE_ASSET,
29
30
  APP_LOGO_VALUE_SLOTS: () => APP_LOGO_VALUE_SLOTS,
30
31
  APP_MODES: () => APP_MODES,
32
+ APP_PROPERTIES: () => APP_PROPERTIES,
31
33
  APP_RELEASE_DOC: () => APP_RELEASE_DOC,
32
34
  APP_ROOT_IMPORTS: () => APP_ROOT_IMPORTS,
33
35
  APP_TARGET_STORAGE_KEY: () => APP_TARGET_STORAGE_KEY,
@@ -1790,6 +1792,7 @@ __export(index_exports, {
1790
1792
  unmappedMethodArgs: () => unmappedMethodArgs,
1791
1793
  unmappedParams: () => unmappedParams,
1792
1794
  updateRuleNode: () => updateRuleNode,
1795
+ usesAppInfo: () => usesAppInfo,
1793
1796
  usesAuthProperty: () => usesAuthProperty,
1794
1797
  usesStorage: () => usesStorage,
1795
1798
  validateButtonKey: () => validateButtonKey,
@@ -2144,6 +2147,18 @@ var AUTH_PROPERTIES = [
2144
2147
  { id: "userUsername", name: "user.username", dataType: { type: "string" } },
2145
2148
  { id: "deployToken", name: "user.deployToken", dataType: { type: "string" } }
2146
2149
  ];
2150
+ var APP_PROPERTIES = [
2151
+ { id: "appName", name: "app.name", dataType: { type: "string" } },
2152
+ {
2153
+ id: "appDescription",
2154
+ name: "app.description",
2155
+ dataType: { type: "string" }
2156
+ },
2157
+ { id: "appOwner", name: "app.owner", dataType: { type: "string" } },
2158
+ { id: "appVersion", name: "app.version", dataType: { type: "string" } },
2159
+ { id: "appTimestamp", name: "app.timestamp", dataType: { type: "string" } },
2160
+ { id: "appLink", name: "app.link", dataType: { type: "string" } }
2161
+ ];
2147
2162
  var ROUTER_LINK_MODES = [
2148
2163
  "absolute",
2149
2164
  "relative",
@@ -7963,6 +7978,14 @@ function usesAuthProperty(value, property) {
7963
7978
  if (record["kind"] === "auth" && record["property"] === property) return true;
7964
7979
  return Object.values(record).some((item) => usesAuthProperty(item, property));
7965
7980
  }
7981
+ function usesAppInfo(value) {
7982
+ if (Array.isArray(value)) return value.some(usesAppInfo);
7983
+ if (!value || typeof value !== "object") return false;
7984
+ const record = value;
7985
+ if (record["kind"] === "app" && APP_PROPERTIES.some((entry2) => entry2.id === record["property"]))
7986
+ return true;
7987
+ return Object.values(record).some(usesAppInfo);
7988
+ }
7966
7989
  function controlMapStateRootIds(map) {
7967
7990
  const ids = /* @__PURE__ */ new Set();
7968
7991
  Object.values(map).forEach(
@@ -8203,7 +8226,7 @@ var isBindingInScope = (binding, controlId, controlMap) => {
8203
8226
  };
8204
8227
  var bindingPathKey = (binding) => {
8205
8228
  const root = binding.root;
8206
- 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}`;
8229
+ const head = root.kind === "alias" ? `alias:${root.repeatId}:${root.alias}` : root.kind === "auth" || root.kind === "app" ? `${root.kind}:${root.property}` : root.kind === "none" ? root.kind : `${root.kind}:${root.id}`;
8207
8230
  return binding.path.length ? `${head}.${binding.path.join(".")}` : head;
8208
8231
  };
8209
8232
  var watchKey = (binding, scope) => {
@@ -9205,6 +9228,14 @@ var AUTH_EXPRESSION = {
9205
9228
  userUsername: "user()?.username",
9206
9229
  deployToken: "deployToken()"
9207
9230
  };
9231
+ var APP_EXPRESSION = {
9232
+ appName: "name",
9233
+ appDescription: "description",
9234
+ appOwner: "owner",
9235
+ appVersion: "version",
9236
+ appTimestamp: "timestamp",
9237
+ appLink: "link"
9238
+ };
9208
9239
  var shapesOf = (scope) => ({
9209
9240
  ...withListRowShape(scope.shapes),
9210
9241
  // And every FormShape this Screen draws, so a `form_model` root walks into
@@ -9377,6 +9408,7 @@ var bindingCardinality = (binding, scope, seen = /* @__PURE__ */ new Set()) => {
9377
9408
  break;
9378
9409
  }
9379
9410
  case "auth":
9411
+ case "app":
9380
9412
  return binding.path.length ? void 0 : "one";
9381
9413
  case "alias": {
9382
9414
  if (seen.has(root.repeatId)) return void 0;
@@ -9492,6 +9524,9 @@ var rootExpression = (binding, scope) => {
9492
9524
  // Feature-owned, so it reads the same on a storeless Page (ADR 0040).
9493
9525
  case "auth":
9494
9526
  return `${scope.memberPrefix ?? ""}authStore.${AUTH_EXPRESSION[root.property]}`;
9527
+ // App-wide like AuthStore: read off this app's own link, never a Feature.
9528
+ case "app":
9529
+ return `${scope.memberPrefix ?? ""}appInfo().${APP_EXPRESSION[root.property]}`;
9495
9530
  // A FunctionBinding that reads nothing (ADR 0199): no argument is a `pipe`,
9496
9531
  // so this head is never spelled — the call alone is the read.
9497
9532
  case "none":
@@ -9800,6 +9835,8 @@ var rootLabel = (root, scope) => {
9800
9835
  return `row alias of repeat '${root.repeatId}'`;
9801
9836
  case "auth":
9802
9837
  return `auth field '${root.property}'`;
9838
+ case "app":
9839
+ return `app field '${root.property}'`;
9803
9840
  case "none":
9804
9841
  return "function call";
9805
9842
  }
@@ -9825,6 +9862,7 @@ var WALKABLE_ROOTS = /* @__PURE__ */ new Set([
9825
9862
  var encodeRoot = (root) => {
9826
9863
  if (root.kind === "alias") return `alias:${root.repeatId}:${root.alias}`;
9827
9864
  if (root.kind === "auth") return `auth:${root.property}`;
9865
+ if (root.kind === "app") return `app:${root.property}`;
9828
9866
  if (root.kind === "none") return root.kind;
9829
9867
  return `${root.kind}:${root.id}`;
9830
9868
  };
@@ -9849,6 +9887,10 @@ var decodeRoot = (encoded) => {
9849
9887
  const property = AUTH_PROPERTIES.find((entry2) => entry2.id === parts[1]);
9850
9888
  return property ? { kind: "auth", property: property.id } : void 0;
9851
9889
  }
9890
+ if (parts[0] === "app") {
9891
+ const property = APP_PROPERTIES.find((entry2) => entry2.id === parts[1]);
9892
+ return property ? { kind: "app", property: property.id } : void 0;
9893
+ }
9852
9894
  if (parts[0] === "user_store" && parts[1] === "deployToken") {
9853
9895
  return { kind: "auth", property: "deployToken" };
9854
9896
  }
@@ -10022,6 +10064,12 @@ var authRoots = () => AUTH_PROPERTIES.map((property) => ({
10022
10064
  dataType: property.dataType,
10023
10065
  cardinality: "one"
10024
10066
  }));
10067
+ var appRoots = () => APP_PROPERTIES.map((property) => ({
10068
+ root: { kind: "app", property: property.id },
10069
+ name: property.name,
10070
+ dataType: property.dataType,
10071
+ cardinality: "one"
10072
+ }));
10025
10073
  var option = (root, path, label, dataType, cardinality) => ({
10026
10074
  value: encodeBinding({ root, path }),
10027
10075
  label,
@@ -10105,7 +10153,8 @@ var bindingOptions = (rawScope, accept) => {
10105
10153
  ...[
10106
10154
  ...aliasRoots(scope),
10107
10155
  ...screenRoots(scope),
10108
- ...authRoots()
10156
+ ...authRoots(),
10157
+ ...appRoots()
10109
10158
  ].flatMap(
10110
10159
  (entry2) => optionsForRoot(scope, accept, entry2)
10111
10160
  ),
@@ -15786,7 +15835,14 @@ var applyBindingText = (tree, controlMap, scope) => {
15786
15835
  })
15787
15836
  );
15788
15837
  const authSlots = authSlotMap(bindings);
15789
- return authSlots ? { ...node, childrens, bindingText, authSlots } : { ...node, childrens, bindingText };
15838
+ const appSlots = appSlotMap(bindings);
15839
+ return {
15840
+ ...node,
15841
+ childrens,
15842
+ bindingText,
15843
+ ...authSlots ? { authSlots } : {},
15844
+ ...appSlots ? { appSlots } : {}
15845
+ };
15790
15846
  };
15791
15847
  return tree.map(applyToNode);
15792
15848
  };
@@ -15802,6 +15858,18 @@ var authSlotMap = (bindings) => {
15802
15858
  ])
15803
15859
  );
15804
15860
  };
15861
+ var appSlotMap = (bindings) => {
15862
+ const entries = Object.entries(bindings).filter(
15863
+ ([, binding]) => binding.root.kind === "app" && !binding.transform
15864
+ );
15865
+ if (!entries.length) return void 0;
15866
+ return Object.fromEntries(
15867
+ entries.map(([slot, binding]) => [
15868
+ slot,
15869
+ binding.root.property
15870
+ ])
15871
+ );
15872
+ };
15805
15873
  var rootDisplayName = (root, scope) => {
15806
15874
  switch (root.kind) {
15807
15875
  case "alias":
@@ -15816,6 +15884,8 @@ var rootDisplayName = (root, scope) => {
15816
15884
  return scope.formModels?.[root.id]?.name;
15817
15885
  case "auth":
15818
15886
  return AUTH_PROPERTIES.find((property) => property.id === root.property)?.name;
15887
+ case "app":
15888
+ return APP_PROPERTIES.find((property) => property.id === root.property)?.name;
15819
15889
  // Named by its call in `bindingPathText`, which holds the binding.
15820
15890
  case "none":
15821
15891
  return void 0;
@@ -23625,6 +23695,7 @@ var boundCardinality = (binding, ctx) => {
23625
23695
  break;
23626
23696
  }
23627
23697
  case "auth":
23698
+ case "app":
23628
23699
  return binding.path.length ? void 0 : "one";
23629
23700
  case "alias":
23630
23701
  return void 0;
@@ -28359,6 +28430,17 @@ ${tables.map(
28359
28430
  ],
28360
28431
  "deployToken"
28361
28432
  );
28433
+ const usesAppInfoRoot = usesAppInfo([
28434
+ ctx.controlMap,
28435
+ ctx.screenVariants,
28436
+ ctx.variables,
28437
+ ctx.autoCalls,
28438
+ ctx.screenMethods,
28439
+ ctx.screenComputeds,
28440
+ ctx.formModels,
28441
+ ctx.inputs,
28442
+ menuVariants
28443
+ ]);
28362
28444
  const injectedGlobalStores = Object.keys(GLOBAL_METHOD_STORES).filter(
28363
28445
  (store) => store !== "AuthStore" && callsGlobalStore(ctx.controlMap ?? {}, ctx.screenMethods ?? {}, store)
28364
28446
  );
@@ -28559,7 +28641,7 @@ ${tables.map(
28559
28641
  ...screenComputedsBody || screenVariantsBody || cardsBody || messageParamsBody ? ["computed"] : [],
28560
28642
  ...autoCalls.length ? ["effect"] : [],
28561
28643
  ...autoCallsBody.includes("untracked(") ? ["untracked"] : [],
28562
- ...needsStore || usesAuth || injectedGlobalStores.length > 0 || usesModal || drawsOverlayClose || drawsOutcomeNav || classReadsNavRef || `${classArmsBody}${outputOpenBody}`.includes(`${OVERLAY_REF_MEMBER}?.`) || `${classArmsBody}${outputOpenBody}`.includes(`${NAV_REF_MEMBER}?.`) || `${outputLinkBody}${menuActionHandlersBody}${outputArmHandlersBody}`.includes(
28644
+ ...needsStore || usesAuth || usesAppInfoRoot || injectedGlobalStores.length > 0 || usesModal || drawsOverlayClose || drawsOutcomeNav || classReadsNavRef || `${classArmsBody}${outputOpenBody}`.includes(`${OVERLAY_REF_MEMBER}?.`) || `${classArmsBody}${outputOpenBody}`.includes(`${NAV_REF_MEMBER}?.`) || `${outputLinkBody}${menuActionHandlersBody}${outputArmHandlersBody}`.includes(
28563
28645
  `${NAV_REF_MEMBER}?.`
28564
28646
  ) ? ["inject"] : [],
28565
28647
  ...inputs.length ? ["input"] : [],
@@ -28706,6 +28788,11 @@ ${tables.map(
28706
28788
  ` : "";
28707
28789
  const authBody = usesAuth ? `
28708
28790
  protected readonly authStore = inject(AuthStore);
28791
+ ` : "";
28792
+ const appInfoImport = usesAppInfoRoot ? `import { APP_INFO } from '@magmonium/one';
28793
+ ` : "";
28794
+ const appInfoBody = usesAppInfoRoot ? `
28795
+ protected readonly appInfo = inject(APP_INFO);
28709
28796
  ` : "";
28710
28797
  const globalStoreImports = injectedGlobalStores.map(
28711
28798
  (store) => `import { ${GLOBAL_METHOD_STORES[store].className} } from '@magmonium/one';
@@ -28823,7 +28910,7 @@ ${memberEnums.map(
28823
28910
  const classReaderImport = classReaders.length ? `import { ${classReaders.join(", ")} } from '@magmonium/one';
28824
28911
  ` : "";
28825
28912
  return `${angularImports}
28826
- ${`${outcomeHandlersBody}${menuActionHandlersBody}`.includes("$event: MenuItem") ? "import type { MenuItem } from '@magmonium/one';\n" : ""}${contextMenuConfigBody ? "import type { ContextMenu } from '@magmonium/one';\n" : ""}${audiencePickerConfigBody ? "import type { AudiencePicker } from '@magmonium/one';\n" : ""}${environmentImport}${inputTypeImports}${memberEnumImports}${importsBlock}${validationImports}${sectionTableImport}${formModelImports}${storeImport}${busyImport}${authImport}${globalStoreImports}${modalImport}${overlayRefImport}${navRefImport}${navRouterImport}${assetOptionsImport}${payloadReaderImport}${classReaderImport}${enumImports}${screenFunctionImport}
28913
+ ${`${outcomeHandlersBody}${menuActionHandlersBody}`.includes("$event: MenuItem") ? "import type { MenuItem } from '@magmonium/one';\n" : ""}${contextMenuConfigBody ? "import type { ContextMenu } from '@magmonium/one';\n" : ""}${audiencePickerConfigBody ? "import type { AudiencePicker } from '@magmonium/one';\n" : ""}${environmentImport}${inputTypeImports}${memberEnumImports}${importsBlock}${validationImports}${sectionTableImport}${formModelImports}${storeImport}${busyImport}${authImport}${appInfoImport}${globalStoreImports}${modalImport}${overlayRefImport}${navRefImport}${navRouterImport}${assetOptionsImport}${payloadReaderImport}${classReaderImport}${enumImports}${screenFunctionImport}
28827
28914
  @Component({
28828
28915
  selector: '${naming.selector}',
28829
28916
  changeDetection: ChangeDetectionStrategy.OnPush,
@@ -28843,7 +28930,7 @@ ${`${outcomeHandlersBody}${menuActionHandlersBody}`.includes("$event: MenuItem")
28843
28930
  width: 100%
28844
28931
  \`,
28845
28932
  })
28846
- export class ${naming.className} {${storeBody}${busyBody}${authBody}${globalStoreBody}${modalBody}${overlayRefBody}${navRefBody}${navRouterBody}${imgApiOriginBody}${inputsBody}${constantsBody}${screenComputedsBody}${variablesBody}${formModelsBody}${screenVariantsBody}${cardsBody}${searchBody}${messageParamsBody}${outputsBody}${wiresBody}${overlayProps}${contextMenuConfigBody}${audiencePickerConfigBody}${payloadsBody}${transformMembersBody}${memberEnumsBody}${payloadReadersBody}${sectionTablesBody}${submitTargetQueriesBody}${checksBody}${screenMethodsBody}${outputOpenBody}${outputLinkBody}${outcomeHandlersBody}${menuActionHandlersBody}${menuConditionBody}${outputArmHandlersBody}${autoCallsBody}}
28933
+ export class ${naming.className} {${storeBody}${busyBody}${authBody}${appInfoBody}${globalStoreBody}${modalBody}${overlayRefBody}${navRefBody}${navRouterBody}${imgApiOriginBody}${inputsBody}${constantsBody}${screenComputedsBody}${variablesBody}${formModelsBody}${screenVariantsBody}${cardsBody}${searchBody}${messageParamsBody}${outputsBody}${wiresBody}${overlayProps}${contextMenuConfigBody}${audiencePickerConfigBody}${payloadsBody}${transformMembersBody}${memberEnumsBody}${payloadReadersBody}${sectionTablesBody}${submitTargetQueriesBody}${checksBody}${screenMethodsBody}${outputOpenBody}${outputLinkBody}${outcomeHandlersBody}${menuActionHandlersBody}${menuConditionBody}${outputArmHandlersBody}${autoCallsBody}}
28847
28934
  `;
28848
28935
  }
28849
28936
  function assetName(node) {
@@ -29181,7 +29268,7 @@ __export(package_exports, {
29181
29268
  version: () => version
29182
29269
  });
29183
29270
  var name = "@magmonium/one";
29184
- var version = "0.4.139";
29271
+ var version = "0.4.140";
29185
29272
  var description = "Magmonium One \u2014 Angular design-system primitives for mm Apps";
29186
29273
  var author = "magmonium";
29187
29274
  var license = "MIT";
@@ -29249,7 +29336,7 @@ __export(package_exports2, {
29249
29336
  version: () => version2
29250
29337
  });
29251
29338
  var name2 = "@magmonium/cli";
29252
- var version2 = "0.10.19";
29339
+ var version2 = "0.10.20";
29253
29340
  var description2 = "A powerful and extensible asset compilation tool that can be shared across multiple projects";
29254
29341
  var bin = {
29255
29342
  "mag-cli": "bin/cli.js"
@@ -37878,9 +37965,11 @@ var HISTORY_SELECTION_KEYS = [
37878
37965
  ALL_VARIANT,
37879
37966
  API_SEGMENT,
37880
37967
  APP_CONFIG_SOURCE,
37968
+ APP_EXPRESSION,
37881
37969
  APP_LOGO_VALUE_ASSET,
37882
37970
  APP_LOGO_VALUE_SLOTS,
37883
37971
  APP_MODES,
37972
+ APP_PROPERTIES,
37884
37973
  APP_RELEASE_DOC,
37885
37974
  APP_ROOT_IMPORTS,
37886
37975
  APP_TARGET_STORAGE_KEY,
@@ -39643,6 +39732,7 @@ var HISTORY_SELECTION_KEYS = [
39643
39732
  unmappedMethodArgs,
39644
39733
  unmappedParams,
39645
39734
  updateRuleNode,
39735
+ usesAppInfo,
39646
39736
  usesAuthProperty,
39647
39737
  usesStorage,
39648
39738
  validateButtonKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magmonium/cli",
3
- "version": "0.10.19",
3
+ "version": "0.10.20",
4
4
  "description": "A powerful and extensible asset compilation tool that can be shared across multiple projects",
5
5
  "bin": {
6
6
  "mag-cli": "bin/cli.js"