@raytio/types 7.3.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": "7.3.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 && rimraf 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
@@ -5,3 +5,7 @@ export * from "./theme";
5
5
  export * from "./verification";
6
6
  export * from "./wizard";
7
7
  export * from "./orgs";
8
+ export * from "./subscription";
9
+ export * from "./merchant";
10
+ export * from "./tenant";
11
+ export * from "./authz";
@@ -0,0 +1,22 @@
1
+ import type { CommonFields, Json, MId, PRid } from "./raytio";
2
+
3
+ export type MerchantTypeCode = "TYPE_1" | "TYPE_2";
4
+ export type MerchantClassCode = "CLASS_1" | "CLASS_2";
5
+ export type MerchantStatusCode = "ACTIVE" | "INACTIVE";
6
+ export type MerchantApprovalStatusCode = "PENDING" | "APPROVED";
7
+
8
+ export type Merchant = CommonFields<MId> & {
9
+ party_id: PRid;
10
+ merchant_name: string | null;
11
+ merchant_name_i18n: Json | null;
12
+ merchant_common_name: string | null;
13
+ merchant_common_name_i18n: Json | null;
14
+ merchant_description: string | null;
15
+ merchant_description_i18n: Json | null;
16
+ merchant_image_url_logo: string | null;
17
+ merchant_image_url_thumbnail: string | null;
18
+ merchant_type_code: MerchantTypeCode | null;
19
+ merchant_class_code: MerchantClassCode | null;
20
+ merchant_status_code: MerchantStatusCode | null;
21
+ merchant_approval_status_code: MerchantApprovalStatusCode | null;
22
+ };
package/src/orgs.ts CHANGED
@@ -1,15 +1,86 @@
1
+ import type {
2
+ CId,
3
+ CommonFields,
4
+ LOCId,
5
+ Lookup,
6
+ OId,
7
+ PCId,
8
+ PRid,
9
+ PermissionType,
10
+ UId,
11
+ } from "./raytio";
12
+
1
13
  /** Types Used for Organization Related API Responses */
2
- /** An Organisation */
3
- export type Party = {
4
- id: string;
5
- start_date: string;
6
- end_date: string;
7
- active: boolean;
14
+
15
+ /**
16
+ * An organization.
17
+ * NOTE: this is different to how the schema defines an Organization. **The schema is wrong (see #468)**
18
+ */
19
+ export type Organization = {
20
+ id: CId;
21
+ orgId: OId;
22
+ name: string;
23
+ // just using email_address for now until ss_Billing_Organization gets updated to support the additional fields
24
+ contact_point?: Pick<ContactPoint, "email_address" | "id">;
25
+ address?: unknown; // Waiting on Backend Progress Before being properly updated (as of #1361)
26
+ customerUsers: CustomerUser[];
27
+ };
28
+
29
+ /** @internal some APIs now return extra info. this is what gets passed around in the client. */
30
+ export type FullOrg = {
31
+ id: CId;
32
+ organization: Omit<Organization, "id">;
33
+ /** 🧙‍♂️ */
34
+ gandalf?: unknown;
35
+ stripe?: { customer: unknown };
36
+ centrix_credentials?: unknown;
37
+ };
38
+
39
+ /** An organization/customer, directly returned by the API */
40
+ export type Customer = CommonFields<CId> & {
41
+ customer_code: string;
42
+ party_id: PRid;
43
+ party_description: OId; // this is the old org_id but it's not a UUID so it's stored here (see #1361)
44
+ permission_type: PermissionType | null; // Once we start caring about Permissions (Sometime after #1390) this should be in a similar format to "ADMINS" | "OWNS" etc
45
+ user_id: UId | null;
46
+ owner_email: string;
47
+ user_email: string;
48
+ prm_parties?: Party;
49
+ };
50
+
51
+ /** Organization Customer / User, Returned directly by the API */
52
+ export type CustomerUser = CommonFields<CId> & {
53
+ customer_code: string;
54
+ party_id: PRid;
8
55
  party_name: string;
9
- party_description: string;
56
+ party_description: OId;
57
+ owner_id: UId;
58
+ owner_email: string;
59
+ permission_type: PermissionType | null;
60
+ user_id: UId | null;
61
+ user_email: string | null;
62
+ group_name: string | null;
63
+ };
64
+
65
+ export type Party = CommonFields<PRid, PartyMetadata> & {
66
+ party_name: string;
67
+ party_description: OId;
10
68
  party_type: string;
11
- metadata: PartyMetadata;
12
- party_number: number;
69
+ party_image_url_logo: string | null;
70
+ far_customers: CommonFields<CId> &
71
+ {
72
+ freight_term_code: string;
73
+ customer_type_code: string;
74
+ customer_class_code: string;
75
+ customer_status_code: string;
76
+ price_list_version_id: string | null;
77
+ customer_approval_status_code: string;
78
+ far_customers_customer_type_lookup: Lookup;
79
+ far_customers_freight_terms_lookup: Lookup;
80
+ far_customers_customer_class_lookup: Lookup;
81
+ far_customers_customer_status_lookup: Lookup;
82
+ far_customers_customer_approval_status_lookup: Lookup;
83
+ }[];
13
84
  };
14
85
 
15
86
  /** An Organizations credentials */
@@ -20,27 +91,34 @@ export type PartyMetadata = {
20
91
  };
21
92
 
22
93
  /** An Organization Site */
23
- export type PartySite = {
24
- id: string;
25
- start_date: string;
26
- end_date: string;
27
- active: boolean;
28
- party_id: string;
29
- location_number: number;
94
+ export type PartySite = CommonFields<never> & {
95
+ party_id: PRid;
96
+ location_id: number;
30
97
  party_site_name: string;
31
98
  party_site_description: string | null;
32
- party_site_number: string | null;
33
99
  party_uses: string[];
34
100
  party_use_primary: string;
35
- metadata: unknown;
101
+ };
102
+
103
+ export type CustomerSite = CommonFields<never> & {
104
+ org_id: OId;
105
+ party_site_id: string;
106
+ customer_site_code: string;
107
+ customer_site_status_code: string;
108
+ };
109
+
110
+ export type CustomerSiteUse = CommonFields<never> & {
111
+ org_id: OId;
112
+ customer_site_id: string;
113
+ customer_site_use_purpose_code: string;
114
+ customer_site_use_name: string;
115
+ freight_term_code: string | null;
116
+ payment_term_id: string;
117
+ price_list_version_id: string | null;
36
118
  };
37
119
 
38
120
  /** An Organization Location */
39
- export type Location = {
40
- id: string;
41
- start_date: string;
42
- end_date: string;
43
- active: boolean;
121
+ export type Location = CommonFields<LOCId> & {
44
122
  location_name: string;
45
123
  location_description: string | null;
46
124
  address_line_1: string | null;
@@ -62,16 +140,11 @@ export type Location = {
62
140
  country: string | null;
63
141
  geolocation: string | null;
64
142
  geolocation_outline: string | null;
65
- metadata: unknown;
66
143
  };
67
144
 
68
145
  /** A Contact Point for an Organization */
69
- export type ContactPoint = {
70
- id: string;
71
- start_date: string;
72
- end_date: string;
73
- active: boolean;
74
- to_table: string;
146
+ export type ContactPoint = CommonFields<PCId> & {
147
+ party_id: PRid;
75
148
  uuid: string | undefined;
76
149
  contact_point_purpose: string;
77
150
  contact_point_type: string;
@@ -82,5 +155,4 @@ export type ContactPoint = {
82
155
  url_type: string | null;
83
156
  email_address: string;
84
157
  email_address_preferred_format: string;
85
- metadata: unknown;
86
158
  };
package/src/raytio.ts CHANGED
@@ -5,7 +5,7 @@ import type { Colors, CustomFonts } from "./theme";
5
5
  export type StringWithIdentity<T> = string & { $$typeof$$: T };
6
6
 
7
7
  /** @internal */
8
- type Json = Record<string, any>; // TODO: (semver breaking) unknown
8
+ export type Json = Record<string, any>; // TODO: (semver breaking) unknown
9
9
 
10
10
  /** A `p_id` is the ID of a {@link Relationship} */
11
11
  export type PId = StringWithIdentity<"PId">;
@@ -21,16 +21,64 @@ 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 `o_id` is the ID of an {@link Organization} */
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">;
32
+ /**
33
+ * An `o_id` is the ID of an {@link Organization}
34
+ *
35
+ * NOTE: Will be deprecated soon. Use CId instead.
36
+ * */
25
37
  export type OId = StringWithIdentity<"OId">;
38
+ /** A `pr_id` is the ID of a {@link Party} */
39
+ export type PRid = StringWithIdentity<"PRid">;
40
+ /** A `pc_id` is the ID of a Party Contact Point */
41
+ export type PCId = StringWithIdentity<"PCId">;
26
42
  /** A `wi_id` is the ID of a {@link Webhook} */
27
43
  export type WId = StringWithIdentity<"WId">;
28
44
  /** An `l_id` is the ID of any data stored in the KV-Store */ // e.g. StoredWizardConfig and VerBundleMetadata
29
45
  export type LId = StringWithIdentity<"LId">;
30
46
  /** A `k_id` (also called a `aack_id` or a `publicKeyId`) is the ID of an AA's public key */
31
47
  export type KId = StringWithIdentity<"KId">;
48
+ /** A `pk_id` is the ID of an AA's private key */
49
+ export type PKId = StringWithIdentity<"PKId">;
50
+ /** A `c_id` is the ID of a {@link Customer}, (will eventually replace org_id) */
51
+ export type CId = StringWithIdentity<"CId">;
52
+ /** A `t_id` is the ID of a transaction */
53
+ export type TId = StringWithIdentity<"TId">;
54
+ /** A `ws_id` is the ID of a transition */
55
+ export type WSId = StringWithIdentity<"WSId">;
32
56
  /** A `SchemaName` is the ID of a {@link Schema} */
33
57
  export type SchemaName = StringWithIdentity<"SchemaName">;
58
+ /** A `loc_id` is the ID of a location */
59
+ export type LOCId = StringWithIdentity<"LOCId">;
60
+ /** A `pl_id` is the ID of a PriceList */
61
+ export type PLId = StringWithIdentity<"PLId">;
62
+ /** A `prc_id` is the ID of a Price */
63
+ export type PRCId = StringWithIdentity<"PRCId">;
64
+ /** A `pll_id` is the ID of a PriceListLine/Plan */
65
+ export type PLLId = StringWithIdentity<"PLLId">;
66
+ /** A `s_id` is the ID of a Subscription */
67
+ export type SId = StringWithIdentity<"SId">;
68
+ /** A `sl_id` is the ID of a SubscriptionLine */
69
+ export type SLId = StringWithIdentity<"SLId">;
70
+ /** A `pm_id` is the ID of a PaymentMethod */
71
+ export type PMId = StringWithIdentity<"PMId">;
72
+ /** A `pt_id` is the ID of a PaymentProcessor */
73
+ export type PTId = StringWithIdentity<"PTId">;
74
+ /** A `m_id` is the ID of a Merchant */
75
+ export type MId = StringWithIdentity<"MId">;
76
+ /** A `gpm_id` is the ID of a Verification Type */
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">;
34
82
 
35
83
  export type DataTypes =
36
84
  | "string"
@@ -49,6 +97,7 @@ export type SubmissionStatus =
49
97
  | "Completed"
50
98
  | "DataChanged"
51
99
  | "Received"
100
+ | "Pending"
52
101
  | "Accepted";
53
102
 
54
103
  /**
@@ -74,8 +123,15 @@ export type CommonFields<
74
123
  end_date: string;
75
124
  active: boolean;
76
125
  metadata: Metadata | undefined;
126
+ row_version?: number;
127
+ resource_group?: string;
128
+ resource_name?: string;
129
+ resource_url?: string;
130
+ tenant_id?: string;
77
131
  };
78
132
 
133
+ export type PermissionType = "ADMINS" | "VIEWS" | "EDITS" | "OWNS";
134
+
79
135
  /** You can supply an option type argument if you know exactly what the properties will be */
80
136
  export type ProfileObject<Properties = Json> = Partial<CommonFields<NId2>> & {
81
137
  n_id: NId;
@@ -122,6 +178,8 @@ export type Urn =
122
178
  | `urn:schema:${SchemaName}`
123
179
  | `urn:document:${NId}`;
124
180
 
181
+ export type ContentUrl = `url:${string}`;
182
+
125
183
  export type Relationship = {
126
184
  start: Urn;
127
185
  end: Urn;
@@ -144,6 +202,8 @@ export type Lookup = {
144
202
  label?: string | number;
145
203
  children?: Lookup[];
146
204
  description?: string;
205
+ /** Icon source in format `icon:{AntDesignIconName}` (e.g., `icon:CameraOutlined`) */
206
+ image_src?: string;
147
207
 
148
208
  /** used in AkahuDynamicSection only */
149
209
  requires_2FA?: boolean;
@@ -152,9 +212,7 @@ export type Lookup = {
152
212
  export type AATag =
153
213
  | "type:client_only"
154
214
  | "type:share_with_new_user"
155
- // heritage
156
- | `related_service_provider:n_id:${NId}`
157
- | "ServiceProvider"; // TODO: document or delete
215
+ | "Merchant"; // TODO: document or delete
158
216
 
159
217
  export type AA = {
160
218
  a_id: AId;
@@ -175,10 +233,13 @@ export type AA = {
175
233
  font?: CustomFonts;
176
234
  colors?: Colors;
177
235
  };
178
- /** the n_id of the associated service provider */
236
+ /** @deprecated use merchant_id instead */
179
237
  service_provider_n_id?: NId;
180
238
  /** the id of the associated organization */
181
- org_id: OId;
239
+ org_id?: OId;
240
+ customer_id: CId;
241
+ /** the id of the associated merchant (replaces service_provider_n_id) */
242
+ merchant_id?: MId;
182
243
 
183
244
  /** configuration for the submission rules */
184
245
  // we know the type should be `ScoreConfig`, but we can't rely that it's valid, or the right version
@@ -187,6 +248,9 @@ export type AA = {
187
248
  /** if true, only specific email addresses can submit the form */
188
249
  auth_list_enabled?: boolean;
189
250
 
251
+ /** Bot protection challenge type. If set, users must complete a challenge before accessing the wizard. */
252
+ client_challenge_type?: "turnstile" | null;
253
+
190
254
  /** Currently Unused Attributes */
191
255
  start_date?: Date;
192
256
  end_date?: Date;
@@ -196,10 +260,32 @@ export type AA = {
196
260
  metadata?: unknown;
197
261
  secret?: unknown;
198
262
 
199
- /** @internal */
263
+ /** @internal fetched separately (see #1511) */
200
264
  transitions?: unknown[];
201
265
  };
202
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
+
203
289
  export type InstanceWithoutData = CommonFields<IId, { message?: string }> & {
204
290
  /** ID of the access application this submission was made to */
205
291
  aa_id: AId;
@@ -214,10 +300,10 @@ export type InstanceWithoutData = CommonFields<IId, { message?: string }> & {
214
300
  thread: string;
215
301
  /** The status of a submission */
216
302
  state: SubmissionStatus;
217
- /** Hash of the Service Provider ID */
218
- sub_service_provider_hash: string;
219
- /** Service provider ID */
220
- 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;
221
307
 
222
308
  /** added by the client once it calculates the score */
223
309
  // Defined as `unknown` instead of `ScoreResult` because it could be nonsense,
@@ -258,28 +344,6 @@ export type Instance = InstanceWithoutData & {
258
344
  relationships: Relationship[];
259
345
  };
260
346
 
261
- /**
262
- * An organization.
263
- * NOTE: this is different to how the schema defines an Organization. **The schema is wrong (see #468)**
264
- */
265
- export type Organization = {
266
- id: OId;
267
- name: string;
268
- email: string;
269
- address: unknown; // Waiting on Backend Progress Before being properly updated (as of #1361)
270
- customer: unknown; // Waiting on Backend Progress Before being properly updated (as of #1361) (was previously Record<string, unknown>)
271
- };
272
-
273
- /** @internal some APIs now return extra info */
274
- export type FullOrg = {
275
- id: OId;
276
- organization: Omit<Organization, "id">;
277
- /** 🧙‍♂️ */
278
- gandalf: unknown;
279
- stripe: { customer: unknown };
280
- centrix_credentials: unknown;
281
- };
282
-
283
347
  /** validation data returned by preVerify (part of the extract&map API) */
284
348
  export type Validation = {
285
349
  score: number;
@@ -297,39 +361,71 @@ export type Validation = {
297
361
  };
298
362
  };
299
363
 
300
- export type WebhookStatus = "subscribed" | "pending" | "unsubscribe_failed";
301
-
302
- export type Webhook = {
303
- wi_id: WId;
304
- /** n_id of "the webhook provider which can be set up against a service provider" */
305
- provider_webhook_id: NId;
306
- /** not sure what this is */
307
- provider_webhook_subscription_id: NId;
308
- status: WebhookStatus;
309
- /** ISO Date */
310
- date_created: string;
311
- /** ISO Date */
312
- date_updated: string;
364
+ export type WebhookStatus =
365
+ | "PENDING"
366
+ | "SUBSCRIBED"
367
+ | "UNSUBSCRIBED"
368
+ | "UNSUBSCRIBE_FAILED"
369
+ | "ERROR"
370
+ | "ARCHIVED";
313
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;
314
379
  webhook_filter_schema: {
315
380
  operator: string;
316
381
  field_value: string;
317
382
  field_name: string;
318
- };
319
- webhook_action: { webhook_action_type: string }[];
320
- webhook_filter_source: string;
383
+ } | null;
384
+ webhook_action: { webhook_action_type: string }[] | null;
321
385
  webhook_field_mapping_schema: {
322
386
  [key: string]: string;
323
- };
324
- webhook_processing_rules: 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;
325
399
 
326
- provider_subscription_credentials: unknown;
327
- provider_signature_check_enabled: boolean;
328
- provider_signature_credentials: unknown;
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
404
+ };
405
+
406
+ /**
407
+ * Link used for an Access Application, including all additional information
408
+ */
409
+ export type Link = {
410
+ id: NId;
411
+ a_id: AId;
412
+ name: string;
413
+ subtitle: string;
414
+ code: LId;
415
+ url: string;
416
+ details?: AA;
417
+ isDefault?: boolean;
418
+ };
329
419
 
330
- subscribe_log?: {
331
- date: string;
332
- response_status_code: number;
333
- response_payload: Json;
334
- }[];
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;
335
431
  };