@apotech-os/cli 0.7.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()),
@@ -22862,6 +22888,10 @@ 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(),
@@ -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(),
@@ -22975,8 +23001,6 @@ var CoreOrderSchema = external_exports.object({
22975
23001
  });
22976
23002
  var coreOrder = {
22977
23003
  key: "order",
22978
- prismaModel: "AppRecord",
22979
- appRecord: { appSlug: "_core", objectKey: "shopify-order" },
22980
23004
  schema: CoreOrderSchema,
22981
23005
  requiredRole: "VIEWER"
22982
23006
  };
@@ -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
  }