@diagonal-hq/cli 0.29.0 → 0.30.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.
@@ -4494,6 +4494,11 @@ type SdkDisplayFormatOptions = {
4494
4494
  durationUnit?: 'milliseconds' | 'seconds' | 'minutes' | 'hours';
4495
4495
  };
4496
4496
 
4497
+ type SdkDisplayPriceOptions = {
4498
+ /** Use a short suffix or a long billing phrase. Defaults to `short`. */
4499
+ style?: 'short' | 'long';
4500
+ };
4501
+
4497
4502
  type SdkRecordInput<TRecord extends ResourceRecord = ResourceRecord> =
4498
4503
  | TRecord
4499
4504
  | { fields?: TRecord | null }
@@ -4537,6 +4542,29 @@ type SdkDisplayUtils = {
4537
4542
  options?: SdkDisplayFormatOptions
4538
4543
  ) => string | null;
4539
4544
 
4545
+ /**
4546
+ * Format money with its billing recurrence for string contexts such as template
4547
+ * literals and `<option>` labels. Pass the recurrence select field handle so an
4548
+ * unknown value can use its option label, or its raw value if no label exists.
4549
+ * Uses the existing money formatter. The default style is `short`.
4550
+ * `one_time`, nullish, and empty recurrence values return the amount alone.
4551
+ * Invalid money, malformed fields, and invalid styles return `null` and report
4552
+ * the standard SDK diagnostic.
4553
+ *
4554
+ * @example
4555
+ * const recurrence = prices.fields.recurrence;
4556
+ * const amount = { amount: 5000, currency: 'USD' };
4557
+ * Sdk.utils.display.price(recurrence, 'monthly', amount); // '$50.00/mo'
4558
+ * Sdk.utils.display.price(recurrence, 'monthly', amount, { style: 'long' }); // '$50.00 per month'
4559
+ * Sdk.utils.display.price(recurrence, 'weekly', amount); // '$50.00 (Weekly)' with an option label
4560
+ */
4561
+ price: (
4562
+ field: SdkResourceField | null | undefined,
4563
+ recurrence: any,
4564
+ amount: any,
4565
+ options?: SdkDisplayPriceOptions
4566
+ ) => string | null;
4567
+
4540
4568
  /**
4541
4569
  * Build initials from the first `count` whitespace-delimited name parts.
4542
4570
  * `count` defaults to `2`. Nullish/blank names or an invalid count return `''`
@@ -4654,11 +4682,17 @@ type SdkUtils = Omit<TaskUtils, 'workspace' | 'workflow' | 'tiptap'> & {
4654
4682
  * @remarks
4655
4683
  * `format` delegates date, time, money, number, phone, and location rendering to the
4656
4684
  * existing SDK formatters so their current locale and timezone behavior remains consistent.
4685
+ * Use `price` for billing recurrence wording in template literals and `<option>` labels.
4657
4686
  * Nullish or malformed values return `null` with the standard SDK diagnostic;
4658
4687
  * `fieldValue` returns `null`.
4659
4688
  *
4660
4689
  * @example
4661
4690
  * const status = Sdk.utils.display.format(tasks.fields.status, task.status);
4691
+ * const recurrence = prices.fields.recurrence;
4692
+ * const amount = { amount: 5000, currency: 'USD' };
4693
+ * Sdk.utils.display.price(recurrence, 'monthly', amount); // '$50.00/mo'
4694
+ * Sdk.utils.display.price(recurrence, 'monthly', amount, { style: 'long' }); // '$50.00 per month'
4695
+ * Sdk.utils.display.price(recurrence, 'weekly', amount); // '$50.00 (Weekly)' with an option label
4662
4696
  */
4663
4697
  display: SdkDisplayUtils;
4664
4698
  };
@@ -14731,6 +14765,7 @@ declare namespace Sdk {
14731
14765
  export type NotifyVariant = import("diagonal:sdk-internal").SdkNotifyVariant;
14732
14766
  export type BadgeVariant = import("diagonal:sdk-internal").SdkBadgeVariant;
14733
14767
  export type DisplayFormatOptions = import("diagonal:sdk-internal").SdkDisplayFormatOptions;
14768
+ export type DisplayPriceOptions = import("diagonal:sdk-internal").SdkDisplayPriceOptions;
14734
14769
  export type FieldSelector<TKey extends string = string> = import("diagonal:sdk-internal").SdkFieldSelector<TKey>;
14735
14770
  export type RecordInput<TRecord extends import("diagonal:sdk-internal").ResourceRecord = import("diagonal:sdk-internal").ResourceRecord> = import("diagonal:sdk-internal").SdkRecordInput<TRecord>;
14736
14771
  export type FieldValue<TRecord extends import("diagonal:sdk-internal").ResourceRecord, TSelector extends import("diagonal:sdk-internal").SdkFieldSelector> = import("diagonal:sdk-internal").SdkFieldValue<TRecord, TSelector>;
@@ -1,7 +1,7 @@
1
1
  import type { ResourceKeyWith } from '../data';
2
2
  import type { ContentDocument } from '../input';
3
3
  import type { DeepReadonly, Liquid, StaticLiquid } from '../liquid';
4
- export declare const SDK_VERSION = 75;
4
+ export declare const SDK_VERSION = 76;
5
5
  export interface WorkspaceSystemFields {
6
6
  "ai_custom_system_prompt": string | null;
7
7
  "brand_kit": {
@@ -964,6 +964,8 @@ export interface NumberFormatInput {
964
964
  }
965
965
  export type NumberFormatOutput = string;
966
966
  export interface PackageInstallInputInput {
967
+ package_id: string;
968
+ key: string;
967
969
  }
968
970
  export type PackageInstallInputOutput = unknown;
969
971
  export interface PageUrlInput {
@@ -1811,8 +1813,7 @@ export interface TextHashInput {
1811
1813
  value: string;
1812
1814
  }
1813
1815
  export type TextHashOutput = string;
1814
- export interface TextRandomUuidInput {
1815
- }
1816
+ export type TextRandomUuidInput = Record<string, never>;
1816
1817
  export type TextRandomUuidOutput = string;
1817
1818
  export interface TextToContentInput {
1818
1819
  value: string;
@@ -1870,11 +1871,9 @@ export interface TiptapParseInput {
1870
1871
  placeholder?: string;
1871
1872
  }
1872
1873
  export type TiptapParseOutput = unknown;
1873
- export interface TransactionBeginInput {
1874
- }
1874
+ export type TransactionBeginInput = Record<string, never>;
1875
1875
  export type TransactionBeginOutput = null;
1876
- export interface TransactionCommitInput {
1877
- }
1876
+ export type TransactionCommitInput = Record<string, never>;
1878
1877
  export type TransactionCommitOutput = null;
1879
1878
  export interface TransactionRollbackInput {
1880
1879
  error?: {
@@ -2097,8 +2096,7 @@ export interface WorkspaceValueInput {
2097
2096
  defaultValue?: unknown;
2098
2097
  }
2099
2098
  export type WorkspaceValueOutput = unknown;
2100
- export interface WorkspaceValuesInput {
2101
- }
2099
+ export type WorkspaceValuesInput = Record<string, never>;
2102
2100
  export type WorkspaceValuesOutput = Record<string, unknown>;
2103
2101
  export declare const ai: {
2104
2102
  /** Ask a decisions model typed questions about some content and get labelled answers with their probabilities */
@@ -2337,7 +2335,7 @@ export declare const text: {
2337
2335
  /** Hash a text value */
2338
2336
  hash: (input: TextHashInput) => Promise<TextHashOutput>;
2339
2337
  /** Generate a random UUID v7 */
2340
- randomUuid: (input: TextRandomUuidInput) => Promise<TextRandomUuidOutput>;
2338
+ randomUuid: (input?: TextRandomUuidInput) => Promise<TextRandomUuidOutput>;
2341
2339
  /** Convert a plain text string into rich Content */
2342
2340
  toContent: (input: TextToContentInput) => Promise<TextToContentOutput>;
2343
2341
  };
@@ -2367,9 +2365,9 @@ export declare const tiptap: {
2367
2365
  };
2368
2366
  export declare const transaction: {
2369
2367
  /** Transaction control for transaction(). */
2370
- begin: (input: TransactionBeginInput) => Promise<TransactionBeginOutput>;
2368
+ begin: (input?: TransactionBeginInput) => Promise<TransactionBeginOutput>;
2371
2369
  /** Transaction control for transaction(). */
2372
- commit: (input: TransactionCommitInput) => Promise<TransactionCommitOutput>;
2370
+ commit: (input?: TransactionCommitInput) => Promise<TransactionCommitOutput>;
2373
2371
  /** Transaction control for transaction(). */
2374
2372
  rollback: (input: TransactionRollbackInput) => Promise<TransactionRollbackOutput>;
2375
2373
  };
@@ -2415,5 +2413,5 @@ export declare const workspace: {
2415
2413
  /** Get the value of a field in a workspace */
2416
2414
  value: (input: WorkspaceValueInput) => Promise<WorkspaceValueOutput>;
2417
2415
  /** Get all workspace field values as a dictionary */
2418
- values: (input: WorkspaceValuesInput) => Promise<WorkspaceValuesOutput>;
2416
+ values: (input?: WorkspaceValuesInput) => Promise<WorkspaceValuesOutput>;
2419
2417
  };
@@ -1,4 +1,4 @@
1
- import { type WorkspaceSystemFields } from './generated/capabilities';
1
+ import { type WorkspaceSystemFields, type WorkspaceValuesInput } from './generated/capabilities';
2
2
  import type { WorkspaceFieldCatalog } from './index';
3
3
  type Fields = Omit<WorkspaceSystemFields, keyof WorkspaceFieldCatalog> & WorkspaceFieldCatalog;
4
4
  type Property<T, K extends string> = T extends null | undefined ? never : T extends readonly (infer Item)[] ? K extends `${number}` ? K extends keyof T ? T[K] : Item : unknown : T extends object ? K extends keyof T ? T[K] : unknown : unknown;
@@ -27,7 +27,7 @@ export declare const workspace: {
27
27
  key: K;
28
28
  value?: WriteValue<NoInfer<K>>;
29
29
  }) => Promise<WriteValue<K>>;
30
- values: (input?: Record<never, never>) => Promise<WorkspaceValues>;
30
+ values: (input?: WorkspaceValuesInput) => Promise<WorkspaceValues>;
31
31
  setValues: <V extends Record<string, unknown> = Record<never, never>>(input: {
32
32
  values?: V & WrittenValues<NoInfer<V>>;
33
33
  }) => Promise<WrittenValues<V>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagonal-hq/cli",
3
- "version": "0.29.0",
3
+ "version": "0.30.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": {