@carthooks/arcubase-cli 0.1.23 → 0.1.25

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.
@@ -18360,6 +18360,33 @@ var helpExamplesIndex = {
18360
18360
  }
18361
18361
  ]
18362
18362
  },
18363
+ "admin.dashboard.update-options": {
18364
+ "command": [
18365
+ "dashboard",
18366
+ "update-options"
18367
+ ],
18368
+ "examples": [
18369
+ {
18370
+ "title": "make a dashboard visible to one Arcubase user",
18371
+ "body": {
18372
+ "changed": [
18373
+ "users"
18374
+ ],
18375
+ "users": [
18376
+ {
18377
+ "type": "user",
18378
+ "id": 2188889901
18379
+ }
18380
+ ]
18381
+ },
18382
+ "notes": [
18383
+ "dashboard visibility is controlled by DashboardUpdateOptionsReqVO.users",
18384
+ "use the currentSpeaker.arcubaseUserId value for the current human speaker",
18385
+ "after updating, verify from the user side with arcubase app get and require dashboards to include the dashboard"
18386
+ ]
18387
+ }
18388
+ ]
18389
+ },
18363
18390
  "admin.widget.create": {
18364
18391
  "command": [
18365
18392
  "widget",
@@ -18662,7 +18689,15 @@ function renderCommandHelpExamples(scope, command) {
18662
18689
  ].join("\n").trimEnd();
18663
18690
  }
18664
18691
 
18665
- // src/runtime/dev_sdk_gen.ts
18692
+ // node_modules/@arcubase/code-gen/dist/index.js
18693
+ var ArcubaseCodeGenError = class extends Error {
18694
+ code;
18695
+ constructor(code, message) {
18696
+ super(message);
18697
+ this.code = code;
18698
+ this.name = "ArcubaseCodeGenError";
18699
+ }
18700
+ };
18666
18701
  function isRecord3(value) {
18667
18702
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
18668
18703
  }
@@ -18671,7 +18706,8 @@ function unwrapData(payload) {
18671
18706
  }
18672
18707
  function toPascalCase(value) {
18673
18708
  const words = value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[^A-Za-z0-9]+/).filter(Boolean);
18674
- if (words.length === 0) return "Entity";
18709
+ if (words.length === 0)
18710
+ return "Entity";
18675
18711
  return words.map((word) => `${word[0].toUpperCase()}${word.slice(1)}`).join("");
18676
18712
  }
18677
18713
  function toCamelCase(value) {
@@ -18711,11 +18747,11 @@ function normalizeFieldType(type) {
18711
18747
  function normalizeEntities(payload) {
18712
18748
  const root = unwrapData(payload);
18713
18749
  if (!isRecord3(root)) {
18714
- throw new CLIError("SDK_GEN_INVALID_SCHEMA", "sdk-gen expected an app detail object", 2);
18750
+ throw new ArcubaseCodeGenError("SDK_GEN_INVALID_SCHEMA", "sdk-gen expected an app detail object");
18715
18751
  }
18716
18752
  const appId = typeof root.id === "number" ? root.id : typeof root.app_id === "number" ? root.app_id : void 0;
18717
18753
  if (!appId) {
18718
- throw new CLIError("SDK_GEN_APP_ID_REQUIRED", "sdk-gen expected app id in app detail response", 2);
18754
+ throw new ArcubaseCodeGenError("SDK_GEN_APP_ID_REQUIRED", "sdk-gen expected app id in app detail response");
18719
18755
  }
18720
18756
  const sourceEntities = Array.isArray(root.entities) ? root.entities : Array.isArray(root.tables) ? root.tables : Array.isArray(root.entitys) ? root.entitys : [];
18721
18757
  const entities = sourceEntities.filter((item) => isRecord3(item)).filter((item) => typeof item.id === "number" && typeof item.name === "string").map((item) => {
@@ -18738,7 +18774,7 @@ function normalizeEntities(payload) {
18738
18774
  return entity;
18739
18775
  });
18740
18776
  if (entities.length === 0) {
18741
- throw new CLIError("SDK_GEN_NO_ENTITIES", "sdk-gen could not find entities in app detail response", 2);
18777
+ throw new ArcubaseCodeGenError("SDK_GEN_NO_ENTITIES", "sdk-gen could not find entities in app detail response");
18742
18778
  }
18743
18779
  validateEntities(entities);
18744
18780
  return entities;
@@ -18747,19 +18783,19 @@ function validateEntities(entities) {
18747
18783
  const entityKeys = /* @__PURE__ */ new Set();
18748
18784
  for (const entity of entities) {
18749
18785
  if (entityKeys.has(entity.sdkName)) {
18750
- throw new CLIError("SDK_GEN_DUPLICATE_ENTITY_KEY", `duplicate generated entity key: ${entity.sdkName}`, 2);
18786
+ throw new ArcubaseCodeGenError("SDK_GEN_DUPLICATE_ENTITY_KEY", `duplicate generated entity key: ${entity.sdkName}`);
18751
18787
  }
18752
18788
  entityKeys.add(entity.sdkName);
18753
18789
  const fieldKeys = /* @__PURE__ */ new Set();
18754
18790
  for (const field of entity.fields) {
18755
18791
  if (!field.key) {
18756
- throw new CLIError("SDK_GEN_FIELD_KEY_REQUIRED", `field.key is required for ${entity.name}.${field.label} (${field.id})`, 2);
18792
+ throw new ArcubaseCodeGenError("SDK_GEN_FIELD_KEY_REQUIRED", `field.key is required for ${entity.name}.${field.label} (${field.id})`);
18757
18793
  }
18758
18794
  if (!/^[A-Za-z][A-Za-z0-9_]*$/.test(field.key)) {
18759
- throw new CLIError("SDK_GEN_INVALID_FIELD_KEY", `field.key must be a TypeScript identifier: ${entity.name}.${field.key}`, 2);
18795
+ throw new ArcubaseCodeGenError("SDK_GEN_INVALID_FIELD_KEY", `field.key must be a TypeScript identifier: ${entity.name}.${field.key}`);
18760
18796
  }
18761
18797
  if (fieldKeys.has(field.key)) {
18762
- throw new CLIError("SDK_GEN_DUPLICATE_FIELD_KEY", `duplicate field.key in ${entity.name}: ${field.key}`, 2);
18798
+ throw new ArcubaseCodeGenError("SDK_GEN_DUPLICATE_FIELD_KEY", `duplicate field.key in ${entity.name}: ${field.key}`);
18763
18799
  }
18764
18800
  fieldKeys.add(field.key);
18765
18801
  }
@@ -18964,6 +19000,18 @@ function generateArcubaseProjectSDK(payload) {
18964
19000
  };
18965
19001
  }
18966
19002
 
19003
+ // src/runtime/dev_sdk_gen.ts
19004
+ function generateArcubaseProjectSDK2(payload) {
19005
+ try {
19006
+ return generateArcubaseProjectSDK(payload);
19007
+ } catch (error51) {
19008
+ if (error51 instanceof ArcubaseCodeGenError) {
19009
+ throw new CLIError(error51.code, error51.message, 2);
19010
+ }
19011
+ throw error51;
19012
+ }
19013
+ }
19014
+
18967
19015
  // src/runtime/execute.ts
18968
19016
  function renderRootHelp(scope) {
18969
19017
  const binary = scope === "admin" ? "arcubase-admin" : "arcubase";
@@ -19195,7 +19243,7 @@ function renderDevSDKGenHelp() {
19195
19243
  " - arcubase-admin dev sdk-gen --app-id <app_id> --out src/arcubase",
19196
19244
  "",
19197
19245
  "requirements:",
19198
- " - missing field.key values are initialized through admin auth as field<id>",
19246
+ " - every generated field must have a configured field.key; sdk-gen fails fast when keys are missing",
19199
19247
  " - existing field.key values must be stable unique TypeScript identifiers",
19200
19248
  " - entity property names use entity.key when available, otherwise a stable entity<id> fallback",
19201
19249
  " - generated code accepts createArcubaseSdk({ baseURL, accessToken, refreshToken })"
@@ -20708,45 +20756,37 @@ function walkSDKGenFields(fields, visit) {
20708
20756
  walkSDKGenFields(field.children, visit);
20709
20757
  }
20710
20758
  }
20711
- function collectExistingSDKGenFieldKeys(entity) {
20712
- const keys = /* @__PURE__ */ new Set();
20713
- walkSDKGenFields(entity.fields, (field) => {
20714
- if (typeof field.key === "string" && field.key.trim() !== "") {
20715
- keys.add(field.key.trim());
20716
- }
20717
- });
20718
- return keys;
20719
- }
20720
- function nextSDKGenFallbackFieldKey(fieldId, usedKeys) {
20721
- const base = `field${fieldId}`;
20722
- if (!usedKeys.has(base)) {
20723
- usedKeys.add(base);
20724
- return base;
20725
- }
20726
- let index = 2;
20727
- while (usedKeys.has(`${base}_${index}`)) {
20728
- index++;
20729
- }
20730
- const key = `${base}_${index}`;
20731
- usedKeys.add(key);
20732
- return key;
20733
- }
20734
- function initializeMissingSDKGenFieldKeys(entity) {
20735
- const usedKeys = collectExistingSDKGenFieldKeys(entity);
20736
- const updates = [];
20759
+ function assertSDKGenFieldKeysPresent(entity) {
20760
+ const missing = [];
20737
20761
  walkSDKGenFields(entity.fields, (field) => {
20738
20762
  if (typeof field.id !== "number") {
20739
20763
  return;
20740
20764
  }
20741
20765
  if (typeof field.key === "string" && field.key.trim() !== "") {
20742
- field.key = field.key.trim();
20743
20766
  return;
20744
20767
  }
20745
- const key = nextSDKGenFallbackFieldKey(field.id, usedKeys);
20746
- field.key = key;
20747
- updates.push({ id: field.id, key });
20768
+ missing.push({
20769
+ id: field.id,
20770
+ label: typeof field.label === "string" && field.label.trim() ? field.label.trim() : `field ${field.id}`
20771
+ });
20772
+ });
20773
+ if (missing.length === 0) {
20774
+ return;
20775
+ }
20776
+ const entityName = typeof entity.name === "string" && entity.name.trim() ? entity.name.trim() : `entity ${String(entity.id ?? "")}`.trim();
20777
+ const preview = missing.slice(0, 8).map((field) => `${entityName}.${field.label} (${field.id})`);
20778
+ const suffix = missing.length > preview.length ? `, and ${missing.length - preview.length} more` : "";
20779
+ throw new CLIError("SDK_GEN_FIELD_KEY_REQUIRED", `missing field.key values: ${preview.join(", ")}${suffix}`, 2, {
20780
+ operation: "dev sdk-gen",
20781
+ issues: missing.map((field) => ({
20782
+ path: `entity.${String(entity.id ?? "unknown")}.field.${field.id}.key`,
20783
+ message: `field.key is required for ${entityName}.${field.label}`
20784
+ })),
20785
+ suggestions: [
20786
+ "set stable field.key values in Arcubase admin before running sdk-gen",
20787
+ "rerun arcubase-admin dev sdk-gen after the schema keys are complete"
20788
+ ]
20748
20789
  });
20749
- return updates;
20750
20790
  }
20751
20791
  async function executeDevSDKGen(runtimeEnv, flags, fetchImpl) {
20752
20792
  validateDevSDKGenFlags(flags);
@@ -20775,7 +20815,6 @@ async function executeDevSDKGen(runtimeEnv, flags, fetchImpl) {
20775
20815
  throw new CLIError("SDK_GEN_NO_ENTITIES", "sdk-gen could not find entities in app detail response", 2);
20776
20816
  }
20777
20817
  const entities = [];
20778
- const initializedFieldKeys = [];
20779
20818
  for (const entityRef of entityRefs) {
20780
20819
  const entityEndpoint = `/api/apps/${encodeURIComponent(appId)}/entity/${encodeURIComponent(entityRef.id)}`;
20781
20820
  const entityDetail = await requestJSON(runtimeEnv, "GET", entityEndpoint, void 0, fetchImpl);
@@ -20783,18 +20822,10 @@ async function executeDevSDKGen(runtimeEnv, flags, fetchImpl) {
20783
20822
  if (!isRecord4(entityPayload)) {
20784
20823
  throw new CLIError("SDK_GEN_INVALID_SCHEMA", "sdk-gen expected entity detail response data", 2);
20785
20824
  }
20786
- const customKeyUpdates = initializeMissingSDKGenFieldKeys(entityPayload);
20787
- if (customKeyUpdates.length > 0) {
20788
- const customKeysEndpoint = `/api/apps/${encodeURIComponent(appId)}/entity/${encodeURIComponent(entityRef.id)}/custom-keys`;
20789
- await requestJSON(runtimeEnv, "PUT", customKeysEndpoint, customKeyUpdates, fetchImpl);
20790
- initializedFieldKeys.push({
20791
- entityId: typeof entityPayload.id === "number" ? entityPayload.id : Number(entityRef.id),
20792
- fields: customKeyUpdates.map((item) => item.key)
20793
- });
20794
- }
20825
+ assertSDKGenFieldKeysPresent(entityPayload);
20795
20826
  entities.push(entityPayload);
20796
20827
  }
20797
- const generated = generateArcubaseProjectSDK({
20828
+ const generated = generateArcubaseProjectSDK2({
20798
20829
  id: resolveSDKGenAppId(appId, appPayload),
20799
20830
  name: typeof appPayload.name === "string" ? appPayload.name : void 0,
20800
20831
  entities
@@ -20814,8 +20845,7 @@ async function executeDevSDKGen(runtimeEnv, flags, fetchImpl) {
20814
20845
  status: appDetail.status,
20815
20846
  data: {
20816
20847
  out: absoluteOutDir,
20817
- files: generated.files.map((file2) => file2.path),
20818
- initializedFieldKeys
20848
+ files: generated.files.map((file2) => file2.path)
20819
20849
  }
20820
20850
  };
20821
20851
  }
@@ -18360,6 +18360,33 @@ var helpExamplesIndex = {
18360
18360
  }
18361
18361
  ]
18362
18362
  },
18363
+ "admin.dashboard.update-options": {
18364
+ "command": [
18365
+ "dashboard",
18366
+ "update-options"
18367
+ ],
18368
+ "examples": [
18369
+ {
18370
+ "title": "make a dashboard visible to one Arcubase user",
18371
+ "body": {
18372
+ "changed": [
18373
+ "users"
18374
+ ],
18375
+ "users": [
18376
+ {
18377
+ "type": "user",
18378
+ "id": 2188889901
18379
+ }
18380
+ ]
18381
+ },
18382
+ "notes": [
18383
+ "dashboard visibility is controlled by DashboardUpdateOptionsReqVO.users",
18384
+ "use the currentSpeaker.arcubaseUserId value for the current human speaker",
18385
+ "after updating, verify from the user side with arcubase app get and require dashboards to include the dashboard"
18386
+ ]
18387
+ }
18388
+ ]
18389
+ },
18363
18390
  "admin.widget.create": {
18364
18391
  "command": [
18365
18392
  "widget",
@@ -18662,7 +18689,15 @@ function renderCommandHelpExamples(scope, command) {
18662
18689
  ].join("\n").trimEnd();
18663
18690
  }
18664
18691
 
18665
- // src/runtime/dev_sdk_gen.ts
18692
+ // node_modules/@arcubase/code-gen/dist/index.js
18693
+ var ArcubaseCodeGenError = class extends Error {
18694
+ code;
18695
+ constructor(code, message) {
18696
+ super(message);
18697
+ this.code = code;
18698
+ this.name = "ArcubaseCodeGenError";
18699
+ }
18700
+ };
18666
18701
  function isRecord3(value) {
18667
18702
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
18668
18703
  }
@@ -18671,7 +18706,8 @@ function unwrapData(payload) {
18671
18706
  }
18672
18707
  function toPascalCase(value) {
18673
18708
  const words = value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[^A-Za-z0-9]+/).filter(Boolean);
18674
- if (words.length === 0) return "Entity";
18709
+ if (words.length === 0)
18710
+ return "Entity";
18675
18711
  return words.map((word) => `${word[0].toUpperCase()}${word.slice(1)}`).join("");
18676
18712
  }
18677
18713
  function toCamelCase(value) {
@@ -18711,11 +18747,11 @@ function normalizeFieldType(type) {
18711
18747
  function normalizeEntities(payload) {
18712
18748
  const root = unwrapData(payload);
18713
18749
  if (!isRecord3(root)) {
18714
- throw new CLIError("SDK_GEN_INVALID_SCHEMA", "sdk-gen expected an app detail object", 2);
18750
+ throw new ArcubaseCodeGenError("SDK_GEN_INVALID_SCHEMA", "sdk-gen expected an app detail object");
18715
18751
  }
18716
18752
  const appId = typeof root.id === "number" ? root.id : typeof root.app_id === "number" ? root.app_id : void 0;
18717
18753
  if (!appId) {
18718
- throw new CLIError("SDK_GEN_APP_ID_REQUIRED", "sdk-gen expected app id in app detail response", 2);
18754
+ throw new ArcubaseCodeGenError("SDK_GEN_APP_ID_REQUIRED", "sdk-gen expected app id in app detail response");
18719
18755
  }
18720
18756
  const sourceEntities = Array.isArray(root.entities) ? root.entities : Array.isArray(root.tables) ? root.tables : Array.isArray(root.entitys) ? root.entitys : [];
18721
18757
  const entities = sourceEntities.filter((item) => isRecord3(item)).filter((item) => typeof item.id === "number" && typeof item.name === "string").map((item) => {
@@ -18738,7 +18774,7 @@ function normalizeEntities(payload) {
18738
18774
  return entity;
18739
18775
  });
18740
18776
  if (entities.length === 0) {
18741
- throw new CLIError("SDK_GEN_NO_ENTITIES", "sdk-gen could not find entities in app detail response", 2);
18777
+ throw new ArcubaseCodeGenError("SDK_GEN_NO_ENTITIES", "sdk-gen could not find entities in app detail response");
18742
18778
  }
18743
18779
  validateEntities(entities);
18744
18780
  return entities;
@@ -18747,19 +18783,19 @@ function validateEntities(entities) {
18747
18783
  const entityKeys = /* @__PURE__ */ new Set();
18748
18784
  for (const entity of entities) {
18749
18785
  if (entityKeys.has(entity.sdkName)) {
18750
- throw new CLIError("SDK_GEN_DUPLICATE_ENTITY_KEY", `duplicate generated entity key: ${entity.sdkName}`, 2);
18786
+ throw new ArcubaseCodeGenError("SDK_GEN_DUPLICATE_ENTITY_KEY", `duplicate generated entity key: ${entity.sdkName}`);
18751
18787
  }
18752
18788
  entityKeys.add(entity.sdkName);
18753
18789
  const fieldKeys = /* @__PURE__ */ new Set();
18754
18790
  for (const field of entity.fields) {
18755
18791
  if (!field.key) {
18756
- throw new CLIError("SDK_GEN_FIELD_KEY_REQUIRED", `field.key is required for ${entity.name}.${field.label} (${field.id})`, 2);
18792
+ throw new ArcubaseCodeGenError("SDK_GEN_FIELD_KEY_REQUIRED", `field.key is required for ${entity.name}.${field.label} (${field.id})`);
18757
18793
  }
18758
18794
  if (!/^[A-Za-z][A-Za-z0-9_]*$/.test(field.key)) {
18759
- throw new CLIError("SDK_GEN_INVALID_FIELD_KEY", `field.key must be a TypeScript identifier: ${entity.name}.${field.key}`, 2);
18795
+ throw new ArcubaseCodeGenError("SDK_GEN_INVALID_FIELD_KEY", `field.key must be a TypeScript identifier: ${entity.name}.${field.key}`);
18760
18796
  }
18761
18797
  if (fieldKeys.has(field.key)) {
18762
- throw new CLIError("SDK_GEN_DUPLICATE_FIELD_KEY", `duplicate field.key in ${entity.name}: ${field.key}`, 2);
18798
+ throw new ArcubaseCodeGenError("SDK_GEN_DUPLICATE_FIELD_KEY", `duplicate field.key in ${entity.name}: ${field.key}`);
18763
18799
  }
18764
18800
  fieldKeys.add(field.key);
18765
18801
  }
@@ -18964,6 +19000,18 @@ function generateArcubaseProjectSDK(payload) {
18964
19000
  };
18965
19001
  }
18966
19002
 
19003
+ // src/runtime/dev_sdk_gen.ts
19004
+ function generateArcubaseProjectSDK2(payload) {
19005
+ try {
19006
+ return generateArcubaseProjectSDK(payload);
19007
+ } catch (error51) {
19008
+ if (error51 instanceof ArcubaseCodeGenError) {
19009
+ throw new CLIError(error51.code, error51.message, 2);
19010
+ }
19011
+ throw error51;
19012
+ }
19013
+ }
19014
+
18967
19015
  // src/runtime/execute.ts
18968
19016
  function renderRootHelp(scope) {
18969
19017
  const binary = scope === "admin" ? "arcubase-admin" : "arcubase";
@@ -19195,7 +19243,7 @@ function renderDevSDKGenHelp() {
19195
19243
  " - arcubase-admin dev sdk-gen --app-id <app_id> --out src/arcubase",
19196
19244
  "",
19197
19245
  "requirements:",
19198
- " - missing field.key values are initialized through admin auth as field<id>",
19246
+ " - every generated field must have a configured field.key; sdk-gen fails fast when keys are missing",
19199
19247
  " - existing field.key values must be stable unique TypeScript identifiers",
19200
19248
  " - entity property names use entity.key when available, otherwise a stable entity<id> fallback",
19201
19249
  " - generated code accepts createArcubaseSdk({ baseURL, accessToken, refreshToken })"
@@ -20708,45 +20756,37 @@ function walkSDKGenFields(fields, visit) {
20708
20756
  walkSDKGenFields(field.children, visit);
20709
20757
  }
20710
20758
  }
20711
- function collectExistingSDKGenFieldKeys(entity) {
20712
- const keys = /* @__PURE__ */ new Set();
20713
- walkSDKGenFields(entity.fields, (field) => {
20714
- if (typeof field.key === "string" && field.key.trim() !== "") {
20715
- keys.add(field.key.trim());
20716
- }
20717
- });
20718
- return keys;
20719
- }
20720
- function nextSDKGenFallbackFieldKey(fieldId, usedKeys) {
20721
- const base = `field${fieldId}`;
20722
- if (!usedKeys.has(base)) {
20723
- usedKeys.add(base);
20724
- return base;
20725
- }
20726
- let index = 2;
20727
- while (usedKeys.has(`${base}_${index}`)) {
20728
- index++;
20729
- }
20730
- const key = `${base}_${index}`;
20731
- usedKeys.add(key);
20732
- return key;
20733
- }
20734
- function initializeMissingSDKGenFieldKeys(entity) {
20735
- const usedKeys = collectExistingSDKGenFieldKeys(entity);
20736
- const updates = [];
20759
+ function assertSDKGenFieldKeysPresent(entity) {
20760
+ const missing = [];
20737
20761
  walkSDKGenFields(entity.fields, (field) => {
20738
20762
  if (typeof field.id !== "number") {
20739
20763
  return;
20740
20764
  }
20741
20765
  if (typeof field.key === "string" && field.key.trim() !== "") {
20742
- field.key = field.key.trim();
20743
20766
  return;
20744
20767
  }
20745
- const key = nextSDKGenFallbackFieldKey(field.id, usedKeys);
20746
- field.key = key;
20747
- updates.push({ id: field.id, key });
20768
+ missing.push({
20769
+ id: field.id,
20770
+ label: typeof field.label === "string" && field.label.trim() ? field.label.trim() : `field ${field.id}`
20771
+ });
20772
+ });
20773
+ if (missing.length === 0) {
20774
+ return;
20775
+ }
20776
+ const entityName = typeof entity.name === "string" && entity.name.trim() ? entity.name.trim() : `entity ${String(entity.id ?? "")}`.trim();
20777
+ const preview = missing.slice(0, 8).map((field) => `${entityName}.${field.label} (${field.id})`);
20778
+ const suffix = missing.length > preview.length ? `, and ${missing.length - preview.length} more` : "";
20779
+ throw new CLIError("SDK_GEN_FIELD_KEY_REQUIRED", `missing field.key values: ${preview.join(", ")}${suffix}`, 2, {
20780
+ operation: "dev sdk-gen",
20781
+ issues: missing.map((field) => ({
20782
+ path: `entity.${String(entity.id ?? "unknown")}.field.${field.id}.key`,
20783
+ message: `field.key is required for ${entityName}.${field.label}`
20784
+ })),
20785
+ suggestions: [
20786
+ "set stable field.key values in Arcubase admin before running sdk-gen",
20787
+ "rerun arcubase-admin dev sdk-gen after the schema keys are complete"
20788
+ ]
20748
20789
  });
20749
- return updates;
20750
20790
  }
20751
20791
  async function executeDevSDKGen(runtimeEnv, flags, fetchImpl) {
20752
20792
  validateDevSDKGenFlags(flags);
@@ -20775,7 +20815,6 @@ async function executeDevSDKGen(runtimeEnv, flags, fetchImpl) {
20775
20815
  throw new CLIError("SDK_GEN_NO_ENTITIES", "sdk-gen could not find entities in app detail response", 2);
20776
20816
  }
20777
20817
  const entities = [];
20778
- const initializedFieldKeys = [];
20779
20818
  for (const entityRef of entityRefs) {
20780
20819
  const entityEndpoint = `/api/apps/${encodeURIComponent(appId)}/entity/${encodeURIComponent(entityRef.id)}`;
20781
20820
  const entityDetail = await requestJSON(runtimeEnv, "GET", entityEndpoint, void 0, fetchImpl);
@@ -20783,18 +20822,10 @@ async function executeDevSDKGen(runtimeEnv, flags, fetchImpl) {
20783
20822
  if (!isRecord4(entityPayload)) {
20784
20823
  throw new CLIError("SDK_GEN_INVALID_SCHEMA", "sdk-gen expected entity detail response data", 2);
20785
20824
  }
20786
- const customKeyUpdates = initializeMissingSDKGenFieldKeys(entityPayload);
20787
- if (customKeyUpdates.length > 0) {
20788
- const customKeysEndpoint = `/api/apps/${encodeURIComponent(appId)}/entity/${encodeURIComponent(entityRef.id)}/custom-keys`;
20789
- await requestJSON(runtimeEnv, "PUT", customKeysEndpoint, customKeyUpdates, fetchImpl);
20790
- initializedFieldKeys.push({
20791
- entityId: typeof entityPayload.id === "number" ? entityPayload.id : Number(entityRef.id),
20792
- fields: customKeyUpdates.map((item) => item.key)
20793
- });
20794
- }
20825
+ assertSDKGenFieldKeysPresent(entityPayload);
20795
20826
  entities.push(entityPayload);
20796
20827
  }
20797
- const generated = generateArcubaseProjectSDK({
20828
+ const generated = generateArcubaseProjectSDK2({
20798
20829
  id: resolveSDKGenAppId(appId, appPayload),
20799
20830
  name: typeof appPayload.name === "string" ? appPayload.name : void 0,
20800
20831
  entities
@@ -20814,8 +20845,7 @@ async function executeDevSDKGen(runtimeEnv, flags, fetchImpl) {
20814
20845
  status: appDetail.status,
20815
20846
  data: {
20816
20847
  out: absoluteOutDir,
20817
- files: generated.files.map((file2) => file2.path),
20818
- initializedFieldKeys
20848
+ files: generated.files.map((file2) => file2.path)
20819
20849
  }
20820
20850
  };
20821
20851
  }
@@ -262,6 +262,20 @@ export declare const helpExamplesIndex: {
262
262
  readonly notes: readonly ["the request body is a top-level array", "do not wrap the array as {\"layout\":[...]}"];
263
263
  }];
264
264
  };
265
+ readonly "admin.dashboard.update-options": {
266
+ readonly command: readonly ["dashboard", "update-options"];
267
+ readonly examples: readonly [{
268
+ readonly title: "make a dashboard visible to one Arcubase user";
269
+ readonly body: {
270
+ readonly changed: readonly ["users"];
271
+ readonly users: readonly [{
272
+ readonly type: "user";
273
+ readonly id: 2188889901;
274
+ }];
275
+ };
276
+ readonly notes: readonly ["dashboard visibility is controlled by DashboardUpdateOptionsReqVO.users", "use the currentSpeaker.arcubaseUserId value for the current human speaker", "after updating, verify from the user side with arcubase app get and require dashboards to include the dashboard"];
277
+ }];
278
+ };
265
279
  readonly "admin.widget.create": {
266
280
  readonly command: readonly ["widget", "create"];
267
281
  readonly examples: readonly [{
@@ -1 +1 @@
1
- {"version":3,"file":"help_examples.generated.d.ts","sourceRoot":"","sources":["../../src/generated/help_examples.generated.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2mBgF,CAAA"}
1
+ {"version":3,"file":"help_examples.generated.d.ts","sourceRoot":"","sources":["../../src/generated/help_examples.generated.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsoBgF,CAAA"}
@@ -363,6 +363,33 @@ export const helpExamplesIndex = {
363
363
  }
364
364
  ]
365
365
  },
366
+ "admin.dashboard.update-options": {
367
+ "command": [
368
+ "dashboard",
369
+ "update-options"
370
+ ],
371
+ "examples": [
372
+ {
373
+ "title": "make a dashboard visible to one Arcubase user",
374
+ "body": {
375
+ "changed": [
376
+ "users"
377
+ ],
378
+ "users": [
379
+ {
380
+ "type": "user",
381
+ "id": 2188889901
382
+ }
383
+ ]
384
+ },
385
+ "notes": [
386
+ "dashboard visibility is controlled by DashboardUpdateOptionsReqVO.users",
387
+ "use the currentSpeaker.arcubaseUserId value for the current human speaker",
388
+ "after updating, verify from the user side with arcubase app get and require dashboards to include the dashboard"
389
+ ]
390
+ }
391
+ ]
392
+ },
366
393
  "admin.widget.create": {
367
394
  "command": [
368
395
  "widget",
@@ -1,9 +1,4 @@
1
- export type GeneratedSDKFile = {
2
- path: string;
3
- contents: string;
4
- };
5
- export type GeneratedSDK = {
6
- files: GeneratedSDKFile[];
7
- };
1
+ import { type GeneratedSDK } from '@arcubase/code-gen';
2
+ export type { GeneratedSDK, GeneratedSDKFile } from '@arcubase/code-gen';
8
3
  export declare function generateArcubaseProjectSDK(payload: unknown): GeneratedSDK;
9
4
  //# sourceMappingURL=dev_sdk_gen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dev_sdk_gen.d.ts","sourceRoot":"","sources":["../../src/runtime/dev_sdk_gen.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,gBAAgB,EAAE,CAAA;CAC1B,CAAA;AAmVD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,CAWzE"}
1
+ {"version":3,"file":"dev_sdk_gen.d.ts","sourceRoot":"","sources":["../../src/runtime/dev_sdk_gen.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAA;AAI3B,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAExE,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,CASzE"}