@tellescope/schema 1.1.5 → 1.2.2
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 +36 -2
- package/lib/cjs/schema.d.ts.map +1 -1
- package/lib/cjs/schema.js +144 -33
- package/lib/cjs/schema.js.map +1 -1
- package/lib/esm/schema.d.ts +36 -2
- package/lib/esm/schema.d.ts.map +1 -1
- package/lib/esm/schema.js +145 -36
- package/lib/esm/schema.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/schema.ts +197 -46
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 {
|
|
@@ -262,6 +265,18 @@ const sideEffects = {
|
|
|
262
265
|
name: "updatePostCommentCount",
|
|
263
266
|
description: "Updates the comment count of a post"
|
|
264
267
|
},
|
|
268
|
+
handleTicketClosed: {
|
|
269
|
+
name: "handleTicketClosed",
|
|
270
|
+
description: "Handles automated actions based on a closed ticket",
|
|
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
|
+
},
|
|
265
280
|
}
|
|
266
281
|
export type SideEffectNames = keyof typeof sideEffects
|
|
267
282
|
|
|
@@ -297,7 +312,7 @@ export type CustomActions = {
|
|
|
297
312
|
},
|
|
298
313
|
form_responses: {
|
|
299
314
|
prepare_form_response: CustomAction<{ formId: string, enduserId: string, automationStepId?: string }, { accessCode: string, url: string }>,
|
|
300
|
-
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 }>,
|
|
301
316
|
},
|
|
302
317
|
journeys: {
|
|
303
318
|
update_state: CustomAction<{ updates: Partial<JourneyState>, id: string, name: string }, { updated: Journey }>,
|
|
@@ -358,6 +373,19 @@ export type PublicActions = {
|
|
|
358
373
|
request_password_reset: CustomAction<{ email: string }, { }>,
|
|
359
374
|
reset_password: CustomAction<{ resetToken: string, newPassword: string }, { }>,
|
|
360
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
|
+
},
|
|
361
389
|
}
|
|
362
390
|
|
|
363
391
|
export type SchemaV1 = Schema & {
|
|
@@ -683,7 +711,7 @@ export const schema: SchemaV1 = build_schema({
|
|
|
683
711
|
validator: mongoIdStringValidator,
|
|
684
712
|
},
|
|
685
713
|
key: {
|
|
686
|
-
validator: stringValidator,
|
|
714
|
+
validator: stringValidator,
|
|
687
715
|
}
|
|
688
716
|
}
|
|
689
717
|
}
|
|
@@ -1431,7 +1459,7 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1431
1459
|
readonly: true,
|
|
1432
1460
|
},
|
|
1433
1461
|
},
|
|
1434
|
-
enduserActions: { prepare_file_upload: {}, file_download_URL: {} },
|
|
1462
|
+
enduserActions: { prepare_file_upload: {}, file_download_URL: {}, read: {}, readMany: {} },
|
|
1435
1463
|
customActions: {
|
|
1436
1464
|
prepare_file_upload: {
|
|
1437
1465
|
op: "custom", access: 'create', method: "post",
|
|
@@ -1485,7 +1513,11 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1485
1513
|
},
|
|
1486
1514
|
},
|
|
1487
1515
|
tickets: {
|
|
1488
|
-
info: {
|
|
1516
|
+
info: {
|
|
1517
|
+
sideEffects: {
|
|
1518
|
+
update: [sideEffects.handleTicketClosed],
|
|
1519
|
+
}
|
|
1520
|
+
},
|
|
1489
1521
|
constraints: {
|
|
1490
1522
|
unique: [],
|
|
1491
1523
|
relationship: [
|
|
@@ -1521,6 +1553,15 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1521
1553
|
onDependencyDelete: 'setNull',
|
|
1522
1554
|
}]
|
|
1523
1555
|
},
|
|
1556
|
+
automationStepId: {
|
|
1557
|
+
validator: mongoIdStringValidator,
|
|
1558
|
+
},
|
|
1559
|
+
closedForReason: {
|
|
1560
|
+
validator: stringValidator,
|
|
1561
|
+
},
|
|
1562
|
+
closeReasons: {
|
|
1563
|
+
validator: listOfStringsValidatorEmptyOk,
|
|
1564
|
+
},
|
|
1524
1565
|
chatRoomId: {
|
|
1525
1566
|
validator: mongoIdStringValidator,
|
|
1526
1567
|
},
|
|
@@ -1700,11 +1741,10 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1700
1741
|
required: true,
|
|
1701
1742
|
examples: ["Text"],
|
|
1702
1743
|
},
|
|
1703
|
-
|
|
1704
|
-
validator:
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
examples: [[]],
|
|
1744
|
+
numFields: {
|
|
1745
|
+
validator: nonNegNumberValidator,
|
|
1746
|
+
initializer: () => 0,
|
|
1747
|
+
examples: [0],
|
|
1708
1748
|
},
|
|
1709
1749
|
customGreeting: { validator: stringValidator5000 },
|
|
1710
1750
|
customSignature: { validator: stringValidator5000 },
|
|
@@ -1714,45 +1754,61 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1714
1754
|
thanksMessage: { validator: stringValidator5000 },
|
|
1715
1755
|
}
|
|
1716
1756
|
},
|
|
1717
|
-
|
|
1718
|
-
info: {
|
|
1757
|
+
form_fields: {
|
|
1758
|
+
info: {
|
|
1759
|
+
sideEffects: {
|
|
1760
|
+
create: [sideEffects.incrementFieldCount],
|
|
1761
|
+
delete: [sideEffects.decrementFieldCount],
|
|
1762
|
+
}
|
|
1763
|
+
},
|
|
1719
1764
|
constraints: {
|
|
1720
1765
|
unique: [],
|
|
1721
1766
|
relationship: [],
|
|
1767
|
+
access: [{ type: 'dependency', foreignModel: 'forms', foreignField: '_id', accessField: 'formId' }]
|
|
1722
1768
|
},
|
|
1723
1769
|
defaultActions: DEFAULT_OPERATIONS,
|
|
1724
|
-
customActions: {
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
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'],
|
|
1739
1795
|
},
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
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: [],
|
|
1754
1811
|
},
|
|
1755
|
-
enduserActions: { prepare_form_response: {}, submit_form_response: {} },
|
|
1756
1812
|
fields: {
|
|
1757
1813
|
...BuiltInFields,
|
|
1758
1814
|
formId: {
|
|
@@ -1781,13 +1837,69 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1781
1837
|
validator: nonNegNumberValidator,
|
|
1782
1838
|
updatesDisabled: true,
|
|
1783
1839
|
},
|
|
1840
|
+
publicSubmit: { validator: booleanValidator },
|
|
1784
1841
|
submittedBy: { validator: stringValidator250 },
|
|
1785
1842
|
accessCode: { validator: stringValidator250 },
|
|
1786
1843
|
userEmail: { validator: emailValidator },
|
|
1787
1844
|
submittedAt: { validator: dateValidator },
|
|
1788
1845
|
formTitle: { validator: stringValidator250 },
|
|
1789
1846
|
responses: { validator: formResponsesValidator },
|
|
1790
|
-
}
|
|
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: {} },
|
|
1791
1903
|
},
|
|
1792
1904
|
webhooks: {
|
|
1793
1905
|
info: {
|
|
@@ -2053,7 +2165,7 @@ export const schema: SchemaV1 = build_schema({
|
|
|
2053
2165
|
automated_actions: {
|
|
2054
2166
|
info: {},
|
|
2055
2167
|
constraints: {
|
|
2056
|
-
unique: [
|
|
2168
|
+
unique: [],
|
|
2057
2169
|
relationship: [],
|
|
2058
2170
|
access: []
|
|
2059
2171
|
},
|
|
@@ -2529,6 +2641,45 @@ export const schema: SchemaV1 = build_schema({
|
|
|
2529
2641
|
},
|
|
2530
2642
|
},
|
|
2531
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
|
+
subscriptionExpiresAt: { validator: dateValidator },
|
|
2675
|
+
subscriptionPeriod: { validator: numberValidator },
|
|
2676
|
+
logoVersion: { validator: numberValidator },
|
|
2677
|
+
roles: { validator: listOfStringsValidator },
|
|
2678
|
+
skills: { validator: listOfStringsValidator },
|
|
2679
|
+
themeColor: { validator: stringValidator100 },
|
|
2680
|
+
},
|
|
2681
|
+
},
|
|
2682
|
+
|
|
2532
2683
|
})
|
|
2533
2684
|
|
|
2534
2685
|
// export type SchemaType = typeof schema
|