@apotech-os/cli 0.6.0 → 0.8.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.js CHANGED
@@ -22754,7 +22754,7 @@ var FunctionTriggerSchema = external_exports.discriminatedUnion("type", [
22754
22754
  timeoutMs: external_exports.number().int().min(1e3).max(3e4).optional()
22755
22755
  })
22756
22756
  ]);
22757
- var FunctionDefSchema = external_exports.object({
22757
+ var FunctionDefFieldsSchema = external_exports.object({
22758
22758
  universalIdentifier: external_exports.string(),
22759
22759
  name: external_exports.string(),
22760
22760
  trigger: FunctionTriggerSchema,
@@ -22780,7 +22780,33 @@ var FunctionDefSchema = external_exports.object({
22780
22780
  * Must be a name declared in manifest.emits OR the name of another function in
22781
22781
  * the same app. Cross-manifest validation is enforced by AppSyncService.
22782
22782
  */
22783
- onFailure: external_exports.string().optional()
22783
+ onFailure: external_exports.string().optional(),
22784
+ /**
22785
+ * Lot 4 — Optional input schema for the two triggers whose payload is caller-
22786
+ * controlled rather than platform-shaped: `uiInvoke` (a browser session) and
22787
+ * `httpRoute` (an external HTTP caller). Reuses the same `FieldDef` vocabulary
22788
+ * as `records[].fields` and `settings.fields` — a deliberate decision to keep
22789
+ * one field vocabulary across the whole contract instead of adding a second,
22790
+ * more expressive free-form JSON Schema surface (see spec "Décisions prises").
22791
+ *
22792
+ * Validated server-side with the existing `fieldDefsToZod` before the handler
22793
+ * runs; a violating payload is rejected `422 INVALID_INPUT` and the handler is
22794
+ * never invoked (apps/api/src/platform-data/app-input-validation.ts).
22795
+ *
22796
+ * Absent on `cron` / `dbEvent` / `event` triggers, whose payload is authored by
22797
+ * the platform, not the app — declaring an input schema there is always a
22798
+ * mistake and is rejected by the refinement below.
22799
+ */
22800
+ input: external_exports.array(FieldDefSchema).optional()
22801
+ });
22802
+ var FunctionDefSchema = FunctionDefFieldsSchema.superRefine((fn, ctx) => {
22803
+ if (fn.input && fn.trigger.type !== "uiInvoke" && fn.trigger.type !== "httpRoute") {
22804
+ ctx.addIssue({
22805
+ code: "custom",
22806
+ path: ["input"],
22807
+ message: `"input" is only allowed on uiInvoke and httpRoute triggers, not "${fn.trigger.type}"`
22808
+ });
22809
+ }
22784
22810
  });
22785
22811
  var AppRoleSchema = external_exports.object({
22786
22812
  reads: external_exports.array(external_exports.string()),
@@ -22854,7 +22880,7 @@ var AppManifestFieldsSchema = external_exports.object({
22854
22880
  placeholder: external_exports.boolean().optional(),
22855
22881
  // true for spaces with no views yet
22856
22882
  reads: external_exports.array(external_exports.string()),
22857
- // core objects read: ['shopify-order.v1']
22883
+ // core objects read: ['order']
22858
22884
  hooks: AppHooksSchema.optional(),
22859
22885
  applicationVariables: external_exports.array(ApplicationVariableSchema).optional(),
22860
22886
  serverVariables: external_exports.array(ServerVariableSchema).optional(),
@@ -22862,10 +22888,14 @@ var AppManifestFieldsSchema = external_exports.object({
22862
22888
  // #71: React UI pages bundled in the artifact
22863
22889
  uiSdkVersion: external_exports.string().optional(),
22864
22890
  // #85: @apotech-os/ui-sdk version stamped by CLI at build time
22891
+ // UI contract number stamped by the CLI (from ui-sdk's package.json `uiContractVersion`).
22892
+ // Only bumped on breaking changes of the runtime API the shell provides to pages,
22893
+ // so lockstep npm releases don't invalidate installed apps.
22894
+ uiContractVersion: external_exports.number().int().min(1).optional(),
22865
22895
  records: external_exports.array(
22866
22896
  external_exports.object({
22867
22897
  universalIdentifier: external_exports.string().uuid(),
22868
- // objectKey allows letters, digits, hyphens, dots (e.g. 'shopify-order.v1', 'product').
22898
+ // objectKey allows letters, digits, hyphens, dots (e.g. 'sales-order.v2', 'product').
22869
22899
  // Bars SQL-injection chars: no quotes, semicolons, spaces, or control chars.
22870
22900
  objectKey: external_exports.string().regex(
22871
22901
  /^[a-zA-Z][a-zA-Z0-9._-]*$/,
@@ -22880,11 +22910,7 @@ var AppManifestFieldsSchema = external_exports.object({
22880
22910
  indexes: external_exports.array(IndexDefSchema).max(10).optional()
22881
22911
  })
22882
22912
  ),
22883
- /** @deprecated Use `records[]` instead — issue #73 migrated all apps to AppRecord. */
22884
- ownsTables: external_exports.array(external_exports.string()).optional(),
22885
22913
  actions: external_exports.array(external_exports.object({ provider: external_exports.string(), action: external_exports.string() })),
22886
- jobs: external_exports.array(external_exports.string()).default([]),
22887
- // deprecated — use functions instead
22888
22914
  functions: external_exports.array(FunctionDefSchema).optional(),
22889
22915
  // Phase 6: typed function declarations
22890
22916
  views: external_exports.array(ViewDefSchema).optional(),
@@ -22960,7 +22986,7 @@ var AppManifestSchema = AppManifestFieldsSchema.superRefine((manifest, ctx) => {
22960
22986
  });
22961
22987
  }
22962
22988
  });
22963
- var ShopifyOrderV1Schema = external_exports.object({
22989
+ var CoreOrderSchema = external_exports.object({
22964
22990
  id: external_exports.string(),
22965
22991
  shopifyId: external_exports.string(),
22966
22992
  createdAt: external_exports.coerce.date(),
@@ -22973,14 +22999,12 @@ var ShopifyOrderV1Schema = external_exports.object({
22973
22999
  note: external_exports.string().nullable(),
22974
23000
  customerId: external_exports.string().nullable()
22975
23001
  });
22976
- var shopifyOrderV1 = {
22977
- key: "shopify-order.v1",
22978
- prismaModel: "AppRecord",
22979
- appRecord: { appSlug: "_core", objectKey: "shopify-order" },
22980
- schema: ShopifyOrderV1Schema,
23002
+ var coreOrder = {
23003
+ key: "order",
23004
+ schema: CoreOrderSchema,
22981
23005
  requiredRole: "VIEWER"
22982
23006
  };
22983
- var CORE_OBJECTS = /* @__PURE__ */ new Map([[shopifyOrderV1.key, shopifyOrderV1]]);
23007
+ var CORE_OBJECTS = /* @__PURE__ */ new Map([[coreOrder.key, coreOrder]]);
22984
23008
 
22985
23009
  // src/manifest-build.ts
22986
23010
  var ManifestBuildError = class extends Error {
@@ -23197,7 +23221,11 @@ function stampUiSdkVersion(manifest, projectRoot, hasUiBundles) {
23197
23221
  try {
23198
23222
  const pkg = JSON.parse((0, import_fs4.readFileSync)(candidate, "utf8"));
23199
23223
  if (pkg.version) {
23200
- return { ...manifest, uiSdkVersion: pkg.version };
23224
+ return {
23225
+ ...manifest,
23226
+ uiSdkVersion: pkg.version,
23227
+ ...Number.isInteger(pkg.uiContractVersion) ? { uiContractVersion: pkg.uiContractVersion } : {}
23228
+ };
23201
23229
  }
23202
23230
  } catch {
23203
23231
  }