@diagonal-hq/cli 0.1.0 → 0.3.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.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import './globals';
2
+ import type { ResourceCapabilities } from './capabilities.generated';
3
+ import type { DataApiEndpoint, FieldDefinition, FieldType } from './fields.generated';
2
4
 
3
5
  // The configuration helpers of file-based workspaces. The workspace build
4
6
  // reads these calls as static data. index.js implements each define* function
@@ -20,62 +22,19 @@ export type ConfigDefinition = {
20
22
 
21
23
  export declare function defineConfig<const T extends ConfigDefinition>(config: T): T;
22
24
 
23
- export type FieldType =
24
- | 'text'
25
- | 'email'
26
- | 'number'
27
- | 'boolean'
28
- | 'date'
29
- | 'datetime'
30
- | 'phone'
31
- | 'url'
32
- | 'select'
33
- | 'money'
34
- | 'markdown'
35
- | 'relation';
36
-
37
- export type FieldOptions = {
38
- label?: string;
39
- description?: string | null;
40
- required?: boolean;
41
- unique?: boolean;
42
- index?: boolean;
43
- default?: StaticValue;
44
- [setting: string]: StaticValue | undefined;
45
- };
46
-
47
- export type SelectOption = { label: string; value: string };
48
-
49
- export type SelectFieldOptions = FieldOptions & { options: readonly SelectOption[] };
50
-
51
- export type RelationType = 'belongs_to' | 'has_many' | 'belongs_to_many';
52
-
53
- export type RelationFieldOptions = FieldOptions & {
54
- /** The id or slug of the related resource. */
55
- resource: string;
56
- type?: RelationType;
57
- };
58
-
59
- export type FieldDefinition<TType extends FieldType = FieldType> = {
60
- readonly $field: TType;
61
- };
62
-
63
- export declare const field: {
64
- text(options?: FieldOptions): FieldDefinition<'text'>;
65
- /** Stored as a `text` field. */
66
- longText(options?: FieldOptions): FieldDefinition<'text'>;
67
- email(options?: FieldOptions): FieldDefinition<'email'>;
68
- number(options?: FieldOptions): FieldDefinition<'number'>;
69
- boolean(options?: FieldOptions): FieldDefinition<'boolean'>;
70
- date(options?: FieldOptions): FieldDefinition<'date'>;
71
- datetime(options?: FieldOptions): FieldDefinition<'datetime'>;
72
- phone(options?: FieldOptions): FieldDefinition<'phone'>;
73
- url(options?: FieldOptions): FieldDefinition<'url'>;
74
- select(options: SelectFieldOptions): FieldDefinition<'select'>;
75
- money(options?: FieldOptions): FieldDefinition<'money'>;
76
- markdown(options?: FieldOptions): FieldDefinition<'markdown'>;
77
- relation(options: RelationFieldOptions): FieldDefinition<'relation'>;
78
- };
25
+ export { field } from './fields.generated';
26
+ export type {
27
+ CommonFieldSettings,
28
+ DataApiEndpoint,
29
+ FieldDefinition,
30
+ FieldSchemaDefinition,
31
+ FieldSchemaSetting,
32
+ FieldType,
33
+ RelationFieldOptions,
34
+ RelationInverse,
35
+ Resolver
36
+ } from './fields.generated';
37
+ export type { CapabilityType, FieldKeyOf, ResourceCapabilities } from './capabilities.generated';
79
38
 
80
39
  export type PolicyScope =
81
40
  | 'index'
@@ -103,34 +62,67 @@ export type IndexDefinition<TKey extends string = string> = {
103
62
  unique?: boolean;
104
63
  };
105
64
 
65
+ export type ResourceEmbeddings<TKey extends string = string> = {
66
+ enabled?: boolean;
67
+ /** Field keys. Relation paths are not allowed. */
68
+ fields?: readonly TKey[] | null;
69
+ };
70
+
71
+ export type ResourceDataApi = {
72
+ /** An omitted endpoint stays enabled. */
73
+ endpoints?: Partial<Record<DataApiEndpoint, { enabled?: boolean }>>;
74
+ };
75
+
106
76
  export type ResourceDefinition<
107
77
  TFields extends Record<string, FieldDefinition> = Record<string, FieldDefinition>
108
78
  > = {
109
- /**
110
- * A lowercase UUID v7, for example '0199f000-0000-7000-8000-000000000001'.
111
- * `diagonal check` suggests a new one when the id is not v7. Keep it
112
- * stable: records and workflows refer to it.
113
- */
114
- id: string;
115
- slug: string;
79
+ /** Only a platform resource reference sets `platform`. */
80
+ platform?: never;
116
81
  name: string;
117
82
  singularName: string;
118
83
  displayField?: Extract<keyof TFields, string>;
84
+ /**
85
+ * The field keys and relation paths that record search matches, for example
86
+ * `['title', 'body', 'author.full_name']`. Without it, search matches the
87
+ * display field and every text and markdown field.
88
+ */
89
+ searchableFields?: readonly (
90
+ | Extract<keyof TFields, string>
91
+ | `${Extract<keyof TFields, string>}.${string}`
92
+ )[];
93
+ /** Every field key once, in the order that forms and tables show them. Defaults to the order of `fields`. */
94
+ fieldOrder?: readonly Extract<keyof TFields, string>[];
119
95
  fields: TFields;
120
96
  indexes?: readonly IndexDefinition<Extract<keyof TFields, string>>[];
97
+ embeddings?: ResourceEmbeddings<Extract<keyof TFields, string>>;
98
+ dataApi?: ResourceDataApi;
99
+ /** A static resource refuses normal record writes. */
100
+ static?: boolean;
121
101
  policies: readonly PolicyDefinition[];
102
+ /**
103
+ * The platform capabilities of the resource, keyed by capability. A field
104
+ * reference names a field of this resource by its key. The deploy validates
105
+ * each capability against the deployed schema and runs its provisioning.
106
+ */
107
+ capabilities?: ResourceCapabilities<TFields>;
122
108
  };
123
109
 
110
+ /**
111
+ * A resource that the platform provisions and owns, such as the roles. The
112
+ * file gives it a `Resources` entry. The deploy does not change it.
113
+ */
114
+ export type PlatformResourceDefinition = { platform: true };
115
+
124
116
  export declare function defineResource<const TFields extends Record<string, FieldDefinition>>(
125
- resource: ResourceDefinition<TFields>
126
- ): ResourceDefinition<TFields>;
117
+ resource: ResourceDefinition<TFields> | PlatformResourceDefinition
118
+ ): ResourceDefinition<TFields> | PlatformResourceDefinition;
127
119
 
128
120
  /** A TipTap document whose mentions resolve against the page's bound records. */
129
121
  export type PageMetaResolver = { readonly type: string; readonly [key: string]: unknown };
130
122
 
131
123
  export type PageRouteParam = {
132
- /** The slug or id of the resource whose record the parameter names. */
133
- resource: string;
124
+ /** The resource whose record the parameter names, as `Resources.<Name>`. */
125
+ resource: ResourceReference;
134
126
  /** The field the parameter matches. Defaults to the record id. */
135
127
  lookupField?: string | null;
136
128
  /** Relation fields to load with the record. */
@@ -142,8 +134,8 @@ export type PageAuthorizer =
142
134
  | null
143
135
  | 'authenticated'
144
136
  | {
145
- /** The slug or id of the resource whose signed-in records may view the page. */
146
- resource?: string | null;
137
+ /** The resource whose signed-in records may view the page, as `Resources.<Name>`. */
138
+ resource?: ResourceReference | null;
147
139
  /** Permission ids. A viewer needs any one of them. */
148
140
  permissions?: readonly string[];
149
141
  };
@@ -183,20 +175,17 @@ export declare function definePage<const T extends PageDefinition>(
183
175
 
184
176
  export type LayoutProps = { children?: React.ReactNode };
185
177
 
186
- export type EmailDefinition = { subject: string };
187
-
188
- export declare function defineEmail<const T extends EmailDefinition, P>(
189
- email: T,
190
- component: (props: P) => unknown
191
- ): T;
192
-
193
178
  export type NavigationItem = { label: string; route: string; icon?: string | null };
194
179
 
195
180
  export type NavigationDefinition = { id: string; items: readonly NavigationItem[] };
196
181
 
197
182
  export declare function defineNavigation<const T extends NavigationDefinition>(navigation: T): T;
198
183
 
199
- /** The slug, name, or id of a resource. */
184
+ /**
185
+ * The slug of a resource: its file name in `resources/`. Use `Resources.<Name>`
186
+ * from `@app/generated/resources`, which `diagonal check` writes, so the editor
187
+ * and the build catch a wrong name. A slug string builds with a warning.
188
+ */
200
189
  export type ResourceReference = string;
201
190
 
202
191
  export type WorkflowRunAs =
@@ -272,3 +261,113 @@ export type WorkflowConfig =
272
261
  })
273
262
  | (ConfigBase & { trigger: ManualTrigger; runAs?: Exclude<WorkflowRunAs, 'session'> })
274
263
  | (ConfigBase & { trigger: RecordLifecycleTrigger });
264
+
265
+ /**
266
+ * Liquid source: inline text, or the path of a `.liquid` file relative to the
267
+ * definition file, for example `{ file: './standard.email.liquid' }`.
268
+ */
269
+ export type LiquidSource = string | { readonly file: `./${string}.liquid` };
270
+
271
+ /** The key of a notification type. */
272
+ export type NotificationTypeReference = string;
273
+
274
+ /** The key of a template, unique within its notification type. */
275
+ export type NotificationTemplateReference = string;
276
+
277
+ /** The key of an email layout, or `'default'` for the built-in layout. */
278
+ export type EmailLayoutReference = string;
279
+
280
+ /** A variable whose value is one record. The sender passes the record id. */
281
+ export type RecordVariableDefinition = {
282
+ /** The slug of the resource whose record the sender passes. */
283
+ resource: ResourceReference;
284
+ label?: string;
285
+ description?: string | null;
286
+ required?: boolean;
287
+ };
288
+
289
+ /**
290
+ * A value that the sender passes to the notification. The name cannot be
291
+ * `record` or `ref`: templates read the recipient as `{{ record.* }}` and the
292
+ * generators as `{{ ref.* }}`.
293
+ */
294
+ export type NotificationVariableDefinition =
295
+ | FieldDefinition<Exclude<FieldType, 'relation'>>
296
+ | RecordVariableDefinition;
297
+
298
+ /** A `notifications/<key>/type.ts` file. */
299
+ export type NotificationTypeDefinition = {
300
+ /**
301
+ * Lowercase letters, digits, and hyphens, for example `'member-welcome'`.
302
+ * Templates, fixtures, and workflows refer to it. Moving the file keeps it.
303
+ */
304
+ key: string;
305
+ name: string;
306
+ /**
307
+ * The resource that receives the notification. The resource maps the email
308
+ * and phone fields. Leave it out to send to email addresses.
309
+ */
310
+ recipient?: { resource: ResourceReference };
311
+ variables?: { readonly [key: string]: NotificationVariableDefinition };
312
+ defaultTemplate: NotificationTemplateReference;
313
+ };
314
+
315
+ export declare function defineNotificationType<const T extends NotificationTypeDefinition>(
316
+ type: T
317
+ ): T;
318
+
319
+ export type NotificationReference = {
320
+ label: string;
321
+ /** The server generator, for example `'page.url'` or `'workspace.login_url'`. */
322
+ generator: string;
323
+ settings?: { readonly [setting: string]: StaticValue };
324
+ };
325
+
326
+ export type NotificationTemplateEmail = {
327
+ subject: string;
328
+ /** Defaults to `'default'`, the built-in layout with one field, `content`. */
329
+ layout?: EmailLayoutReference;
330
+ /** A value for each field of the layout. */
331
+ fields: { readonly [field: string]: LiquidSource };
332
+ };
333
+
334
+ export type NotificationTemplateSms = { body: LiquidSource };
335
+
336
+ /** A `notifications/<type key>/<key>.template.ts` file. A template has an email, an SMS, or both. */
337
+ export type NotificationTemplateDefinition = {
338
+ /** Unique within its type, for example `'standard'`. */
339
+ key: string;
340
+ type: NotificationTypeReference;
341
+ name: string;
342
+ /** Generators that the template reads as `{{ ref.<key> }}`. */
343
+ references?: { readonly [key: string]: NotificationReference };
344
+ } & (
345
+ | { email: NotificationTemplateEmail; sms?: NotificationTemplateSms }
346
+ | { email?: NotificationTemplateEmail; sms: NotificationTemplateSms }
347
+ );
348
+
349
+ export declare function defineNotificationTemplate<const T extends NotificationTemplateDefinition>(
350
+ template: T
351
+ ): T;
352
+
353
+ /** A slot in the layout body. A template fills it with Liquid. */
354
+ export type EmailLayoutFieldDefinition = {
355
+ label: string;
356
+ description?: string | null;
357
+ required?: boolean;
358
+ };
359
+
360
+ /** An `email-layouts/<key>/layout.ts` file. */
361
+ export type EmailLayoutDefinition = {
362
+ /**
363
+ * Lowercase letters, digits, and hyphens, for example `'standard'`. Templates
364
+ * refer to it. `'default'` is the built-in layout.
365
+ */
366
+ key: string;
367
+ name: string;
368
+ body: LiquidSource;
369
+ /** The fields that each template fills in. The body reads them as `{{ <field> }}`. */
370
+ fields?: { readonly [key: string]: EmailLayoutFieldDefinition };
371
+ };
372
+
373
+ export declare function defineEmailLayout<const T extends EmailLayoutDefinition>(layout: T): T;
package/dist/index.js CHANGED
@@ -2,6 +2,9 @@
2
2
  // data, so the helpers only return their argument. A Vite build or a Node
3
3
  // script that imports a configuration file runs them.
4
4
  //
5
+ // The field builders come from fields.generated.js, which
6
+ // `artisan app:generate-custom-typescript` generates from the field types.
7
+ //
5
8
  // Each function must not refer to anything outside its own body:
6
9
  // scripts/lib/runtime-build/app-modules.mjs copies their source into the
7
10
  // workspace modules that a page or a workflow imports.
@@ -12,22 +15,12 @@ export const defineResource = (resource) => resource;
12
15
 
13
16
  export const definePage = (page, _component) => page;
14
17
 
15
- export const defineEmail = (email, _component) => email;
16
-
17
18
  export const defineNavigation = (navigation) => navigation;
18
19
 
19
- export const field = {
20
- text: (options = {}) => ({ $field: 'text', ...options }),
21
- longText: (options = {}) => ({ $field: 'text', ...options }),
22
- email: (options = {}) => ({ $field: 'email', ...options }),
23
- number: (options = {}) => ({ $field: 'number', ...options }),
24
- boolean: (options = {}) => ({ $field: 'boolean', ...options }),
25
- date: (options = {}) => ({ $field: 'date', ...options }),
26
- datetime: (options = {}) => ({ $field: 'datetime', ...options }),
27
- phone: (options = {}) => ({ $field: 'phone', ...options }),
28
- url: (options = {}) => ({ $field: 'url', ...options }),
29
- select: (options) => ({ $field: 'select', ...options }),
30
- money: (options = {}) => ({ $field: 'money', ...options }),
31
- markdown: (options = {}) => ({ $field: 'markdown', ...options }),
32
- relation: (options) => ({ $field: 'relation', ...options })
33
- };
20
+ export const defineNotificationType = (type) => type;
21
+
22
+ export const defineNotificationTemplate = (template) => template;
23
+
24
+ export const defineEmailLayout = (layout) => layout;
25
+
26
+ export { field } from './fields.generated.js';
@@ -119,6 +119,8 @@ type SdkResourceField = {
119
119
  settings: SdkResourceFieldSettings;
120
120
  /** Dotted accessor path; equals `key` at the top level, `parent.key` once nested. */
121
121
  path: string;
122
+ /** A Boolean field's configured default; form checkboxes start from it. */
123
+ default_value?: boolean | null;
122
124
  /** Relation-only decoration, filled lazily by the SDK builder from the flat catalog. */
123
125
  display_field_key?: string | null;
124
126
  column_label?: string | null;
@@ -2327,7 +2329,7 @@ type SdkScheduledNotificationDetail = Omit<SdkUpcomingNotification, 'status'> &
2327
2329
 
2328
2330
  type SdkScheduledNotificationEdits = {
2329
2331
  recipient?: SdkNotificationRecipient;
2330
- /** Omit to retain content. Null restores the shared template. Supply raw source, not a resolved composer draft. */
2332
+ /** Omit to retain content. Null restores the shared template. Use raw content from ScheduledNotificationComposer, not resolved NotificationComposer output. */
2331
2333
  content_override?: SdkScheduledNotificationContent | null;
2332
2334
  };
2333
2335
 
@@ -6080,6 +6082,7 @@ type ComponentRegistry = {
6080
6082
  "ResourceTable": <TResource extends ResourceDataTableResource, const TRelations extends readonly SdkResourceRelationPath<NoInfer<TResource>>[] = readonly []>(props: ResourceTableProps<TResource, TRelations>) => any;
6081
6083
  "RestoreResourceRecord": SdkComponent<RestoreResourceRecordProps>;
6082
6084
  "RichText": SdkComponent<RichTextProps>;
6085
+ "ScheduledNotificationComposer": SdkComponent<ScheduledNotificationComposerProps>;
6083
6086
  "SearchBar": SdkComponent<SearchBarProps>;
6084
6087
  "Separator": SdkComponent<SeparatorProps>;
6085
6088
  "SharedFilters": SdkComponent<SharedFiltersProps>;
@@ -6408,8 +6411,9 @@ type SdkHooks = {
6408
6411
 
6409
6412
  /**
6410
6413
  * List the accounting entities of the workspace with their `active` and `is_default`
6411
- * flags, ordered by name. Inactive entities are included. A branch has no entities and
6412
- * returns an empty list. A signed-out visitor gets an empty list and no request is made,
6414
+ * flags, ordered by name. Inactive entities are included. A branch returns the copies
6415
+ * of its production workspace's entities. A signed-out visitor gets an empty list and
6416
+ * no request is made,
6413
6417
  * so a public page reads the entity of a record from `record.__meta?.accounting_entity`
6414
6418
  * instead. ShowRecord and IndexRecords add it to each invoice, subscription, and payer
6415
6419
  * balance entry record whose entity field the visitor can read. ShowRecord (`useRecord`)
@@ -7469,7 +7473,7 @@ type SdkHooks = {
7469
7473
  /**
7470
7474
  * Form state for editing workspace field values, for layouts that must escape the
7471
7475
  * managed `Sdk.Components.WorkspaceFieldsForm` shell. Submits to
7472
- * `PUT /api/data/workspace-fields/values`; requires `update_workspace_fields`, `manage_workspace_fields`, or `access_system_admin`
7476
+ * `PUT /api/data/workspace-fields/values`; requires `update_workspace_fields` or `manage_workspace_fields`
7473
7477
  * permission.
7474
7478
  *
7475
7479
  * @example
@@ -8274,7 +8278,7 @@ type UseWorkspaceFieldsFormResult = {
8274
8278
  form: SdkWorkspaceFieldsForm;
8275
8279
  /** The active field definitions, in render order. */
8276
8280
  fields: SdkWorkspaceField[];
8277
- /** Whether a save can happen: the identity holds `update_workspace_fields`, `manage_workspace_fields`, or `access_system_admin` and at
8281
+ /** Whether a save can happen: the identity holds `update_workspace_fields` or `manage_workspace_fields` and at
8278
8282
  * least one field or fixed value is active. `submit()` is a no-op otherwise. */
8279
8283
  canSubmit: boolean;
8280
8284
  /** Context-wired input for one workspace field. Must be rendered inside `Form`. */
@@ -12690,6 +12694,24 @@ type RichTextProps = {
12690
12694
  className?: string;
12691
12695
  };
12692
12696
 
12697
+ type ScheduledNotificationComposerProps = {
12698
+ /** The occurrence to open, such as an id from useUpcomingNotifications. */
12699
+ scheduledNotificationId: string;
12700
+ /** Edited raw content, ready to save as content_override. Null while nothing changed, and when the occurrence cannot be edited. */
12701
+ onChange: (content: SdkScheduledNotificationContent | null) => void;
12702
+ /** Preview for an unsaved recipient change instead of the saved recipient. */
12703
+ recipient?: SdkNotificationRecipient;
12704
+ /** Omit to allow every text layout field. An empty array locks every layout field. */
12705
+ editableFields?: string[];
12706
+ /** Allow subject edits. Defaults to true. */
12707
+ editableSubject?: boolean;
12708
+ /** Lock all editors while the parent saves. */
12709
+ disabled?: boolean;
12710
+ /** Called when the occurrence cannot be loaded. */
12711
+ onError?: (error: SdkApiError) => void;
12712
+ className?: string;
12713
+ };
12714
+
12693
12715
  type SearchBarProps = {
12694
12716
  /**
12695
12717
  * Called with the debounced search value.
@@ -4,6 +4,16 @@ type Entry = WorkspaceResources[keyof WorkspaceResources];
4
4
  export type ResourceKey = [keyof WorkspaceResources] extends [never] ? string : Entry extends {
5
5
  id: infer I;
6
6
  } ? I : never;
7
+ /** The id of each entry of `E` that has every capability in `C`. */
8
+ type IdWithCapabilities<E, C extends string> = E extends {
9
+ id: infer I;
10
+ capabilities: infer Declared;
11
+ } ? [C] extends [Declared] ? I : never : never;
12
+ /**
13
+ * The ids of the resources that have every capability in `C`. Any string while the workspace
14
+ * declares no resources.
15
+ */
16
+ export type ResourceKeyWith<C extends string> = [keyof WorkspaceResources] extends [never] ? string : IdWithCapabilities<Entry, C>;
7
17
  type EntryFor<R> = Extract<Entry, {
8
18
  id: R;
9
19
  }>;
@@ -1,5 +1,6 @@
1
+ import type { ResourceKeyWith } from '../data';
1
2
  import type { ContentDocument } from '../input';
2
- export declare const SDK_VERSION = 53;
3
+ export declare const SDK_VERSION = 55;
3
4
  export interface AiDecideInput {
4
5
  state: unknown;
5
6
  questions: Array<{
@@ -24,7 +25,7 @@ export interface AiRunPromptInput {
24
25
  }
25
26
  export type AiRunPromptOutput = string;
26
27
  export interface AuthImpersonateInput {
27
- resource: string;
28
+ resource: ResourceKeyWith<"authenticatable">;
28
29
  record: string;
29
30
  }
30
31
  export type AuthImpersonateOutput = {
@@ -34,18 +35,18 @@ export type AuthImpersonateOutput = {
34
35
  [key: string]: unknown;
35
36
  };
36
37
  export interface AuthLoginInput {
37
- resource: string;
38
+ resource: ResourceKeyWith<"authenticatable">;
38
39
  record: string;
39
40
  }
40
41
  export type AuthLoginOutput = boolean;
41
42
  export interface CalendarGenerateLinkInput {
42
43
  type: "apple" | "google" | "outlook";
43
- resource: string;
44
+ resource: ResourceKeyWith<"eventable">;
44
45
  record: string;
45
46
  }
46
47
  export type CalendarGenerateLinkOutput = unknown;
47
48
  export interface CalendarSearchEventsInput {
48
- resource: string;
49
+ resource: ResourceKeyWith<"eventable">;
49
50
  from: string;
50
51
  to: string;
51
52
  filters?: unknown;
@@ -639,7 +640,7 @@ export interface MoneyFormatInput {
639
640
  }
640
641
  export type MoneyFormatOutput = string;
641
642
  export interface NotificationSendInput {
642
- resource: string;
643
+ resource: ResourceKeyWith<"notifiable">;
643
644
  relations?: Array<string>;
644
645
  record: string;
645
646
  subject: string;
@@ -700,7 +701,7 @@ export interface NotificationSendNotificationInput {
700
701
  }
701
702
  export type NotificationSendNotificationOutput = boolean;
702
703
  export interface NotificationSetConsentInput {
703
- resource: string;
704
+ resource: ResourceKeyWith<"notifiable">;
704
705
  record: string;
705
706
  sms?: boolean | null;
706
707
  email?: boolean | null;
@@ -730,7 +731,7 @@ export type PageUrlOutput = unknown;
730
731
  export interface PayablesVoidInput {
731
732
  reason?: string | null;
732
733
  effectiveDate?: string | null;
733
- payableResource: string;
734
+ payableResource: ResourceKeyWith<"payable">;
734
735
  payableRecord: string;
735
736
  }
736
737
  export type PayablesVoidOutput = {
@@ -739,9 +740,9 @@ export type PayablesVoidOutput = {
739
740
  };
740
741
  export interface PayablesWriteOffInput {
741
742
  lineAllocations?: unknown[] | null;
742
- payableResource: string;
743
+ payableResource: ResourceKeyWith<"payable">;
743
744
  payableRecord: string;
744
- adjustmentResource: string;
745
+ adjustmentResource: ResourceKeyWith<"payable_adjustment">;
745
746
  amount?: {
746
747
  amount: number;
747
748
  currency: string;
@@ -752,7 +753,7 @@ export interface PayablesWriteOffInput {
752
753
  }
753
754
  export type PayablesWriteOffOutput = Record<string, unknown>;
754
755
  export interface PaymentCreateManualInput {
755
- resource: string;
756
+ resource: ResourceKeyWith<"payment">;
756
757
  payableRecord: string;
757
758
  amount: {
758
759
  amount: number;
@@ -765,7 +766,7 @@ export interface PaymentCreateManualInput {
765
766
  }
766
767
  export type PaymentCreateManualOutput = Record<string, unknown>;
767
768
  export interface PaymentsChargeInput {
768
- payableResource: string;
769
+ payableResource: ResourceKeyWith<"payable">;
769
770
  payableRecord: string;
770
771
  amount?: {
771
772
  amount: number;
@@ -778,7 +779,7 @@ export interface PaymentsChargeInput {
778
779
  }
779
780
  export type PaymentsChargeOutput = Record<string, unknown>;
780
781
  export interface PaymentsCheckoutInput {
781
- payableResource: string;
782
+ payableResource: ResourceKeyWith<"payable">;
782
783
  payableRecord: string;
783
784
  successUrl: string;
784
785
  cancelUrl?: string | null;
@@ -790,7 +791,7 @@ export type PaymentsCheckoutOutput = {
790
791
  [key: string]: unknown;
791
792
  };
792
793
  export interface PaymentsConfirmInput {
793
- payableResource: string;
794
+ payableResource: ResourceKeyWith<"payable">;
794
795
  payableRecord: string;
795
796
  confirmationTokenId?: string | null;
796
797
  paymentMethodId?: string | null;
@@ -816,7 +817,7 @@ export type PaymentsConfirmOutput = {
816
817
  [key: string]: unknown;
817
818
  };
818
819
  export interface PaymentsRefundInput {
819
- resource: string;
820
+ resource: ResourceKeyWith<"payment">;
820
821
  record: string;
821
822
  amount?: {
822
823
  amount: number;
@@ -902,7 +903,7 @@ export interface SmsSendNotificationInput {
902
903
  }
903
904
  export type SmsSendNotificationOutput = Record<string, unknown>;
904
905
  export interface SubscriptionsActivateInput {
905
- subscriptionResource: string;
906
+ subscriptionResource: ResourceKeyWith<"subscription">;
906
907
  subscriptionRecord: string;
907
908
  }
908
909
  export type SubscriptionsActivateOutput = {
@@ -910,7 +911,7 @@ export type SubscriptionsActivateOutput = {
910
911
  [key: string]: unknown;
911
912
  };
912
913
  export interface SubscriptionsCancelInput {
913
- subscriptionResource: string;
914
+ subscriptionResource: ResourceKeyWith<"subscription">;
914
915
  subscriptionRecord: string;
915
916
  atPeriodEnd?: boolean | null;
916
917
  }
@@ -919,7 +920,7 @@ export type SubscriptionsCancelOutput = {
919
920
  [key: string]: unknown;
920
921
  };
921
922
  export interface SubscriptionsChangeItemsInput {
922
- subscriptionResource: string;
923
+ subscriptionResource: ResourceKeyWith<"subscription">;
923
924
  subscriptionRecord: string;
924
925
  items: Array<{
925
926
  price_record_id?: string;
@@ -1100,7 +1101,7 @@ export type SubscriptionsChangeItemsOutput = {
1100
1101
  [key: string]: unknown;
1101
1102
  };
1102
1103
  export interface SubscriptionsCreateInput {
1103
- subscriptionResource: string;
1104
+ subscriptionResource: ResourceKeyWith<"subscription">;
1104
1105
  accountingEntity?: string | null;
1105
1106
  payerRecord: string;
1106
1107
  priceRecordIds?: Array<string> | null;
@@ -1146,7 +1147,7 @@ export type SubscriptionsCreateOutput = {
1146
1147
  [key: string]: unknown;
1147
1148
  };
1148
1149
  export interface SubscriptionsGenerateInvoiceInput {
1149
- subscriptionResource: string;
1150
+ subscriptionResource: ResourceKeyWith<"subscription">;
1150
1151
  subscriptionRecord: string;
1151
1152
  }
1152
1153
  export type SubscriptionsGenerateInvoiceOutput = {
@@ -1158,7 +1159,7 @@ export type SubscriptionsGenerateInvoiceOutput = {
1158
1159
  [key: string]: unknown;
1159
1160
  };
1160
1161
  export interface SubscriptionsPauseInput {
1161
- subscriptionResource: string;
1162
+ subscriptionResource: ResourceKeyWith<"subscription">;
1162
1163
  subscriptionRecord: string;
1163
1164
  }
1164
1165
  export type SubscriptionsPauseOutput = {
@@ -1166,7 +1167,7 @@ export type SubscriptionsPauseOutput = {
1166
1167
  [key: string]: unknown;
1167
1168
  };
1168
1169
  export interface SubscriptionsPreviewInput {
1169
- subscriptionResource: string;
1170
+ subscriptionResource: ResourceKeyWith<"subscription">;
1170
1171
  priceRecordIds?: Array<string> | null;
1171
1172
  items?: Array<{
1172
1173
  price_record_id?: string;
@@ -1347,7 +1348,7 @@ export type SubscriptionsPreviewOutput = {
1347
1348
  [key: string]: unknown;
1348
1349
  };
1349
1350
  export interface SubscriptionsPreviewChangeInput {
1350
- subscriptionResource: string;
1351
+ subscriptionResource: ResourceKeyWith<"subscription">;
1351
1352
  subscriptionRecord: string;
1352
1353
  items: Array<{
1353
1354
  price_record_id?: string;
@@ -1521,7 +1522,7 @@ export type SubscriptionsPreviewChangeOutput = {
1521
1522
  [key: string]: unknown;
1522
1523
  };
1523
1524
  export interface SubscriptionsResumeInput {
1524
- subscriptionResource: string;
1525
+ subscriptionResource: ResourceKeyWith<"subscription">;
1525
1526
  subscriptionRecord: string;
1526
1527
  }
1527
1528
  export type SubscriptionsResumeOutput = {
@@ -1529,7 +1530,7 @@ export type SubscriptionsResumeOutput = {
1529
1530
  [key: string]: unknown;
1530
1531
  };
1531
1532
  export interface SubscriptionsSetUpcomingItemsInput {
1532
- subscriptionResource: string;
1533
+ subscriptionResource: ResourceKeyWith<"subscription">;
1533
1534
  subscriptionRecord: string;
1534
1535
  desiredPriceRecordIds?: Array<string> | null;
1535
1536
  items?: Array<{
@@ -1804,7 +1805,7 @@ export interface WorkflowRunInput {
1804
1805
  [key: string]: unknown;
1805
1806
  };
1806
1807
  input?: Record<string, unknown> | null;
1807
- runAsResource?: string | null;
1808
+ runAsResource?: ResourceKeyWith<"authenticatable"> | null;
1808
1809
  runAsRecord?: string | null;
1809
1810
  executionMode?: "async" | "sync" | null;
1810
1811
  }
@@ -36,7 +36,7 @@ export declare const notification: {
36
36
  sendBulkNotifications: <T extends NotificationTypeKey, R extends ResourceKey>(input: Omit<NotificationInput<NotificationSendBulkNotificationsInput, T>, "resource"> & {
37
37
  resource: R;
38
38
  }) => Promise<NotificationSendBulkNotificationsOutput>;
39
- setConsent: <R extends ResourceKey>(input: Omit<NotificationSetConsentInput, "resource"> & {
39
+ setConsent: <R extends NotificationSetConsentInput["resource"]>(input: Omit<NotificationSetConsentInput, "resource"> & {
40
40
  resource: R;
41
41
  }) => Promise<NotificationSetConsentOutput>;
42
42
  send: (input: import("./index").NotificationSendInput) => Promise<import("./index").NotificationSendOutput>;