@stardeck-customer-apps/compose 0.14.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1143,16 +1143,16 @@ var require_range = __commonJS({
1143
1143
  };
1144
1144
  var replaceTilde = (comp, options) => {
1145
1145
  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1146
- const z10 = options.includePrerelease ? "-0" : "";
1146
+ const z11 = options.includePrerelease ? "-0" : "";
1147
1147
  return comp.replace(r, (_, M, m, p, pr) => {
1148
1148
  debug("tilde", comp, _, M, m, p, pr);
1149
1149
  let ret;
1150
1150
  if (isX(M)) {
1151
1151
  ret = "";
1152
1152
  } else if (isX(m)) {
1153
- ret = `>=${M}.0.0${z10} <${+M + 1}.0.0-0`;
1153
+ ret = `>=${M}.0.0${z11} <${+M + 1}.0.0-0`;
1154
1154
  } else if (isX(p)) {
1155
- ret = `>=${M}.${m}.0${z10} <${M}.${+m + 1}.0-0`;
1155
+ ret = `>=${M}.${m}.0${z11} <${M}.${+m + 1}.0-0`;
1156
1156
  } else if (pr) {
1157
1157
  debug("replaceTilde pr", pr);
1158
1158
  ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
@@ -1169,19 +1169,19 @@ var require_range = __commonJS({
1169
1169
  var replaceCaret = (comp, options) => {
1170
1170
  debug("caret", comp, options);
1171
1171
  const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1172
- const z10 = options.includePrerelease ? "-0" : "";
1172
+ const z11 = options.includePrerelease ? "-0" : "";
1173
1173
  return comp.replace(r, (_, M, m, p, pr) => {
1174
1174
  debug("caret", comp, _, M, m, p, pr);
1175
1175
  let ret;
1176
1176
  if (isX(M)) {
1177
1177
  ret = "";
1178
1178
  } else if (isX(m)) {
1179
- ret = `>=${M}.0.0${z10} <${+M + 1}.0.0-0`;
1179
+ ret = `>=${M}.0.0${z11} <${+M + 1}.0.0-0`;
1180
1180
  } else if (isX(p)) {
1181
1181
  if (M === "0") {
1182
- ret = `>=${M}.${m}.0${z10} <${M}.${+m + 1}.0-0`;
1182
+ ret = `>=${M}.${m}.0${z11} <${M}.${+m + 1}.0-0`;
1183
1183
  } else {
1184
- ret = `>=${M}.${m}.0${z10} <${+M + 1}.0.0-0`;
1184
+ ret = `>=${M}.${m}.0${z11} <${+M + 1}.0.0-0`;
1185
1185
  }
1186
1186
  } else if (pr) {
1187
1187
  debug("replaceCaret pr", pr);
@@ -2377,7 +2377,18 @@ var modulePermissionClaimSchema = z2.object({
2377
2377
  * External Viewer never holds one. An organization that wants different access duplicates the
2378
2378
  * standard role and edits the copy.
2379
2379
  */
2380
- roles: z2.array(z2.enum(MODULE_PERMISSION_DEFAULT_ROLES)).optional()
2380
+ roles: z2.array(z2.enum(MODULE_PERMISSION_DEFAULT_ROLES)).optional(),
2381
+ /**
2382
+ * Keys this one takes over (a retired or renamed key). On the update that stops declaring
2383
+ * them, every custom role still holding one is granted this key before the old one goes,
2384
+ * so nobody loses access in the change. Standard roles follow `roles` as always.
2385
+ */
2386
+ replaces: z2.array(
2387
+ z2.string().regex(
2388
+ /^[a-z0-9][a-z0-9-]*:[a-z0-9][a-z0-9-]*$/,
2389
+ "must be a lowercase resource:action key"
2390
+ )
2391
+ ).max(20).optional()
2381
2392
  }).strict();
2382
2393
  var seedBundleSchema = z2.object({
2383
2394
  table: tableNameSchema,
@@ -4017,6 +4028,24 @@ function analyzeClientSafeEntryImports(sourceText, fileName) {
4017
4028
  return analyzeClientSafeEntryImportsWithTs(ts3, sourceText, fileName);
4018
4029
  }
4019
4030
 
4031
+ // ../../packages/lib/src/shared/ownership-record.ts
4032
+ import { z as z7 } from "zod";
4033
+ var OWNERSHIP_RECORD_VERSION = 1;
4034
+ var moduleList = z7.array(z7.string().refine(isValidModuleName, "not a Module name"));
4035
+ var ownershipRecordSchema = z7.object({
4036
+ version: z7.literal(OWNERSHIP_RECORD_VERSION),
4037
+ /** False once the app stopped all Stardeck updates: then every file is the app's. */
4038
+ stardeckUpdates: z7.boolean(),
4039
+ /** projects.ejected_modules: updates stopped for these Modules, so their folders are the app's. */
4040
+ updatesStoppedModules: moduleList,
4041
+ /** projects.ui_ejected_modules: Customize UI, so their screens are the app's. */
4042
+ customizedUiModules: moduleList,
4043
+ /** projects.external_modules: installed from another app, so the app owns the copy. */
4044
+ externalModules: moduleList,
4045
+ /** projects.removed_modules names: uninstalled on purpose. */
4046
+ uninstalledModules: moduleList
4047
+ });
4048
+
4020
4049
  // ../../packages/lib/src/shared/platform-owned-paths.ts
4021
4050
  var APP_WEB_PREFIX = "apps/web/";
4022
4051
  var BLUEPRINT_LINT_MARKER = `${APP_WEB_PREFIX}eslint-rules/module-boundaries.mjs`;
@@ -5971,14 +6000,14 @@ function rejectPseudoModuleEntries(entries, parentDir, label) {
5971
6000
  }
5972
6001
 
5973
6002
  // ../../packages/lib/src/shared/module-composition.ts
5974
- import { z as z7 } from "zod";
5975
- var creationSourceBlankSchema = z7.object({
5976
- type: z7.literal("blank")
6003
+ import { z as z8 } from "zod";
6004
+ var creationSourceBlankSchema = z8.object({
6005
+ type: z8.literal("blank")
5977
6006
  });
5978
- var creationSourceBlueprintSchema = z7.object({
5979
- type: z7.literal("blueprint"),
6007
+ var creationSourceBlueprintSchema = z8.object({
6008
+ type: z8.literal("blueprint"),
5980
6009
  /** Internal template/fork project id — keep template naming in identifiers. */
5981
- blueprintProjectId: z7.string().uuid(),
6010
+ blueprintProjectId: z8.string().uuid(),
5982
6011
  /**
5983
6012
  * `null`/absent means every feature Module: the platform stores that as the
5984
6013
  * explicit list of feature Modules in the published Blueprint version the fork
@@ -5986,192 +6015,197 @@ var creationSourceBlueprintSchema = z7.object({
5986
6015
  * a custom app: no feature Module, Library Modules only (`resolvePlatformEnv`
5987
6016
  * emits it as a set value naming no Module).
5988
6017
  */
5989
- enabledModules: z7.array(moduleNameSchema).max(100).nullable().optional()
6018
+ enabledModules: z8.array(moduleNameSchema).max(100).nullable().optional(),
6019
+ /**
6020
+ * The kind of business (a preset id the published version defines). Its Modules are built
6021
+ * and `enabledModules` adds extras on top; for the general kind `enabledModules` is the pick.
6022
+ */
6023
+ businessKind: z8.string().regex(/^[a-z][a-z0-9-]{0,39}$/).optional()
5990
6024
  });
5991
- var creationSourceSchema = z7.discriminatedUnion("type", [
6025
+ var creationSourceSchema = z8.discriminatedUnion("type", [
5992
6026
  creationSourceBlankSchema,
5993
6027
  creationSourceBlueprintSchema
5994
6028
  ]);
5995
- var moduleInstallHandoffSchema = z7.object({
5996
- moduleName: z7.string().min(1),
5997
- homeProjectId: z7.string().uuid(),
5998
- installedVersion: z7.string().min(1),
5999
- baselineSha: z7.string().min(1),
6000
- mounts: z7.array(
6001
- z7.object({
6002
- group: z7.string(),
6003
- segment: z7.string()
6029
+ var moduleInstallHandoffSchema = z8.object({
6030
+ moduleName: z8.string().min(1),
6031
+ homeProjectId: z8.string().uuid(),
6032
+ installedVersion: z8.string().min(1),
6033
+ baselineSha: z8.string().min(1),
6034
+ mounts: z8.array(
6035
+ z8.object({
6036
+ group: z8.string(),
6037
+ segment: z8.string()
6004
6038
  })
6005
6039
  ),
6006
- integration: z7.array(z7.string()),
6007
- workflows: z7.array(z7.string()),
6008
- prunedEnhancements: z7.array(z7.string()),
6009
- restoredEnhancements: z7.array(z7.string()).optional(),
6010
- permissions: z7.array(
6011
- z7.object({
6012
- key: z7.string().min(1),
6013
- description: z7.string().min(1)
6040
+ integration: z8.array(z8.string()),
6041
+ workflows: z8.array(z8.string()),
6042
+ prunedEnhancements: z8.array(z8.string()),
6043
+ restoredEnhancements: z8.array(z8.string()).optional(),
6044
+ permissions: z8.array(
6045
+ z8.object({
6046
+ key: z8.string().min(1),
6047
+ description: z8.string().min(1)
6014
6048
  })
6015
6049
  ).optional()
6016
6050
  });
6017
6051
 
6018
6052
  // ../../packages/lib/src/shared/schema-ops.ts
6019
- import { z as z8 } from "zod";
6020
- var columnSpecSchema = z8.object({
6021
- name: z8.string().min(1).max(63),
6022
- pgType: z8.string().min(1),
6023
- nullable: z8.boolean(),
6053
+ import { z as z9 } from "zod";
6054
+ var columnSpecSchema = z9.object({
6055
+ name: z9.string().min(1).max(63),
6056
+ pgType: z9.string().min(1),
6057
+ nullable: z9.boolean(),
6024
6058
  /**
6025
6059
  * A SQL expression used as the column default, as a raw string (e.g. `'t'`,
6026
6060
  * `0`, `now()`, `gen_random_uuid()`). `null` or omitted means no default.
6027
6061
  * NOT a JS literal — must already be a valid SQL expression.
6028
6062
  */
6029
- default: z8.string().nullable().optional(),
6030
- fieldType: z8.string().optional(),
6031
- fieldConfig: z8.record(z8.string(), z8.unknown()).optional()
6063
+ default: z9.string().nullable().optional(),
6064
+ fieldType: z9.string().optional(),
6065
+ fieldConfig: z9.record(z9.string(), z9.unknown()).optional()
6032
6066
  });
6033
- var referentialActionSchema = z8.enum([
6067
+ var referentialActionSchema = z9.enum([
6034
6068
  "cascade",
6035
6069
  "set null",
6036
6070
  "set default",
6037
6071
  "restrict",
6038
6072
  "no action"
6039
6073
  ]);
6040
- var schemaOpSchema = z8.discriminatedUnion("type", [
6074
+ var schemaOpSchema = z9.discriminatedUnion("type", [
6041
6075
  // Tables
6042
- z8.object({
6043
- type: z8.literal("createTable"),
6044
- table: z8.string().min(1).max(63),
6045
- columns: z8.array(columnSpecSchema).min(1),
6046
- primaryKey: z8.array(z8.string()).optional(),
6047
- ifNotExists: z8.boolean().optional()
6076
+ z9.object({
6077
+ type: z9.literal("createTable"),
6078
+ table: z9.string().min(1).max(63),
6079
+ columns: z9.array(columnSpecSchema).min(1),
6080
+ primaryKey: z9.array(z9.string()).optional(),
6081
+ ifNotExists: z9.boolean().optional()
6048
6082
  }),
6049
- z8.object({
6050
- type: z8.literal("dropTable"),
6051
- table: z8.string().min(1).max(63),
6052
- cascade: z8.boolean().optional(),
6053
- ifExists: z8.boolean().optional()
6083
+ z9.object({
6084
+ type: z9.literal("dropTable"),
6085
+ table: z9.string().min(1).max(63),
6086
+ cascade: z9.boolean().optional(),
6087
+ ifExists: z9.boolean().optional()
6054
6088
  }),
6055
- z8.object({
6056
- type: z8.literal("renameTable"),
6057
- from: z8.string().min(1).max(63),
6058
- to: z8.string().min(1).max(63)
6089
+ z9.object({
6090
+ type: z9.literal("renameTable"),
6091
+ from: z9.string().min(1).max(63),
6092
+ to: z9.string().min(1).max(63)
6059
6093
  }),
6060
6094
  // Columns
6061
- z8.object({
6062
- type: z8.literal("addColumn"),
6063
- table: z8.string().min(1).max(63),
6095
+ z9.object({
6096
+ type: z9.literal("addColumn"),
6097
+ table: z9.string().min(1).max(63),
6064
6098
  column: columnSpecSchema,
6065
- ifNotExists: z8.boolean().optional()
6099
+ ifNotExists: z9.boolean().optional()
6066
6100
  }),
6067
- z8.object({
6068
- type: z8.literal("dropColumn"),
6069
- table: z8.string().min(1).max(63),
6070
- column: z8.string().min(1).max(63),
6071
- cascade: z8.boolean().optional(),
6072
- ifExists: z8.boolean().optional()
6101
+ z9.object({
6102
+ type: z9.literal("dropColumn"),
6103
+ table: z9.string().min(1).max(63),
6104
+ column: z9.string().min(1).max(63),
6105
+ cascade: z9.boolean().optional(),
6106
+ ifExists: z9.boolean().optional()
6073
6107
  }),
6074
- z8.object({
6075
- type: z8.literal("renameColumn"),
6076
- table: z8.string().min(1).max(63),
6077
- from: z8.string().min(1).max(63),
6078
- to: z8.string().min(1).max(63)
6108
+ z9.object({
6109
+ type: z9.literal("renameColumn"),
6110
+ table: z9.string().min(1).max(63),
6111
+ from: z9.string().min(1).max(63),
6112
+ to: z9.string().min(1).max(63)
6079
6113
  }),
6080
- z8.object({
6081
- type: z8.literal("alterColumnType"),
6082
- table: z8.string().min(1).max(63),
6083
- column: z8.string().min(1).max(63),
6084
- newType: z8.string().min(1),
6114
+ z9.object({
6115
+ type: z9.literal("alterColumnType"),
6116
+ table: z9.string().min(1).max(63),
6117
+ column: z9.string().min(1).max(63),
6118
+ newType: z9.string().min(1),
6085
6119
  /** Optional USING expression for potentially-lossy casts */
6086
- using: z8.string().optional()
6120
+ using: z9.string().optional()
6087
6121
  }),
6088
- z8.object({
6089
- type: z8.literal("alterColumnNullable"),
6090
- table: z8.string().min(1).max(63),
6091
- column: z8.string().min(1).max(63),
6092
- nullable: z8.boolean()
6122
+ z9.object({
6123
+ type: z9.literal("alterColumnNullable"),
6124
+ table: z9.string().min(1).max(63),
6125
+ column: z9.string().min(1).max(63),
6126
+ nullable: z9.boolean()
6093
6127
  }),
6094
- z8.object({
6095
- type: z8.literal("alterColumnDefault"),
6096
- table: z8.string().min(1).max(63),
6097
- column: z8.string().min(1).max(63),
6128
+ z9.object({
6129
+ type: z9.literal("alterColumnDefault"),
6130
+ table: z9.string().min(1).max(63),
6131
+ column: z9.string().min(1).max(63),
6098
6132
  /** null means drop the default; otherwise a SQL expression string. */
6099
- default: z8.string().nullable()
6133
+ default: z9.string().nullable()
6100
6134
  }),
6101
6135
  // Indexes
6102
- z8.object({
6103
- type: z8.literal("addIndex"),
6104
- table: z8.string().min(1).max(63),
6105
- name: z8.string().min(1).max(63),
6106
- columns: z8.array(z8.string().min(1)).min(1),
6107
- unique: z8.boolean().optional(),
6136
+ z9.object({
6137
+ type: z9.literal("addIndex"),
6138
+ table: z9.string().min(1).max(63),
6139
+ name: z9.string().min(1).max(63),
6140
+ columns: z9.array(z9.string().min(1)).min(1),
6141
+ unique: z9.boolean().optional(),
6108
6142
  /** Partial-index WHERE clause, as a raw SQL expression */
6109
- where: z8.string().optional(),
6110
- ifNotExists: z8.boolean().optional()
6143
+ where: z9.string().optional(),
6144
+ ifNotExists: z9.boolean().optional()
6111
6145
  }),
6112
- z8.object({
6113
- type: z8.literal("dropIndex"),
6114
- name: z8.string().min(1).max(63),
6115
- cascade: z8.boolean().optional(),
6116
- ifExists: z8.boolean().optional()
6146
+ z9.object({
6147
+ type: z9.literal("dropIndex"),
6148
+ name: z9.string().min(1).max(63),
6149
+ cascade: z9.boolean().optional(),
6150
+ ifExists: z9.boolean().optional()
6117
6151
  }),
6118
6152
  // Constraints
6119
- z8.object({
6120
- type: z8.literal("addForeignKey"),
6121
- table: z8.string().min(1).max(63),
6122
- name: z8.string().min(1).max(63),
6123
- columns: z8.array(z8.string().min(1)).min(1),
6124
- refTable: z8.string().min(1).max(63),
6125
- refColumns: z8.array(z8.string().min(1)).min(1),
6153
+ z9.object({
6154
+ type: z9.literal("addForeignKey"),
6155
+ table: z9.string().min(1).max(63),
6156
+ name: z9.string().min(1).max(63),
6157
+ columns: z9.array(z9.string().min(1)).min(1),
6158
+ refTable: z9.string().min(1).max(63),
6159
+ refColumns: z9.array(z9.string().min(1)).min(1),
6126
6160
  onDelete: referentialActionSchema.optional(),
6127
6161
  onUpdate: referentialActionSchema.optional()
6128
6162
  }),
6129
- z8.object({
6130
- type: z8.literal("addUniqueConstraint"),
6131
- table: z8.string().min(1).max(63),
6132
- name: z8.string().min(1).max(63),
6133
- columns: z8.array(z8.string().min(1)).min(1)
6163
+ z9.object({
6164
+ type: z9.literal("addUniqueConstraint"),
6165
+ table: z9.string().min(1).max(63),
6166
+ name: z9.string().min(1).max(63),
6167
+ columns: z9.array(z9.string().min(1)).min(1)
6134
6168
  }),
6135
- z8.object({
6136
- type: z8.literal("addCheckConstraint"),
6137
- table: z8.string().min(1).max(63),
6138
- name: z8.string().min(1).max(63),
6139
- expression: z8.string().min(1)
6169
+ z9.object({
6170
+ type: z9.literal("addCheckConstraint"),
6171
+ table: z9.string().min(1).max(63),
6172
+ name: z9.string().min(1).max(63),
6173
+ expression: z9.string().min(1)
6140
6174
  }),
6141
- z8.object({
6142
- type: z8.literal("dropConstraint"),
6143
- table: z8.string().min(1).max(63),
6144
- name: z8.string().min(1).max(63),
6145
- cascade: z8.boolean().optional(),
6146
- ifExists: z8.boolean().optional()
6175
+ z9.object({
6176
+ type: z9.literal("dropConstraint"),
6177
+ table: z9.string().min(1).max(63),
6178
+ name: z9.string().min(1).max(63),
6179
+ cascade: z9.boolean().optional(),
6180
+ ifExists: z9.boolean().optional()
6147
6181
  }),
6148
6182
  // Enum types
6149
- z8.object({
6150
- type: z8.literal("createEnum"),
6151
- name: z8.string().min(1).max(63),
6152
- values: z8.array(z8.string().min(1)).min(1)
6183
+ z9.object({
6184
+ type: z9.literal("createEnum"),
6185
+ name: z9.string().min(1).max(63),
6186
+ values: z9.array(z9.string().min(1)).min(1)
6153
6187
  }),
6154
- z8.object({
6155
- type: z8.literal("alterEnumAddValue"),
6156
- name: z8.string().min(1).max(63),
6157
- value: z8.string().min(1),
6188
+ z9.object({
6189
+ type: z9.literal("alterEnumAddValue"),
6190
+ name: z9.string().min(1).max(63),
6191
+ value: z9.string().min(1),
6158
6192
  /** Position the new value before an existing one (mutually exclusive with `after`) */
6159
- before: z8.string().optional(),
6193
+ before: z9.string().optional(),
6160
6194
  /** Position the new value after an existing one (mutually exclusive with `before`) */
6161
- after: z8.string().optional(),
6162
- ifNotExists: z8.boolean().optional()
6195
+ after: z9.string().optional(),
6196
+ ifNotExists: z9.boolean().optional()
6163
6197
  }),
6164
- z8.object({
6165
- type: z8.literal("dropEnum"),
6166
- name: z8.string().min(1).max(63),
6167
- cascade: z8.boolean().optional(),
6168
- ifExists: z8.boolean().optional()
6198
+ z9.object({
6199
+ type: z9.literal("dropEnum"),
6200
+ name: z9.string().min(1).max(63),
6201
+ cascade: z9.boolean().optional(),
6202
+ ifExists: z9.boolean().optional()
6169
6203
  }),
6170
6204
  // Extensions
6171
- z8.object({
6172
- type: z8.literal("createExtension"),
6173
- name: z8.string().min(1),
6174
- ifNotExists: z8.boolean().optional()
6205
+ z9.object({
6206
+ type: z9.literal("createExtension"),
6207
+ name: z9.string().min(1),
6208
+ ifNotExists: z9.boolean().optional()
6175
6209
  }),
6176
6210
  // Data operations
6177
6211
  /**
@@ -6179,26 +6213,26 @@ var schemaOpSchema = z8.discriminatedUnion("type", [
6179
6213
  * destructive — requires explicit confirm to replay on prod. The
6180
6214
  * `description` is what the agent/user sees at confirm time.
6181
6215
  */
6182
- z8.object({
6183
- type: z8.literal("backfill"),
6184
- description: z8.string().min(1),
6185
- sql: z8.string().min(1)
6216
+ z9.object({
6217
+ type: z9.literal("backfill"),
6218
+ description: z9.string().min(1),
6219
+ sql: z9.string().min(1)
6186
6220
  }),
6187
6221
  /**
6188
6222
  * Escape hatch for DDL the structured ops can't express. `destructive`
6189
6223
  * forces classification — use false only for genuinely additive-only SQL
6190
6224
  * (e.g. CREATE EXTENSION variants the structured op doesn't cover).
6191
6225
  */
6192
- z8.object({
6193
- type: z8.literal("rawSql"),
6194
- description: z8.string().min(1),
6195
- sql: z8.string().min(1),
6196
- destructive: z8.boolean()
6226
+ z9.object({
6227
+ type: z9.literal("rawSql"),
6228
+ description: z9.string().min(1),
6229
+ sql: z9.string().min(1),
6230
+ destructive: z9.boolean()
6197
6231
  })
6198
6232
  ]);
6199
6233
 
6200
6234
  // ../../packages/lib/src/server/module-rail/ops.ts
6201
- import { z as z9 } from "zod";
6235
+ import { z as z10 } from "zod";
6202
6236
 
6203
6237
  // ../../packages/lib/src/server/module-rail/reconcile.ts
6204
6238
  var SANDBOX_BATCH_SIZE = 200;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stardeck-customer-apps/compose",
3
- "version": "0.14.1",
3
+ "version": "0.16.0",
4
4
  "description": "Regenerates a Stardeck app's Module-rail artifacts — the six src/*.gen.ts registries and every route/endpoint stub — from src/modules/*/module.json",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",