@integration-app/react 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/contexts/integration-app-context.d.ts +2 -4
- package/integrations/index.d.ts +3 -4
- package/package.json +17 -4
- package/node_modules/@compwright/namecase/LICENSE +0 -26
- package/node_modules/@compwright/namecase/README.md +0 -49
- package/node_modules/@compwright/namecase/bin/namecase +0 -28
- package/node_modules/@compwright/namecase/dist/namecase.min.js +0 -4
- package/node_modules/@compwright/namecase/dist/namecase.min.js.map +0 -1
- package/node_modules/@compwright/namecase/package.json +0 -46
- package/node_modules/@compwright/namecase/src/index.js +0 -146
- package/node_modules/@integration-app/sdk/accessors.d.ts +0 -56
- package/node_modules/@integration-app/sdk/accessors.js +0 -104
- package/node_modules/@integration-app/sdk/accessors.js.map +0 -1
- package/node_modules/@integration-app/sdk/app-data-collections/accessors.d.ts +0 -16
- package/node_modules/@integration-app/sdk/app-data-collections/accessors.js +0 -38
- package/node_modules/@integration-app/sdk/app-data-collections/accessors.js.map +0 -1
- package/node_modules/@integration-app/sdk/app-data-collections/api.d.ts +0 -18
- package/node_modules/@integration-app/sdk/app-data-collections/api.js +0 -3
- package/node_modules/@integration-app/sdk/app-data-collections/api.js.map +0 -1
- package/node_modules/@integration-app/sdk/app-data-collections/index.d.ts +0 -26
- package/node_modules/@integration-app/sdk/app-data-collections/index.js +0 -3
- package/node_modules/@integration-app/sdk/app-data-collections/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/app-data-schemas/accessors.d.ts +0 -16
- package/node_modules/@integration-app/sdk/app-data-schemas/accessors.js +0 -38
- package/node_modules/@integration-app/sdk/app-data-schemas/accessors.js.map +0 -1
- package/node_modules/@integration-app/sdk/app-data-schemas/api.d.ts +0 -18
- package/node_modules/@integration-app/sdk/app-data-schemas/api.js +0 -3
- package/node_modules/@integration-app/sdk/app-data-schemas/api.js.map +0 -1
- package/node_modules/@integration-app/sdk/app-data-schemas/index.d.ts +0 -21
- package/node_modules/@integration-app/sdk/app-data-schemas/index.js +0 -3
- package/node_modules/@integration-app/sdk/app-data-schemas/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/app-events/accessors.d.ts +0 -16
- package/node_modules/@integration-app/sdk/app-events/accessors.js +0 -38
- package/node_modules/@integration-app/sdk/app-events/accessors.js.map +0 -1
- package/node_modules/@integration-app/sdk/app-events/api.d.ts +0 -18
- package/node_modules/@integration-app/sdk/app-events/api.js +0 -3
- package/node_modules/@integration-app/sdk/app-events/api.js.map +0 -1
- package/node_modules/@integration-app/sdk/app-events/index.d.ts +0 -46
- package/node_modules/@integration-app/sdk/app-events/index.js +0 -3
- package/node_modules/@integration-app/sdk/app-events/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/auth/accessors.d.ts +0 -7
- package/node_modules/@integration-app/sdk/auth/accessors.js +0 -13
- package/node_modules/@integration-app/sdk/auth/accessors.js.map +0 -1
- package/node_modules/@integration-app/sdk/auth/index.d.ts +0 -6
- package/node_modules/@integration-app/sdk/auth/index.js +0 -3
- package/node_modules/@integration-app/sdk/auth/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/bundle-index.d.ts +0 -1
- package/node_modules/@integration-app/sdk/bundle-index.js +0 -5
- package/node_modules/@integration-app/sdk/bundle-index.js.map +0 -1
- package/node_modules/@integration-app/sdk/bundle.js +0 -30163
- package/node_modules/@integration-app/sdk/bundle.js.map +0 -1
- package/node_modules/@integration-app/sdk/client.d.ts +0 -108
- package/node_modules/@integration-app/sdk/client.js +0 -248
- package/node_modules/@integration-app/sdk/client.js.map +0 -1
- package/node_modules/@integration-app/sdk/connections/accessors.d.ts +0 -13
- package/node_modules/@integration-app/sdk/connections/accessors.js +0 -39
- package/node_modules/@integration-app/sdk/connections/accessors.js.map +0 -1
- package/node_modules/@integration-app/sdk/connections/api.d.ts +0 -20
- package/node_modules/@integration-app/sdk/connections/api.js +0 -17
- package/node_modules/@integration-app/sdk/connections/api.js.map +0 -1
- package/node_modules/@integration-app/sdk/connections/index.d.ts +0 -39
- package/node_modules/@integration-app/sdk/connections/index.js +0 -13
- package/node_modules/@integration-app/sdk/connections/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/connector-api/index.d.ts +0 -2
- package/node_modules/@integration-app/sdk/connector-api/index.js +0 -9
- package/node_modules/@integration-app/sdk/connector-api/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/context.d.ts +0 -9
- package/node_modules/@integration-app/sdk/data-builder/context.js +0 -32
- package/node_modules/@integration-app/sdk/data-builder/context.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/base.d.ts +0 -9
- package/node_modules/@integration-app/sdk/data-builder/formulas/base.js +0 -59
- package/node_modules/@integration-app/sdk/data-builder/formulas/base.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/case.d.ts +0 -14
- package/node_modules/@integration-app/sdk/data-builder/formulas/case.js +0 -45
- package/node_modules/@integration-app/sdk/data-builder/formulas/case.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/concat.d.ts +0 -18
- package/node_modules/@integration-app/sdk/data-builder/formulas/concat.js +0 -36
- package/node_modules/@integration-app/sdk/data-builder/formulas/concat.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/copy.d.ts +0 -10
- package/node_modules/@integration-app/sdk/data-builder/formulas/copy.js +0 -22
- package/node_modules/@integration-app/sdk/data-builder/formulas/copy.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/extractDate.d.ts +0 -11
- package/node_modules/@integration-app/sdk/data-builder/formulas/extractDate.js +0 -31
- package/node_modules/@integration-app/sdk/data-builder/formulas/extractDate.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/extractTime.d.ts +0 -11
- package/node_modules/@integration-app/sdk/data-builder/formulas/extractTime.js +0 -31
- package/node_modules/@integration-app/sdk/data-builder/formulas/extractTime.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/findAppRecordId.d.ts +0 -17
- package/node_modules/@integration-app/sdk/data-builder/formulas/findAppRecordId.js +0 -24
- package/node_modules/@integration-app/sdk/data-builder/formulas/findAppRecordId.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/findExternalRecordId.d.ts +0 -17
- package/node_modules/@integration-app/sdk/data-builder/formulas/findExternalRecordId.js +0 -24
- package/node_modules/@integration-app/sdk/data-builder/formulas/findExternalRecordId.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/first-name.d.ts +0 -10
- package/node_modules/@integration-app/sdk/data-builder/formulas/first-name.js +0 -25
- package/node_modules/@integration-app/sdk/data-builder/formulas/first-name.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/index.d.ts +0 -28
- package/node_modules/@integration-app/sdk/data-builder/formulas/index.js +0 -177
- package/node_modules/@integration-app/sdk/data-builder/formulas/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/iterate.d.ts +0 -15
- package/node_modules/@integration-app/sdk/data-builder/formulas/iterate.js +0 -41
- package/node_modules/@integration-app/sdk/data-builder/formulas/iterate.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/last-name.d.ts +0 -10
- package/node_modules/@integration-app/sdk/data-builder/formulas/last-name.js +0 -25
- package/node_modules/@integration-app/sdk/data-builder/formulas/last-name.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/lookup.d.ts +0 -20
- package/node_modules/@integration-app/sdk/data-builder/formulas/lookup.js +0 -24
- package/node_modules/@integration-app/sdk/data-builder/formulas/lookup.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/map.d.ts +0 -17
- package/node_modules/@integration-app/sdk/data-builder/formulas/map.js +0 -34
- package/node_modules/@integration-app/sdk/data-builder/formulas/map.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/plain.d.ts +0 -7
- package/node_modules/@integration-app/sdk/data-builder/formulas/plain.js +0 -20
- package/node_modules/@integration-app/sdk/data-builder/formulas/plain.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/record.d.ts +0 -10
- package/node_modules/@integration-app/sdk/data-builder/formulas/record.js +0 -23
- package/node_modules/@integration-app/sdk/data-builder/formulas/record.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/schemaOption.d.ts +0 -12
- package/node_modules/@integration-app/sdk/data-builder/formulas/schemaOption.js +0 -22
- package/node_modules/@integration-app/sdk/data-builder/formulas/schemaOption.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/tpl.d.ts +0 -15
- package/node_modules/@integration-app/sdk/data-builder/formulas/tpl.js +0 -31
- package/node_modules/@integration-app/sdk/data-builder/formulas/tpl.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/formulas/var.d.ts +0 -8
- package/node_modules/@integration-app/sdk/data-builder/formulas/var.js +0 -21
- package/node_modules/@integration-app/sdk/data-builder/formulas/var.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/index.d.ts +0 -2
- package/node_modules/@integration-app/sdk/data-builder/index.js +0 -17
- package/node_modules/@integration-app/sdk/data-builder/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-builder/locators.d.ts +0 -56
- package/node_modules/@integration-app/sdk/data-builder/locators.js +0 -560
- package/node_modules/@integration-app/sdk/data-builder/locators.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-collections.d.ts +0 -36
- package/node_modules/@integration-app/sdk/data-collections.js +0 -16
- package/node_modules/@integration-app/sdk/data-collections.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-filter/index.d.ts +0 -12
- package/node_modules/@integration-app/sdk/data-filter/index.js +0 -104
- package/node_modules/@integration-app/sdk/data-filter/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-filter/operators.d.ts +0 -13
- package/node_modules/@integration-app/sdk/data-filter/operators.js +0 -140
- package/node_modules/@integration-app/sdk/data-filter/operators.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-links/accessors.d.ts +0 -20
- package/node_modules/@integration-app/sdk/data-links/accessors.js +0 -65
- package/node_modules/@integration-app/sdk/data-links/accessors.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-links/api.d.ts +0 -49
- package/node_modules/@integration-app/sdk/data-links/api.js +0 -3
- package/node_modules/@integration-app/sdk/data-links/api.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-links/index.d.ts +0 -35
- package/node_modules/@integration-app/sdk/data-links/index.js +0 -10
- package/node_modules/@integration-app/sdk/data-links/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-locations/accessors.d.ts +0 -10
- package/node_modules/@integration-app/sdk/data-locations/accessors.js +0 -22
- package/node_modules/@integration-app/sdk/data-locations/accessors.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-locations/api.d.ts +0 -4
- package/node_modules/@integration-app/sdk/data-locations/api.js +0 -3
- package/node_modules/@integration-app/sdk/data-locations/api.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-locations/index.d.ts +0 -138
- package/node_modules/@integration-app/sdk/data-locations/index.js +0 -17
- package/node_modules/@integration-app/sdk/data-locations/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-schema/index.d.ts +0 -49
- package/node_modules/@integration-app/sdk/data-schema/index.js +0 -88
- package/node_modules/@integration-app/sdk/data-schema/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-sources/accessors.d.ts +0 -29
- package/node_modules/@integration-app/sdk/data-sources/accessors.js +0 -71
- package/node_modules/@integration-app/sdk/data-sources/accessors.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-sources/api.d.ts +0 -37
- package/node_modules/@integration-app/sdk/data-sources/api.js +0 -3
- package/node_modules/@integration-app/sdk/data-sources/api.js.map +0 -1
- package/node_modules/@integration-app/sdk/data-sources/index.d.ts +0 -55
- package/node_modules/@integration-app/sdk/data-sources/index.js +0 -3
- package/node_modules/@integration-app/sdk/data-sources/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/datetime.d.ts +0 -1
- package/node_modules/@integration-app/sdk/datetime.js +0 -15
- package/node_modules/@integration-app/sdk/datetime.js.map +0 -1
- package/node_modules/@integration-app/sdk/entity-repository.d.ts +0 -11
- package/node_modules/@integration-app/sdk/entity-repository.js +0 -10
- package/node_modules/@integration-app/sdk/entity-repository.js.map +0 -1
- package/node_modules/@integration-app/sdk/errors.d.ts +0 -64
- package/node_modules/@integration-app/sdk/errors.js +0 -141
- package/node_modules/@integration-app/sdk/errors.js.map +0 -1
- package/node_modules/@integration-app/sdk/field-mappings/accessors.d.ts +0 -25
- package/node_modules/@integration-app/sdk/field-mappings/accessors.js +0 -60
- package/node_modules/@integration-app/sdk/field-mappings/accessors.js.map +0 -1
- package/node_modules/@integration-app/sdk/field-mappings/api.d.ts +0 -34
- package/node_modules/@integration-app/sdk/field-mappings/api.js +0 -3
- package/node_modules/@integration-app/sdk/field-mappings/api.js.map +0 -1
- package/node_modules/@integration-app/sdk/field-mappings/index.d.ts +0 -90
- package/node_modules/@integration-app/sdk/field-mappings/index.js +0 -195
- package/node_modules/@integration-app/sdk/field-mappings/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/flow-runs/flow-node-runs.d.ts +0 -30
- package/node_modules/@integration-app/sdk/flow-runs/flow-node-runs.js +0 -11
- package/node_modules/@integration-app/sdk/flow-runs/flow-node-runs.js.map +0 -1
- package/node_modules/@integration-app/sdk/flow-runs/index.d.ts +0 -59
- package/node_modules/@integration-app/sdk/flow-runs/index.js +0 -44
- package/node_modules/@integration-app/sdk/flow-runs/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/accessors.d.ts +0 -37
- package/node_modules/@integration-app/sdk/flows/accessors.js +0 -167
- package/node_modules/@integration-app/sdk/flows/accessors.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/api.d.ts +0 -55
- package/node_modules/@integration-app/sdk/flows/api.js +0 -8
- package/node_modules/@integration-app/sdk/flows/api.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/index.d.ts +0 -84
- package/node_modules/@integration-app/sdk/flows/index.js +0 -26
- package/node_modules/@integration-app/sdk/flows/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/api-trigger.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/api-trigger.js +0 -9
- package/node_modules/@integration-app/sdk/flows/nodes/api-trigger.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/app-event-trigger.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/app-event-trigger.js +0 -9
- package/node_modules/@integration-app/sdk/flows/nodes/app-event-trigger.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/create-data-link.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/create-data-link.js +0 -8
- package/node_modules/@integration-app/sdk/flows/nodes/create-data-link.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/create-data-record.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/create-data-record.js +0 -8
- package/node_modules/@integration-app/sdk/flows/nodes/create-data-record.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/data-record-created-trigger.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/data-record-created-trigger.js +0 -9
- package/node_modules/@integration-app/sdk/flows/nodes/data-record-created-trigger.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/data-record-deleted-trigger.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/data-record-deleted-trigger.js +0 -9
- package/node_modules/@integration-app/sdk/flows/nodes/data-record-deleted-trigger.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/data-record-updated-trigger.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/data-record-updated-trigger.js +0 -9
- package/node_modules/@integration-app/sdk/flows/nodes/data-record-updated-trigger.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/delete-data-record.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/delete-data-record.js +0 -8
- package/node_modules/@integration-app/sdk/flows/nodes/delete-data-record.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/filter.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/filter.js +0 -8
- package/node_modules/@integration-app/sdk/flows/nodes/filter.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/find-data-link.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/find-data-link.js +0 -8
- package/node_modules/@integration-app/sdk/flows/nodes/find-data-link.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/find-data-record-by-id.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/find-data-record-by-id.js +0 -8
- package/node_modules/@integration-app/sdk/flows/nodes/find-data-record-by-id.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/find-data-records.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/find-data-records.js +0 -8
- package/node_modules/@integration-app/sdk/flows/nodes/find-data-records.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/http-request.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/http-request.js +0 -8
- package/node_modules/@integration-app/sdk/flows/nodes/http-request.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/index.d.ts +0 -28
- package/node_modules/@integration-app/sdk/flows/nodes/index.js +0 -50
- package/node_modules/@integration-app/sdk/flows/nodes/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/list-data-records.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/list-data-records.js +0 -8
- package/node_modules/@integration-app/sdk/flows/nodes/list-data-records.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/schedule-trigger.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/schedule-trigger.js +0 -9
- package/node_modules/@integration-app/sdk/flows/nodes/schedule-trigger.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/transform-data.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/transform-data.js +0 -8
- package/node_modules/@integration-app/sdk/flows/nodes/transform-data.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/nodes/update-data-record.d.ts +0 -3
- package/node_modules/@integration-app/sdk/flows/nodes/update-data-record.js +0 -8
- package/node_modules/@integration-app/sdk/flows/nodes/update-data-record.js.map +0 -1
- package/node_modules/@integration-app/sdk/flows/utils.d.ts +0 -10
- package/node_modules/@integration-app/sdk/flows/utils.js +0 -72
- package/node_modules/@integration-app/sdk/flows/utils.js.map +0 -1
- package/node_modules/@integration-app/sdk/http-requests.d.ts +0 -37
- package/node_modules/@integration-app/sdk/http-requests.js +0 -33
- package/node_modules/@integration-app/sdk/http-requests.js.map +0 -1
- package/node_modules/@integration-app/sdk/iframe.d.ts +0 -9
- package/node_modules/@integration-app/sdk/iframe.js +0 -112
- package/node_modules/@integration-app/sdk/iframe.js.map +0 -1
- package/node_modules/@integration-app/sdk/index.d.ts +0 -4
- package/node_modules/@integration-app/sdk/index.js +0 -8
- package/node_modules/@integration-app/sdk/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/integration-elements/index.d.ts +0 -22
- package/node_modules/@integration-app/sdk/integration-elements/index.js +0 -15
- package/node_modules/@integration-app/sdk/integration-elements/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/integrations/accessors.d.ts +0 -17
- package/node_modules/@integration-app/sdk/integrations/accessors.js +0 -36
- package/node_modules/@integration-app/sdk/integrations/accessors.js.map +0 -1
- package/node_modules/@integration-app/sdk/integrations/api.d.ts +0 -10
- package/node_modules/@integration-app/sdk/integrations/api.js +0 -3
- package/node_modules/@integration-app/sdk/integrations/api.js.map +0 -1
- package/node_modules/@integration-app/sdk/integrations/index.d.ts +0 -27
- package/node_modules/@integration-app/sdk/integrations/index.js +0 -16
- package/node_modules/@integration-app/sdk/integrations/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/json-schema/index.d.ts +0 -32
- package/node_modules/@integration-app/sdk/json-schema/index.js +0 -207
- package/node_modules/@integration-app/sdk/json-schema/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/json-schema/schema-builder.d.ts +0 -7
- package/node_modules/@integration-app/sdk/json-schema/schema-builder.js +0 -232
- package/node_modules/@integration-app/sdk/json-schema/schema-builder.js.map +0 -1
- package/node_modules/@integration-app/sdk/jwt.d.ts +0 -1
- package/node_modules/@integration-app/sdk/jwt.js +0 -37
- package/node_modules/@integration-app/sdk/jwt.js.map +0 -1
- package/node_modules/@integration-app/sdk/package.json +0 -63
- package/node_modules/@integration-app/sdk/rollup.config.js +0 -23
- package/node_modules/@integration-app/sdk/src/accessors.ts +0 -150
- package/node_modules/@integration-app/sdk/src/app-data-collections/accessors.ts +0 -69
- package/node_modules/@integration-app/sdk/src/app-data-collections/api.ts +0 -31
- package/node_modules/@integration-app/sdk/src/app-data-collections/index.ts +0 -46
- package/node_modules/@integration-app/sdk/src/app-data-schemas/accessors.ts +0 -69
- package/node_modules/@integration-app/sdk/src/app-data-schemas/api.ts +0 -28
- package/node_modules/@integration-app/sdk/src/app-data-schemas/index.ts +0 -35
- package/node_modules/@integration-app/sdk/src/app-events/accessors.ts +0 -69
- package/node_modules/@integration-app/sdk/src/app-events/api.ts +0 -28
- package/node_modules/@integration-app/sdk/src/app-events/index.ts +0 -75
- package/node_modules/@integration-app/sdk/src/auth/accessors.ts +0 -10
- package/node_modules/@integration-app/sdk/src/auth/index.ts +0 -7
- package/node_modules/@integration-app/sdk/src/bundle-index.ts +0 -6
- package/node_modules/@integration-app/sdk/src/client.ts +0 -417
- package/node_modules/@integration-app/sdk/src/connections/accessors.ts +0 -58
- package/node_modules/@integration-app/sdk/src/connections/api.ts +0 -28
- package/node_modules/@integration-app/sdk/src/connections/index.ts +0 -70
- package/node_modules/@integration-app/sdk/src/connector-api/index.ts +0 -44
- package/node_modules/@integration-app/sdk/src/data-builder/context.ts +0 -40
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/base.test.ts +0 -26
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/base.ts +0 -95
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/case.test.ts +0 -158
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/case.ts +0 -53
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/concat.test.ts +0 -117
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/concat.ts +0 -49
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/copy.test.ts +0 -70
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/copy.ts +0 -20
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/extractDate.test.ts +0 -49
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/extractDate.ts +0 -28
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/extractTime.test.ts +0 -49
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/extractTime.ts +0 -28
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/findAppRecordId.test.ts +0 -30
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/findAppRecordId.ts +0 -30
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/findExternalRecordId.test.ts +0 -30
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/findExternalRecordId.ts +0 -30
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/first-name.ts +0 -21
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/index.test.ts +0 -83
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/index.ts +0 -190
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/iterate.test.ts +0 -154
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/iterate.ts +0 -46
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/last-name.ts +0 -21
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/lookup.test.ts +0 -20
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/lookup.ts +0 -33
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/map.test.ts +0 -125
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/map.ts +0 -42
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/plain.ts +0 -17
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/record.ts +0 -20
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/schemaOption.ts +0 -26
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/tpl.test.ts +0 -51
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/tpl.ts +0 -33
- package/node_modules/@integration-app/sdk/src/data-builder/formulas/var.ts +0 -19
- package/node_modules/@integration-app/sdk/src/data-builder/index.test.ts +0 -372
- package/node_modules/@integration-app/sdk/src/data-builder/index.ts +0 -16
- package/node_modules/@integration-app/sdk/src/data-builder/locators.test.ts +0 -1045
- package/node_modules/@integration-app/sdk/src/data-builder/locators.ts +0 -702
- package/node_modules/@integration-app/sdk/src/data-collections.ts +0 -74
- package/node_modules/@integration-app/sdk/src/data-filter/index.test.ts +0 -48
- package/node_modules/@integration-app/sdk/src/data-filter/index.ts +0 -127
- package/node_modules/@integration-app/sdk/src/data-filter/operators.test.ts +0 -694
- package/node_modules/@integration-app/sdk/src/data-filter/operators.ts +0 -163
- package/node_modules/@integration-app/sdk/src/data-links/accessors.ts +0 -108
- package/node_modules/@integration-app/sdk/src/data-links/api.ts +0 -75
- package/node_modules/@integration-app/sdk/src/data-links/index.ts +0 -55
- package/node_modules/@integration-app/sdk/src/data-locations/accessors.ts +0 -24
- package/node_modules/@integration-app/sdk/src/data-locations/api.ts +0 -5
- package/node_modules/@integration-app/sdk/src/data-locations/index.ts +0 -209
- package/node_modules/@integration-app/sdk/src/data-schema/index.test.ts +0 -90
- package/node_modules/@integration-app/sdk/src/data-schema/index.ts +0 -185
- package/node_modules/@integration-app/sdk/src/data-sources/accessors.ts +0 -133
- package/node_modules/@integration-app/sdk/src/data-sources/api.ts +0 -59
- package/node_modules/@integration-app/sdk/src/data-sources/index.ts +0 -103
- package/node_modules/@integration-app/sdk/src/datetime.ts +0 -16
- package/node_modules/@integration-app/sdk/src/entity-repository.ts +0 -12
- package/node_modules/@integration-app/sdk/src/errors.ts +0 -154
- package/node_modules/@integration-app/sdk/src/field-mappings/accessors.ts +0 -100
- package/node_modules/@integration-app/sdk/src/field-mappings/api.ts +0 -61
- package/node_modules/@integration-app/sdk/src/field-mappings/index.ts +0 -341
- package/node_modules/@integration-app/sdk/src/flow-runs/flow-node-runs.ts +0 -53
- package/node_modules/@integration-app/sdk/src/flow-runs/index.ts +0 -102
- package/node_modules/@integration-app/sdk/src/flows/accessors.ts +0 -246
- package/node_modules/@integration-app/sdk/src/flows/api.ts +0 -71
- package/node_modules/@integration-app/sdk/src/flows/index.ts +0 -233
- package/node_modules/@integration-app/sdk/src/flows/nodes/api-trigger.ts +0 -7
- package/node_modules/@integration-app/sdk/src/flows/nodes/app-event-trigger.ts +0 -7
- package/node_modules/@integration-app/sdk/src/flows/nodes/create-data-link.ts +0 -6
- package/node_modules/@integration-app/sdk/src/flows/nodes/create-data-record.ts +0 -6
- package/node_modules/@integration-app/sdk/src/flows/nodes/data-record-created-trigger.ts +0 -8
- package/node_modules/@integration-app/sdk/src/flows/nodes/data-record-deleted-trigger.ts +0 -8
- package/node_modules/@integration-app/sdk/src/flows/nodes/data-record-updated-trigger.ts +0 -8
- package/node_modules/@integration-app/sdk/src/flows/nodes/delete-data-record.ts +0 -6
- package/node_modules/@integration-app/sdk/src/flows/nodes/filter.ts +0 -6
- package/node_modules/@integration-app/sdk/src/flows/nodes/find-data-link.ts +0 -6
- package/node_modules/@integration-app/sdk/src/flows/nodes/find-data-record-by-id.ts +0 -6
- package/node_modules/@integration-app/sdk/src/flows/nodes/find-data-records.ts +0 -6
- package/node_modules/@integration-app/sdk/src/flows/nodes/http-request.ts +0 -6
- package/node_modules/@integration-app/sdk/src/flows/nodes/index.ts +0 -60
- package/node_modules/@integration-app/sdk/src/flows/nodes/list-data-records.ts +0 -7
- package/node_modules/@integration-app/sdk/src/flows/nodes/schedule-trigger.ts +0 -7
- package/node_modules/@integration-app/sdk/src/flows/nodes/transform-data.ts +0 -7
- package/node_modules/@integration-app/sdk/src/flows/nodes/update-data-record.ts +0 -6
- package/node_modules/@integration-app/sdk/src/flows/utils.test.ts +0 -63
- package/node_modules/@integration-app/sdk/src/flows/utils.ts +0 -110
- package/node_modules/@integration-app/sdk/src/http-requests.ts +0 -41
- package/node_modules/@integration-app/sdk/src/iframe.ts +0 -142
- package/node_modules/@integration-app/sdk/src/index.ts +0 -5
- package/node_modules/@integration-app/sdk/src/integration-elements/index.ts +0 -24
- package/node_modules/@integration-app/sdk/src/integrations/accessors.ts +0 -42
- package/node_modules/@integration-app/sdk/src/integrations/api.ts +0 -13
- package/node_modules/@integration-app/sdk/src/integrations/index.ts +0 -50
- package/node_modules/@integration-app/sdk/src/json-schema/__snapshots__/schema-builder.test.ts.snap +0 -167
- package/node_modules/@integration-app/sdk/src/json-schema/index.ts +0 -251
- package/node_modules/@integration-app/sdk/src/json-schema/json-schema.test.ts +0 -246
- package/node_modules/@integration-app/sdk/src/json-schema/schema-builder.test.ts +0 -396
- package/node_modules/@integration-app/sdk/src/json-schema/schema-builder.ts +0 -258
- package/node_modules/@integration-app/sdk/src/jwt.test.ts +0 -11
- package/node_modules/@integration-app/sdk/src/jwt.ts +0 -40
- package/node_modules/@integration-app/sdk/src/udm/activities.test.ts +0 -43
- package/node_modules/@integration-app/sdk/src/udm/activities.ts +0 -83
- package/node_modules/@integration-app/sdk/src/udm/base.ts +0 -88
- package/node_modules/@integration-app/sdk/src/udm/campaigns.ts +0 -72
- package/node_modules/@integration-app/sdk/src/udm/companies.ts +0 -80
- package/node_modules/@integration-app/sdk/src/udm/contacts.test.ts +0 -147
- package/node_modules/@integration-app/sdk/src/udm/contacts.ts +0 -106
- package/node_modules/@integration-app/sdk/src/udm/deals.ts +0 -90
- package/node_modules/@integration-app/sdk/src/udm/index.ts +0 -28
- package/node_modules/@integration-app/sdk/src/udm/leads.ts +0 -113
- package/node_modules/@integration-app/sdk/src/udm/users.ts +0 -92
- package/node_modules/@integration-app/sdk/src/users/accessors.ts +0 -28
- package/node_modules/@integration-app/sdk/src/users/api.ts +0 -8
- package/node_modules/@integration-app/sdk/src/users/index.ts +0 -5
- package/node_modules/@integration-app/sdk/src/variables.ts +0 -33
- package/node_modules/@integration-app/sdk/src/workspaces/index.ts +0 -5
- package/node_modules/@integration-app/sdk/tsconfig.build.json +0 -10
- package/node_modules/@integration-app/sdk/tsconfig.json +0 -19
- package/node_modules/@integration-app/sdk/udm/activities.d.ts +0 -30
- package/node_modules/@integration-app/sdk/udm/activities.js +0 -70
- package/node_modules/@integration-app/sdk/udm/activities.js.map +0 -1
- package/node_modules/@integration-app/sdk/udm/base.d.ts +0 -27
- package/node_modules/@integration-app/sdk/udm/base.js +0 -62
- package/node_modules/@integration-app/sdk/udm/base.js.map +0 -1
- package/node_modules/@integration-app/sdk/udm/campaigns.d.ts +0 -25
- package/node_modules/@integration-app/sdk/udm/campaigns.js +0 -66
- package/node_modules/@integration-app/sdk/udm/campaigns.js.map +0 -1
- package/node_modules/@integration-app/sdk/udm/companies.d.ts +0 -42
- package/node_modules/@integration-app/sdk/udm/companies.js +0 -69
- package/node_modules/@integration-app/sdk/udm/companies.js.map +0 -1
- package/node_modules/@integration-app/sdk/udm/contacts.d.ts +0 -49
- package/node_modules/@integration-app/sdk/udm/contacts.js +0 -94
- package/node_modules/@integration-app/sdk/udm/contacts.js.map +0 -1
- package/node_modules/@integration-app/sdk/udm/deals.d.ts +0 -26
- package/node_modules/@integration-app/sdk/udm/deals.js +0 -84
- package/node_modules/@integration-app/sdk/udm/deals.js.map +0 -1
- package/node_modules/@integration-app/sdk/udm/index.d.ts +0 -11
- package/node_modules/@integration-app/sdk/udm/index.js +0 -31
- package/node_modules/@integration-app/sdk/udm/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/udm/leads.d.ts +0 -52
- package/node_modules/@integration-app/sdk/udm/leads.js +0 -101
- package/node_modules/@integration-app/sdk/udm/leads.js.map +0 -1
- package/node_modules/@integration-app/sdk/udm/users.d.ts +0 -31
- package/node_modules/@integration-app/sdk/udm/users.js +0 -81
- package/node_modules/@integration-app/sdk/udm/users.js.map +0 -1
- package/node_modules/@integration-app/sdk/users/accessors.d.ts +0 -10
- package/node_modules/@integration-app/sdk/users/accessors.js +0 -21
- package/node_modules/@integration-app/sdk/users/accessors.js.map +0 -1
- package/node_modules/@integration-app/sdk/users/api.d.ts +0 -6
- package/node_modules/@integration-app/sdk/users/api.js +0 -3
- package/node_modules/@integration-app/sdk/users/api.js.map +0 -1
- package/node_modules/@integration-app/sdk/users/index.d.ts +0 -5
- package/node_modules/@integration-app/sdk/users/index.js +0 -3
- package/node_modules/@integration-app/sdk/users/index.js.map +0 -1
- package/node_modules/@integration-app/sdk/variables.d.ts +0 -3
- package/node_modules/@integration-app/sdk/variables.js +0 -30
- package/node_modules/@integration-app/sdk/variables.js.map +0 -1
- package/node_modules/@integration-app/sdk/workspaces/index.d.ts +0 -5
- package/node_modules/@integration-app/sdk/workspaces/index.js +0 -3
- package/node_modules/@integration-app/sdk/workspaces/index.js.map +0 -1
- package/node_modules/@sinclair/typebox/package.json +0 -40
- package/node_modules/@sinclair/typebox/readme.md +0 -740
- package/node_modules/@sinclair/typebox/typebox.d.ts +0 -351
- package/node_modules/@sinclair/typebox/typebox.js +0 -345
- package/node_modules/@types/node/README.md +0 -16
- package/node_modules/@types/node/assert.d.ts +0 -128
- package/node_modules/@types/node/async_hooks.d.ts +0 -229
- package/node_modules/@types/node/buffer.d.ts +0 -89
- package/node_modules/@types/node/child_process.d.ts +0 -514
- package/node_modules/@types/node/cluster.d.ts +0 -265
- package/node_modules/@types/node/console.d.ts +0 -142
- package/node_modules/@types/node/constants.d.ts +0 -18
- package/node_modules/@types/node/crypto.d.ts +0 -1283
- package/node_modules/@types/node/dgram.d.ts +0 -144
- package/node_modules/@types/node/dns.d.ts +0 -387
- package/node_modules/@types/node/domain.d.ts +0 -27
- package/node_modules/@types/node/events.d.ts +0 -82
- package/node_modules/@types/node/fs/promises.d.ts +0 -572
- package/node_modules/@types/node/fs.d.ts +0 -2281
- package/node_modules/@types/node/globals.d.ts +0 -747
- package/node_modules/@types/node/globals.global.d.ts +0 -1
- package/node_modules/@types/node/http.d.ts +0 -580
- package/node_modules/@types/node/http2.d.ts +0 -962
- package/node_modules/@types/node/https.d.ts +0 -271
- package/node_modules/@types/node/index.d.ts +0 -98
- package/node_modules/@types/node/inspector.d.ts +0 -3051
- package/node_modules/@types/node/module.d.ts +0 -56
- package/node_modules/@types/node/net.d.ts +0 -308
- package/node_modules/@types/node/os.d.ts +0 -243
- package/node_modules/@types/node/package.json +0 -232
- package/node_modules/@types/node/path.d.ts +0 -168
- package/node_modules/@types/node/perf_hooks.d.ts +0 -274
- package/node_modules/@types/node/process.d.ts +0 -413
- package/node_modules/@types/node/punycode.d.ts +0 -78
- package/node_modules/@types/node/querystring.d.ts +0 -31
- package/node_modules/@types/node/readline.d.ts +0 -174
- package/node_modules/@types/node/repl.d.ts +0 -398
- package/node_modules/@types/node/stream.d.ts +0 -359
- package/node_modules/@types/node/string_decoder.d.ts +0 -10
- package/node_modules/@types/node/timers.d.ts +0 -19
- package/node_modules/@types/node/tls.d.ts +0 -784
- package/node_modules/@types/node/trace_events.d.ts +0 -64
- package/node_modules/@types/node/ts4.8/assert.d.ts +0 -128
- package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -229
- package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -89
- package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -514
- package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -265
- package/node_modules/@types/node/ts4.8/console.d.ts +0 -142
- package/node_modules/@types/node/ts4.8/constants.d.ts +0 -18
- package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -1283
- package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -144
- package/node_modules/@types/node/ts4.8/dns.d.ts +0 -387
- package/node_modules/@types/node/ts4.8/domain.d.ts +0 -27
- package/node_modules/@types/node/ts4.8/events.d.ts +0 -82
- package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -572
- package/node_modules/@types/node/ts4.8/fs.d.ts +0 -2281
- package/node_modules/@types/node/ts4.8/globals.d.ts +0 -746
- package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
- package/node_modules/@types/node/ts4.8/http.d.ts +0 -580
- package/node_modules/@types/node/ts4.8/http2.d.ts +0 -962
- package/node_modules/@types/node/ts4.8/https.d.ts +0 -271
- package/node_modules/@types/node/ts4.8/index.d.ts +0 -53
- package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -3051
- package/node_modules/@types/node/ts4.8/module.d.ts +0 -56
- package/node_modules/@types/node/ts4.8/net.d.ts +0 -308
- package/node_modules/@types/node/ts4.8/os.d.ts +0 -243
- package/node_modules/@types/node/ts4.8/path.d.ts +0 -168
- package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -274
- package/node_modules/@types/node/ts4.8/process.d.ts +0 -413
- package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -78
- package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -31
- package/node_modules/@types/node/ts4.8/readline.d.ts +0 -174
- package/node_modules/@types/node/ts4.8/repl.d.ts +0 -398
- package/node_modules/@types/node/ts4.8/stream.d.ts +0 -359
- package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -10
- package/node_modules/@types/node/ts4.8/timers.d.ts +0 -19
- package/node_modules/@types/node/ts4.8/tls.d.ts +0 -784
- package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -64
- package/node_modules/@types/node/ts4.8/tty.d.ts +0 -69
- package/node_modules/@types/node/ts4.8/url.d.ts +0 -149
- package/node_modules/@types/node/ts4.8/util.d.ts +0 -216
- package/node_modules/@types/node/ts4.8/v8.d.ts +0 -190
- package/node_modules/@types/node/ts4.8/vm.d.ts +0 -155
- package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -89
- package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -241
- package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -364
- package/node_modules/@types/node/tty.d.ts +0 -69
- package/node_modules/@types/node/url.d.ts +0 -149
- package/node_modules/@types/node/util.d.ts +0 -216
- package/node_modules/@types/node/v8.d.ts +0 -190
- package/node_modules/@types/node/vm.d.ts +0 -155
- package/node_modules/@types/node/wasi.d.ts +0 -89
- package/node_modules/@types/node/worker_threads.d.ts +0 -241
- package/node_modules/@types/node/zlib.d.ts +0 -364
@@ -1,740 +0,0 @@
|
|
1
|
-
<div align='center'>
|
2
|
-
|
3
|
-
<h1>TypeBox</h1>
|
4
|
-
|
5
|
-
<p>JSON Schema Type Builder with Static Type Resolution for TypeScript</p>
|
6
|
-
|
7
|
-
<img src="https://github.com/sinclairzx81/typebox/blob/master/typebox.png?raw=true" />
|
8
|
-
|
9
|
-
<br />
|
10
|
-
<br />
|
11
|
-
|
12
|
-
[![npm version](https://badge.fury.io/js/%40sinclair%2Ftypebox.svg)](https://badge.fury.io/js/%40sinclair%2Ftypebox) [![GitHub CI](https://github.com/sinclairzx81/typebox/workflows/GitHub%20CI/badge.svg)](https://github.com/sinclairzx81/typebox/actions)
|
13
|
-
|
14
|
-
</div>
|
15
|
-
|
16
|
-
<a name="Install"></a>
|
17
|
-
|
18
|
-
## Install
|
19
|
-
|
20
|
-
#### Node
|
21
|
-
|
22
|
-
```bash
|
23
|
-
$ npm install @sinclair/typebox --save
|
24
|
-
```
|
25
|
-
|
26
|
-
#### Deno
|
27
|
-
|
28
|
-
```typescript
|
29
|
-
import { Static, Type } from 'https://deno.land/x/typebox/src/typebox.ts'
|
30
|
-
```
|
31
|
-
|
32
|
-
## Example
|
33
|
-
|
34
|
-
```typescript
|
35
|
-
import { Static, Type } from '@sinclair/typebox'
|
36
|
-
|
37
|
-
const T = Type.String() // const T = { "type": "string" }
|
38
|
-
|
39
|
-
type T = Static<typeof T> // type T = string
|
40
|
-
```
|
41
|
-
|
42
|
-
<a name="Overview"></a>
|
43
|
-
|
44
|
-
## Overview
|
45
|
-
|
46
|
-
TypeBox is a library that creates in-memory JSON Schema objects that can be statically inferred as TypeScript types. The schemas produced by this library are designed to match the static type checking rules of the TypeScript compiler. TypeBox allows one to create a unified type that can be both statically asserted by the TypeScript compiler and runtime asserted using standard JSON Schema validation.
|
47
|
-
|
48
|
-
TypeBox can be used as a simple tool to build up complex schemas or integrated into RPC or REST services to help validate JSON data received over the wire. TypeBox does not provide any JSON schema validation. Please use libraries such as AJV to validate schemas built with this library.
|
49
|
-
|
50
|
-
Requires TypeScript 4.3.5 and above.
|
51
|
-
|
52
|
-
License MIT
|
53
|
-
|
54
|
-
## Contents
|
55
|
-
- [Install](#Install)
|
56
|
-
- [Overview](#Overview)
|
57
|
-
- [Usage](#Usage)
|
58
|
-
- [Types](#Types)
|
59
|
-
- [Modifiers](#Modifiers)
|
60
|
-
- [Options](#Options)
|
61
|
-
- [Generic Types](#Generic-Types)
|
62
|
-
- [Reference Types](#Reference-Types)
|
63
|
-
- [Recursive Types](#Recursive-Types)
|
64
|
-
- [Extended Types](#Extended-Types)
|
65
|
-
- [Strict](#Strict)
|
66
|
-
- [Validation](#Validation)
|
67
|
-
- [OpenAPI](#OpenAPI)
|
68
|
-
|
69
|
-
<a name="Example"></a>
|
70
|
-
|
71
|
-
## Usage
|
72
|
-
|
73
|
-
The following demonstrates TypeBox's general usage.
|
74
|
-
|
75
|
-
```typescript
|
76
|
-
|
77
|
-
import { Static, Type } from '@sinclair/typebox'
|
78
|
-
|
79
|
-
//--------------------------------------------------------------------------------------------
|
80
|
-
//
|
81
|
-
// Let's say you have the following type ...
|
82
|
-
//
|
83
|
-
//--------------------------------------------------------------------------------------------
|
84
|
-
|
85
|
-
type T = {
|
86
|
-
id: string,
|
87
|
-
name: string,
|
88
|
-
timestamp: number
|
89
|
-
}
|
90
|
-
|
91
|
-
//--------------------------------------------------------------------------------------------
|
92
|
-
//
|
93
|
-
// ... you can express this type in the following way.
|
94
|
-
//
|
95
|
-
//--------------------------------------------------------------------------------------------
|
96
|
-
|
97
|
-
const T = Type.Object({ // const T = {
|
98
|
-
id: Type.String(), // type: 'object',
|
99
|
-
name: Type.String(), // properties: {
|
100
|
-
timestamp: Type.Integer() // id: {
|
101
|
-
}) // type: 'string'
|
102
|
-
// },
|
103
|
-
// name: {
|
104
|
-
// type: 'string'
|
105
|
-
// },
|
106
|
-
// timestamp: {
|
107
|
-
// type: 'integer'
|
108
|
-
// }
|
109
|
-
// },
|
110
|
-
// required: [
|
111
|
-
// "id",
|
112
|
-
// "name",
|
113
|
-
// "timestamp"
|
114
|
-
// ]
|
115
|
-
// }
|
116
|
-
|
117
|
-
//--------------------------------------------------------------------------------------------
|
118
|
-
//
|
119
|
-
// ... then infer back to the original static type this way.
|
120
|
-
//
|
121
|
-
//--------------------------------------------------------------------------------------------
|
122
|
-
|
123
|
-
type T = Static<typeof T> // type T = {
|
124
|
-
// id: string,
|
125
|
-
// name: string,
|
126
|
-
// timestamp: number
|
127
|
-
// }
|
128
|
-
|
129
|
-
//--------------------------------------------------------------------------------------------
|
130
|
-
//
|
131
|
-
// ... then use the type both as JSON schema and as a TypeScript type.
|
132
|
-
//
|
133
|
-
//--------------------------------------------------------------------------------------------
|
134
|
-
|
135
|
-
function receive(value: T) { // ... as a Type
|
136
|
-
|
137
|
-
if(JSON.validate(T, value)) { // ... as a Schema
|
138
|
-
|
139
|
-
// ok...
|
140
|
-
}
|
141
|
-
}
|
142
|
-
```
|
143
|
-
|
144
|
-
<a name="Types"></a>
|
145
|
-
|
146
|
-
## Types
|
147
|
-
|
148
|
-
The following table outlines the TypeBox mappings between TypeScript and JSON schema.
|
149
|
-
|
150
|
-
```typescript
|
151
|
-
┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐
|
152
|
-
│ TypeBox │ TypeScript │ JSON Schema │
|
153
|
-
│ │ │ │
|
154
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
155
|
-
│ const T = Type.Any() │ type T = any │ const T = { } │
|
156
|
-
│ │ │ │
|
157
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
158
|
-
│ const T = Type.Unknown() │ type T = unknown │ const T = { } │
|
159
|
-
│ │ │ │
|
160
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
161
|
-
│ const T = Type.String() │ type T = string │ const T = { │
|
162
|
-
│ │ │ type: 'string' │
|
163
|
-
│ │ │ } │
|
164
|
-
│ │ │ │
|
165
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
166
|
-
│ const T = Type.Number() │ type T = number │ const T = { │
|
167
|
-
│ │ │ type: 'number' │
|
168
|
-
│ │ │ } │
|
169
|
-
│ │ │ │
|
170
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
171
|
-
│ const T = Type.Integer() │ type T = number │ const T = { │
|
172
|
-
│ │ │ type: 'integer' │
|
173
|
-
│ │ │ } │
|
174
|
-
│ │ │ │
|
175
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
176
|
-
│ const T = Type.Boolean() │ type T = boolean │ const T = { │
|
177
|
-
│ │ │ type: 'boolean' │
|
178
|
-
│ │ │ } │
|
179
|
-
│ │ │ │
|
180
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
181
|
-
│ const T = Type.Null() │ type T = null │ const T = { │
|
182
|
-
│ │ │ type: 'null' │
|
183
|
-
│ │ │ } │
|
184
|
-
│ │ │ │
|
185
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
186
|
-
│ const T = Type.RegEx(/foo/) │ type T = string │ const T = { │
|
187
|
-
│ │ │ type: 'string', │
|
188
|
-
│ │ │ pattern: 'foo' │
|
189
|
-
│ │ │ } │
|
190
|
-
│ │ │ │
|
191
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
192
|
-
│ const T = Type.Literal(42) │ type T = 42 │ const T = { │
|
193
|
-
│ │ │ const: 42 │
|
194
|
-
│ │ │ type: 'number' │
|
195
|
-
│ │ │ } │
|
196
|
-
│ │ │ │
|
197
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
198
|
-
│ const T = Type.Array( │ type T = number[] │ const T = { │
|
199
|
-
│ Type.Number() │ │ type: 'array', │
|
200
|
-
│ ) │ │ items: { │
|
201
|
-
│ │ │ type: 'number' │
|
202
|
-
│ │ │ } │
|
203
|
-
│ │ │ } │
|
204
|
-
│ │ │ │
|
205
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
206
|
-
│ const T = Type.Object({ │ type T = { │ const T = { │
|
207
|
-
│ x: Type.Number(), │ x: number, │ type: 'object', │
|
208
|
-
│ y: Type.Number() │ y: number │ properties: { │
|
209
|
-
│ }) │ } │ x: { │
|
210
|
-
│ │ │ type: 'number' │
|
211
|
-
│ │ │ }, │
|
212
|
-
│ │ │ y: { │
|
213
|
-
│ │ │ type: 'number' │
|
214
|
-
│ │ │ } │
|
215
|
-
│ │ │ }, │
|
216
|
-
│ │ │ required: ['x', 'y'] │
|
217
|
-
│ │ │ } │
|
218
|
-
│ │ │ │
|
219
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
220
|
-
│ const T = Type.Tuple([ │ type T = [number, number] │ const T = { │
|
221
|
-
│ Type.Number(), │ │ type: 'array', │
|
222
|
-
│ Type.Number() │ │ items: [ │
|
223
|
-
│ ]) │ │ { │
|
224
|
-
│ │ │ type: 'number' │
|
225
|
-
│ │ │ }, { │
|
226
|
-
│ │ │ type: 'number' │
|
227
|
-
│ │ │ } │
|
228
|
-
│ │ │ ], │
|
229
|
-
│ │ │ additionalItems: false, │
|
230
|
-
│ │ │ minItems: 2, │
|
231
|
-
│ │ │ maxItems: 2, │
|
232
|
-
│ │ │ } │
|
233
|
-
│ │ │ │
|
234
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
235
|
-
│ enum Foo { │ enum Foo { │ const T = { │
|
236
|
-
│ A, │ A, │ anyOf: [{ │
|
237
|
-
│ B │ B │ type: 'number', │
|
238
|
-
│ } │ } │ const: 0 │
|
239
|
-
│ │ │ }, { │
|
240
|
-
│ const T = Type.Enum(Foo) │ type T = Foo │ type: 'number', │
|
241
|
-
│ │ │ const: 1 │
|
242
|
-
│ │ │ }] │
|
243
|
-
│ │ │ } │
|
244
|
-
│ │ │ │
|
245
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
246
|
-
│ const T = Type.KeyOf( │ type T = keyof { │ const T = { │
|
247
|
-
│ Type.Object({ │ x: number, │ enum: ['x', 'y'], │
|
248
|
-
│ x: Type.Number(), │ y: number │ type: 'string' │
|
249
|
-
│ y: Type.Number() │ } │ } │
|
250
|
-
│ }) │ │ │
|
251
|
-
│ ) │ │ │
|
252
|
-
│ │ │ │
|
253
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
254
|
-
│ const T = Type.Union([ │ type T = string | number │ const T = { │
|
255
|
-
│ Type.String(), │ │ anyOf: [{ │
|
256
|
-
│ Type.Number() │ │ type: 'string' │
|
257
|
-
│ ]) │ │ }, { │
|
258
|
-
│ │ │ type: 'number' │
|
259
|
-
│ │ │ }] │
|
260
|
-
│ │ │ } │
|
261
|
-
│ │ │ │
|
262
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
263
|
-
│ const T = Type.Intersect([ │ type T = { │ const T = { │
|
264
|
-
│ Type.Object({ │ x: number │ allOf: [{ │
|
265
|
-
│ x: Type.Number() │ } & { │ type: 'object', │
|
266
|
-
│ }), │ y: number │ properties: { │
|
267
|
-
│ Type.Object({ │ } │ x: { │
|
268
|
-
│ y: Type.Number() │ │ type: 'number' │
|
269
|
-
│ }) │ │ } │
|
270
|
-
│ ]) │ │ }, │
|
271
|
-
│ │ │ required: ['x'] │
|
272
|
-
│ │ │ }, { │
|
273
|
-
│ │ │ type: 'object', │
|
274
|
-
│ │ │ properties: { │
|
275
|
-
│ │ │ y: { │
|
276
|
-
│ │ │ type: 'number' │
|
277
|
-
│ │ │ } │
|
278
|
-
│ │ │ }, │
|
279
|
-
│ │ │ required: ['y'] │
|
280
|
-
│ │ │ }] │
|
281
|
-
│ │ │ } │
|
282
|
-
│ │ │ │
|
283
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
284
|
-
│ const T = Type.Record( │ type T = { │ const T = { │
|
285
|
-
│ Type.String(), │ [key: string]: number │ type: 'object', │
|
286
|
-
│ Type.Number() │ } │ patternProperties: { │
|
287
|
-
│ ) │ │ '^.*$': { │
|
288
|
-
│ │ │ type: 'number' │
|
289
|
-
│ │ │ } │
|
290
|
-
│ │ │ } │
|
291
|
-
│ │ │ } │
|
292
|
-
│ │ │ │
|
293
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
294
|
-
│ const T = Type.Partial( │ type T = Partial<{ │ const T = { │
|
295
|
-
│ Type.Object({ │ x: number, │ type: 'object', │
|
296
|
-
│ x: Type.Number(), │ y: number │ properties: { │
|
297
|
-
│ y: Type.Number() | }> │ x: { │
|
298
|
-
│ }) │ │ type: 'number' │
|
299
|
-
│ ) │ │ }, │
|
300
|
-
│ │ │ y: { │
|
301
|
-
│ │ │ type: 'number' │
|
302
|
-
│ │ │ } │
|
303
|
-
│ │ │ } │
|
304
|
-
│ │ │ } │
|
305
|
-
│ │ │ │
|
306
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
307
|
-
│ const T = Type.Required( │ type T = Required<{ │ const T = { │
|
308
|
-
│ Type.Object({ │ x?: number, │ type: 'object', │
|
309
|
-
│ x: Type.Optional( │ y?: number │ properties: { │
|
310
|
-
│ Type.Number() | }> │ x: { │
|
311
|
-
│ ), │ │ type: 'number' │
|
312
|
-
│ y: Type.Optional( │ │ }, │
|
313
|
-
│ Type.Number() │ │ y: { │
|
314
|
-
│ ) │ │ type: 'number' │
|
315
|
-
│ }) │ │ } │
|
316
|
-
│ ) │ │ }, │
|
317
|
-
│ │ │ required: ['x', 'y'] │
|
318
|
-
│ │ │ } │
|
319
|
-
│ │ │ │
|
320
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
321
|
-
│ const T = Type.Pick( │ type T = Pick<{ │ const T = { │
|
322
|
-
│ Type.Object({ │ x: number, │ type: 'object', │
|
323
|
-
│ x: Type.Number(), │ y: number │ properties: { │
|
324
|
-
│ y: Type.Number(), | }, 'x'> │ x: { │
|
325
|
-
│ }), ['x'] │ │ type: 'number' │
|
326
|
-
│ ) │ │ } │
|
327
|
-
│ │ │ }, │
|
328
|
-
│ │ │ required: ['x'] │
|
329
|
-
│ │ │ } │
|
330
|
-
│ │ │ │
|
331
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
332
|
-
│ const T = Type.Omit( │ type T = Omit<{ │ const T = { │
|
333
|
-
│ Type.Object({ │ x: number, │ type: 'object', │
|
334
|
-
│ x: Type.Number(), │ y: number │ properties: { │
|
335
|
-
│ y: Type.Number(), | }, 'x'> │ y: { │
|
336
|
-
│ }), ['x'] │ │ type: 'number' │
|
337
|
-
│ ) │ │ } │
|
338
|
-
│ │ │ }, │
|
339
|
-
│ │ │ required: ['y'] │
|
340
|
-
│ │ │ } │
|
341
|
-
│ │ │ │
|
342
|
-
└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘
|
343
|
-
```
|
344
|
-
<a name="Modifiers"></a>
|
345
|
-
|
346
|
-
### Modifiers
|
347
|
-
|
348
|
-
TypeBox provides modifiers that can be applied to an objects properties. This allows for `optional` and `readonly` to be applied to that property. The following table illustates how they map between TypeScript and JSON Schema.
|
349
|
-
|
350
|
-
```typescript
|
351
|
-
┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐
|
352
|
-
│ TypeBox │ TypeScript │ JSON Schema │
|
353
|
-
│ │ │ │
|
354
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
355
|
-
│ const T = Type.Object({ │ type T = { │ const T = { │
|
356
|
-
│ name: Type.Optional( │ name?: string, │ type: 'object', │
|
357
|
-
│ Type.String(), │ } │ properties: { │
|
358
|
-
│ ) │ │ name: { │
|
359
|
-
│ }) │ │ type: 'string' │
|
360
|
-
│ │ │ } │
|
361
|
-
│ │ │ } │
|
362
|
-
│ │ │ } │
|
363
|
-
│ │ │ │
|
364
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
365
|
-
│ const T = Type.Object({ │ type T = { │ const T = { │
|
366
|
-
│ name: Type.Readonly( │ readonly name: string, │ type: 'object', │
|
367
|
-
│ Type.String(), │ } │ properties: { │
|
368
|
-
│ ) │ │ name: { │
|
369
|
-
│ }) │ │ type: 'string' │
|
370
|
-
│ │ │ } │
|
371
|
-
│ │ │ }, │
|
372
|
-
│ │ │ required: ['name'] │
|
373
|
-
│ │ │ } │
|
374
|
-
│ │ │ │
|
375
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
376
|
-
│ const T = Type.Object({ │ type T = { │ const T = { │
|
377
|
-
│ name: Type.ReadonlyOptional( │ readonly name?: string, │ type: 'object', │
|
378
|
-
│ Type.String(), │ } │ properties: { │
|
379
|
-
│ ) │ │ name: { │
|
380
|
-
│ }) │ │ type: 'string' │
|
381
|
-
│ │ │ } │
|
382
|
-
│ │ │ } │
|
383
|
-
│ │ │ } │
|
384
|
-
│ │ │ │
|
385
|
-
└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘
|
386
|
-
```
|
387
|
-
|
388
|
-
<a name="Options"></a>
|
389
|
-
|
390
|
-
### Options
|
391
|
-
|
392
|
-
You can pass additional JSON schema options on the last argument of any given type. The following are some examples.
|
393
|
-
|
394
|
-
```typescript
|
395
|
-
// string must be an email
|
396
|
-
const T = Type.String({ format: 'email' })
|
397
|
-
|
398
|
-
// number must be a multiple of 2
|
399
|
-
const T = Type.Number({ multipleOf: 2 })
|
400
|
-
|
401
|
-
// array must have at least 5 integer values
|
402
|
-
const T = Type.Array(Type.Integer(), { minItems: 5 })
|
403
|
-
```
|
404
|
-
<a name="Generic-Types"></a>
|
405
|
-
|
406
|
-
### Generic Types
|
407
|
-
|
408
|
-
Generic types can be created using functions. The following creates a generic `Nullable<T>` type.
|
409
|
-
|
410
|
-
```typescript
|
411
|
-
import { Type, Static, TSchema } from '@sinclair/typebox'
|
412
|
-
|
413
|
-
// type Nullable<T> = T | null
|
414
|
-
|
415
|
-
const Nullable = <T extends TSchema>(type: T) => Type.Union([type, Type.Null()])
|
416
|
-
|
417
|
-
const T = Nullable(Type.String()) // const T = {
|
418
|
-
// "anyOf": [{
|
419
|
-
// type: 'string'
|
420
|
-
// }, {
|
421
|
-
// type: 'null'
|
422
|
-
// }]
|
423
|
-
// }
|
424
|
-
|
425
|
-
type T = Static<typeof T> // type T = string | null
|
426
|
-
|
427
|
-
const U = Nullable(Type.Number()) // const U = {
|
428
|
-
// "anyOf": [{
|
429
|
-
// type: 'number'
|
430
|
-
// }, {
|
431
|
-
// type: 'null'
|
432
|
-
// }]
|
433
|
-
// }
|
434
|
-
|
435
|
-
type U = Static<typeof U> // type U = number | null
|
436
|
-
```
|
437
|
-
|
438
|
-
<a name="Reference-Types"></a>
|
439
|
-
|
440
|
-
### Reference Types
|
441
|
-
|
442
|
-
Types can be referenced with `Type.Ref(...)`. To reference a type, the target type must specify an `$id`.
|
443
|
-
|
444
|
-
```typescript
|
445
|
-
const T = Type.String({ $id: 'T' }) // const T = {
|
446
|
-
// $id: 'T',
|
447
|
-
// type: 'string'
|
448
|
-
// }
|
449
|
-
|
450
|
-
const R = Type.Ref(T) // const R = {
|
451
|
-
// $ref: 'T'
|
452
|
-
// }
|
453
|
-
```
|
454
|
-
|
455
|
-
It can sometimes be helpful to organize shared referenced types under a common namespace. The `Type.Namespace(...)` function can be used to create a shared definition container for related types. The following creates a `Math3D` container and a `Vertex` structure that references types in the container.
|
456
|
-
|
457
|
-
```typescript
|
458
|
-
const Math3D = Type.Namespace({ // const Math3D = {
|
459
|
-
Vector4: Type.Object({ // $id: 'Math3D',
|
460
|
-
x: Type.Number(), // $defs: {
|
461
|
-
y: Type.Number(), // Vector4: {
|
462
|
-
z: Type.Number(), // type: 'object',
|
463
|
-
w: Type.Number() // properties: {
|
464
|
-
}), // x: { type: 'number' },
|
465
|
-
Vector3: Type.Object({ // y: { type: 'number' },
|
466
|
-
x: Type.Number(), // z: { type: 'number' },
|
467
|
-
y: Type.Number(), // w: { type: 'number' }
|
468
|
-
z: Type.Number() // },
|
469
|
-
}), // required: ['x', 'y', 'z', 'w']
|
470
|
-
Vector2: Type.Object({ // },
|
471
|
-
x: Type.Number(), // Vector3: {
|
472
|
-
y: Type.Number() // type: 'object',
|
473
|
-
}) // properties: {
|
474
|
-
}, { $id: 'Math3D' }) // x: { 'type': 'number' },
|
475
|
-
// y: { 'type': 'number' },
|
476
|
-
// z: { 'type': 'number' }
|
477
|
-
// },
|
478
|
-
// required: ['x', 'y', 'z']
|
479
|
-
// },
|
480
|
-
// Vector2: {
|
481
|
-
// type: 'object',
|
482
|
-
// properties: {
|
483
|
-
// x: { 'type': 'number' },
|
484
|
-
// y: { 'type': 'number' },
|
485
|
-
// },
|
486
|
-
// required: ['x', 'y']
|
487
|
-
// }
|
488
|
-
// }
|
489
|
-
// }
|
490
|
-
|
491
|
-
const Vertex = Type.Object({ // const Vertex = {
|
492
|
-
position: Type.Ref(Math3D, 'Vector4'), // type: 'object',
|
493
|
-
normal: Type.Ref(Math3D, 'Vector3'), // properties: {
|
494
|
-
uv: Type.Ref(Math3D, 'Vector2') // position: { $ref: 'Math3D#/$defs/Vector4' },
|
495
|
-
}) // normal: { $ref: 'Math3D#/$defs/Vector3' },
|
496
|
-
// uv: { $ref: 'Math3D#/$defs/Vector2' }
|
497
|
-
// },
|
498
|
-
// required: ['position', 'normal', 'uv']
|
499
|
-
// }
|
500
|
-
```
|
501
|
-
|
502
|
-
<a name="Recursive-Types"></a>
|
503
|
-
|
504
|
-
### Recursive Types
|
505
|
-
|
506
|
-
Recursive types can be created with the `Type.Rec(...)` function. The following creates a `Node` type that contains an array of inner Nodes. Note that due to current restrictions on TypeScript inference, it is not possible for TypeBox to statically infer for recursive types. TypeBox will infer the inner recursive type as `any`.
|
507
|
-
|
508
|
-
```typescript
|
509
|
-
const Node = Type.Rec(Self => Type.Object({ // const Node = {
|
510
|
-
id: Type.String(), // $id: 'Node',
|
511
|
-
nodes: Type.Array(Self), // $ref: 'Node#/$defs/self',
|
512
|
-
}), { $id: 'Node' }) // $defs: {
|
513
|
-
// self: {
|
514
|
-
// type: 'object',
|
515
|
-
// properties: {
|
516
|
-
// id: {
|
517
|
-
// type: 'string'
|
518
|
-
// },
|
519
|
-
// nodes: {
|
520
|
-
// type: 'array',
|
521
|
-
// items: {
|
522
|
-
// $ref: 'Node#/$defs/self'
|
523
|
-
// }
|
524
|
-
// }
|
525
|
-
// }
|
526
|
-
// }
|
527
|
-
// }
|
528
|
-
|
529
|
-
type Node = Static<typeof Node> // type Node = {
|
530
|
-
// id: string
|
531
|
-
// nodes: any[]
|
532
|
-
// }
|
533
|
-
|
534
|
-
function visit(node: Node) {
|
535
|
-
for(const inner of node.nodes) {
|
536
|
-
visit(inner as Node) // Assert inner as Node
|
537
|
-
}
|
538
|
-
}
|
539
|
-
```
|
540
|
-
|
541
|
-
<a name="Extended-Types"></a>
|
542
|
-
|
543
|
-
### Extended Types
|
544
|
-
|
545
|
-
In addition to JSON schema types, TypeBox provides several extended types that allow for `function` and `constructor` types to be composed. These additional types are not valid JSON Schema and will not validate using typical JSON Schema validation. However, these types can be used to frame JSON schema and describe callable interfaces that may receive JSON validated data. These types are as follows.
|
546
|
-
|
547
|
-
```typescript
|
548
|
-
┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐
|
549
|
-
│ TypeBox │ TypeScript │ Extended Schema │
|
550
|
-
│ │ │ │
|
551
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
552
|
-
│ const T = Type.Constructor([ │ type T = new ( │ const T = { │
|
553
|
-
│ Type.String(), │ arg0: string, │ type: 'constructor' │
|
554
|
-
│ Type.Number(), │ arg1: number │ arguments: [{ │
|
555
|
-
│ ], Type.Boolean()) │ ) => boolean │ type: 'string' │
|
556
|
-
│ │ │ }, { │
|
557
|
-
│ │ │ type: 'number' │
|
558
|
-
│ │ │ }], │
|
559
|
-
│ │ │ returns: { │
|
560
|
-
│ │ │ type: 'boolean' │
|
561
|
-
│ │ │ } │
|
562
|
-
│ │ │ } │
|
563
|
-
│ │ │ │
|
564
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
565
|
-
│ const T = Type.Function([ │ type T = ( │ const T = { │
|
566
|
-
| Type.String(), │ arg0: string, │ type : 'function', │
|
567
|
-
│ Type.Number(), │ arg1: number │ arguments: [{ │
|
568
|
-
│ ], Type.Boolean()) │ ) => boolean │ type: 'string' │
|
569
|
-
│ │ │ }, { │
|
570
|
-
│ │ │ type: 'number' │
|
571
|
-
│ │ │ }], │
|
572
|
-
│ │ │ returns: { │
|
573
|
-
│ │ │ type: 'boolean' │
|
574
|
-
│ │ │ } │
|
575
|
-
│ │ │ } │
|
576
|
-
│ │ │ │
|
577
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
578
|
-
│ const T = Type.Promise( │ type T = Promise<string> │ const T = { │
|
579
|
-
│ Type.String() │ │ type: 'promise', │
|
580
|
-
│ ) │ │ item: { │
|
581
|
-
│ │ │ type: 'string' │
|
582
|
-
│ │ │ } │
|
583
|
-
│ │ │ } │
|
584
|
-
│ │ │ │
|
585
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
586
|
-
│ const T = Type.Undefined() │ type T = undefined │ const T = { │
|
587
|
-
│ │ │ type: 'undefined' │
|
588
|
-
│ │ │ } │
|
589
|
-
│ │ │ │
|
590
|
-
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
591
|
-
│ const T = Type.Void() │ type T = void │ const T = { │
|
592
|
-
│ │ │ type: 'void' │
|
593
|
-
│ │ │ } │
|
594
|
-
│ │ │ │
|
595
|
-
└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘
|
596
|
-
```
|
597
|
-
|
598
|
-
<a name="Strict"></a>
|
599
|
-
|
600
|
-
### Strict
|
601
|
-
|
602
|
-
TypeBox schemas contain the properties `kind` and `modifier`. These properties are provided to enable runtime type reflection on schemas, as well as helping TypeBox apply the appropriate static type inference rules. These properties are not strictly valid JSON schema so in some cases it may be desirable to omit them. TypeBox provides a `Type.Strict()` function that will omit these properties if necessary.
|
603
|
-
|
604
|
-
```typescript
|
605
|
-
const T = Type.Object({ // const T = {
|
606
|
-
name: Type.Optional(Type.String()) // kind: Symbol(ObjectKind),
|
607
|
-
}) // type: 'object',
|
608
|
-
// properties: {
|
609
|
-
// name: {
|
610
|
-
// kind: Symbol(StringKind),
|
611
|
-
// type: 'string',
|
612
|
-
// modifier: Symbol(OptionalModifier)
|
613
|
-
// }
|
614
|
-
// }
|
615
|
-
// }
|
616
|
-
|
617
|
-
const U = Type.Strict(T) // const U = {
|
618
|
-
// type: 'object',
|
619
|
-
// properties: {
|
620
|
-
// name: {
|
621
|
-
// type: 'string'
|
622
|
-
// }
|
623
|
-
// }
|
624
|
-
// }
|
625
|
-
```
|
626
|
-
|
627
|
-
<a name="Validation"></a>
|
628
|
-
|
629
|
-
### Validation
|
630
|
-
|
631
|
-
TypeBox does not provide JSON schema validation so users will need to select an appropriate JSON Schema validator for their needs. TypeBox schemas target JSON Schema draft `2019-09` so any validator capable of draft `2019-09` should be fine. A good library to use for validation in JavaScript environments is [AJV](https://www.npmjs.com/package/ajv). The following example shows setting up AJV 7 to work with TypeBox.
|
632
|
-
|
633
|
-
```bash
|
634
|
-
$ npm install ajv ajv-formats --save
|
635
|
-
```
|
636
|
-
|
637
|
-
```typescript
|
638
|
-
//--------------------------------------------------------------------------------------------
|
639
|
-
//
|
640
|
-
// Import the 2019 compliant validator from AJV
|
641
|
-
//
|
642
|
-
//--------------------------------------------------------------------------------------------
|
643
|
-
|
644
|
-
import { Type } from '@sinclair/typebox'
|
645
|
-
import addFormats from 'ajv-formats'
|
646
|
-
import Ajv from 'ajv/dist/2019'
|
647
|
-
|
648
|
-
//--------------------------------------------------------------------------------------------
|
649
|
-
//
|
650
|
-
// Setup AJV validator with the following options and formats
|
651
|
-
//
|
652
|
-
//--------------------------------------------------------------------------------------------
|
653
|
-
|
654
|
-
const ajv = addFormats(new Ajv({}), [
|
655
|
-
'date-time',
|
656
|
-
'time',
|
657
|
-
'date',
|
658
|
-
'email',
|
659
|
-
'hostname',
|
660
|
-
'ipv4',
|
661
|
-
'ipv6',
|
662
|
-
'uri',
|
663
|
-
'uri-reference',
|
664
|
-
'uuid',
|
665
|
-
'uri-template',
|
666
|
-
'json-pointer',
|
667
|
-
'relative-json-pointer',
|
668
|
-
'regex'
|
669
|
-
]).addKeyword('kind')
|
670
|
-
.addKeyword('modifier')
|
671
|
-
|
672
|
-
//--------------------------------------------------------------------------------------------
|
673
|
-
//
|
674
|
-
// Create a TypeBox type
|
675
|
-
//
|
676
|
-
//--------------------------------------------------------------------------------------------
|
677
|
-
|
678
|
-
const User = Type.Object({
|
679
|
-
userId: Type.String({ format: 'uuid' }),
|
680
|
-
email: Type.String({ format: 'email' }),
|
681
|
-
online: Type.Boolean(),
|
682
|
-
}, { additionalProperties: false })
|
683
|
-
|
684
|
-
//--------------------------------------------------------------------------------------------
|
685
|
-
//
|
686
|
-
// Validate Data
|
687
|
-
//
|
688
|
-
//--------------------------------------------------------------------------------------------
|
689
|
-
|
690
|
-
const ok = ajv.validate(User, {
|
691
|
-
userId: '68b4b1d8-0db6-468d-b551-02069a692044',
|
692
|
-
email: 'dave@domain.com',
|
693
|
-
online: true
|
694
|
-
}) // -> ok
|
695
|
-
```
|
696
|
-
|
697
|
-
Please refer to the official AJV [documentation](https://ajv.js.org/guide/getting-started.html) for additional information on using AJV.
|
698
|
-
|
699
|
-
### OpenAPI
|
700
|
-
|
701
|
-
TypeBox can be used to create schemas for OpenAPI, however users should be mindful of some disparities between the JSON Schema and OpenAPI for versions prior to OpenAPI 3.1. Two common instances where OpenAPI diverges is the handling nullable and string enum schemas types. The following shows how you can use TypeBox to construct these types.
|
702
|
-
|
703
|
-
```typescript
|
704
|
-
import { Type, Static, TNull, TLiteral, TUnion, TSchema } from '@sinclair/typebox'
|
705
|
-
|
706
|
-
//--------------------------------------------------------------------------------------------
|
707
|
-
//
|
708
|
-
// Nullable<T>
|
709
|
-
//
|
710
|
-
//--------------------------------------------------------------------------------------------
|
711
|
-
|
712
|
-
function Nullable<T extends TSchema>(schema: T): TUnion<[T, TNull]> {
|
713
|
-
return { ...schema, nullable: true } as any
|
714
|
-
}
|
715
|
-
|
716
|
-
const T = Nullable(Type.String()) // const T = {
|
717
|
-
// type: 'string',
|
718
|
-
// nullable: true
|
719
|
-
// }
|
720
|
-
|
721
|
-
type T = Static<typeof T> // type T = string | null
|
722
|
-
|
723
|
-
//--------------------------------------------------------------------------------------------
|
724
|
-
//
|
725
|
-
// StringUnion<[...]>
|
726
|
-
//
|
727
|
-
//--------------------------------------------------------------------------------------------
|
728
|
-
|
729
|
-
type IntoStringUnion<T> = {[K in keyof T]: T[K] extends string ? TLiteral<T[K]>: never }
|
730
|
-
|
731
|
-
function StringUnion<T extends string[]>(values: [...T]): TUnion<IntoStringUnion<T>> {
|
732
|
-
return { enum: values } as any
|
733
|
-
}
|
734
|
-
|
735
|
-
const T = StringUnion(['A', 'B', 'C']) // const T = {
|
736
|
-
// enum: ['A', 'B', 'C']
|
737
|
-
// }
|
738
|
-
|
739
|
-
type T = Static<typeof T> // type T = 'A' | 'B' | 'C'
|
740
|
-
```
|