@tellescope/types-models 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/index.d.ts +86 -10
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +2 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.d.ts +86 -10
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +2 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/index.ts +108 -12
package/src/index.ts
CHANGED
|
@@ -57,24 +57,35 @@ export type OrganizationLimits = {
|
|
|
57
57
|
[K in OrganizationLimit]?: number;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
export interface
|
|
61
|
-
creator: string;
|
|
62
|
-
name: string;
|
|
60
|
+
export interface Organization_readonly extends ClientRecord {
|
|
63
61
|
subscriptionExpiresAt: Date;
|
|
64
62
|
subscriptionPeriod: number;
|
|
63
|
+
}
|
|
64
|
+
export interface Organization_required {}
|
|
65
|
+
export interface Organization_updatesDisabled {
|
|
66
|
+
name: string;
|
|
67
|
+
subdomain: string;
|
|
68
|
+
}
|
|
69
|
+
export interface Organization extends Organization_readonly, Organization_required, Organization_updatesDisabled {
|
|
65
70
|
roles?: string[];
|
|
66
71
|
skills?: string[];
|
|
67
72
|
logoVersion?: number; // missing if no logo set
|
|
68
73
|
themeColor?: string;
|
|
69
74
|
}
|
|
70
|
-
export
|
|
75
|
+
export type OrganizationTheme = {
|
|
76
|
+
name: string,
|
|
77
|
+
businessId: string,
|
|
78
|
+
subdomain: string,
|
|
79
|
+
logoURL?: string,
|
|
80
|
+
themeColor?: string
|
|
81
|
+
}
|
|
71
82
|
|
|
72
83
|
|
|
73
84
|
// Standard database models
|
|
74
85
|
export interface RecordInfo {
|
|
75
86
|
businessId: string;
|
|
76
87
|
updatedAt: Date;
|
|
77
|
-
creator: string;
|
|
88
|
+
creator: string; // can technically be null in some cases (e.g. enduser creates self), todo: allow as part of type
|
|
78
89
|
}
|
|
79
90
|
|
|
80
91
|
export interface ClientRecord extends RecordInfo { id: string }
|
|
@@ -84,6 +95,7 @@ export interface Session {
|
|
|
84
95
|
businessId: string,
|
|
85
96
|
iat: number,
|
|
86
97
|
exp: number,
|
|
98
|
+
allowedPaths?: string[],
|
|
87
99
|
}
|
|
88
100
|
|
|
89
101
|
export type SessionType = "user" | "enduser"
|
|
@@ -414,7 +426,9 @@ export interface Note extends Note_readonly, Note_required, Note_updatesDisabled
|
|
|
414
426
|
fields?: Indexable<string | CustomField>,
|
|
415
427
|
}
|
|
416
428
|
|
|
417
|
-
export type
|
|
429
|
+
export type FormFieldLiteralType = 'string' | 'number' | 'email' | 'phone'
|
|
430
|
+
export type FormFieldComplexType = "multiple_choice" | "file" | "signature"
|
|
431
|
+
export type FormFieldType = FormFieldLiteralType | FormFieldComplexType
|
|
418
432
|
export interface MultipleChoiceOptions {
|
|
419
433
|
choices: string[];
|
|
420
434
|
radio?: boolean; // absent indicates not radio
|
|
@@ -422,18 +436,40 @@ export interface MultipleChoiceOptions {
|
|
|
422
436
|
}
|
|
423
437
|
|
|
424
438
|
export type FormFieldOptions = MultipleChoiceOptions
|
|
425
|
-
|
|
439
|
+
|
|
440
|
+
export type PreviousFormFieldType = 'root' | 'after'
|
|
441
|
+
export type PreviousFormFieldBuilder <T extends PreviousFormFieldType, V> = { type: T, info: V }
|
|
442
|
+
|
|
443
|
+
export type PreviousFormFieldAfterInfo = { fieldId: string }
|
|
444
|
+
export type PreviousFormFieldAfter = PreviousFormFieldBuilder<'after', PreviousFormFieldAfterInfo>
|
|
445
|
+
export type PreviousFormFieldRoot = PreviousFormFieldBuilder<'root', {}>
|
|
446
|
+
export type PreviousFormField = (
|
|
447
|
+
PreviousFormFieldRoot
|
|
448
|
+
| PreviousFormFieldAfter
|
|
449
|
+
)
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
export interface FormField_readonly extends ClientRecord {}
|
|
453
|
+
export interface FormField_required {
|
|
454
|
+
formId: string,
|
|
455
|
+
title: string,
|
|
456
|
+
type: FormFieldType,
|
|
457
|
+
previousFields: PreviousFormField[], // previous will always be known on create, rather than next
|
|
458
|
+
}
|
|
459
|
+
export interface FormField_updatesDisabled {}
|
|
460
|
+
export interface FormField extends FormField_readonly, FormField_required, FormField_updatesDisabled {
|
|
426
461
|
isOptional ?: boolean,
|
|
427
|
-
title : string,
|
|
428
|
-
type : FormFieldType,
|
|
429
462
|
description ?: string,
|
|
430
463
|
options ?: FormFieldOptions | {},
|
|
431
464
|
intakeField ?: string | null,
|
|
432
465
|
}
|
|
433
|
-
|
|
466
|
+
|
|
467
|
+
export interface Form_readonly extends ClientRecord {
|
|
468
|
+
numFields: number,
|
|
469
|
+
}
|
|
434
470
|
export interface Form_required {
|
|
435
471
|
title: string,
|
|
436
|
-
fields: FormField[],
|
|
472
|
+
// fields: FormField[],
|
|
437
473
|
}
|
|
438
474
|
export interface Form_updatesDisabled {}
|
|
439
475
|
export interface Form extends Form_readonly, Form_required, Form_updatesDisabled {
|
|
@@ -445,7 +481,56 @@ export interface Form extends Form_readonly, Form_required, Form_updatesDisabled
|
|
|
445
481
|
thanksMessage?: string,
|
|
446
482
|
}
|
|
447
483
|
|
|
448
|
-
export type
|
|
484
|
+
export type FormResponseValueAnswerBuilder <TYPE extends FormFieldType, VALUE extends number | object | string> = {
|
|
485
|
+
type: TYPE,
|
|
486
|
+
value: VALUE,
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export type FormResponseAnswerEmail = FormResponseValueAnswerBuilder<'email', string>
|
|
490
|
+
export type FormResponseAnswerNumber = FormResponseValueAnswerBuilder<'number', number>
|
|
491
|
+
export type FormResponseAnswerPhone = FormResponseValueAnswerBuilder<'phone', string>
|
|
492
|
+
export type FormResponseAnswerString = FormResponseValueAnswerBuilder<'string', string>
|
|
493
|
+
|
|
494
|
+
export type FormResponseAnswerSignatureValue = {
|
|
495
|
+
fullName: string,
|
|
496
|
+
signed: boolean,
|
|
497
|
+
}
|
|
498
|
+
export type FormResponseAnswerSignature = FormResponseValueAnswerBuilder<'signature', FormResponseAnswerSignatureValue>
|
|
499
|
+
|
|
500
|
+
export type FormResponseAnswerMultipleChoiceValue = string[]
|
|
501
|
+
export type FormResponseAnswerMultipleChoice = FormResponseValueAnswerBuilder<'multiple_choice', FormResponseAnswerMultipleChoiceValue>
|
|
502
|
+
|
|
503
|
+
export type FormResponseAnswerFileValue = {
|
|
504
|
+
secureName: string,
|
|
505
|
+
name: string,
|
|
506
|
+
}
|
|
507
|
+
export type FormResponseAnswerFile = FormResponseValueAnswerBuilder<'file', FormResponseAnswerFileValue>
|
|
508
|
+
|
|
509
|
+
export type FormResponseValueAnswer = (
|
|
510
|
+
FormResponseAnswerEmail
|
|
511
|
+
| FormResponseAnswerNumber
|
|
512
|
+
| FormResponseAnswerPhone
|
|
513
|
+
| FormResponseAnswerString
|
|
514
|
+
| FormResponseAnswerSignature
|
|
515
|
+
| FormResponseAnswerMultipleChoice
|
|
516
|
+
| FormResponseAnswerFile
|
|
517
|
+
)
|
|
518
|
+
|
|
519
|
+
export type FormResponseValue = {
|
|
520
|
+
fieldId: string,
|
|
521
|
+
fieldTitle: string,
|
|
522
|
+
answer: FormResponseValueAnswer,
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
export type AnswerForType = {
|
|
526
|
+
'email': FormResponseAnswerEmail['value'],
|
|
527
|
+
'number': FormResponseAnswerNumber['value'],
|
|
528
|
+
'phone': FormResponseAnswerPhone['value'],
|
|
529
|
+
'string': FormResponseAnswerString['value'],
|
|
530
|
+
'signature': FormResponseAnswerSignature['value'],
|
|
531
|
+
'multiple_choice': FormResponseAnswerMultipleChoice['value'],
|
|
532
|
+
'file': FormResponseAnswerFile['value'],
|
|
533
|
+
}
|
|
449
534
|
|
|
450
535
|
export interface FormResponse_readonly extends ClientRecord {}
|
|
451
536
|
export interface FormResponse_required {
|
|
@@ -453,6 +538,7 @@ export interface FormResponse_required {
|
|
|
453
538
|
enduserId: string,
|
|
454
539
|
formTitle: string,
|
|
455
540
|
responses: FormResponseValue[],
|
|
541
|
+
publicSubmit?: boolean,
|
|
456
542
|
submittedBy?: string,
|
|
457
543
|
submittedAt?: Date,
|
|
458
544
|
accessCode?: string,
|
|
@@ -832,6 +918,7 @@ export type ModelForName_required = {
|
|
|
832
918
|
meetings: Meeting_required;
|
|
833
919
|
notes: Note_required;
|
|
834
920
|
forms: Form_required,
|
|
921
|
+
form_fields: FormField_required;
|
|
835
922
|
form_responses: FormResponse_required,
|
|
836
923
|
calendar_events: CalendarEvent_required,
|
|
837
924
|
automation_steps: AutomationStep_required,
|
|
@@ -847,6 +934,7 @@ export type ModelForName_required = {
|
|
|
847
934
|
forum_posts: ForumPost_required;
|
|
848
935
|
post_likes: PostLike_required;
|
|
849
936
|
post_comments: PostComment_required;
|
|
937
|
+
organizations: Organization_required;
|
|
850
938
|
}
|
|
851
939
|
export type ClientModel_required = ModelForName_required[keyof ModelForName_required]
|
|
852
940
|
|
|
@@ -867,6 +955,7 @@ export interface ModelForName_readonly {
|
|
|
867
955
|
meetings: Meeting_readonly;
|
|
868
956
|
notes: Note_readonly;
|
|
869
957
|
forms: Form_readonly;
|
|
958
|
+
form_fields: FormField_readonly;
|
|
870
959
|
form_responses: FormResponse_readonly;
|
|
871
960
|
calendar_events: CalendarEvent_readonly,
|
|
872
961
|
automation_steps: AutomationStep_readonly,
|
|
@@ -882,6 +971,7 @@ export interface ModelForName_readonly {
|
|
|
882
971
|
forum_posts: ForumPost_readonly;
|
|
883
972
|
post_likes: PostLike_readonly;
|
|
884
973
|
post_comments: PostComment_readonly;
|
|
974
|
+
organizations: Organization_readonly;
|
|
885
975
|
}
|
|
886
976
|
export type ClientModel_readonly = ModelForName_readonly[keyof ModelForName_readonly]
|
|
887
977
|
|
|
@@ -902,6 +992,7 @@ export interface ModelForName_updatesDisabled {
|
|
|
902
992
|
meetings: Meeting_updatesDisabled;
|
|
903
993
|
notes: Note_updatesDisabled;
|
|
904
994
|
forms: Form_updatesDisabled;
|
|
995
|
+
form_fields: FormField_updatesDisabled;
|
|
905
996
|
form_responses: FormResponse_updatesDisabled;
|
|
906
997
|
calendar_events: CalendarEvent_updatesDisabled,
|
|
907
998
|
automation_steps: AutomationStep_updatesDisabled,
|
|
@@ -917,6 +1008,7 @@ export interface ModelForName_updatesDisabled {
|
|
|
917
1008
|
forum_posts: ForumPost_updatesDisabled;
|
|
918
1009
|
post_likes: PostLike_updatesDisabled;
|
|
919
1010
|
post_comments: PostComment_updatesDisabled;
|
|
1011
|
+
organizations: Organization_updatesDisabled;
|
|
920
1012
|
}
|
|
921
1013
|
export type ClientModel_updatesDisabled = ModelForName_updatesDisabled[keyof ModelForName_updatesDisabled]
|
|
922
1014
|
|
|
@@ -937,6 +1029,7 @@ export interface ModelForName extends ModelForName_required, ModelForName_readon
|
|
|
937
1029
|
meetings: Meeting;
|
|
938
1030
|
notes: Note;
|
|
939
1031
|
forms: Form;
|
|
1032
|
+
form_fields: FormField;
|
|
940
1033
|
form_responses: FormResponse;
|
|
941
1034
|
calendar_events: CalendarEvent,
|
|
942
1035
|
automation_steps: AutomationStep,
|
|
@@ -952,6 +1045,7 @@ export interface ModelForName extends ModelForName_required, ModelForName_readon
|
|
|
952
1045
|
forum_posts: ForumPost;
|
|
953
1046
|
post_likes: PostLike;
|
|
954
1047
|
post_comments: PostComment;
|
|
1048
|
+
organizations: Organization;
|
|
955
1049
|
}
|
|
956
1050
|
export type ModelName = keyof ModelForName
|
|
957
1051
|
export type Model = ModelForName[keyof ModelForName]
|
|
@@ -983,6 +1077,7 @@ export const modelNameChecker: { [K in ModelName] : true } = {
|
|
|
983
1077
|
meetings: true,
|
|
984
1078
|
notes: true,
|
|
985
1079
|
forms: true,
|
|
1080
|
+
form_fields: true,
|
|
986
1081
|
form_responses: true,
|
|
987
1082
|
calendar_events: true,
|
|
988
1083
|
automation_steps: true,
|
|
@@ -997,6 +1092,7 @@ export const modelNameChecker: { [K in ModelName] : true } = {
|
|
|
997
1092
|
forum_posts: true,
|
|
998
1093
|
post_likes: true,
|
|
999
1094
|
post_comments: true,
|
|
1095
|
+
organizations: true,
|
|
1000
1096
|
}
|
|
1001
1097
|
|
|
1002
1098
|
export const isModelName = (s: string): s is ModelName => modelNameChecker[s as ModelName]
|