@raytio/types
TypeScript icon, indicating that this package has built-in type declarations

7.3.0 • Public • Published

@raytio/types

This module contains typescript definitions for Raytio data structures, such as Schema and ProfileObject.

Usage

Install the package:

npm i -D @raytio/types

Import definitions:

import type { Schema } from "@raytio/types";

Hovering over the type in VSCode will display documentation and available properties.

Versioning

⚠️ This package does not strictly follow semver, since every change to the type definitions is a breaking change.

Documentation

Table of contents

Enumerations

Type Aliases

Type Aliases

AA

Ƭ AA: Object

Type declaration

Name Type Description
a_id AId -
aa_help? string markdown or string help information including [phoneNumber || email]
aa_introduction? string If a user signs up while completing this form, this message will be sent in the sign up email.
active? boolean -
auth_list_enabled? boolean if true, only specific email addresses can submit the form
callback_uri? string[] -
description? string -
end_date? Date -
key? string -
logout_uri? string[] -
metadata? unknown -
name string -
org_id OId the id of the associated organization
picture? Urn Deprecated see !2101
picture_url? string Easy to use AA logo url for pasting into emails
ruleset? unknown configuration for the submission rules
scopes? string[] -
secret? unknown -
service_provider_n_id? NId the n_id of the associated service provider
start_date? Date Currently Unused Attributes
tags? AATag[] -
theme? { colors?: Colors ; font?: CustomFonts } -
theme.colors? Colors -
theme.font? CustomFonts -

AATag

Ƭ AATag: "type:client_only" | "type:share_with_new_user" | `related_service_provider:n_id:${NId}` | "ServiceProvider"


AId

Ƭ AId: StringWithIdentity<"AId">

An a_id is the ID of an AA


Colors

Ƭ Colors: Object

Type declaration

Name Type Description
blank string -
climaterolText string -
climaterolUi string -
errorRed string -
feelingHugged string -
loadingYellow string -
poolblueText string -
poolblueUi string -
raytioOrangeHover string -
raytioOrangeShade string
raytioOrangeText string -
raytioOrangeUi string -
sariShade string -
silverShell string -
sirPinklyText string -
sirPinklyUi string -
successGreen string -
textFull string -
textLight string -
textMedium string -
violaPerpetuoText string -
violaPerpetuoUi string -

CommonFields

Ƭ CommonFields<IdType, Metadata>: Object

Every object in the new database has these fields. In the interest of type-safety, the id should be one of the well-known IDs that extend StringWithIdentity (e.g. NId or AId). If the ID is irrelevant, then use CommonFields<never> rather than CommonFields<string>. This will deliberately prevent you from utilising the id field until you define a special type for that ID.

This is especially important with the new API where it is much easier to mix up the different types of IDs.

Type parameters

Name Type
IdType extends StringWithIdentity<string>
Metadata unknown

Type declaration

Name Type Description
active boolean -
end_date string ISO Date
id IdType -
metadata Metadata | undefined -
start_date string ISO Date

CommonSchemaAttributes

Ƭ CommonSchemaAttributes: Object

not exported. Attributes that are identical in both client schema & server schema

Type declaration

Name Type Description
description string -
description_decorator? "md" specifies that the description is formatted in markdown
display? { expand?: { fields: string[] ; label: string }[] ; head_main?: { fields: string[] ; format?: string } ; head_sub?: { fields: string[] ; format?: string } } -
display.expand? { fields: string[] ; label: string }[] list of fields that should not be shown by default, unless you expand a collpase section which has a name from the label property. Array because there could be multiple expand groups
display.head_main? { fields: string[] ; format?: string } list of fields to be considered the header/name of the PO fields joined with a space unless format format string is supplied
display.head_main.fields string[] -
display.head_main.format? string -
display.head_sub? { fields: string[] ; format?: string } list of fields to be considered the subheader of the PO fields joined with a space unless format format string is supplied
display.head_sub.fields string[] -
display.head_sub.format? string -
i18n? { [locale: string]: { [fieldNameOrGroupName: string]: 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 } }; } -
onboard_properties? { organizations?: { access_applications?: { links?: { description: string ; wizardConfig: Omit<WizardConfig, "a_id"> }[] ; properties: Omit<AA, "org_id"> }[] ; properties: Organization }[] ; profile_objects?: { properties: Record<string, unknown> ; schema_name: 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
onboard_properties.organizations? { access_applications?: { links?: { description: string ; wizardConfig: Omit<WizardConfig, "a_id"> }[] ; properties: Omit<AA, "org_id"> }[] ; properties: Organization }[] Organizations that should be created. NOTE: if multiple are specified, when the wizard completes, the first one will be selected
onboard_properties.profile_objects? { properties: Record<string, unknown> ; schema_name: SchemaName }[] Profile Objects that should be created
onboard_properties.relationships? { from: string ; properties?: Record<string, string> ; to: string ; type: string }[] Relationships that should be created
onboard_properties.return_to? string The relative path in the client to redirect to once finished. May include variables
relationships? { anyOf?: SchemaName[] ; direction: "from" ; multiple?: boolean ; oneOf?: (SchemaName | "instance")[] ; properties?: { [fieldName: string]: SchemaField; } ; relationship_name: string ; required?: string[] ; required_relationship?: boolean ; type: string }[] -
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.
schema_type? SchemaType -
tags? SchemaTag[] -
title string these fields will always exist on schema
title_plural? string plural version of the title

ConditionallyRequired

Ƭ ConditionallyRequired: Object

should be renamed since this applies to ConditionallyVerifiable

Type declaration

Name Type
field string
if { [fieldName: string]: (string | number | boolean)[]; }

ContactPoint

Ƭ ContactPoint: Object

A Contact Point for an Organization

Type declaration

Name Type
active boolean
contact_point_purpose string
contact_point_type string
e164 string | null
e164_suffix string | null
e164_type string | null
email_address string
email_address_preferred_format string
end_date string
id string
metadata unknown
start_date string
to_table string
url string | null
url_type string | null
uuid string | undefined

CustomFonts

Ƭ CustomFonts: Object

Type declaration

Name Type
body? string
header? string

DataTypes

Ƭ DataTypes: "string" | "number" | "boolean" | "object" | "integer" | "array" | "null"


Encrypted

Ƭ Encrypted<_Data>: Object

Type parameters

Name Type
_Data string

Type declaration

Name Type
encrypted_data { algorithm: AesKeyAlgorithm ; data: string ; iv: string }
encrypted_data.algorithm AesKeyAlgorithm
encrypted_data.data string
encrypted_data.iv string
encrypted_key { encrypted_key: string }
encrypted_key.encrypted_key string

GId

Ƭ GId: StringWithIdentity<"GId">

A g_id is the ID of a group


IId

Ƭ IId: StringWithIdentity<"IId">

An i_id is the ID of an Instance


Instance

Ƭ Instance: InstanceWithoutData & { keys: { [nId2: NId2]: { [fieldName: string]: { data: string }; }; } ; profile_objects: ProfileObject[] ; relationships: Relationship[] }

The API used to store data in this format, but it no longer does :( so @raytio/core reconstructs this object.


InstanceWithoutData

Ƭ InstanceWithoutData: CommonFields<IId, { message?: string }> & { aa_id: AId ; aack_id: KId ; confirmation_code: string ; data_provider_email: string ; device_id?: unknown ; instance_version?: unknown ; platform_footer_html?: unknown ; previous_state?: SubmissionStatus ; reference: string ; related_offers?: unknown ; related_service_types?: unknown ; score?: unknown ; service_provider_n_id: NId ; source_ip?: unknown ; state: SubmissionStatus ; sub_service_provider_hash: string ; thread: string }


KId

Ƭ KId: StringWithIdentity<"KId">

A k_id (also called a aack_id or a publicKeyId) is the ID of an AA's public key


LId

Ƭ LId: StringWithIdentity<"LId">

An l_id is the ID of any data stored in the KV-Store


Location

Ƭ Location: Object

An Organization Location

Type declaration

Name Type
active boolean
address_line_1 string | null
address_line_2 string | null
address_line_3 string | null
address_line_4 string | null
administrative_area_level_1 string | null
administrative_area_level_2 string | null
administrative_area_level_3 string | null
city string | null
country string | null
end_date string
geolocation string | null
geolocation_outline string | null
id string
locality string | null
location_description string | null
location_name string
metadata unknown
postal_code string
postal_code_suffix string | null
premise string | null
region string | null
route string | null
start_date string
street_number string | null
subpremise string | null

Lookup

Ƭ Lookup: Object

Type declaration

Name Type Description
children? Lookup[] -
description? string -
key string | number -
label? string | number Used in Antd Cascader
requires_2FA? boolean used in AkahuDynamicSection only
value string | number -

NId

Ƭ NId: StringWithIdentity<"NId">

An n_id is the ID of a ProfileObject


NId2

Ƭ NId2: StringWithIdentity<"NId2">

⚠️ This ID duplicates the NId and should only be used in exceptional circumstances


OId

Ƭ OId: StringWithIdentity<"OId">

An o_id is the ID of an Organization


Organization

Ƭ Organization: Object

An organization. NOTE: this is different to how the schema defines an Organization. The schema is wrong (see #468)

Type declaration

Name Type
address unknown
customer unknown
email string
id OId
name string

PId

Ƭ PId: StringWithIdentity<"PId">

A p_id is the ID of a Relationship


Party

Ƭ Party: Object

An Organisation

Type declaration

Name Type
active boolean
end_date string
id string
metadata PartyMetadata
party_description string
party_name string
party_number number
party_type string
start_date string

PartyMetadata

Ƭ PartyMetadata: Object

An Organizations credentials

Type declaration

Name Type
centrix_credentials unknown
gandalf unknown
stripe { customer: unknown }
stripe.customer unknown

PartySite

Ƭ PartySite: Object

An Organization Site

Type declaration

Name Type
active boolean
end_date string
id string
location_number number
metadata unknown
party_id string
party_site_description string | null
party_site_name string
party_site_number string | null
party_use_primary string
party_uses string[]
start_date string

ProfileObject

Ƭ ProfileObject<Properties>: Partial<CommonFields<NId2>> & { labels: string[] ; n_id: NId ; properties: Properties }

You can supply an option type argument if you know exactly what the properties will be

Type parameters

Name Type
Properties Json

RealVer

Ƭ RealVer: Object

This is what @raytio/core exposes, which is more useable than Verification

Type declaration

Name Type Description
belongsToNId? NId nId of the PO that the verification belongs to. Could be undefined
expired Date | false If the verification has expired, it's the date that it expired on. Otherwise it's false
fieldName string -
metadata? VerificationPayload<false>["metadata"] arbitary metadata returned by the verifier
nID NId nId of the verification
provider VerificationProvider -
signature string -
value unknown -
verified boolean whether the fieldName/value pair is verified, as confirmed by the API. This should be the single source of truth.
xId string this will be a unique id to group verifications from the same PO. Doesn't work yet

Relationship

Ƭ Relationship: Object

Type declaration

Name Type
active? boolean
end Urn
end_date? string
p_id PId
properties? { [fieldName: string]: unknown; name?: string ; p_id: PId }
properties.name? string
properties.p_id PId
start Urn
start_date? string
type string

Schema

Ƭ Schema: CommonSchemaAttributes & { clientLocale?: string ; end_date?: string ; groupNames?: Record<string, string> ; group_title?: string ; isProfileSchema?: boolean ; isSpSchema?: boolean ; name: SchemaName ; properties: { [fieldName: string]: SchemaField; } ; required?: (string | ConditionallyRequired)[] ; start_date?: string ; timing?: Record<"extract" | "live_person" | "verify_pending_delay", number> ; type?: DataTypes ; verified_fields?: (string | ConditionallyRequired)[] ; version: string ; wasExpandedByClient?: boolean }

Raytio's variant of JSON Schema, as used by the client. It is a modified version of what the API returns.


SchemaField

Ƭ SchemaField: Object

Type declaration

Name Type Description
$id? string Deprecated don't use, it's inconsistent
$ref? SchemaName If this field refers to a sub-object
add_row_btn_label? string if this field is a table input, this determines the text to show on the "Add Row" btn
allOf? [{ $ref: string }, ServerSchemaField] -
content? string only checkbox uses this prop
contentEncoding? "base64" -
contentMediaType? string -
default? unknown the default value
default_signature_name? string used on fields that are a signature file picker, see !849 also used to determine if the MediaPicker should be shown inline
description? string -
description_decorator? "md" specifies that the description is formatted in markdown
encrypt? boolean whether the field should be encrypted
encrypt_require? boolean if true, the user must have encryption enabled to save this data, see #1324
enum? (string | number | boolean)[] -
examples? unknown[] -
format? "date" | "date-time" | "uri" -
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
items? { properties: { [subFieldName: string]: SchemaField; } ; type: DataTypes } items is used for nested arrays, (while properties is used for nested objects)
items.properties { [subFieldName: string]: SchemaField; } -
items.type DataTypes -
lookup? string URL to a JSON file in the Lookup format
maxLength? number Deprecated raytio's usage not documented
maximum? number for number inputs, the maximum allowed value
minLength? number Deprecated raytio's usage not documented
minimum? number for number inputs, the minimum allowed value
override? { permissions: { default: string } } -
override.permissions { default: string } -
override.permissions.default string ideally this could be typed as keyof typeof GROUPS but the schemas aren't consistent and we have to assume it could be invalid.
pattern? string -
patternMessage? string if a pattern is specified, this is the error message
priority? number -
properties? { [subFieldName: string]: SchemaField; } properties is used for nested objects, (while items is used for nested arrays)
readOnly? boolean readOnly means the Wizard won't show this field
step? number for number inputs, the step size used in the input or slider
table_empty_message? string if this field is a table input, this determines the text to show if the table is empty
tags? SchemaFieldTag[] -
title? string -
title_plural? string -
type? DataTypes -

SchemaFieldTag

Ƭ SchemaFieldTag: "password" | `group:${string}` | `upload-group:${string}` | "display:stars" | "display:no_autofill" | "display:currency" | "display:cascade" | "display:survey" | "display:quoting" | "display:customModal" | `display:replace:'${string}':'${string}'` | "display:terms_conditions" | `display:main_media:${string}` | "date_component:day" | "date_component:month" | "date_component:year" | "action:client_upload" | "action:require_webauthn" | "verify:show_if_pending" | "special:hide_select_behind_button" | "type:capture_geolocation" | "type:extract_required"


SchemaName

Ƭ SchemaName: StringWithIdentity<"SchemaName">

A SchemaName is the ID of a Schema


SchemaTag

Ƭ 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"


SchemaType

Ƭ SchemaType: "ss" | "ps" | "us"

Type Classification of a Schema returned by API


ServerSchemaField

Ƭ ServerSchemaField: Omit<SchemaField, "$prop">

the only difference between the client & server's definition is that the client adds $prop


SubmissionStatus

Ƭ SubmissionStatus: "Submitted" | "Processing" | "Rejected" | "Expired" | "Completed" | "DataChanged" | "Received" | "Accepted"


UId

Ƭ UId: StringWithIdentity<"UId">

A u_id is the ID of a user


Urn

Ƭ Urn: `urn:user:${UId}` | `urn:profile_object:${NId}` | `urn:instance:${IId}` | `urn:temp_object:${LId}` | `urn:schema:${SchemaName}` | `urn:document:${NId}`

e.g. "urn:user:..."


UrnNodeType

Ƭ UrnNodeType: "user" | "profile_object" | "instance" | "schema" | "temp_object" | "document"


Validation

Ƭ Validation: Object

validation data returned by preVerify (part of the extract&map API)

Type declaration

Name Type
breakdown { [category: string]: { code?: number ; passed: boolean ; reason?: string ; severity?: "low" | "medium" | "high" }; }
score number
warning? string[]

Verification

Ƭ Verification<WithValue>: ProfileObject<{ field: string ; n_id: NId ; valid_until?: string ; verifications: [{ data: VerificationPayload<WithValue> ; hashing_algorithm?: "SHA512" ; key_id?: string ; key_urn?: string ; signature: string ; signing_algorithm?: "RSASSA_PSS_SHA_512" }] }>

Different APIs inconsistently include the value prop. If you know it exists, use Verification<true>, otherwise just Verification. Verifications from the DataContext don't have the value.

Type parameters

Name Type
WithValue extends boolean = false

VerificationPayload

Ƭ VerificationPayload<WithValue>: { field: string ; metadata?: { [otherAttributes: string]: unknown; pending_details?: { pending_time: "short" | "long" ; pending_type: "time" | "user" } ; safeHarbourScore?: SafeHarbourCode ; status?: "pending" } ; passed: boolean ; request_div: string ; schema?: SchemaName ; source: string ; source_hashed_n_id?: NId ; source_n_id?: NId ; type?: null ; v_id: string ; verification_date: string ; verifier_div: string ; verifier_id?: NId ; verifier_service_id?: NId ; verifier_source_id?: NId } & WithValue extends true ? { value: string | number } : {}

Type parameters

Name Type
WithValue extends boolean

VerificationProvider

Ƭ VerificationProvider: Object

These n_ids point to service provider profile objects

Type declaration

Name Type Description
dataSourceNId? NId -
date? Date the date which the verification was verified on, or last re-verified on
serviceProviderNId? NId -
verifierNId? NId -

WId

Ƭ WId: StringWithIdentity<"WId">

A wi_id is the ID of a Webhook


Webhook

Ƭ Webhook: Object

Type declaration

Name Type Description
date_created string ISO Date
date_updated string ISO Date
provider_signature_check_enabled boolean -
provider_signature_credentials unknown -
provider_subscription_credentials unknown -
provider_webhook_id NId n_id of "the webhook provider which can be set up against a service provider"
provider_webhook_subscription_id NId not sure what this is
status WebhookStatus -
subscribe_log? { date: string ; response_payload: Json ; response_status_code: number }[] -
webhook_action { webhook_action_type: string }[] -
webhook_field_mapping_schema { [key: string]: string; } -
webhook_filter_schema { field_name: string ; field_value: string ; operator: string } -
webhook_filter_schema.field_name string -
webhook_filter_schema.field_value string -
webhook_filter_schema.operator string -
webhook_filter_source string -
webhook_processing_rules unknown -
wi_id WId -

WebhookStatus

Ƭ WebhookStatus: "subscribed" | "pending" | "unsubscribe_failed"


WizardConfig

Ƭ WizardConfig: Object

when a form link is generated, this is what gets saved on the API. Each value can be overridden in the query parameters. If specified in the query parameters, it needs to be base64 and/or url encoded.

Type declaration

Name Type Description
a_id AId -
display_sharing_preview? boolean If this value is true, the form will display some data sharing information before the form (WizardPreview)
emails? string[] if specified, the email addresses that a submission should be sent to
expiry_date? number number of days in the future
pages WizardPage[] -
quick_onboard? boolean whether the passwordless-signup process should be used if the user visits this form, and they are not logged in. If false, the standard sign-up process will be used
reference? string -
relationships? { from: string ; properties?: Record<string, any> ; to: string ; type: string }[] a list of relationships that should be created after the wizard completes (see #987)
return_to? string the callback url to redirect to once complete. Must be in the AA's list of authorized callback urls
review_text? string the text on the WizardReview page
sharing_data_message? string the loading message to show next to the spinner after the review screen
signature_schema? SchemaName if specified, a Wizard will be shown on the review page with this schema
skip_share? boolean Deprecated added in !244 but never used
submit_text? string the submit button label
terms_schema? SchemaName if specified, a Wizard will be shown on the review page with this schema
update_reference? boolean whether the user can change the reference, if there is one in the QP
webauthn_type? ("usb" | "nfc" | "ble" | "internal")[] if specified, the user must validate their WebAuthN credential before they can submit the form

WizardPage

Ƭ WizardPage: Object

configuration data for a single wizard page (WizardConfig)

Type declaration

Name Type Description
allow_upload? boolean do not allow uploading in ImageDynamicSection if this is explictly false
branching_rule_name? string If specified, this is is a "Conditional Wizard Page", which is only shown if the rule passed. This field contains the ID (not name) of the rule.
create_new_text? string custom text to display on the Create New button
description? string the fallback description, if there isn't one for the specific situation
description_create? string -
description_select? string -
description_update? string -
display_field_description? boolean whether the field descriptions should be shown
display_field_title? boolean whether the field titles should be shown
display_mode? "light" | "dark" | "default" can you force the colour theme to change for just one page (#1066, #1074). At the moment this on pages that use WebcamImageCapture
display_schema_description? boolean whether the schema description should be shown
extract_threshold? number for ImageDynamicSection, the minimum score to be treated as a pass
extract_threshold_fail_action? "capture" | "capture_review" | "recapture_or_next_step" | "review" | "next_step" for ImageDynamicSection, the action to take if pre-verify fails
extract_threshold_null_action? WizardPage["extract_threshold_fail_action"] for ImageDynamicSection, the action to take if the API returns no validation: {} object
extract_threshold_pass_action? "review" | "next_step" for ImageDynamicSection, the action to take if pre-verify passes
field_list? string[] if supplied, only the fields that are listed should be shared (#520, #1024)
filter "oneOf" | "anyOf" -
multiple? boolean if true mulitple POs can be shared
name? string | symbol if undefined, the schema title will be used
optional? boolean if true this page can be skipped. The PageResult wil be undefined
optional_fields? string[] a list of fields that should not be required, even if the schema says they're required
profile? boolean if explictly == false, then it's an AO (not a PO), in which case there can only be one schema
reverify_header? string custom text & header that's displayed on reverfication modal for expired PO
reverify_text? string -
schemas SchemaName[] -
selection_hierarchy_json? string a URL to a preset for configuing NestedSchemaSelect. DeepConfig
service_provider_link? boolean see #463
share? "profile" | "verification" | "both" the information to share. undefined implies both.
tags? WizardPageTag[] -
verify_data? boolean if false, ProfileObjects created while completing the form will not be verified. if true, you can only select ProfileObjects that are partially or fully verified. undefined implies true. Default ts true

WizardPageTag

Ƭ WizardPageTag: "action:require_chip"


WrappedSchema

Ƭ WrappedSchema: Object

This is what's returned by the API

Type declaration

Name Type Description
active true -
end_date string ISO Date. If this tag exists, the schema is deprecated.
schema CommonSchemaAttributes & { $id?: string ; $schema?: string ; allOf?: { $ref?: string ; if?: Partial<WrappedSchema["schema"]> ; then?: Partial<WrappedSchema["schema"]> }[] ; definitions?: Record<string, { $ref: Urn }> ; properties: { [fieldName: string]: ServerSchemaField; } ; required?: string[] ; verified_fields?: string[] } -
schema_name SchemaName Schema Name Type and Version Properties
schema_type SchemaType -
schema_version string -
start_date string ISO Date
version_current boolean whether the version is the latest version

Readme

Keywords

none

Package Sidebar

Install

npm i @raytio/types

Weekly Downloads

13

Version

7.3.0

License

MIT

Unpacked Size

114 kB

Total Files

30

Last publish

Collaborators

  • cameron.beattie
  • borigthedwarf
  • kyle.h
  • kalda341