@tellescope/schema 1.2.0 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/schema.d.ts +32 -2
- package/lib/cjs/schema.d.ts.map +1 -1
- package/lib/cjs/schema.js +133 -32
- package/lib/cjs/schema.js.map +1 -1
- package/lib/esm/schema.d.ts +32 -2
- package/lib/esm/schema.d.ts.map +1 -1
- package/lib/esm/schema.js +134 -35
- package/lib/esm/schema.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/schema.ts +184 -45
package/src/schema.ts
CHANGED
|
@@ -28,6 +28,8 @@ import {
|
|
|
28
28
|
MessageTemplateType,
|
|
29
29
|
FormResponseValue,
|
|
30
30
|
MeetingInfo,
|
|
31
|
+
PreviousFormField,
|
|
32
|
+
OrganizationTheme,
|
|
31
33
|
} from "@tellescope/types-models"
|
|
32
34
|
|
|
33
35
|
import {
|
|
@@ -45,7 +47,6 @@ import {
|
|
|
45
47
|
emailValidator,
|
|
46
48
|
fieldsValidator,
|
|
47
49
|
journeysValidator,
|
|
48
|
-
journeyStateValidator,
|
|
49
50
|
journeyStatesValidator,
|
|
50
51
|
phoneValidator,
|
|
51
52
|
nameValidator,
|
|
@@ -58,7 +59,6 @@ import {
|
|
|
58
59
|
stringValidator,
|
|
59
60
|
stringValidator100,
|
|
60
61
|
listOfStringsValidator,
|
|
61
|
-
//listOfMongoIdValidator,
|
|
62
62
|
emailEncodingValidator,
|
|
63
63
|
numberToDateValidator,
|
|
64
64
|
SMSMessageValidator,
|
|
@@ -81,7 +81,6 @@ import {
|
|
|
81
81
|
WebhookSubscriptionValidator,
|
|
82
82
|
attendeeValidator,
|
|
83
83
|
meetingDisplayInfoValidator,
|
|
84
|
-
listOfFormFieldsValidator,
|
|
85
84
|
intakePhoneValidator,
|
|
86
85
|
formResponsesValidator,
|
|
87
86
|
stringValidator25000,
|
|
@@ -103,6 +102,10 @@ import {
|
|
|
103
102
|
FHIRObservationStatusCodeValidator,
|
|
104
103
|
FHIRObservationValueValidator,
|
|
105
104
|
userIdentityValidator,
|
|
105
|
+
formFieldTypeValidator,
|
|
106
|
+
previousFormFieldsValidator,
|
|
107
|
+
numberValidator,
|
|
108
|
+
organizationThemeValidator,
|
|
106
109
|
} from "@tellescope/validation"
|
|
107
110
|
|
|
108
111
|
import {
|
|
@@ -266,6 +269,14 @@ const sideEffects = {
|
|
|
266
269
|
name: "handleTicketClosed",
|
|
267
270
|
description: "Handles automated actions based on a closed ticket",
|
|
268
271
|
},
|
|
272
|
+
incrementFieldCount: {
|
|
273
|
+
name: "incrementFieldCount",
|
|
274
|
+
description: "Increments numFields in a form when a new field is created",
|
|
275
|
+
},
|
|
276
|
+
decrementFieldCount: {
|
|
277
|
+
name: "decrementFieldCount",
|
|
278
|
+
description: "Decrements numFields in a form when a field is deleted",
|
|
279
|
+
},
|
|
269
280
|
}
|
|
270
281
|
export type SideEffectNames = keyof typeof sideEffects
|
|
271
282
|
|
|
@@ -301,7 +312,7 @@ export type CustomActions = {
|
|
|
301
312
|
},
|
|
302
313
|
form_responses: {
|
|
303
314
|
prepare_form_response: CustomAction<{ formId: string, enduserId: string, automationStepId?: string }, { accessCode: string, url: string }>,
|
|
304
|
-
submit_form_response: CustomAction<{ accessCode: string, responses: FormResponseValue, automationStepId?: string }, { formResponse: FormResponse }>,
|
|
315
|
+
submit_form_response: CustomAction<{ accessCode: string, responses: FormResponseValue[], automationStepId?: string }, { formResponse: FormResponse }>,
|
|
305
316
|
},
|
|
306
317
|
journeys: {
|
|
307
318
|
update_state: CustomAction<{ updates: Partial<JourneyState>, id: string, name: string }, { updated: Journey }>,
|
|
@@ -362,6 +373,19 @@ export type PublicActions = {
|
|
|
362
373
|
request_password_reset: CustomAction<{ email: string }, { }>,
|
|
363
374
|
reset_password: CustomAction<{ resetToken: string, newPassword: string }, { }>,
|
|
364
375
|
},
|
|
376
|
+
organizations: {
|
|
377
|
+
get_theme: CustomAction<{ businessId: string }, { theme: OrganizationTheme }>,
|
|
378
|
+
},
|
|
379
|
+
form_responses: {
|
|
380
|
+
session_for_public_form: CustomAction<{
|
|
381
|
+
fname?: string,
|
|
382
|
+
lname?: string,
|
|
383
|
+
email: string,
|
|
384
|
+
phone?: string,
|
|
385
|
+
formId: string,
|
|
386
|
+
businessId: string
|
|
387
|
+
}, { accessCode: string, authToken: string, url: string, path: string }>,
|
|
388
|
+
},
|
|
365
389
|
}
|
|
366
390
|
|
|
367
391
|
export type SchemaV1 = Schema & {
|
|
@@ -687,7 +711,7 @@ export const schema: SchemaV1 = build_schema({
|
|
|
687
711
|
validator: mongoIdStringValidator,
|
|
688
712
|
},
|
|
689
713
|
key: {
|
|
690
|
-
validator: stringValidator,
|
|
714
|
+
validator: stringValidator,
|
|
691
715
|
}
|
|
692
716
|
}
|
|
693
717
|
}
|
|
@@ -1435,7 +1459,7 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1435
1459
|
readonly: true,
|
|
1436
1460
|
},
|
|
1437
1461
|
},
|
|
1438
|
-
enduserActions: { prepare_file_upload: {}, file_download_URL: {} },
|
|
1462
|
+
enduserActions: { prepare_file_upload: {}, file_download_URL: {}, read: {}, readMany: {} },
|
|
1439
1463
|
customActions: {
|
|
1440
1464
|
prepare_file_upload: {
|
|
1441
1465
|
op: "custom", access: 'create', method: "post",
|
|
@@ -1717,11 +1741,10 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1717
1741
|
required: true,
|
|
1718
1742
|
examples: ["Text"],
|
|
1719
1743
|
},
|
|
1720
|
-
|
|
1721
|
-
validator:
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
examples: [[]],
|
|
1744
|
+
numFields: {
|
|
1745
|
+
validator: nonNegNumberValidator,
|
|
1746
|
+
initializer: () => 0,
|
|
1747
|
+
examples: [0],
|
|
1725
1748
|
},
|
|
1726
1749
|
customGreeting: { validator: stringValidator5000 },
|
|
1727
1750
|
customSignature: { validator: stringValidator5000 },
|
|
@@ -1731,45 +1754,61 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1731
1754
|
thanksMessage: { validator: stringValidator5000 },
|
|
1732
1755
|
}
|
|
1733
1756
|
},
|
|
1734
|
-
|
|
1735
|
-
info: {
|
|
1757
|
+
form_fields: {
|
|
1758
|
+
info: {
|
|
1759
|
+
sideEffects: {
|
|
1760
|
+
create: [sideEffects.incrementFieldCount],
|
|
1761
|
+
delete: [sideEffects.decrementFieldCount],
|
|
1762
|
+
}
|
|
1763
|
+
},
|
|
1736
1764
|
constraints: {
|
|
1737
1765
|
unique: [],
|
|
1738
1766
|
relationship: [],
|
|
1767
|
+
access: [{ type: 'dependency', foreignModel: 'forms', foreignField: '_id', accessField: 'formId' }]
|
|
1739
1768
|
},
|
|
1740
1769
|
defaultActions: DEFAULT_OPERATIONS,
|
|
1741
|
-
customActions: {
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1770
|
+
customActions: {},
|
|
1771
|
+
enduserActions: { read: {}, readMany: {} },
|
|
1772
|
+
fields: {
|
|
1773
|
+
...BuiltInFields,
|
|
1774
|
+
formId: {
|
|
1775
|
+
validator: mongoIdStringValidator,
|
|
1776
|
+
required: true,
|
|
1777
|
+
dependencies: [
|
|
1778
|
+
{
|
|
1779
|
+
dependsOn: ['forms'],
|
|
1780
|
+
dependencyField: '_id',
|
|
1781
|
+
relationship: 'foreignKey',
|
|
1782
|
+
onDependencyDelete: 'delete',
|
|
1783
|
+
},
|
|
1784
|
+
],
|
|
1785
|
+
examples: [PLACEHOLDER_ID],
|
|
1786
|
+
},
|
|
1787
|
+
title: {
|
|
1788
|
+
validator: stringValidator250,
|
|
1789
|
+
required: true,
|
|
1790
|
+
examples: ["Text"],
|
|
1791
|
+
},
|
|
1792
|
+
type: {
|
|
1793
|
+
validator: formFieldTypeValidator,
|
|
1794
|
+
examples: ['number'],
|
|
1756
1795
|
},
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1796
|
+
previousFields: { // can't be required - nextField may not exist yet on creation
|
|
1797
|
+
validator: previousFormFieldsValidator,
|
|
1798
|
+
examples: [[{ type: 'root', info: { } } as PreviousFormField]]
|
|
1799
|
+
},
|
|
1800
|
+
options: { validator: objectAnyFieldsAnyValuesValidator }, // todo: more restriction
|
|
1801
|
+
description: { validator: stringValidator250 },
|
|
1802
|
+
intakeField: { validator: stringValidator }, // todo: ensure built-ins are ignored
|
|
1803
|
+
isOptional: { validator: booleanValidator },
|
|
1804
|
+
}
|
|
1805
|
+
},
|
|
1806
|
+
form_responses: {
|
|
1807
|
+
info: {},
|
|
1808
|
+
constraints: {
|
|
1809
|
+
unique: [],
|
|
1810
|
+
relationship: [],
|
|
1771
1811
|
},
|
|
1772
|
-
enduserActions: { prepare_form_response: {}, submit_form_response: {} },
|
|
1773
1812
|
fields: {
|
|
1774
1813
|
...BuiltInFields,
|
|
1775
1814
|
formId: {
|
|
@@ -1798,13 +1837,69 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1798
1837
|
validator: nonNegNumberValidator,
|
|
1799
1838
|
updatesDisabled: true,
|
|
1800
1839
|
},
|
|
1840
|
+
publicSubmit: { validator: booleanValidator },
|
|
1801
1841
|
submittedBy: { validator: stringValidator250 },
|
|
1802
1842
|
accessCode: { validator: stringValidator250 },
|
|
1803
1843
|
userEmail: { validator: emailValidator },
|
|
1804
1844
|
submittedAt: { validator: dateValidator },
|
|
1805
1845
|
formTitle: { validator: stringValidator250 },
|
|
1806
1846
|
responses: { validator: formResponsesValidator },
|
|
1807
|
-
}
|
|
1847
|
+
},
|
|
1848
|
+
defaultActions: DEFAULT_OPERATIONS,
|
|
1849
|
+
customActions: {
|
|
1850
|
+
prepare_form_response: {
|
|
1851
|
+
op: "custom", access: 'create', method: "post",
|
|
1852
|
+
path: '/prepare-form-response',
|
|
1853
|
+
name: 'Prepare Form Response',
|
|
1854
|
+
description: "Generates an access code that allows an enduser to submit a form response.",
|
|
1855
|
+
parameters: {
|
|
1856
|
+
formId: { validator: mongoIdStringValidator, required: true },
|
|
1857
|
+
enduserId: { validator: mongoIdStringValidator, required: true },
|
|
1858
|
+
automationStepId: { validator: mongoIdStringValidator },
|
|
1859
|
+
},
|
|
1860
|
+
returns: {
|
|
1861
|
+
accessCode: { validator: stringValidator250, required: true },
|
|
1862
|
+
url: { validator: stringValidator250, required: true },
|
|
1863
|
+
},
|
|
1864
|
+
},
|
|
1865
|
+
submit_form_response: {
|
|
1866
|
+
op: "custom", access: 'update', method: "patch",
|
|
1867
|
+
name: 'Submit Form Response',
|
|
1868
|
+
path: '/submit-form-response',
|
|
1869
|
+
description: "With an accessCode, stores responses to a form.",
|
|
1870
|
+
parameters: {
|
|
1871
|
+
accessCode: { validator: stringValidator250, required: true },
|
|
1872
|
+
responses: { validator: formResponsesValidator, required: true },
|
|
1873
|
+
automationStepId: { validator: mongoIdStringValidator },
|
|
1874
|
+
},
|
|
1875
|
+
returns: {
|
|
1876
|
+
formResponse: 'form response' as any,
|
|
1877
|
+
},
|
|
1878
|
+
}
|
|
1879
|
+
},
|
|
1880
|
+
publicActions: {
|
|
1881
|
+
session_for_public_form: {
|
|
1882
|
+
op: "custom", access: 'create', method: "post",
|
|
1883
|
+
path: '/session-for-public-form',
|
|
1884
|
+
name: 'Generate Session for Public Form',
|
|
1885
|
+
description: "Generates a session for filling out a public form.",
|
|
1886
|
+
parameters: {
|
|
1887
|
+
email: { validator: emailValidator, required: true },
|
|
1888
|
+
formId: { validator: mongoIdStringValidator, required: true },
|
|
1889
|
+
businessId: { validator: mongoIdStringValidator, required: true },
|
|
1890
|
+
phone: { validator: phoneValidator },
|
|
1891
|
+
fname: { validator: nameValidator },
|
|
1892
|
+
lname: { validator: nameValidator },
|
|
1893
|
+
},
|
|
1894
|
+
returns: {
|
|
1895
|
+
accessCode: { validator: stringValidator250, required: true },
|
|
1896
|
+
authToken: { validator: stringValidator250, required: true },
|
|
1897
|
+
url: { validator: stringValidator250, required: true },
|
|
1898
|
+
path: { validator: stringValidator250, required: true },
|
|
1899
|
+
},
|
|
1900
|
+
},
|
|
1901
|
+
},
|
|
1902
|
+
enduserActions: { prepare_form_response: {}, submit_form_response: {} },
|
|
1808
1903
|
},
|
|
1809
1904
|
webhooks: {
|
|
1810
1905
|
info: {
|
|
@@ -2070,7 +2165,7 @@ export const schema: SchemaV1 = build_schema({
|
|
|
2070
2165
|
automated_actions: {
|
|
2071
2166
|
info: {},
|
|
2072
2167
|
constraints: {
|
|
2073
|
-
unique: [
|
|
2168
|
+
unique: [],
|
|
2074
2169
|
relationship: [],
|
|
2075
2170
|
access: []
|
|
2076
2171
|
},
|
|
@@ -2546,6 +2641,50 @@ export const schema: SchemaV1 = build_schema({
|
|
|
2546
2641
|
},
|
|
2547
2642
|
},
|
|
2548
2643
|
},
|
|
2644
|
+
organizations: {
|
|
2645
|
+
info: {},
|
|
2646
|
+
constraints: {
|
|
2647
|
+
unique: ['name'],
|
|
2648
|
+
relationship: [],
|
|
2649
|
+
},
|
|
2650
|
+
defaultActions: { },
|
|
2651
|
+
customActions: { },
|
|
2652
|
+
enduserActions: { },
|
|
2653
|
+
publicActions: {
|
|
2654
|
+
get_theme: {
|
|
2655
|
+
op: "custom", access: 'read', method: "get",
|
|
2656
|
+
name: 'Get Organization Theme',
|
|
2657
|
+
path: '/organization-theme', // follows default format
|
|
2658
|
+
description: "Gets theme information for an organization",
|
|
2659
|
+
parameters: {
|
|
2660
|
+
businessId: { validator: mongoIdStringValidator },
|
|
2661
|
+
},
|
|
2662
|
+
returns: {
|
|
2663
|
+
theme: { validator: organizationThemeValidator, required: true },
|
|
2664
|
+
}
|
|
2665
|
+
},
|
|
2666
|
+
},
|
|
2667
|
+
fields: {
|
|
2668
|
+
...BuiltInFields,
|
|
2669
|
+
name: {
|
|
2670
|
+
validator: stringValidator100,
|
|
2671
|
+
required: true,
|
|
2672
|
+
examples: ["Template Name"],
|
|
2673
|
+
},
|
|
2674
|
+
subdomain: {
|
|
2675
|
+
validator: stringValidator100,
|
|
2676
|
+
required: true,
|
|
2677
|
+
examples: ["subdomain"],
|
|
2678
|
+
},
|
|
2679
|
+
subscriptionExpiresAt: { validator: dateValidator },
|
|
2680
|
+
subscriptionPeriod: { validator: numberValidator },
|
|
2681
|
+
logoVersion: { validator: numberValidator },
|
|
2682
|
+
roles: { validator: listOfStringsValidator },
|
|
2683
|
+
skills: { validator: listOfStringsValidator },
|
|
2684
|
+
themeColor: { validator: stringValidator100 },
|
|
2685
|
+
},
|
|
2686
|
+
},
|
|
2687
|
+
|
|
2549
2688
|
})
|
|
2550
2689
|
|
|
2551
2690
|
// export type SchemaType = typeof schema
|