@raytio/types 7.2.0 → 7.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/README.md CHANGED
@@ -38,6 +38,7 @@ Hovering over the type in VSCode will display documentation and available proper
38
38
  - [AATag](#aatag)
39
39
  - [AId](#aid)
40
40
  - [Colors](#colors)
41
+ - [CommonFields](#commonfields)
41
42
  - [CommonSchemaAttributes](#commonschemaattributes)
42
43
  - [ConditionallyRequired](#conditionallyrequired)
43
44
  - [ContactPoint](#contactpoint)
@@ -47,10 +48,13 @@ Hovering over the type in VSCode will display documentation and available proper
47
48
  - [GId](#gid)
48
49
  - [IId](#iid)
49
50
  - [Instance](#instance)
51
+ - [InstanceWithoutData](#instancewithoutdata)
52
+ - [KId](#kid)
50
53
  - [LId](#lid)
51
54
  - [Location](#location)
52
55
  - [Lookup](#lookup)
53
56
  - [NId](#nid)
57
+ - [NId2](#nid2)
54
58
  - [OId](#oid)
55
59
  - [Organization](#organization)
56
60
  - [PId](#pid)
@@ -63,6 +67,7 @@ Hovering over the type in VSCode will display documentation and available proper
63
67
  - [Schema](#schema)
64
68
  - [SchemaField](#schemafield)
65
69
  - [SchemaFieldTag](#schemafieldtag)
70
+ - [SchemaName](#schemaname)
66
71
  - [SchemaTag](#schematag)
67
72
  - [SchemaType](#schematype)
68
73
  - [ServerSchemaField](#serverschemafield)
@@ -113,7 +118,7 @@ Hovering over the type in VSCode will display documentation and available proper
113
118
  | `service_provider_n_id?` | [`NId`](#nid) | the n_id of the associated service provider |
114
119
  | `start_date?` | `Date` | Currently Unused Attributes |
115
120
  | `tags?` | [`AATag`](#aatag)[] | - |
116
- | `theme?` | { `colors?`: [`Colors`](#colors) ; `font?`: [`CustomFonts`](modules.md#customfonts) } | - |
121
+ | `theme?` | { `colors?`: [`Colors`](#colors) ; `font?`: [`CustomFonts`](#customfonts) } | - |
117
122
  | `theme.colors?` | [`Colors`](#colors) | - |
118
123
  | `theme.font?` | [`CustomFonts`](#customfonts) | - |
119
124
 
@@ -166,6 +171,40 @@ ___
166
171
 
167
172
  ___
168
173
 
174
+ ### CommonFields
175
+
176
+ Ƭ **CommonFields**<`IdType`, `Metadata`\>: `Object`
177
+
178
+ Every object in the new database has these fields. In the
179
+ interest of type-safety, the `id` should be one of the
180
+ well-known IDs that extend StringWithIdentity (e.g.
181
+ [NId](#nid) or [AId](#aid)). If the ID is irrelevant, then
182
+ use `CommonFields<never>` rather than `CommonFields<string>`.
183
+ This will deliberately prevent you from utilising the `id`
184
+ field until you define a special type for that ID.
185
+
186
+ This is especially important with the new API where it is much
187
+ easier to mix up the different types of IDs.
188
+
189
+ #### Type parameters
190
+
191
+ | Name | Type |
192
+ | :------ | :------ |
193
+ | `IdType` | extends `StringWithIdentity`<`string`\> |
194
+ | `Metadata` | `unknown` |
195
+
196
+ #### Type declaration
197
+
198
+ | Name | Type | Description |
199
+ | :------ | :------ | :------ |
200
+ | `active` | `boolean` | - |
201
+ | `end_date` | `string` | ISO Date |
202
+ | `id` | `IdType` | - |
203
+ | `metadata` | `Metadata` \| `undefined` | - |
204
+ | `start_date` | `string` | ISO Date |
205
+
206
+ ___
207
+
169
208
  ### CommonSchemaAttributes
170
209
 
171
210
  Ƭ **CommonSchemaAttributes**: `Object`
@@ -187,12 +226,12 @@ not exported. Attributes that are identical in both client schema & server schem
187
226
  | `display.head_sub.fields` | `string`[] | - |
188
227
  | `display.head_sub.format?` | `string` | - |
189
228
  | `i18n?` | { `[locale: string]`: { `[fieldNameOrGroupName: string]`: [`ServerSchemaField`](#serverschemafield) & { `title_plural?`: `string` }; `$loading_create_sub_obj`: { `title`: `string` } ; `$loading_delete_pending_ver`: { `title`: `string` } ; `$loading_extract`: { `title`: `string` } ; `$loading_link_to_person`: { `title`: `string` } ; `$loading_long_verification_message`: { `description?`: `string` ; `title?`: `string` } ; `$loading_pending_ver_resubmit`: { `title`: `string` } ; `$loading_permission`: { `title`: `string` } ; `$loading_save`: { `title`: `string` } ; `$loading_update`: { `title`: `string` } ; `$loading_upload`: { `title`: `string` } ; `$loading_verify`: { `title`: `string` } ; `$schema`: { `description?`: `string` ; `title`: `string` ; `title_plural?`: `string` } }; } | - |
190
- | `onboard_properties?` | { `organizations?`: { `access_applications?`: { `links?`: { `description`: `string` ; `wizardConfig`: `Omit`<[`WizardConfig`](#wizardconfig), ``"a_id"``\> }[] ; `properties`: `Omit`<[`AA`](modules.md#aa), ``"org_id"``\> }[] ; `properties`: [`Organization`](modules.md#organization) }[] ; `profile_objects?`: { `properties`: `Record`<`string`, `unknown`\> ; `schema_name`: `string` }[] ; `relationships?`: { `from`: `string` ; `properties?`: `Record`<`string`, `string`\> ; `to`: `string` ; `type`: `string` }[] ; `return_to?`: `string` } | only the schema used for the onboarding wizard have this property |
191
- | `onboard_properties.organizations?` | { `access_applications?`: { `links?`: { `description`: `string` ; `wizardConfig`: `Omit`<[`WizardConfig`](#wizardconfig), ``"a_id"``\> }[] ; `properties`: `Omit`<[`AA`](modules.md#aa), ``"org_id"``\> }[] ; `properties`: [`Organization`](modules.md#organization) }[] | Organizations that should be created. NOTE: if multiple are specified, when the wizard completes, the _first one_ will be selected |
192
- | `onboard_properties.profile_objects?` | { `properties`: `Record`<`string`, `unknown`\> ; `schema_name`: `string` }[] | Profile Objects that should be created |
229
+ | `onboard_properties?` | { `organizations?`: { `access_applications?`: { `links?`: { `description`: `string` ; `wizardConfig`: `Omit`<[`WizardConfig`](#wizardconfig), ``"a_id"``\> }[] ; `properties`: `Omit`<[`AA`](#aa), ``"org_id"``\> }[] ; `properties`: [`Organization`](#organization) }[] ; `profile_objects?`: { `properties`: `Record`<`string`, `unknown`\> ; `schema_name`: [`SchemaName`](#schemaname) }[] ; `relationships?`: { `from`: `string` ; `properties?`: `Record`<`string`, `string`\> ; `to`: `string` ; `type`: `string` }[] ; `return_to?`: `string` } | only the schema used for the onboarding wizard have this property |
230
+ | `onboard_properties.organizations?` | { `access_applications?`: { `links?`: { `description`: `string` ; `wizardConfig`: `Omit`<[`WizardConfig`](#wizardconfig), ``"a_id"``\> }[] ; `properties`: `Omit`<[`AA`](#aa), ``"org_id"``\> }[] ; `properties`: [`Organization`](#organization) }[] | Organizations that should be created. NOTE: if multiple are specified, when the wizard completes, the _first one_ will be selected |
231
+ | `onboard_properties.profile_objects?` | { `properties`: `Record`<`string`, `unknown`\> ; `schema_name`: [`SchemaName`](#schemaname) }[] | Profile Objects that should be created |
193
232
  | `onboard_properties.relationships?` | { `from`: `string` ; `properties?`: `Record`<`string`, `string`\> ; `to`: `string` ; `type`: `string` }[] | Relationships that should be created |
194
233
  | `onboard_properties.return_to?` | `string` | The relative path in the client to redirect to once finished. May include variables |
195
- | `relationships?` | { `anyOf?`: `string`[] ; `direction`: ``"from"`` ; `multiple?`: `boolean` ; `oneOf?`: `string`[] ; `properties?`: { `[fieldName: string]`: [`SchemaField`](#schemafield); } ; `relationship_name`: `string` ; `required?`: `string`[] ; `required_relationship?`: `boolean` ; `type`: `string` }[] | - |
234
+ | `relationships?` | { `anyOf?`: [`SchemaName`](#schemaname)[] ; `direction`: ``"from"`` ; `multiple?`: `boolean` ; `oneOf?`: ([`SchemaName`](#schemaname) \| ``"instance"``)[] ; `properties?`: { `[fieldName: string]`: [`SchemaField`](#schemafield); } ; `relationship_name`: `string` ; `required?`: `string`[] ; `required_relationship?`: `boolean` ; `type`: `string` }[] | - |
196
235
  | `schema_group?` | `string` | the group that a schema belongs to, such as "passports". This is useful for forms that accept different types of similar documents. |
197
236
  | `schema_type?` | [`SchemaType`](#schematype) | - |
198
237
  | `tags?` | [`SchemaTag`](#schematag)[] | - |
@@ -305,39 +344,24 @@ ___
305
344
 
306
345
  ### Instance
307
346
 
308
- Ƭ **Instance**: `Object`
347
+ Ƭ **Instance**: [`InstanceWithoutData`](#instancewithoutdata) & { `keys`: { `[nId2: NId2]`: { `[fieldName: string]`: { `data`: `string` }; }; } ; `profile_objects`: [`ProfileObject`](#profileobject)[] ; `relationships`: [`Relationship`](#relationship)[] }
309
348
 
310
- #### Type declaration
349
+ The API used to store data in this format, but it no
350
+ longer does :( so `@raytio/core` reconstructs this object.
311
351
 
312
- | Name | Type | Description |
313
- | :------ | :------ | :------ |
314
- | `_state?` | [`SubmissionStatus`](#submissionstatus) | **`Deprecated`** The status of a submission |
315
- | `a_id` | [`AId`](#aid) | ID of the access application this submission was made to |
316
- | `aa_name` | `string` | name of the access application this submission was made to |
317
- | `aack_id?` | `string` | Key (Can be used to retrieve instance) |
318
- | `active?` | `boolean` | Activity Status |
319
- | `confirmation_code` | `string` | Code that validates information has been shared |
320
- | `data_provider_email` | `string` | Email of user who shared the data |
321
- | `device_id?` | `unknown` | Device Id |
322
- | `end_date` | `string` | Latest date in which the shared information was available |
323
- | `i_id` | [`IId`](#iid) | Access application instance ID |
324
- | `instance_version?` | `unknown` | Instance Version |
325
- | `keys` | { `[nId: NId]`: { `[fieldName: string]`: { `data`: `string` ; `n_id`: [`NId`](#nid) }; }; } | - |
326
- | `metadata?` | `unknown` | Metadata |
327
- | `platform_footer_html?` | `unknown` | Footer Html |
328
- | `previous_state?` | [`SubmissionStatus`](#submissionstatus) | Previous status of the shared information |
329
- | `profile_objects` | [`ProfileObject`](#profileobject)[] | data associated is access application's instance |
330
- | `reference` | `string` | reference provided by the user who shared the data |
331
- | `related_offers?` | `unknown` | Related Offers |
332
- | `related_service_types?` | `unknown` | Related Service Types |
333
- | `relationships?` | [`Relationship`](#relationship)[] | - |
334
- | `score?` | `unknown` | added by the client once it calculates the score |
335
- | `service_provider_n_id?` | [`NId`](#nid) | Service provider ID |
336
- | `source_ip?` | `unknown` | Source IP |
337
- | `start_date` | `string` | Earliest date on which the shared information was available |
338
- | `state` | [`SubmissionStatus`](#submissionstatus) | The status of a submission |
339
- | `sub_service_provider_hash?` | `string` | Hash of the Service Provider ID |
340
- | `thread` | `string` | - |
352
+ ___
353
+
354
+ ### InstanceWithoutData
355
+
356
+ Ƭ **InstanceWithoutData**: [`CommonFields`](#commonfields)<[`IId`](#iid), { `message?`: `string` }\> & { `aa_id`: [`AId`](#aid) ; `aack_id`: [`KId`](#kid) ; `confirmation_code`: `string` ; `data_provider_email`: `string` ; `device_id?`: `unknown` ; `instance_version?`: `unknown` ; `platform_footer_html?`: `unknown` ; `previous_state?`: [`SubmissionStatus`](#submissionstatus) ; `reference`: `string` ; `related_offers?`: `unknown` ; `related_service_types?`: `unknown` ; `score?`: `unknown` ; `service_provider_n_id`: [`NId`](#nid) ; `source_ip?`: `unknown` ; `state`: [`SubmissionStatus`](#submissionstatus) ; `sub_service_provider_hash`: `string` ; `thread`: `string` }
357
+
358
+ ___
359
+
360
+ ### KId
361
+
362
+ Ƭ **KId**: `StringWithIdentity`<``"KId"``\>
363
+
364
+ A `k_id` (also called a `aack_id` or a `publicKeyId`) is the ID of an AA's public key
341
365
 
342
366
  ___
343
367
 
@@ -413,6 +437,14 @@ An `n_id` is the ID of a [ProfileObject](#profileobject)
413
437
 
414
438
  ___
415
439
 
440
+ ### NId2
441
+
442
+ Ƭ **NId2**: `StringWithIdentity`<``"NId2"``\>
443
+
444
+ ⚠️ This ID duplicates the [NId](#nid) and should only be used in exceptional circumstances
445
+
446
+ ___
447
+
416
448
  ### OId
417
449
 
418
450
  Ƭ **OId**: `StringWithIdentity`<``"OId"``\>
@@ -514,7 +546,7 @@ ___
514
546
 
515
547
  ### ProfileObject
516
548
 
517
- Ƭ **ProfileObject**<`Properties`\>: `Object`
549
+ Ƭ **ProfileObject**<`Properties`\>: `Partial`<[`CommonFields`](#commonfields)<[`NId2`](#nid2)\>\> & { `labels`: `string`[] ; `n_id`: [`NId`](#nid) ; `properties`: `Properties` }
518
550
 
519
551
  You can supply an option type argument if you know exactly what the properties will be
520
552
 
@@ -524,14 +556,6 @@ You can supply an option type argument if you know exactly what the properties w
524
556
  | :------ | :------ |
525
557
  | `Properties` | `Json` |
526
558
 
527
- #### Type declaration
528
-
529
- | Name | Type |
530
- | :------ | :------ |
531
- | `labels` | `string`[] |
532
- | `n_id` | [`NId`](#nid) |
533
- | `properties` | `Properties` |
534
-
535
559
  ___
536
560
 
537
561
  ### RealVer
@@ -565,19 +589,22 @@ ___
565
589
 
566
590
  | Name | Type |
567
591
  | :------ | :------ |
592
+ | `active?` | `boolean` |
568
593
  | `end` | [`Urn`](#urn) |
594
+ | `end_date?` | `string` |
569
595
  | `p_id` | [`PId`](#pid) |
570
596
  | `properties?` | { `[fieldName: string]`: `unknown`; `name?`: `string` ; `p_id`: [`PId`](#pid) } |
571
597
  | `properties.name?` | `string` |
572
598
  | `properties.p_id` | [`PId`](#pid) |
573
599
  | `start` | [`Urn`](#urn) |
600
+ | `start_date?` | `string` |
574
601
  | `type` | `string` |
575
602
 
576
603
  ___
577
604
 
578
605
  ### Schema
579
606
 
580
- Ƭ **Schema**: [`CommonSchemaAttributes`](#commonschemaattributes) & { `clientLocale?`: `string` ; `end_date?`: `string` ; `groupNames?`: `Record`<`string`, `string`\> ; `group_title?`: `string` ; `isProfileSchema?`: `boolean` ; `isSpSchema?`: `boolean` ; `name`: `string` ; `properties`: { `[fieldName: string]`: [`SchemaField`](modules.md#schemafield); } ; `required?`: (`string` \| [`ConditionallyRequired`](modules.md#conditionallyrequired))[] ; `start_date?`: `string` ; `timing?`: `Record`<``"extract"`` \| ``"live_person"`` \| ``"verify_pending_delay"``, `number`\> ; `type?`: [`DataTypes`](modules.md#datatypes) ; `verified_fields?`: (`string` \| [`ConditionallyRequired`](modules.md#conditionallyrequired))[] ; `version`: `string` ; `wasExpandedByClient?`: `boolean` }
607
+ Ƭ **Schema**: [`CommonSchemaAttributes`](#commonschemaattributes) & { `clientLocale?`: `string` ; `end_date?`: `string` ; `groupNames?`: `Record`<`string`, `string`\> ; `group_title?`: `string` ; `isProfileSchema?`: `boolean` ; `isSpSchema?`: `boolean` ; `name`: [`SchemaName`](#schemaname) ; `properties`: { `[fieldName: string]`: [`SchemaField`](#schemafield); } ; `required?`: (`string` \| [`ConditionallyRequired`](#conditionallyrequired))[] ; `start_date?`: `string` ; `timing?`: `Record`<``"extract"`` \| ``"live_person"`` \| ``"verify_pending_delay"``, `number`\> ; `type?`: [`DataTypes`](#datatypes) ; `verified_fields?`: (`string` \| [`ConditionallyRequired`](#conditionallyrequired))[] ; `version`: `string` ; `wasExpandedByClient?`: `boolean` }
581
608
 
582
609
  Raytio's variant of JSON Schema, as used by the client. It is a modified version
583
610
  of what the API returns.
@@ -593,7 +620,7 @@ ___
593
620
  | Name | Type | Description |
594
621
  | :------ | :------ | :------ |
595
622
  | `$id?` | `string` | **`Deprecated`** don't use, it's inconsistent |
596
- | `$ref?` | `string` | If this field refers to a sub-object |
623
+ | `$ref?` | [`SchemaName`](#schemaname) | If this field refers to a sub-object |
597
624
  | `add_row_btn_label?` | `string` | if this field is a table input, this determines the text to show on the "Add Row" btn |
598
625
  | `allOf?` | [{ `$ref`: `string` }, [`ServerSchemaField`](#serverschemafield)] | - |
599
626
  | `content?` | `string` | only checkbox uses this prop |
@@ -609,7 +636,7 @@ ___
609
636
  | `examples?` | `unknown`[] | - |
610
637
  | `format?` | ``"date"`` \| ``"date-time"`` \| ``"uri"`` | - |
611
638
  | `image_silhouette?` | `string` | If this schema requires a photo of a document, you can specify a URL to a silhouette image which will be overlaid on top of the camera. For best results, the image should have a transparent background + minimal white foreground |
612
- | `items?` | { `properties`: { `[subFieldName: string]`: [`SchemaField`](#schemafield); } ; `type`: [`DataTypes`](modules.md#datatypes) } | `items` is used for nested arrays, (while `properties` is used for nested objects) |
639
+ | `items?` | { `properties`: { `[subFieldName: string]`: [`SchemaField`](#schemafield); } ; `type`: [`DataTypes`](#datatypes) } | `items` is used for nested arrays, (while `properties` is used for nested objects) |
613
640
  | `items.properties` | { `[subFieldName: string]`: [`SchemaField`](#schemafield); } | - |
614
641
  | `items.type` | [`DataTypes`](#datatypes) | - |
615
642
  | `lookup?` | `string` | URL to a JSON file in the `Lookup` format |
@@ -640,6 +667,14 @@ ___
640
667
 
641
668
  ___
642
669
 
670
+ ### SchemaName
671
+
672
+ Ƭ **SchemaName**: `StringWithIdentity`<``"SchemaName"``\>
673
+
674
+ A `SchemaName` is the ID of a [Schema](#schema)
675
+
676
+ ___
677
+
643
678
  ### SchemaTag
644
679
 
645
680
  Ƭ **SchemaTag**: ``"action:experimental_pass_object_store_id"`` \| ``"action:verify"`` \| ``"default_camera:rear"`` \| ``"default_camera:front"`` \| \`oauth2\_component:name:${string}\` \| \`oauth2\_component:redirect\_url:${string}\` \| \`time:${string}:${number}\` \| \`link\_to:${string}:${string}\` \| ``"type:service_provider"`` \| ``"type:service_offer"`` \| ``"type:marketplace"`` \| ``"type:client_only"`` \| ``"type:globally_unique_field"``
@@ -678,7 +713,7 @@ ___
678
713
 
679
714
  ### Urn
680
715
 
681
- Ƭ **Urn**: \`urn:user:${UId}\` \| \`urn:profile\_object:${NId}\` \| \`urn:instance:${IId}\` \| \`urn:temp\_object:${LId}\` \| \`urn:schema:${string}\` \| \`urn:document:${NId}\`
716
+ Ƭ **Urn**: \`urn:user:${UId}\` \| \`urn:profile\_object:${NId}\` \| \`urn:instance:${IId}\` \| \`urn:temp\_object:${LId}\` \| \`urn:schema:${SchemaName}\` \| \`urn:document:${NId}\`
682
717
 
683
718
  e.g. "urn:user:..."
684
719
 
@@ -708,7 +743,7 @@ ___
708
743
 
709
744
  ### Verification
710
745
 
711
- Ƭ **Verification**<`WithValue`\>: [`ProfileObject`](#profileobject)<{ `field`: `string` ; `n_id`: [`NId`](modules.md#nid) ; `valid_until?`: `string` ; `verifications`: [{ `data`: [`VerificationPayload`](modules.md#verificationpayload)<`WithValue`\> ; `hashing_algorithm?`: ``"SHA512"`` ; `key_id?`: `string` ; `key_urn?`: `string` ; `signature`: `string` ; `signing_algorithm?`: ``"RSASSA_PSS_SHA_512"`` }] }\>
746
+ Ƭ **Verification**<`WithValue`\>: [`ProfileObject`](#profileobject)<{ `field`: `string` ; `n_id`: [`NId`](#nid) ; `valid_until?`: `string` ; `verifications`: [{ `data`: [`VerificationPayload`](#verificationpayload)<`WithValue`\> ; `hashing_algorithm?`: ``"SHA512"`` ; `key_id?`: `string` ; `key_urn?`: `string` ; `signature`: `string` ; `signing_algorithm?`: ``"RSASSA_PSS_SHA_512"`` }] }\>
712
747
 
713
748
  Different APIs inconsistently include the `value` prop. If you know it exists,
714
749
  use `Verification<true>`, otherwise just `Verification`. Verifications from
@@ -724,7 +759,7 @@ ___
724
759
 
725
760
  ### VerificationPayload
726
761
 
727
- Ƭ **VerificationPayload**<`WithValue`\>: { `field`: `string` ; `metadata?`: { `[otherAttributes: string]`: `unknown`; `pending_details?`: { `pending_time`: ``"short"`` \| ``"long"`` ; `pending_type`: ``"time"`` \| ``"user"`` } ; `safeHarbourScore?`: [`SafeHarbourCode`](enums/SafeHarbourCode.md) ; `status?`: ``"pending"`` } ; `passed`: `boolean` ; `request_div`: `string` ; `schema?`: `string` ; `source`: `string` ; `source_hashed_n_id?`: [`NId`](#nid) ; `source_n_id?`: [`NId`](modules.md#nid) ; `type?`: ``null`` ; `v_id`: `string` ; `verification_date`: `string` ; `verifier_div`: `string` ; `verifier_id?`: [`NId`](modules.md#nid) ; `verifier_service_id?`: [`NId`](modules.md#nid) ; `verifier_source_id?`: [`NId`](modules.md#nid) } & `WithValue` extends ``true`` ? { `value`: `string` \| `number` } : {}
762
+ Ƭ **VerificationPayload**<`WithValue`\>: { `field`: `string` ; `metadata?`: { `[otherAttributes: string]`: `unknown`; `pending_details?`: { `pending_time`: ``"short"`` \| ``"long"`` ; `pending_type`: ``"time"`` \| ``"user"`` } ; `safeHarbourScore?`: [`SafeHarbourCode`](enums/SafeHarbourCode.md) ; `status?`: ``"pending"`` } ; `passed`: `boolean` ; `request_div`: `string` ; `schema?`: [`SchemaName`](#schemaname) ; `source`: `string` ; `source_hashed_n_id?`: [`NId`](#nid) ; `source_n_id?`: [`NId`](#nid) ; `type?`: ``null`` ; `v_id`: `string` ; `verification_date`: `string` ; `verifier_div`: `string` ; `verifier_id?`: [`NId`](#nid) ; `verifier_service_id?`: [`NId`](#nid) ; `verifier_source_id?`: [`NId`](#nid) } & `WithValue` extends ``true`` ? { `value`: `string` \| `number` } : {}
728
763
 
729
764
  #### Type parameters
730
765
 
@@ -817,10 +852,10 @@ in the query parameters, it needs to be base64 and/or url encoded.
817
852
  | `return_to?` | `string` | the callback url to redirect to once complete. Must be in the AA's list of authorized callback urls |
818
853
  | `review_text?` | `string` | the text on the WizardReview page |
819
854
  | `sharing_data_message?` | `string` | the loading message to show next to the spinner after the review screen |
820
- | `signature_schema?` | `string` | if specified, a Wizard will be shown on the review page with this schema |
855
+ | `signature_schema?` | [`SchemaName`](#schemaname) | if specified, a Wizard will be shown on the review page with this schema |
821
856
  | `skip_share?` | `boolean` | **`Deprecated`** added in !244 but never used |
822
857
  | `submit_text?` | `string` | the submit button label |
823
- | `terms_schema?` | `string` | if specified, a Wizard will be shown on the review page with this schema |
858
+ | `terms_schema?` | [`SchemaName`](#schemaname) | if specified, a Wizard will be shown on the review page with this schema |
824
859
  | `update_reference?` | `boolean` | whether the user can change the reference, if there is one in the QP |
825
860
  | `webauthn_type?` | (``"usb"`` \| ``"nfc"`` \| ``"ble"`` \| ``"internal"``)[] | if specified, the user must validate their WebAuthN credential before they can submit the form |
826
861
 
@@ -860,7 +895,7 @@ configuration data for a single wizard page ([WizardConfig](#wizardconfig))
860
895
  | `profile?` | `boolean` | if explictly == false, then it's an AO (not a PO), in which case there can only be one schema |
861
896
  | `reverify_header?` | `string` | custom text & header that's displayed on reverfication modal for expired PO |
862
897
  | `reverify_text?` | `string` | - |
863
- | `schemas` | `string`[] | - |
898
+ | `schemas` | [`SchemaName`](#schemaname)[] | - |
864
899
  | `selection_hierarchy_json?` | `string` | a URL to a preset for configuing NestedSchemaSelect. DeepConfig |
865
900
  | `service_provider_link?` | `boolean` | see #463 |
866
901
  | `share?` | ``"profile"`` \| ``"verification"`` \| ``"both"`` | the information to share. undefined implies both. |
@@ -887,8 +922,8 @@ This is what's returned by the API
887
922
  | :------ | :------ | :------ |
888
923
  | `active` | ``true`` | - |
889
924
  | `end_date` | `string` | ISO Date. If this tag exists, the schema is deprecated. |
890
- | `schema` | [`CommonSchemaAttributes`](#commonschemaattributes) & { `$id?`: `string` ; `$schema?`: `string` ; `allOf?`: { `$ref?`: `string` ; `if?`: `Partial`<[`WrappedSchema`](modules.md#wrappedschema)[``"schema"``]\> ; `then?`: `Partial`<[`WrappedSchema`](modules.md#wrappedschema)[``"schema"``]\> }[] ; `definitions?`: `Record`<`string`, { `$ref`: [`Urn`](modules.md#urn) }\> ; `properties`: { `[fieldName: string]`: [`ServerSchemaField`](modules.md#serverschemafield); } ; `required?`: `string`[] ; `verified_fields?`: `string`[] } | - |
891
- | `schema_name` | `string` | Schema Name Type and Version Properties |
925
+ | `schema` | [`CommonSchemaAttributes`](#commonschemaattributes) & { `$id?`: `string` ; `$schema?`: `string` ; `allOf?`: { `$ref?`: `string` ; `if?`: `Partial`<[`WrappedSchema`](#wrappedschema)[``"schema"``]\> ; `then?`: `Partial`<[`WrappedSchema`](#wrappedschema)[``"schema"``]\> }[] ; `definitions?`: `Record`<`string`, { `$ref`: [`Urn`](#urn) }\> ; `properties`: { `[fieldName: string]`: [`ServerSchemaField`](#serverschemafield); } ; `required?`: `string`[] ; `verified_fields?`: `string`[] } | - |
926
+ | `schema_name` | [`SchemaName`](#schemaname) | Schema Name Type and Version Properties |
892
927
  | `schema_type` | [`SchemaType`](#schematype) | - |
893
928
  | `schema_version` | `string` | - |
894
929
  | `start_date` | `string` | ISO Date |
package/dist/raytio.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Encrypted } from "./crypto";
2
- import { Colors, CustomFonts } from "./theme";
1
+ import type { Encrypted } from "./crypto";
2
+ import type { Colors, CustomFonts } from "./theme";
3
3
  /** @internal see Microsoft/TypeScript#202 */
4
4
  export type StringWithIdentity<T> = string & {
5
5
  $$typeof$$: T;
@@ -12,6 +12,8 @@ export type PId = StringWithIdentity<"PId">;
12
12
  export type IId = StringWithIdentity<"IId">;
13
13
  /** An `n_id` is the ID of a {@link ProfileObject} */
14
14
  export type NId = StringWithIdentity<"NId">;
15
+ /** ⚠️ This ID duplicates the {@link NId} and should only be used in exceptional circumstances */
16
+ export type NId2 = StringWithIdentity<"NId2">;
15
17
  /** A `g_id` is the ID of a group */
16
18
  export type GId = StringWithIdentity<"GId">;
17
19
  /** A `u_id` is the ID of a user */
@@ -23,10 +25,35 @@ export type OId = StringWithIdentity<"OId">;
23
25
  /** A `wi_id` is the ID of a {@link Webhook} */
24
26
  export type WId = StringWithIdentity<"WId">;
25
27
  /** An `l_id` is the ID of any data stored in the KV-Store */ export type LId = StringWithIdentity<"LId">;
28
+ /** A `k_id` (also called a `aack_id` or a `publicKeyId`) is the ID of an AA's public key */
29
+ export type KId = StringWithIdentity<"KId">;
30
+ /** A `SchemaName` is the ID of a {@link Schema} */
31
+ export type SchemaName = StringWithIdentity<"SchemaName">;
26
32
  export type DataTypes = "string" | "number" | "boolean" | "object" | "integer" | "array" | "null";
27
33
  export type SubmissionStatus = "Submitted" | "Processing" | "Rejected" | "Expired" | "Completed" | "DataChanged" | "Received" | "Accepted";
34
+ /**
35
+ * Every object in the new database has these fields. In the
36
+ * interest of type-safety, the `id` should be one of the
37
+ * well-known IDs that extend {@link StringWithIdentity} (e.g.
38
+ * {@link NId} or {@link AId}). If the ID is irrelevant, then
39
+ * use `CommonFields<never>` rather than `CommonFields<string>`.
40
+ * This will deliberately prevent you from utilising the `id`
41
+ * field until you define a special type for that ID.
42
+ *
43
+ * This is especially important with the new API where it is much
44
+ * easier to mix up the different types of IDs.
45
+ */
46
+ export type CommonFields<IdType extends StringWithIdentity<string>, Metadata = unknown> = {
47
+ id: IdType;
48
+ /** ISO Date */
49
+ start_date: string;
50
+ /** ISO Date */
51
+ end_date: string;
52
+ active: boolean;
53
+ metadata: Metadata | undefined;
54
+ };
28
55
  /** You can supply an option type argument if you know exactly what the properties will be */
29
- export type ProfileObject<Properties = Json> = {
56
+ export type ProfileObject<Properties = Json> = Partial<CommonFields<NId2>> & {
30
57
  n_id: NId;
31
58
  properties: Properties;
32
59
  labels: string[];
@@ -46,12 +73,12 @@ export type ProfileObjectForUpload<Properties = Json> = {
46
73
  type?: string;
47
74
  };
48
75
  labels?: string[];
49
- schema?: string;
76
+ schema?: SchemaName;
50
77
  n_id?: NId;
51
78
  };
52
79
  export type UrnNodeType = "user" | "profile_object" | "instance" | "schema" | "temp_object" | "document";
53
80
  /** e.g. "urn:user:..." */
54
- export type Urn = `urn:user:${UId}` | `urn:profile_object:${NId}` | `urn:instance:${IId}` | `urn:temp_object:${LId}` | `urn:schema:${string}` | `urn:document:${NId}`;
81
+ export type Urn = `urn:user:${UId}` | `urn:profile_object:${NId}` | `urn:instance:${IId}` | `urn:temp_object:${LId}` | `urn:schema:${SchemaName}` | `urn:document:${NId}`;
55
82
  export type Relationship = {
56
83
  start: Urn;
57
84
  end: Urn;
@@ -62,6 +89,9 @@ export type Relationship = {
62
89
  name?: string;
63
90
  [fieldName: string]: unknown;
64
91
  };
92
+ start_date?: string;
93
+ end_date?: string;
94
+ active?: boolean;
65
95
  };
66
96
  export type Lookup = {
67
97
  key: string | number;
@@ -112,13 +142,13 @@ export type AA = {
112
142
  /** @internal */
113
143
  transitions?: unknown[];
114
144
  };
115
- export type Instance = {
116
- /** Access application instance ID */
117
- i_id: IId;
145
+ export type InstanceWithoutData = CommonFields<IId, {
146
+ message?: string;
147
+ }> & {
118
148
  /** ID of the access application this submission was made to */
119
- a_id: AId;
120
- /** name of the access application this submission was made to */
121
- aa_name: string;
149
+ aa_id: AId;
150
+ /** ID of the public key for this AA */
151
+ aack_id: KId;
122
152
  /** Code that validates information has been shared */
123
153
  confirmation_code: string;
124
154
  /** reference provided by the user who shared the data */
@@ -126,29 +156,12 @@ export type Instance = {
126
156
  /** Email of user who shared the data */
127
157
  data_provider_email: string;
128
158
  thread: string;
129
- /** Latest date in which the shared information was available */
130
- end_date: string;
131
- /** Earliest date on which the shared information was available */
132
- start_date: string;
133
159
  /** The status of a submission */
134
160
  state: SubmissionStatus;
135
- /** @deprecated The status of a submission */
136
- _state?: SubmissionStatus;
137
161
  /** Hash of the Service Provider ID */
138
- sub_service_provider_hash?: string;
162
+ sub_service_provider_hash: string;
139
163
  /** Service provider ID */
140
- service_provider_n_id?: NId;
141
- /** data associated is access application's instance */
142
- profile_objects: ProfileObject[];
143
- keys: {
144
- [nId: NId]: {
145
- [fieldName: string]: {
146
- data: string;
147
- n_id: NId;
148
- };
149
- };
150
- };
151
- relationships?: Relationship[];
164
+ service_provider_n_id: NId;
152
165
  /** added by the client once it calculates the score */
153
166
  score?: unknown;
154
167
  /** Previous status of the shared information */
@@ -165,12 +178,21 @@ export type Instance = {
165
178
  platform_footer_html?: unknown;
166
179
  /** Related Service Types */
167
180
  related_service_types?: unknown;
168
- /** Activity Status */
169
- active?: boolean;
170
- /** Key (Can be used to retrieve instance) */
171
- aack_id?: string;
172
- /** Metadata */
173
- metadata?: unknown;
181
+ };
182
+ /**
183
+ * The API used to store data in this format, but it no
184
+ * longer does :( so `@raytio/core` reconstructs this object.
185
+ */
186
+ export type Instance = InstanceWithoutData & {
187
+ profile_objects: ProfileObject[];
188
+ keys: {
189
+ [nId2: NId2]: {
190
+ [fieldName: string]: {
191
+ data: string;
192
+ };
193
+ };
194
+ };
195
+ relationships: Relationship[];
174
196
  };
175
197
  /**
176
198
  * An organization.
package/dist/schema.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { AA, DataTypes, Organization, Urn } from "./raytio";
2
- import { WizardConfig } from "./wizard";
1
+ import type { AA, DataTypes, Organization, SchemaName, Urn } from "./raytio";
2
+ import type { WizardConfig } from "./wizard";
3
3
  /** should be renamed since this applies to ConditionallyVerifiable */
4
4
  export type ConditionallyRequired = {
5
5
  field: string;
@@ -53,7 +53,7 @@ export type SchemaField = {
53
53
  [subFieldName: string]: SchemaField;
54
54
  };
55
55
  /** If this field refers to a sub-object */
56
- $ref?: string;
56
+ $ref?: SchemaName;
57
57
  /**
58
58
  * @internal
59
59
  * the client adds this for conditional properties, see #329
@@ -175,9 +175,9 @@ export type CommonSchemaAttributes = {
175
175
  /** if required_relationship then use will be alerted in relationship menu and won't be able to share PO unless filled out */
176
176
  required_relationship?: boolean;
177
177
  /** Specify `oneOf` XOR `anyOf`. It's a list of schema names, or `"instance"` (see #784) */
178
- oneOf?: string[];
178
+ oneOf?: (SchemaName | "instance")[];
179
179
  /** Specify `oneOf` XOR `anyOf` It's a list of schema names. */
180
- anyOf?: string[];
180
+ anyOf?: SchemaName[];
181
181
  /** assume TRUE if not specified */
182
182
  multiple?: boolean;
183
183
  /** these are arbitary fields on the relationship */
@@ -217,7 +217,7 @@ export type CommonSchemaAttributes = {
217
217
  onboard_properties?: {
218
218
  /** Profile Objects that should be created */
219
219
  profile_objects?: {
220
- schema_name: string;
220
+ schema_name: SchemaName;
221
221
  properties: Record<string, unknown>;
222
222
  }[];
223
223
  /** Relationships that should be created */
@@ -254,7 +254,7 @@ export type CommonSchemaAttributes = {
254
254
  */
255
255
  export type Schema = CommonSchemaAttributes & {
256
256
  /** added by the client, copied from {@link WrappedSchema} */
257
- name: string;
257
+ name: SchemaName;
258
258
  /** added by client */
259
259
  type?: DataTypes;
260
260
  /** the localized title of the `schema_group`. added by the client */
@@ -299,7 +299,7 @@ export type WrappedSchema = {
299
299
  /** ISO Date. If this tag exists, the schema is deprecated. */
300
300
  end_date: string;
301
301
  /** Schema Name Type and Version Properties */
302
- schema_name: string;
302
+ schema_name: SchemaName;
303
303
  schema_type: SchemaType;
304
304
  schema_version: string;
305
305
  /** whether the \`version\` is the latest version */
@@ -1,4 +1,4 @@
1
- import { NId, ProfileObject } from "./raytio";
1
+ import type { NId, ProfileObject, SchemaName } from "./raytio";
2
2
  export declare enum SafeHarbourCode {
3
3
  /** “a match has been made on each the Full Name, Address and Date of Birth” */
4
4
  M1 = "M1",
@@ -9,7 +9,7 @@ export declare enum SafeHarbourCode {
9
9
  }
10
10
  export type VerificationPayload<WithValue extends boolean> = {
11
11
  field: string;
12
- schema?: string;
12
+ schema?: SchemaName;
13
13
  metadata?: {
14
14
  safeHarbourScore?: SafeHarbourCode;
15
15
  status?: "pending";
package/dist/wizard.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { AId } from "./raytio";
1
+ import type { AId, SchemaName } from "./raytio";
2
2
  export type WizardPageTag = "action:require_chip";
3
3
  /** configuration data for a single wizard page ({@link WizardConfig}) */
4
4
  export type WizardPage = {
5
5
  /** if undefined, the schema title will be used */
6
6
  name?: string | symbol;
7
7
  filter: "oneOf" | "anyOf";
8
- schemas: string[];
8
+ schemas: SchemaName[];
9
9
  /** the fallback description, if there isn't one for the specific situation */
10
10
  description?: string;
11
11
  description_select?: string;
@@ -81,9 +81,9 @@ export type WizardConfig = {
81
81
  /** number of days in the future */
82
82
  expiry_date?: number;
83
83
  /** if specified, a Wizard will be shown on the review page with this schema */
84
- terms_schema?: string;
84
+ terms_schema?: SchemaName;
85
85
  /** if specified, a Wizard will be shown on the review page with this schema */
86
- signature_schema?: string;
86
+ signature_schema?: SchemaName;
87
87
  reference?: string;
88
88
  /**
89
89
  * the callback url to redirect to once complete. Must be in the AA's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raytio/types",
3
- "version": "7.2.0",
3
+ "version": "7.3.0",
4
4
  "license": "MIT",
5
5
  "main": "index",
6
6
  "types": "index",
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
- import { Urn, UrnNodeType } from "..";
2
+ import type { Urn, UrnNodeType } from "..";
3
3
 
4
4
  // test that the definition of `Urn` only uses valid `UrnNodeType`s
5
5
  const assertTrue: Urn extends `urn:${UrnNodeType}:${string}` ? true : false =
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
- import { Schema, SchemaField, WrappedSchema } from "..";
2
+ import type { Schema, SchemaField, WrappedSchema } from "..";
3
3
 
4
4
  /**
5
5
  * this file is not run, it is just compiled by tsc
package/src/raytio.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Encrypted } from "./crypto";
2
- import { Colors, CustomFonts } from "./theme";
1
+ import type { Encrypted } from "./crypto";
2
+ import type { Colors, CustomFonts } from "./theme";
3
3
 
4
4
  /** @internal see Microsoft/TypeScript#202 */
5
5
  export type StringWithIdentity<T> = string & { $$typeof$$: T };
@@ -13,6 +13,8 @@ export type PId = StringWithIdentity<"PId">;
13
13
  export type IId = StringWithIdentity<"IId">;
14
14
  /** An `n_id` is the ID of a {@link ProfileObject} */
15
15
  export type NId = StringWithIdentity<"NId">;
16
+ /** ⚠️ This ID duplicates the {@link NId} and should only be used in exceptional circumstances */
17
+ export type NId2 = StringWithIdentity<"NId2">;
16
18
  /** A `g_id` is the ID of a group */
17
19
  export type GId = StringWithIdentity<"GId">;
18
20
  /** A `u_id` is the ID of a user */
@@ -25,6 +27,10 @@ export type OId = StringWithIdentity<"OId">;
25
27
  export type WId = StringWithIdentity<"WId">;
26
28
  /** An `l_id` is the ID of any data stored in the KV-Store */ // e.g. StoredWizardConfig and VerBundleMetadata
27
29
  export type LId = StringWithIdentity<"LId">;
30
+ /** A `k_id` (also called a `aack_id` or a `publicKeyId`) is the ID of an AA's public key */
31
+ export type KId = StringWithIdentity<"KId">;
32
+ /** A `SchemaName` is the ID of a {@link Schema} */
33
+ export type SchemaName = StringWithIdentity<"SchemaName">;
28
34
 
29
35
  export type DataTypes =
30
36
  | "string"
@@ -45,8 +51,33 @@ export type SubmissionStatus =
45
51
  | "Received"
46
52
  | "Accepted";
47
53
 
54
+ /**
55
+ * Every object in the new database has these fields. In the
56
+ * interest of type-safety, the `id` should be one of the
57
+ * well-known IDs that extend {@link StringWithIdentity} (e.g.
58
+ * {@link NId} or {@link AId}). If the ID is irrelevant, then
59
+ * use `CommonFields<never>` rather than `CommonFields<string>`.
60
+ * This will deliberately prevent you from utilising the `id`
61
+ * field until you define a special type for that ID.
62
+ *
63
+ * This is especially important with the new API where it is much
64
+ * easier to mix up the different types of IDs.
65
+ */
66
+ export type CommonFields<
67
+ IdType extends StringWithIdentity<string>,
68
+ Metadata = unknown,
69
+ > = {
70
+ id: IdType;
71
+ /** ISO Date */
72
+ start_date: string;
73
+ /** ISO Date */
74
+ end_date: string;
75
+ active: boolean;
76
+ metadata: Metadata | undefined;
77
+ };
78
+
48
79
  /** You can supply an option type argument if you know exactly what the properties will be */
49
- export type ProfileObject<Properties = Json> = {
80
+ export type ProfileObject<Properties = Json> = Partial<CommonFields<NId2>> & {
50
81
  n_id: NId;
51
82
  properties: Properties;
52
83
  labels: string[];
@@ -70,7 +101,7 @@ export type ProfileObjectForUpload<Properties = Json> = {
70
101
 
71
102
  // TODO: represent the below constraint in the typedef
72
103
  // `schema` XOR `n_id` depending on whether creating or updating
73
- schema?: string; // only if creating a new PO
104
+ schema?: SchemaName; // only if creating a new PO
74
105
  n_id?: NId; // only if editing an existing PO
75
106
  };
76
107
 
@@ -88,7 +119,7 @@ export type Urn =
88
119
  | `urn:profile_object:${NId}`
89
120
  | `urn:instance:${IId}`
90
121
  | `urn:temp_object:${LId}`
91
- | `urn:schema:${/* schemaName */ string}`
122
+ | `urn:schema:${SchemaName}`
92
123
  | `urn:document:${NId}`;
93
124
 
94
125
  export type Relationship = {
@@ -101,6 +132,9 @@ export type Relationship = {
101
132
  name?: string;
102
133
  [fieldName: string]: unknown;
103
134
  };
135
+ start_date?: string;
136
+ end_date?: string;
137
+ active?: boolean;
104
138
  };
105
139
 
106
140
  export type Lookup = {
@@ -166,13 +200,11 @@ export type AA = {
166
200
  transitions?: unknown[];
167
201
  };
168
202
 
169
- export type Instance = {
170
- /** Access application instance ID */
171
- i_id: IId;
203
+ export type InstanceWithoutData = CommonFields<IId, { message?: string }> & {
172
204
  /** ID of the access application this submission was made to */
173
- a_id: AId;
174
- /** name of the access application this submission was made to */
175
- aa_name: string;
205
+ aa_id: AId;
206
+ /** ID of the public key for this AA */
207
+ aack_id: KId;
176
208
  /** Code that validates information has been shared */
177
209
  confirmation_code: string;
178
210
  /** reference provided by the user who shared the data */
@@ -180,31 +212,12 @@ export type Instance = {
180
212
  /** Email of user who shared the data */
181
213
  data_provider_email: string;
182
214
  thread: string;
183
- /** Latest date in which the shared information was available */
184
- end_date: string;
185
- /** Earliest date on which the shared information was available */
186
- start_date: string;
187
215
  /** The status of a submission */
188
216
  state: SubmissionStatus;
189
- /** @deprecated The status of a submission */
190
- _state?: SubmissionStatus;
191
-
192
217
  /** Hash of the Service Provider ID */
193
- sub_service_provider_hash?: string;
218
+ sub_service_provider_hash: string;
194
219
  /** Service provider ID */
195
- service_provider_n_id?: NId;
196
- /** data associated is access application's instance */
197
- profile_objects: ProfileObject[];
198
- // TODO: (semver breaking) mark as optional since the get-shared-data API doesn't return keys
199
- keys: {
200
- [nId: NId]: {
201
- [fieldName: string]: {
202
- data: string;
203
- n_id: NId;
204
- };
205
- };
206
- };
207
- relationships?: Relationship[];
220
+ service_provider_n_id: NId;
208
221
 
209
222
  /** added by the client once it calculates the score */
210
223
  // Defined as `unknown` instead of `ScoreResult` because it could be nonsense,
@@ -226,12 +239,23 @@ export type Instance = {
226
239
  platform_footer_html?: unknown;
227
240
  /** Related Service Types */
228
241
  related_service_types?: unknown;
229
- /** Activity Status */
230
- active?: boolean;
231
- /** Key (Can be used to retrieve instance) */
232
- aack_id?: string;
233
- /** Metadata */
234
- metadata?: unknown;
242
+ };
243
+
244
+ /**
245
+ * The API used to store data in this format, but it no
246
+ * longer does :( so `@raytio/core` reconstructs this object.
247
+ */
248
+ export type Instance = InstanceWithoutData & {
249
+ profile_objects: ProfileObject[];
250
+ keys: {
251
+ // this is no longer keyed by the nId,
252
+ [nId2: NId2]: {
253
+ [fieldName: string]: {
254
+ data: string;
255
+ };
256
+ };
257
+ };
258
+ relationships: Relationship[];
235
259
  };
236
260
 
237
261
  /**
package/src/schema.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { AA, DataTypes, Organization, Urn } from "./raytio";
2
- import { WizardConfig } from "./wizard";
1
+ import type { AA, DataTypes, Organization, SchemaName, Urn } from "./raytio";
2
+ import type { WizardConfig } from "./wizard";
3
3
 
4
4
  /** should be renamed since this applies to ConditionallyVerifiable */
5
5
  export type ConditionallyRequired = {
@@ -104,7 +104,7 @@ export type SchemaField = {
104
104
  };
105
105
 
106
106
  /** If this field refers to a sub-object */
107
- $ref?: string;
107
+ $ref?: SchemaName;
108
108
 
109
109
  /**
110
110
  * @internal
@@ -221,9 +221,9 @@ export type CommonSchemaAttributes = {
221
221
  /** if required_relationship then use will be alerted in relationship menu and won't be able to share PO unless filled out */
222
222
  required_relationship?: boolean;
223
223
  /** Specify `oneOf` XOR `anyOf`. It's a list of schema names, or `"instance"` (see #784) */
224
- oneOf?: string[];
224
+ oneOf?: (SchemaName | "instance")[];
225
225
  /** Specify `oneOf` XOR `anyOf` It's a list of schema names. */
226
- anyOf?: string[];
226
+ anyOf?: SchemaName[];
227
227
 
228
228
  /** assume TRUE if not specified */
229
229
  multiple?: boolean;
@@ -259,7 +259,7 @@ export type CommonSchemaAttributes = {
259
259
  onboard_properties?: {
260
260
  /** Profile Objects that should be created */
261
261
  profile_objects?: {
262
- schema_name: string;
262
+ schema_name: SchemaName;
263
263
  properties: Record<string, unknown>;
264
264
  }[];
265
265
 
@@ -300,7 +300,7 @@ export type CommonSchemaAttributes = {
300
300
  */
301
301
  export type Schema = CommonSchemaAttributes & {
302
302
  /** added by the client, copied from {@link WrappedSchema} */
303
- name: string; // Will always exist on schema
303
+ name: SchemaName;
304
304
 
305
305
  /** added by client */
306
306
  type?: DataTypes;
@@ -361,7 +361,7 @@ export type WrappedSchema = {
361
361
  end_date: string;
362
362
 
363
363
  /** Schema Name Type and Version Properties */
364
- schema_name: string;
364
+ schema_name: SchemaName;
365
365
  schema_type: SchemaType;
366
366
  schema_version: string;
367
367
 
@@ -1,4 +1,4 @@
1
- import { NId, ProfileObject } from "./raytio";
1
+ import type { NId, ProfileObject, SchemaName } from "./raytio";
2
2
 
3
3
  // see #659
4
4
  export enum SafeHarbourCode {
@@ -13,7 +13,7 @@ export enum SafeHarbourCode {
13
13
  export type VerificationPayload<WithValue extends boolean> = {
14
14
  // we deliberately haven't defined 'sub'
15
15
  field: string;
16
- schema?: string;
16
+ schema?: SchemaName;
17
17
  metadata?: {
18
18
  safeHarbourScore?: SafeHarbourCode;
19
19
  status?: "pending";
package/src/wizard.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AId } from "./raytio";
1
+ import type { AId, SchemaName } from "./raytio";
2
2
 
3
3
  export type WizardPageTag =
4
4
  // actions
@@ -9,7 +9,7 @@ export type WizardPage = {
9
9
  /** if undefined, the schema title will be used */
10
10
  name?: string | symbol;
11
11
  filter: "oneOf" | "anyOf";
12
- schemas: string[];
12
+ schemas: SchemaName[];
13
13
 
14
14
  /** the fallback description, if there isn't one for the specific situation */
15
15
  description?: string;
@@ -110,9 +110,9 @@ export type WizardConfig = {
110
110
  /** number of days in the future */
111
111
  expiry_date?: number;
112
112
  /** if specified, a Wizard will be shown on the review page with this schema */
113
- terms_schema?: string;
113
+ terms_schema?: SchemaName;
114
114
  /** if specified, a Wizard will be shown on the review page with this schema */
115
- signature_schema?: string;
115
+ signature_schema?: SchemaName;
116
116
 
117
117
  // the following ones are generally not pre-configured, instead they
118
118
  // just come from the URL query params.