@diagonal-hq/cli 0.40.1 → 0.41.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/cli.mjs CHANGED
@@ -613,7 +613,7 @@ async function checkSources() {
613
613
  if (existsSync4(DATA_FILE) && existsSync4(SDK_FILE)) {
614
614
  return { dataFile: DATA_FILE, sdkFile: SDK_FILE };
615
615
  }
616
- const { checkData, scriptSdk } = await import("./cli-check-data-YZ4H6YJ6.mjs");
616
+ const { checkData, scriptSdk } = await import("./cli-check-data-SOAXPNUY.mjs");
617
617
  return { data: checkData(), sdk: scriptSdk() };
618
618
  }
619
619
  function isScriptTestPath(path) {
@@ -369,22 +369,27 @@ export type WalletAccountingEntityFieldSettings = CommonFieldSettings & {
369
369
  };
370
370
  };
371
371
 
372
+ type BelongsToInverseSettings = (
373
+ | { type?: "has_many"; "max_connections"?: number | null }
374
+ | { type: "has_one"; "max_connections"?: null }
375
+ );
376
+
372
377
  /**
373
378
  * The inverse of a relation. It points back at the resource that declares it,
374
- * and its relation type is the inverse of the declaring relation type.
379
+ * and the build derives its type from the declaring relation. Use `RelationInverse<'belongs_to'>` to choose a `has_one` inverse.
375
380
  */
376
- export type RelationInverse = {
381
+ export type RelationInverse<Owner extends string = string> = {
377
382
  /** The uid of the inverse field, unique in the target resource. `diagonal check` writes a missing one. */
378
383
  uid?: DefinitionUid;
379
384
  key: string;
380
385
  label?: string;
381
386
  description?: string | null;
382
- settings?: Omit<RelationFieldSettings, 'inverse'> & { "max_connections"?: number | null };
387
+ settings?: Omit<RelationFieldSettings, 'inverse'> & (Owner extends "belongs_to" ? BelongsToInverseSettings : { type?: never; "max_connections"?: number | null });
383
388
  };
384
389
 
385
390
  /** A relation names its target resource by slug, as `Resources.<Name>`. The type defaults to `belongs_to`. */
386
391
  export type RelationFieldOptions = Omit<BaseFieldOptions<RelationFieldSettings>, 'settings'> & { resource: string } & (
387
- | { type?: "belongs_to"; settings?: RelationFieldSettings }
392
+ | { type?: "belongs_to"; settings?: Omit<RelationFieldSettings, 'inverse'> & { inverse?: RelationInverse<"belongs_to"> | null } }
388
393
  | { type: "belongs_to_many"; settings?: RelationFieldSettings & { "max_connections"?: number | null } }
389
394
  | { type: "has_many"; settings?: RelationFieldSettings & { "max_connections"?: number | null } }
390
395
  | { type: "has_one"; settings?: RelationFieldSettings }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagonal-hq/cli",
3
- "version": "0.40.1",
3
+ "version": "0.41.0",
4
4
  "description": "The diagonal CLI and the configuration helpers for file-based Diagonal workspaces.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -51,8 +51,8 @@
51
51
  "bun": "1.4.4"
52
52
  },
53
53
  "optionalDependencies": {
54
- "@diagonal-hq/workflow-script-compiler-darwin-arm64": "0.1.0-h470cc3c437fa",
55
- "@diagonal-hq/workflow-script-compiler-linux-x64": "0.1.0-h470cc3c437fa",
56
- "@diagonal-hq/workflow-script-compiler-linux-arm64": "0.1.0-h470cc3c437fa"
54
+ "@diagonal-hq/workflow-script-compiler-darwin-arm64": "0.1.0-hcad94e7c5df7",
55
+ "@diagonal-hq/workflow-script-compiler-linux-x64": "0.1.0-hcad94e7c5df7",
56
+ "@diagonal-hq/workflow-script-compiler-linux-arm64": "0.1.0-hcad94e7c5df7"
57
57
  }
58
58
  }