@diagonal-hq/cli 0.30.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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagonal-hq/cli",
3
- "version": "0.30.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": {