@raytio/types 8.0.0 → 8.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raytio/types",
3
- "version": "8.0.0",
3
+ "version": "8.1.0",
4
4
  "license": "MIT",
5
5
  "main": "index",
6
6
  "types": "index",
@@ -13,6 +13,6 @@
13
13
  "scripts": {
14
14
  "docs": "sh ../../scripts/generate-docs.sh",
15
15
  "test": "npm run build && yarn docs",
16
- "build": "tsc && rm -rf dist/__tests__"
16
+ "build": "yarn run -T tsc && rm -rf dist/__tests__"
17
17
  }
18
18
  }
package/src/authz.ts ADDED
@@ -0,0 +1,13 @@
1
+ /** Relation types used by the new authz tuple system */
2
+ export type AuthzRelation = "viewer" | "editor" | "admin" | "owner" | "member";
3
+
4
+ export type AuthzSubjectType = "user" | "group";
5
+
6
+ export type AuthzObjectType =
7
+ | "dsm_node"
8
+ | "dsm_access_application"
9
+ | "dsm_access_application_instance"
10
+ | "dsm_link"
11
+ | "dsm_public_profile"
12
+ | "far_customer"
13
+ | "group";
package/src/index.ts CHANGED
@@ -7,3 +7,5 @@ export * from "./wizard";
7
7
  export * from "./orgs";
8
8
  export * from "./subscription";
9
9
  export * from "./merchant";
10
+ export * from "./tenant";
11
+ export * from "./authz";
package/src/raytio.ts CHANGED
@@ -21,6 +21,14 @@ export type GId = StringWithIdentity<"GId">;
21
21
  export type UId = StringWithIdentity<"UId">;
22
22
  /** An `a_id` is the ID of an {@link AA} */
23
23
  export type AId = StringWithIdentity<"AId">;
24
+ /** An `ao_id` is the ID of an {@link AAObject} */
25
+ export type AOId = StringWithIdentity<"AOId">;
26
+ /** A `aain_id` is the ID of an Instance Node */
27
+ export type AINId = StringWithIdentity<"AINId">;
28
+ /** A `aaink_id` is the ID of an Instance Node Key */
29
+ export type AINKId = StringWithIdentity<"AINKId">;
30
+ /** A `tnt_id` is the ID of a Tenant */
31
+ export type TNTId = StringWithIdentity<"TNTId">;
24
32
  /**
25
33
  * An `o_id` is the ID of an {@link Organization}
26
34
  *
@@ -67,6 +75,10 @@ export type PTId = StringWithIdentity<"PTId">;
67
75
  export type MId = StringWithIdentity<"MId">;
68
76
  /** A `gpm_id` is the ID of a Verification Type */
69
77
  export type GPMId = StringWithIdentity<"GPMId">;
78
+ /** A `b_id` is the ID of a badge definition */
79
+ export type BId = StringWithIdentity<"BId">;
80
+ /** a `GroupName` is the unique name of a group, often used instead of {@link GId} */
81
+ export type GroupName = StringWithIdentity<"GroupName">;
70
82
 
71
83
  export type DataTypes =
72
84
  | "string"
@@ -85,6 +97,7 @@ export type SubmissionStatus =
85
97
  | "Completed"
86
98
  | "DataChanged"
87
99
  | "Received"
100
+ | "Pending"
88
101
  | "Accepted";
89
102
 
90
103
  /**
@@ -189,6 +202,8 @@ export type Lookup = {
189
202
  label?: string | number;
190
203
  children?: Lookup[];
191
204
  description?: string;
205
+ /** Icon source in format `icon:{AntDesignIconName}` (e.g., `icon:CameraOutlined`) */
206
+ image_src?: string;
192
207
 
193
208
  /** used in AkahuDynamicSection only */
194
209
  requires_2FA?: boolean;
@@ -197,9 +212,7 @@ export type Lookup = {
197
212
  export type AATag =
198
213
  | "type:client_only"
199
214
  | "type:share_with_new_user"
200
- // heritage
201
- | `related_service_provider:n_id:${NId}`
202
- | "ServiceProvider"; // TODO: document or delete
215
+ | "Merchant"; // TODO: document or delete
203
216
 
204
217
  export type AA = {
205
218
  a_id: AId;
@@ -220,11 +233,13 @@ export type AA = {
220
233
  font?: CustomFonts;
221
234
  colors?: Colors;
222
235
  };
223
- /** the n_id of the associated service provider */
236
+ /** @deprecated use merchant_id instead */
224
237
  service_provider_n_id?: NId;
225
238
  /** the id of the associated organization */
226
239
  org_id?: OId;
227
240
  customer_id: CId;
241
+ /** the id of the associated merchant (replaces service_provider_n_id) */
242
+ merchant_id?: MId;
228
243
 
229
244
  /** configuration for the submission rules */
230
245
  // we know the type should be `ScoreConfig`, but we can't rely that it's valid, or the right version
@@ -233,6 +248,9 @@ export type AA = {
233
248
  /** if true, only specific email addresses can submit the form */
234
249
  auth_list_enabled?: boolean;
235
250
 
251
+ /** Bot protection challenge type. If set, users must complete a challenge before accessing the wizard. */
252
+ client_challenge_type?: "turnstile" | null;
253
+
236
254
  /** Currently Unused Attributes */
237
255
  start_date?: Date;
238
256
  end_date?: Date;
@@ -246,6 +264,28 @@ export type AA = {
246
264
  transitions?: unknown[];
247
265
  };
248
266
 
267
+ export type AAObject = CommonFields<AOId> & {
268
+ aa_id: AId;
269
+ aai_id: IId;
270
+ properties: Json;
271
+ labels: string[];
272
+ };
273
+
274
+ export type InstanceNode = CommonFields<AINId> & {
275
+ aa_id: AId;
276
+ /* The n_id of the shared PO */
277
+ n_id: NId;
278
+ field_list: string[];
279
+ };
280
+
281
+ export type InstanceNodeKey = CommonFields<AINKId> & {
282
+ aa_id: AId;
283
+ aai_id: IId;
284
+ aain_id: AINId;
285
+ field_name: string;
286
+ key_data: string;
287
+ };
288
+
249
289
  export type InstanceWithoutData = CommonFields<IId, { message?: string }> & {
250
290
  /** ID of the access application this submission was made to */
251
291
  aa_id: AId;
@@ -260,10 +300,10 @@ export type InstanceWithoutData = CommonFields<IId, { message?: string }> & {
260
300
  thread: string;
261
301
  /** The status of a submission */
262
302
  state: SubmissionStatus;
263
- /** Hash of the Service Provider ID */
264
- sub_service_provider_hash: string;
265
- /** Service provider ID */
266
- service_provider_n_id: NId;
303
+ /** Hash of the Merchant ID */
304
+ sub_merchant_hash: string;
305
+ /** Merchant ID (replaces service_provider_n_id) */
306
+ merchant_id: MId;
267
307
 
268
308
  /** added by the client once it calculates the score */
269
309
  // Defined as `unknown` instead of `ScoreResult` because it could be nonsense,
@@ -321,41 +361,46 @@ export type Validation = {
321
361
  };
322
362
  };
323
363
 
324
- export type WebhookStatus = "subscribed" | "pending" | "unsubscribe_failed";
325
-
326
- export type Webhook = {
327
- wi_id: WId;
328
- /** n_id of "the webhook provider which can be set up against a service provider" */
329
- provider_webhook_id: NId;
330
- /** not sure what this is */
331
- provider_webhook_subscription_id: NId;
332
- status: WebhookStatus;
333
- /** ISO Date */
334
- date_created: string;
335
- /** ISO Date */
336
- date_updated: string;
364
+ export type WebhookStatus =
365
+ | "PENDING"
366
+ | "SUBSCRIBED"
367
+ | "UNSUBSCRIBED"
368
+ | "UNSUBSCRIBE_FAILED"
369
+ | "ERROR"
370
+ | "ARCHIVED";
337
371
 
372
+ export type Webhook = CommonFields<WId> & {
373
+ aa_id: AId;
374
+ webhook_processing_rules: unknown;
375
+ provider_subscription_credentials: unknown;
376
+ provider_signature_check_enabled: boolean;
377
+ provider_signature_credentials: unknown;
378
+ webhook_filter_source: string | null;
338
379
  webhook_filter_schema: {
339
380
  operator: string;
340
381
  field_value: string;
341
382
  field_name: string;
342
- };
343
- webhook_action: { webhook_action_type: string }[];
344
- webhook_filter_source: string;
383
+ } | null;
384
+ webhook_action: { webhook_action_type: string }[] | null;
345
385
  webhook_field_mapping_schema: {
346
386
  [key: string]: string;
347
- };
348
- webhook_processing_rules: unknown;
349
-
350
- provider_subscription_credentials: unknown;
351
- provider_signature_check_enabled: boolean;
352
- provider_signature_credentials: unknown;
387
+ } | null;
388
+ provider_webhook_id: string;
389
+ provider_webhook_subscription_id: string | null;
390
+ subscribe_log?:
391
+ | {
392
+ date: string;
393
+ response_status_code: number;
394
+ response_payload: Json;
395
+ }[]
396
+ | null;
397
+ status: WebhookStatus;
398
+ metadata: unknown;
353
399
 
354
- subscribe_log?: {
355
- date: string;
356
- response_status_code: number;
357
- response_payload: Json;
358
- }[];
400
+ // Legacy compatibility - these will be computed from the new fields
401
+ wi_id?: WId; // mapped from id
402
+ date_created?: string; // mapped from start_date
403
+ date_updated?: string; // computed or mapped as needed
359
404
  };
360
405
 
361
406
  /**
@@ -371,3 +416,16 @@ export type Link = {
371
416
  details?: AA;
372
417
  isDefault?: boolean;
373
418
  };
419
+
420
+ // Used in Permissions - Get for Node
421
+ export type Permission = {
422
+ id: NId;
423
+ n_id: NId;
424
+ labels: string[];
425
+ properties: { permissions: string; provider_name: string };
426
+ user_permission_type: string | null;
427
+ group_permission_type: "VIEWS" | "EDITS" | null;
428
+ group_name: "ALL" | "Public" | `sharing|${UId}|${UId}` | GId;
429
+ is_owner: boolean;
430
+ permission_id: PId;
431
+ };
package/src/schema.ts CHANGED
@@ -1,5 +1,11 @@
1
- import type { AA, DataTypes, SchemaName, Urn } from "./raytio";
2
- import type { Organization } from "./orgs";
1
+ import type {
2
+ AA,
3
+ CommonFields,
4
+ DataTypes,
5
+ Json,
6
+ SchemaName,
7
+ Urn,
8
+ } from "./raytio";
3
9
  import type { WizardConfig } from "./wizard";
4
10
 
5
11
  /** should be renamed since this applies to ConditionallyVerifiable */
@@ -11,6 +17,15 @@ export type ConditionallyRequired = {
11
17
  };
12
18
  };
13
19
 
20
+ /** Schema-level conditional tags, evaluated at runtime based on form values */
21
+ export type ConditionalTags = {
22
+ tags: string[];
23
+ // see `isConditionMet` for how this syntax works
24
+ if: {
25
+ [fieldName: string]: (string | number | boolean)[];
26
+ };
27
+ };
28
+
14
29
  export type SchemaFieldTag =
15
30
  // legacy (TODO: remove these)
16
31
  | "password"
@@ -29,6 +44,11 @@ export type SchemaFieldTag =
29
44
  | `display:replace:('${string}', '${string}')`
30
45
  | "display:terms_conditions"
31
46
  | `display:main_media:${string}` // property name to determine what image to display
47
+ // content block variants (see ContentBlockField)
48
+ | "display:content-block"
49
+ | "display:info"
50
+ | "display:warning"
51
+ | "display:error"
32
52
  // date picker components
33
53
  | "date_component:day"
34
54
  | "date_component:month"
@@ -41,6 +61,7 @@ export type SchemaFieldTag =
41
61
  | "action:hash" // creates hash containing specified information
42
62
  | "action:require_webauthn"
43
63
  | `action:generate_pepper:` // generates a pepper length 'n'
64
+ | `action:timeout:${number}` // for a lookup field. Signifies it should expire after 'n' seconds
44
65
  | "verify:show_if_pending"
45
66
  | "special:hide_select_behind_button"
46
67
  | "type:capture_geolocation" // triggers the wizard's GeoLocationInput field
@@ -51,6 +72,7 @@ export type SchemaTag =
51
72
  | "action:experimental_pass_object_store_id"
52
73
  | "action:verify"
53
74
  | `action:display_qr_code:${/* either extract or verify */ string}:${/* when to display QR */ string}`
75
+ | `action:display_global_idv_app_qr_code:${/* either extract or verify */ string}`
54
76
  // camera
55
77
  | "default_camera:rear"
56
78
  | "default_camera:front"
@@ -61,12 +83,15 @@ export type SchemaTag =
61
83
  | `time:${/* type */ string}:${/* seconds */ number}`
62
84
  | `link_to:${/* schemaName */ string}:${/* relationshipType */ string}`
63
85
  | "display:default_view:edit" // links profile POcard direct to edit menu
86
+ // bot protection
87
+ | "support_challenge"
64
88
  // type
65
- | "type:service_provider"
89
+ | "type:merchant"
66
90
  | "type:service_offer"
67
91
  | "type:marketplace"
68
92
  | "type:client_only"
69
- | "type:globally_unique_field";
93
+ | "type:globally_unique_field"
94
+ | "type:application_object";
70
95
 
71
96
  export type SchemaField = {
72
97
  /** @deprecated don't use, it's inconsistent */
@@ -88,9 +113,9 @@ export type SchemaField = {
88
113
  step?: number;
89
114
  /** if true, the user must have encryption enabled to save this data, see #1324 */
90
115
  encrypt_require?: boolean;
91
- /** @deprecated raytio's usage not documented */
116
+ /** for string inputs, the maximum character length. Also used to determine textarea rendering (maxLength > 30 renders a textarea) */
92
117
  maxLength?: number;
93
- /** @deprecated raytio's usage not documented */
118
+ /** for string inputs, the minimum character length. Not currently used anywhere in the client */
94
119
  minLength?: number;
95
120
  /** the default value */
96
121
  default?: unknown;
@@ -146,12 +171,40 @@ export type SchemaField = {
146
171
  content?: string;
147
172
  /** URL to a JSON file in the `Lookup` format */
148
173
  lookup?: string;
174
+ /**
175
+ * Transforms the lookup response into the expected `{ key, value }[]` format.
176
+ * Use when the API returns data in a different structure.
177
+ *
178
+ * Simple format (extract array from path, use values as both key and value):
179
+ * ```json
180
+ * "lookupTransform": "[0].scopes"
181
+ * ```
182
+ *
183
+ * Object format (specify key/value mapping):
184
+ * ```json
185
+ * "lookupTransform": {
186
+ * "path": "[0].items",
187
+ * "key": "id",
188
+ * "value": "name"
189
+ * }
190
+ * ```
191
+ */
192
+ lookupTransform?:
193
+ | string
194
+ | {
195
+ /** JSON path to extract the array (e.g., "[0].scopes", "data.items") */
196
+ path: string;
197
+ /** Property name to use as the lookup key (if omitted, uses the value itself) */
198
+ key?: string;
199
+ /** Property name to use as the lookup value (if omitted, uses the value itself) */
200
+ value?: string;
201
+ };
149
202
  /** @internal the client adds this - it's the fieldName. */
150
203
  $prop: string;
151
204
  priority?: number;
152
205
  /** @internal if supplied, it's the existing field values. Added by the client */
153
206
  subObjectRef?: unknown[];
154
- /** specifies that the description is formatted in markdown */
207
+ /** @deprecated Markdown is now rendered by default for all descriptions. This property is no longer needed. */
155
208
  description_decorator?: "md";
156
209
  /** if a `pattern` is specified, this is the error message */
157
210
  patternMessage?: string;
@@ -191,12 +244,25 @@ export type SchemaField = {
191
244
  /** the only difference between the client & server's definition is that the client adds `$prop` */
192
245
  export type ServerSchemaField = Omit<SchemaField, "$prop">;
193
246
 
247
+ /** An i18n entry from the fnd_i18n_entries API endpoint */
248
+ export type FndI18nEntry = CommonFields<never> & {
249
+ i18n_key: string;
250
+ category: string;
251
+ translations: {
252
+ [locale: string]: {
253
+ title: string;
254
+ description?: string;
255
+ title_plural?: string;
256
+ };
257
+ };
258
+ };
259
+
194
260
  /** not exported. Attributes that are identical in both client schema & server schema */
195
261
  export type CommonSchemaAttributes = {
196
262
  /** these fields will always exist on schema */
197
263
  title: string;
198
264
  description: string;
199
- /** specifies that the description is formatted in markdown */
265
+ /** @deprecated Markdown is now rendered by default for all descriptions. This property is no longer needed. */
200
266
  description_decorator?: "md";
201
267
 
202
268
  schema_type?: SchemaType;
@@ -207,11 +273,22 @@ export type CommonSchemaAttributes = {
207
273
  /**
208
274
  * the group that a schema belongs to, such as "passports". This is useful for
209
275
  * forms that accept different types of similar documents.
276
+ * Can be a single group (string) or multiple groups (string[]) to allow a schema
277
+ * to appear in multiple lists.
210
278
  */
211
- schema_group?: string;
279
+ schema_group?: string | string[];
280
+
281
+ /** Additional search terms to help users find schemas (e.g., ["license", "passport", "drivers license"]) */
282
+ search_terms?: string[];
212
283
 
213
284
  tags?: SchemaTag[];
214
285
 
286
+ /** if specified, suggests this onboarding scenario after creating a PO of this schema type */
287
+ suggest_post_create?: SchemaName;
288
+
289
+ /** Array of 2-character country codes that this schema is available for */
290
+ schema_country_codes?: string[];
291
+
215
292
  /* any overrides can be specfied per field or for the whole schema */
216
293
  i18n?: {
217
294
  [locale: string]: {
@@ -294,41 +371,140 @@ export type CommonSchemaAttributes = {
294
371
  * view or deafult view
295
372
  */
296
373
  compact_table?: boolean;
374
+
375
+ /**
376
+ * Pre-defined filter presets provided by the schema author.
377
+ * These appear as "Default filters" in the admin table UI and
378
+ * cannot be deleted by users (unlike user-saved filters).
379
+ *
380
+ * Each token's `propertyKey` must match a key in `properties`.
381
+ * Valid operators: `=`, `!=`, `:`, `!:`, `>`, `<`, `>=`, `<=`
382
+ */
383
+ filters?: {
384
+ /** Display name for the filter preset */
385
+ name: string;
386
+ /** How tokens are combined: "and" = all must match, "or" = any must match */
387
+ operation: "and" | "or";
388
+ /** Filter conditions */
389
+ tokens: {
390
+ /** Must match a key in schema `properties` */
391
+ propertyKey: string;
392
+ /** Comparison operator */
393
+ operator: string;
394
+ /** Value to compare against */
395
+ value: string;
396
+ }[];
397
+ }[];
398
+
399
+ /** Kanban board configuration for admin dashboard */
400
+ kanban?: {
401
+ /** Field that determines which column a card belongs to */
402
+ column_field?: string;
403
+ /** Field displayed as the card title */
404
+ title_field?: string;
405
+ /** Additional fields displayed on each card */
406
+ card_fields?: string[];
407
+ };
297
408
  };
298
409
 
299
410
  /** only the schema used for the onboarding wizard have this property */
300
411
  onboard_properties?: {
301
- /** Profile Objects that should be created */
302
- profile_objects?: {
303
- schema_name: SchemaName;
304
- properties: Record<string, unknown>;
305
- }[];
306
-
307
- /** Relationships that should be created */
308
- relationships?: {
309
- /** will normally look like `"{n_id:profile_objects[0]}"` */
310
- from: string;
311
- to: string;
312
- type: string;
313
- properties?: Record<string, string>;
314
- }[];
412
+ /**
413
+ * High-level actions for complex workflows.
414
+ * create_organization: Single object for creating one organization
415
+ * create_access_application_link: Array for creating multiple links
416
+ */
417
+ actions?: {
418
+ /** Creates a single organization. Use this instead of legacy 'organizations' array. */
419
+ create_organization?: Array<{
420
+ properties: Json;
421
+ store_as?: string; // alias used to reference the created organization
422
+ }>;
423
+ /** Creates access application links (can be multiple) */
424
+ create_access_application_link?: Array<{
425
+ properties: Record<string, unknown>;
426
+ store_as?: string;
427
+ }>;
428
+ /** Other actions can be defined as needed */
429
+ [key: string]: any;
430
+ };
431
+ /**
432
+ * Execution order for entity creation. If not specified, uses default order.
433
+ * Examples: ["actions.create_organization", "db.v1.xrm_merchants", "db.v1.dsm_nodes"]
434
+ */
435
+ execution_order?: string[];
315
436
 
316
437
  /**
317
- * Organizations that should be created. NOTE: if multiple are specified, when the wizard
318
- * completes, the _first one_ will be selected
438
+ * Generic API endpoints organized by namespace and version.
439
+ *
440
+ * Structure: `{namespace}.{version}.{endpoint_name}` → `POST /{namespace}/{version}/{endpoint_name}`
441
+ *
442
+ * Examples:
443
+ * - `db.v1.xrm_merchants` → `POST /db/v1/xrm_merchants`
444
+ * - `db.v2.something` → `POST /db/v2/something`
445
+ * - `persist.v2.endpoint` → `POST /persist/v2/endpoint`
446
+ *
447
+ * Any namespace can be used. The `db` namespace is shown below as the primary example.
319
448
  */
320
- organizations?: {
321
- properties: Organization;
322
- /** Access Applications that should be created for this org */
323
- access_applications?: {
324
- properties: Omit<AA, "org_id">;
325
- /** Links that should be created for this AA */
326
- links?: {
327
- description: string;
328
- wizardConfig: Omit<WizardConfig, "a_id">;
329
- }[];
330
- }[];
331
- }[];
449
+ db?: {
450
+ v1?: {
451
+ /** Profile objects - POST /db/v1/dsm_nodes */
452
+ dsm_nodes?: Array<{
453
+ labels?: string[];
454
+ properties: Record<string, unknown>;
455
+ schema_name?: SchemaName;
456
+ }>;
457
+
458
+ /** Merchants - POST /db/v1/xrm_merchants */
459
+ xrm_merchants?: Array<Record<string, unknown>>;
460
+
461
+ /** Access Applications - POST /db/v1/dsm_access_applications */
462
+ dsm_access_applications?: Array<
463
+ Omit<AA, "org_id" | "a_id"> & {
464
+ org_id?: string;
465
+ links?: {
466
+ description: string;
467
+ wizardConfig: Omit<WizardConfig, "a_id">;
468
+ }[];
469
+ }
470
+ >;
471
+
472
+ /** Relationships - POST /db/v1/dsm_node_relationships */
473
+ dsm_node_relationships?: Array<{
474
+ from: string;
475
+ to: string;
476
+ type: string;
477
+ properties?: Record<string, unknown>;
478
+ }>;
479
+
480
+ /** Extensible for any other endpoint */
481
+ [endpoint: string]: Array<Record<string, unknown>> | undefined;
482
+ };
483
+ v2?: {
484
+ [endpoint: string]: Array<Record<string, unknown>> | undefined;
485
+ };
486
+ [version: string]:
487
+ | {
488
+ [endpoint: string]: Array<Record<string, unknown>> | undefined;
489
+ }
490
+ | undefined;
491
+ };
492
+ /**
493
+ * Additional namespaces can be added following the same structure as `db`.
494
+ * Example: persist?: { v2?: { [endpoint: string]: Array<Record<string, unknown>> } }
495
+ */
496
+ [namespace: string]:
497
+ | {
498
+ [version: string]:
499
+ | {
500
+ [endpoint: string]: Array<Record<string, unknown>> | undefined;
501
+ }
502
+ | undefined;
503
+ }
504
+ | object // for actions
505
+ | string[] // for execution_order
506
+ | string // for return_to
507
+ | undefined;
332
508
 
333
509
  /** The relative path in the client to redirect to once finished. May include variables */
334
510
  return_to?: string;
@@ -346,6 +522,12 @@ export type Schema = CommonSchemaAttributes & {
346
522
  /** added by client */
347
523
  type?: DataTypes;
348
524
 
525
+ /**
526
+ * Schema-level conditional tags, pre-processed for runtime evaluation.
527
+ * When form values match the `if` condition, the tags are added to the schema.
528
+ */
529
+ conditionalTags?: ConditionalTags[];
530
+
349
531
  /** the localized title of the `schema_group`. added by the client */
350
532
  group_title?: string;
351
533
 
@@ -373,12 +555,47 @@ export type Schema = CommonSchemaAttributes & {
373
555
  * In this case, this attribute defines what database table we need to use
374
556
  * to fetch the corresponding data, and which field is the primary_key of that
375
557
  * table (e.g. `id`, `o_id` etc.)
558
+ *
559
+ * The `path` property specifies the complete API path to use. If not provided,
560
+ * defaults to `/db/v1/{table}`. When `path` is specified, it is used directly
561
+ * without appending the table name.
562
+ * Examples:
563
+ * - `path: "/db/v1/rpc/my_function"` for RPC endpoints
564
+ * - `path: "/api/v2/custom_endpoint"` for custom API paths
565
+ *
566
+ * The optional `select` parameter supports PostgREST select syntax for nested
567
+ * objects/arrays. For example:
568
+ * `select: "id,item_id,gpm_items(id,item_key)"`
569
+ * This will return nested objects in the response.
376
570
  */
377
- database?: { table: string; primary_key: string };
571
+ database?: {
572
+ /** Table name (required when path is not specified to construct `/db/v1/{table}`) */
573
+ table?: string;
574
+ primary_key: string;
575
+ /** Complete API path. If specified, used directly instead of `/db/v1/{table}` */
576
+ path?: string;
577
+ select?: string;
578
+ /** Schema to redirect to after creating a record (for insert schemas) */
579
+ return_to?: SchemaName;
580
+ /** HTTP method override. If specified, uses this instead of the default (POST for create, PATCH for edit, DELETE for delete) */
581
+ method?: "POST" | "PATCH" | "DELETE";
582
+ /**
583
+ * PostgREST query parameters to include in requests.
584
+ * Supports variable substitution: {$context.organizationId}, {$context.userId}, {$context.tenantId}
585
+ * Example: "org_id=eq.{$context.organizationId}&active=eq.true"
586
+ * If this contains "select=", it takes precedence over the `select` property.
587
+ */
588
+ query_parameters?: string;
589
+ };
378
590
 
379
591
  /** the client adds this after processing the i18n property */
380
592
  groupNames?: Record<string, string>;
381
593
 
594
+ /** specifies the order in which groups should be displayed */
595
+ groups?: {
596
+ order?: string[];
597
+ };
598
+
382
599
  /** added by the client to inform downstream components which locale from schema.i18n was used */
383
600
  clientLocale?: string;
384
601
 
@@ -399,7 +616,7 @@ export type Schema = CommonSchemaAttributes & {
399
616
  };
400
617
 
401
618
  /** Type Classification of a Schema returned by API */
402
- export type SchemaType = "ss" | "ps" | "us";
619
+ export type SchemaType = "ss" | "ps" | "us" | "ms";
403
620
 
404
621
  /** This is what's returned by the API */
405
622
  export type WrappedSchema = {
@@ -416,6 +633,10 @@ export type WrappedSchema = {
416
633
 
417
634
  /** whether the \`version\` is the latest version */
418
635
  version_current: boolean;
636
+
637
+ /** Country codes that this schema is available for */
638
+ schema_country_codes?: string[];
639
+
419
640
  schema: CommonSchemaAttributes & {
420
641
  /** @deprecated don't use this */
421
642
  $id?: string;
@@ -61,6 +61,7 @@ export type Subscription = CommonFields<SId> & {
61
61
  billing_cycle_hour: number | null;
62
62
  billing_cycle_minute: number | null;
63
63
  billing_cycle_second: number | null;
64
+ subscription_timezone_offset_minutes: number | null;
64
65
  subscription_name: string;
65
66
  subscription_name_i18n: string | null;
66
67
  current_billing_period_start: string;