@diagonal-hq/cli 0.40.1 → 0.41.1

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-C5ON5QX7.mjs");
617
617
  return { data: checkData(), sdk: scriptSdk() };
618
618
  }
619
619
  function isScriptTestPath(path) {
@@ -274,6 +274,7 @@ export type RegularHoursFieldSettings = CommonFieldSettings & {
274
274
  export type RelationFieldSettings = CommonFieldSettings & {
275
275
  "filters"?: Record<string, unknown> | null;
276
276
  "delete_policy"?: "cascade" | "ignore" | "restrict" | "set_null" | null;
277
+ "foreign_key"?: string | null;
277
278
  /** The relation field that the build adds to the target resource. */
278
279
  inverse?: RelationInverse | null;
279
280
  ui?: {
@@ -369,22 +370,27 @@ export type WalletAccountingEntityFieldSettings = CommonFieldSettings & {
369
370
  };
370
371
  };
371
372
 
373
+ type BelongsToInverseSettings = (
374
+ | { type?: "has_many"; "max_connections"?: number | null }
375
+ | { type: "has_one"; "max_connections"?: null }
376
+ );
377
+
372
378
  /**
373
379
  * 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.
380
+ * and the build derives its type from the declaring relation. Use `RelationInverse<'belongs_to'>` to choose a `has_one` inverse.
375
381
  */
376
- export type RelationInverse = {
382
+ export type RelationInverse<Owner extends string = string> = {
377
383
  /** The uid of the inverse field, unique in the target resource. `diagonal check` writes a missing one. */
378
384
  uid?: DefinitionUid;
379
385
  key: string;
380
386
  label?: string;
381
387
  description?: string | null;
382
- settings?: Omit<RelationFieldSettings, 'inverse'> & { "max_connections"?: number | null };
388
+ settings?: Omit<RelationFieldSettings, 'inverse'> & (Owner extends "belongs_to" ? BelongsToInverseSettings : { type?: never; "max_connections"?: number | null });
383
389
  };
384
390
 
385
391
  /** A relation names its target resource by slug, as `Resources.<Name>`. The type defaults to `belongs_to`. */
386
392
  export type RelationFieldOptions = Omit<BaseFieldOptions<RelationFieldSettings>, 'settings'> & { resource: string } & (
387
- | { type?: "belongs_to"; settings?: RelationFieldSettings }
393
+ | { type?: "belongs_to"; settings?: Omit<RelationFieldSettings, 'inverse'> & { inverse?: RelationInverse<"belongs_to"> | null } }
388
394
  | { type: "belongs_to_many"; settings?: RelationFieldSettings & { "max_connections"?: number | null } }
389
395
  | { type: "has_many"; settings?: RelationFieldSettings & { "max_connections"?: number | null } }
390
396
  | { 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.1",
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
  }