@terros-inc/sdk 1.0.9 → 1.0.11

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/dist/index.d.mts CHANGED
@@ -49,7 +49,6 @@ type TinyTeam = {
49
49
  };
50
50
  //#endregion
51
51
  //#region src/models/shared.d.ts
52
- type CustomFieldMap = Record<string, string | number | boolean | null>;
53
52
  type AuditLog = {
54
53
  userId: UserId;
55
54
  timestamp: number;
@@ -88,8 +87,209 @@ type SmallAddress = Pick<Address, 'countrySubd' | 'line1' | 'locality' | 'postal
88
87
  latlng: LatLng;
89
88
  };
90
89
  //#endregion
90
+ //#region src/models/calendar/model.d.ts
91
+ type CalendarEventId = `Event:${string}` | `Event.${string}`;
92
+ /** @deprecated */
93
+ type EventOutcomeId = `O.${string}`;
94
+ type InterviewId = `Interview:${string}` | `Interview.${string}`;
95
+ type AttachmentId = `Attachment:${string}` | `Attachment.${string}`;
96
+ type EventType = 'Consultation' | 'Comeback' | 'Interview' | 'GeneralVisit' | 'Shadow' | 'Team';
97
+ type SpecialtyAttachments = {
98
+ utilityBill?: AttachmentId;
99
+ customerVerification?: AttachmentId;
100
+ };
101
+ /** @deprecated */
102
+ type SyncedCalendarEvent = {
103
+ calendarType: string;
104
+ calendarId: string;
105
+ userId: UserId;
106
+ deviceId: string;
107
+ eventId: string;
108
+ };
109
+ type CalendarEventLocation = Pick<Address, 'oneLine'> & LatLng;
110
+ type UnsavedCalendarEventData = {
111
+ importId?: string;
112
+ eventType: EventType;
113
+ title: string;
114
+ sourceId?: string; /** UTC milliseconds. */
115
+ eventDate: number;
116
+ outcomeId?: EventOutcomeId;
117
+ dispositionId?: DispositionId; /** Minutes. */
118
+ duration: number;
119
+ attachments?: AttachmentId[];
120
+ specialtyAttachments?: SpecialtyAttachments;
121
+ accountId?: AccountId;
122
+ locationId?: LocationId;
123
+ location?: CalendarEventLocation;
124
+ ownerId?: UserId;
125
+ attendeeId?: UserId;
126
+ dispatcherId?: UserId;
127
+ occurredOwner?: boolean;
128
+ occurredAttendee?: boolean;
129
+ interviewId?: InterviewId; /** @deprecated */
130
+ notes?: string;
131
+ previousEventId?: CalendarEventId; /** @deprecated */
132
+ syncedCalendarIds?: string[]; /** @deprecated */
133
+ syncedCalendarEvents?: SyncedCalendarEvent[];
134
+ teamId?: TeamId;
135
+ };
136
+ type EventOutcomeHistory = {
137
+ outcomeId: EventOutcomeId;
138
+ userId: UserId;
139
+ timestamp: number;
140
+ };
141
+ type SitOutcomeFault = string;
142
+ type CalendarEventData = UnsavedCalendarEventData & {
143
+ outcomeHistory?: EventOutcomeHistory[];
144
+ createdAt?: number;
145
+ createdBy?: UserId;
146
+ updatedAt?: number;
147
+ updatedBy?: UserId;
148
+ eventId: CalendarEventId;
149
+ ownerId: UserId;
150
+ occurred?: boolean;
151
+ closed?: boolean;
152
+ reasonNotOccurred?: string;
153
+ fault?: SitOutcomeFault;
154
+ allDay?: boolean;
155
+ canDelete?: boolean;
156
+ };
157
+ type CalendarEventDataWithDetails = CalendarEventData & {
158
+ resident?: TinyResidentData;
159
+ owner?: SmallUser;
160
+ attendee?: SmallUser;
161
+ teams?: TinyTeam[];
162
+ account?: TinyWorkflowAccount;
163
+ };
164
+ //#endregion
165
+ //#region src/models/calendar/api.d.ts
166
+ type CalendarEventRoleFilter = 'owner' | 'attendee';
167
+ type OptionalCalendarEventLocation = UpsertLatLng & {
168
+ locationId?: LocationId;
169
+ oneLine?: string;
170
+ };
171
+ /** A yes/no/unset filter — matches events where the field is true, false, unset, or set to any value. */
172
+ type BooleanFilter = 'true' | 'false' | 'undefined' | 'defined';
173
+ type CalendarAvailabilityInput = {
174
+ /** UTC milliseconds. */startDate: number; /** Minutes. Defaults to 30. */
175
+ duration?: number;
176
+ teamId?: TeamId;
177
+ };
178
+ type CalendarAvailabilitySuccess = ApiSuccess<{
179
+ available: boolean;
180
+ }>;
181
+ type CalendarClosersInput = CalendarAvailabilityInput & {
182
+ latLng?: LatLng;
183
+ };
184
+ type CalendarClosersSuccess = ApiSuccess<{
185
+ closers: AvailableCloser[];
186
+ }>;
187
+ type CalendarTimeslotsInput = {
188
+ targetId?: TeamId | UserId;
189
+ days?: number;
190
+ locationId?: LocationId; /** UTC milliseconds. */
191
+ startTime?: number;
192
+ };
193
+ type CalendarTimeslotsSuccess = ApiSuccess<{
194
+ closers: TinyCloser[];
195
+ }>;
196
+ type CalendarEventAddInput = {
197
+ event: UnsavedCalendarEventData; /** Defaults to true. */
198
+ errorOnCloserUnavailable?: boolean;
199
+ };
200
+ type CalendarEventAddSuccess = ApiSuccess<{
201
+ event: CalendarEventData;
202
+ }>;
203
+ type CalendarEventGetInput = {
204
+ eventId: CalendarEventId;
205
+ };
206
+ type CalendarEventGetSuccess = ApiSuccess<{
207
+ event: CalendarEventDataWithDetails;
208
+ }>;
209
+ type CalendarEventListInput = {
210
+ startTime?: number;
211
+ endTime?: number;
212
+ ownerId?: UserId;
213
+ locationId?: LocationId;
214
+ companyId?: string; /** @deprecated use teamIds */
215
+ teamId?: TeamId;
216
+ teamIds?: TeamId[];
217
+ roleIds?: RoleId[];
218
+ occurred?: BooleanFilter;
219
+ closed?: BooleanFilter;
220
+ eventType?: EventType;
221
+ filterByRoles?: CalendarEventRoleFilter[];
222
+ };
223
+ type CalendarEventListSuccess = ApiSuccess<{
224
+ events: CalendarEventDataWithDetails[];
225
+ }>;
226
+ type CalendarEventUpdateInput = {
227
+ event: Partial<CalendarEventData> & {
228
+ eventId: CalendarEventId;
229
+ attendeeId?: UserId | null;
230
+ };
231
+ errorOnCloserUnavailable?: boolean;
232
+ };
233
+ type CalendarEventUpdateSuccess = ApiSuccess<{
234
+ event: CalendarEventData;
235
+ }>;
236
+ type CalendarEventUpsertInput = {
237
+ event: Partial<{
238
+ eventId: CalendarEventId;
239
+ sourceId: string; /** Defaults to 'Consultation' on create. */
240
+ eventType: string;
241
+ title: string; /** Defaults to now on create. */
242
+ eventDate: string | number; /** An EventOutcomeId, integration mapping string, or case-insensitive name. */
243
+ outcomeId: string; /** Minutes. */
244
+ duration: number;
245
+ accountId: AccountId;
246
+ location: OptionalCalendarEventLocation; /** A UserId or email. Defaults to the authenticated user on create. */
247
+ ownerId: string; /** A UserId or email. Pass null to clear on update. */
248
+ attendeeId: string | null; /** A UserId or email. */
249
+ dispatcherId: string;
250
+ occurredOwner: boolean;
251
+ occurredAttendee: boolean;
252
+ notes: string;
253
+ previousEventId: CalendarEventId;
254
+ }>;
255
+ };
256
+ type CalendarEventUpsertSuccess = ApiSuccess<{
257
+ event: CalendarEventData;
258
+ }>;
259
+ type CalendarEventConfirmInput = {
260
+ eventId: CalendarEventId;
261
+ occurred?: boolean;
262
+ };
263
+ type CalendarEventConfirmSuccess = ApiSuccess<{
264
+ event: CalendarEventData;
265
+ }>;
266
+ type CalendarEventRemoveInput = {
267
+ archive?: boolean;
268
+ eventId: CalendarEventId;
269
+ };
270
+ //#endregion
271
+ //#region src/models/customFields/model.d.ts
272
+ type CustomFieldId = `CF.${string}`;
273
+ /** use null to clear this field */
274
+ type CustomFieldType = string | number | boolean | AttachmentId | null;
275
+ type CustomFieldMap = Record<CustomFieldId, CustomFieldType>;
276
+ type RangeFilter = {
277
+ gte?: number;
278
+ lte?: number;
279
+ };
280
+ type CustomFieldFilter = Record<CustomFieldId, CustomFieldFilterValue>;
281
+ type CustomFieldFilterValue = {
282
+ type: 'range';
283
+ range: RangeFilter;
284
+ } | {
285
+ type: 'multipleChoice';
286
+ values: CustomFieldType[];
287
+ } | {
288
+ type: 'exists';
289
+ exists: boolean;
290
+ };
291
+ //#endregion
91
292
  //#region src/models/company/model.d.ts
92
- type CompanyState = 'active' | 'trial' | 'internal' | 'demo' | 'sandbox' | 'template' | 'suspended';
93
293
  type CompanyKind = 'customer' | 'sandbox' | 'demo' | 'template' | 'development';
94
294
  type AccessStatus = 'active' | 'suspended';
95
295
  type BillingMethod = 'stripe' | 'none';
@@ -99,12 +299,11 @@ type CompanyData = {
99
299
  companyId: CompanyId;
100
300
  name: string;
101
301
  legalName?: string;
102
- kind?: CompanyKind;
103
- accessStatus?: AccessStatus;
302
+ kind: CompanyKind;
303
+ accessStatus: AccessStatus;
104
304
  internalOwnerId?: UserId;
105
305
  billingEmail?: string;
106
306
  billingMethod?: BillingMethod;
107
- state: CompanyState;
108
307
  maxUsers?: number;
109
308
  size?: number;
110
309
  industries?: CompanyIndustry[];
@@ -422,10 +621,6 @@ type TagId = `Tag.${string}`;
422
621
  type LocationId = `Can.${string}` | `LocNew:${string}` | `LocNew.${string}` | `Loc:${string}` | `TLoc:${string}` | `TLoc.${string}` | `FA.${string}` | `PR.${string}`;
423
622
  type DispositionId = `Disposition:${string}` | `Disposition.${string}` | 'NotHome' | 'Comeback' | 'NotNow' | 'NotQualified' | 'PartialPitch' | 'NewAccount' | 'Competitor' | 'Custom1' | 'Custom2' | 'Custom3';
424
623
  type ContactMethod = 'door' | 'phone';
425
- type RangeFilter = {
426
- gte?: number;
427
- lte?: number;
428
- };
429
624
  /** A cursor for paging through sorted account lists. */
430
625
  type SortCursor = number | number[];
431
626
  type AccountUserDetails = Omit<SmallUser, 'userId' | 'memberOf'>;
@@ -541,8 +736,6 @@ type AccountData = Omit<UnsavedAccount, 'contacts' | 'notes'> & {
541
736
  };
542
737
  type AccountSortBy = 'createdDate' | 'lastActionDate' | 'lastUpdatedDate' | `CF.${string}`;
543
738
  type AccountSortOrder = 'asc' | 'desc';
544
- /** Not modeled in detail by this SDK — treat as an opaque record. */
545
- type CustomFieldFilter = Record<string, unknown>;
546
739
  type AccountDataResponse = {
547
740
  accounts: AccountData[];
548
741
  sortTimestamp?: SortCursor;
@@ -554,28 +747,13 @@ type BulkModifyAccountsAction = ({
554
747
  } | {
555
748
  actionType: 'updateStage';
556
749
  stageId: WorkflowStageId;
750
+ } | {
751
+ actionType: 'updateCustomField';
752
+ fieldId: CustomFieldId;
753
+ value: CustomFieldType;
557
754
  } | {
558
755
  actionType: 'delete' | 'clearDisposition';
559
756
  })[];
560
- /** Not modeled in detail by this SDK — treat as an opaque record. */
561
- type ElasticFilter = {
562
- cities?: string[];
563
- states?: string[];
564
- zipCodes?: string[];
565
- advancedCustomFields?: CustomFieldFilter;
566
- statusIds?: AccountStatusId[];
567
- workflowStageIds?: WorkflowStageId[];
568
- tagIds?: TagId[];
569
- teamIds?: TeamId[];
570
- userIds?: UserId[];
571
- coordinates?: LatLng[];
572
- boundingBox?: {
573
- top: LatLng;
574
- bottom: LatLng;
575
- };
576
- workflowActionCount?: RangeFilter;
577
- contactCount?: RangeFilter;
578
- };
579
757
  type PartialAddress = Partial<Omit<SmallAddress, 'latlng'>> & {
580
758
  latlng?: Partial<LatLng>;
581
759
  };
@@ -624,6 +802,24 @@ type AccountStatusData = UnsavedAccountStatus & {
624
802
  type TinyAccountStatus = Pick<AccountStatusData, 'name' | 'statusId'>;
625
803
  //#endregion
626
804
  //#region src/models/account/api.d.ts
805
+ type ElasticFilter = {
806
+ cities?: string[];
807
+ states?: string[];
808
+ zipCodes?: string[];
809
+ advancedCustomFields?: CustomFieldFilter;
810
+ statusIds?: AccountStatusId[];
811
+ workflowStageIds?: WorkflowStageId[];
812
+ tagIds?: TagId[];
813
+ teamIds?: TeamId[];
814
+ userIds?: UserId[];
815
+ coordinates?: LatLng[];
816
+ boundingBox?: {
817
+ top: LatLng;
818
+ bottom: LatLng;
819
+ };
820
+ workflowActionCount?: RangeFilter;
821
+ contactCount?: RangeFilter;
822
+ };
627
823
  type AccountStatusSearchInput = {
628
824
  accountIds?: AccountId[];
629
825
  workflowId?: WorkflowId;
@@ -779,185 +975,112 @@ type AccountStatusRemoveInput = {
779
975
  statusId: AccountStatusId;
780
976
  };
781
977
  //#endregion
782
- //#region src/models/calendar/model.d.ts
783
- type CalendarEventId = `Event:${string}` | `Event.${string}`;
784
- /** @deprecated */
785
- type EventOutcomeId = `O.${string}`;
786
- type InterviewId = `Interview:${string}` | `Interview.${string}`;
787
- type AttachmentId = `Attachment:${string}` | `Attachment.${string}`;
788
- type EventType = 'Consultation' | 'Comeback' | 'Interview' | 'GeneralVisit' | 'Shadow' | 'Team';
789
- type SpecialtyAttachments = {
790
- utilityBill?: AttachmentId;
791
- customerVerification?: AttachmentId;
978
+ //#region src/models/area/model.d.ts
979
+ type AreaId = `Area.${string}`;
980
+ type AreaAssignmentType = 'user' | 'team' | 'company' | 'draft';
981
+ type AreaRunType = 'assign' | 'unassign' | 'reassign';
982
+ type AreaFilters = {
983
+ cities?: string[];
984
+ states?: string[];
985
+ zipCodes?: string[];
986
+ statusIds?: AccountStatusId[];
987
+ workflowStageIds?: WorkflowStageId[];
988
+ teamIds?: TeamId[];
989
+ userIds?: UserId[];
990
+ customFields?: {
991
+ id: CustomFieldId;
992
+ value: CustomFieldType;
993
+ }[];
994
+ advancedCustomFields?: CustomFieldFilter;
792
995
  };
793
- /** @deprecated */
794
- type SyncedCalendarEvent = {
795
- calendarType: string;
796
- calendarId: string;
797
- userId: UserId;
798
- deviceId: string;
799
- eventId: string;
996
+ type AreaAssignmentConfig = {
997
+ enabled: false;
998
+ autoRunOnImport?: boolean;
999
+ } | {
1000
+ enabled: true;
1001
+ autoRunOnImport?: boolean;
1002
+ order: number;
800
1003
  };
801
- type CalendarEventLocation = Pick<Address, 'oneLine'> & LatLng;
802
- type UnsavedCalendarEventData = {
803
- importId?: string;
804
- eventType: EventType;
805
- title: string;
806
- sourceId?: string; /** UTC milliseconds. */
807
- eventDate: number;
808
- outcomeId?: EventOutcomeId;
809
- dispositionId?: DispositionId; /** Minutes. */
810
- duration: number;
811
- attachments?: AttachmentId[];
812
- specialtyAttachments?: SpecialtyAttachments;
813
- accountId?: AccountId;
814
- locationId?: LocationId;
815
- location?: CalendarEventLocation;
816
- ownerId?: UserId;
817
- attendeeId?: UserId;
818
- dispatcherId?: UserId;
819
- occurredOwner?: boolean;
820
- occurredAttendee?: boolean;
821
- interviewId?: InterviewId; /** @deprecated */
822
- notes?: string;
823
- previousEventId?: CalendarEventId; /** @deprecated */
824
- syncedCalendarIds?: string[]; /** @deprecated */
825
- syncedCalendarEvents?: SyncedCalendarEvent[];
1004
+ type AreaScheduleEntry = {
1005
+ type: 'assign' | 'unassign';
1006
+ at: number;
1007
+ } | {
1008
+ type: 'reassign';
1009
+ at: number;
826
1010
  teamId?: TeamId;
1011
+ userIds?: UserId[];
827
1012
  };
828
- type EventOutcomeHistory = {
829
- outcomeId: EventOutcomeId;
830
- userId: UserId;
1013
+ type AreaRunHistoryEntry = {
831
1014
  timestamp: number;
832
- };
833
- type SitOutcomeFault = string;
834
- type CalendarEventData = UnsavedCalendarEventData & {
835
- outcomeHistory?: EventOutcomeHistory[];
836
- createdAt?: number;
837
- createdBy?: UserId;
838
- updatedAt?: number;
839
- updatedBy?: UserId;
840
- eventId: CalendarEventId;
841
- ownerId: UserId;
842
- occurred?: boolean;
843
- closed?: boolean;
844
- reasonNotOccurred?: string;
845
- fault?: SitOutcomeFault;
846
- allDay?: boolean;
847
- canDelete?: boolean;
848
- };
849
- type CalendarEventDataWithDetails = CalendarEventData & {
850
- resident?: TinyResidentData;
851
- owner?: SmallUser;
852
- attendee?: SmallUser;
853
- teams?: TinyTeam[];
854
- account?: TinyWorkflowAccount;
855
- };
856
- //#endregion
857
- //#region src/models/calendar/api.d.ts
858
- type CalendarEventRoleFilter = 'owner' | 'attendee';
859
- type OptionalCalendarEventLocation = UpsertLatLng & {
860
- locationId?: LocationId;
861
- oneLine?: string;
862
- };
863
- /** A yes/no/unset filter — matches events where the field is true, false, unset, or set to any value. */
864
- type BooleanFilter = 'true' | 'false' | 'undefined' | 'defined';
865
- type CalendarAvailabilityInput = {
866
- /** UTC milliseconds. */startDate: number; /** Minutes. Defaults to 30. */
867
- duration?: number;
1015
+ count: number;
1016
+ type?: AreaRunType;
1017
+ runBy?: UserId;
1018
+ process?: string;
868
1019
  teamId?: TeamId;
1020
+ userIds?: UserId[];
869
1021
  };
870
- type CalendarAvailabilitySuccess = ApiSuccess<{
871
- available: boolean;
872
- }>;
873
- type CalendarClosersInput = CalendarAvailabilityInput & {
874
- latLng?: LatLng;
875
- };
876
- type CalendarClosersSuccess = ApiSuccess<{
877
- closers: AvailableCloser[];
878
- }>;
879
- type CalendarTimeslotsInput = {
880
- targetId?: TeamId | UserId;
881
- days?: number;
882
- locationId?: LocationId; /** UTC milliseconds. */
883
- startTime?: number;
1022
+ type AreaJobInfo = {
1023
+ total: number;
1024
+ assigned: number;
1025
+ assignedDate: number;
1026
+ isRunning: boolean;
1027
+ status: 'preparing' | 'queued' | 'running' | 'completed';
1028
+ };
1029
+ type UnsavedArea = {
1030
+ name?: string;
1031
+ coordinates: LatLng[];
1032
+ assignmentType: AreaAssignmentType;
1033
+ teamId?: TeamId;
1034
+ userIds?: UserId[];
1035
+ color?: string;
1036
+ note?: string;
1037
+ filters?: AreaFilters;
1038
+ assignmentConfig?: AreaAssignmentConfig;
1039
+ schedule?: AreaScheduleEntry[];
884
1040
  };
885
- type CalendarTimeslotsSuccess = ApiSuccess<{
886
- closers: TinyCloser[];
887
- }>;
888
- type CalendarEventAddInput = {
889
- event: UnsavedCalendarEventData; /** Defaults to true. */
890
- errorOnCloserUnavailable?: boolean;
1041
+ type AreaData = UnsavedArea & AuditProps & {
1042
+ areaId: AreaId;
1043
+ importId?: string;
1044
+ deleteOnCompletion?: boolean;
1045
+ runHistory?: AreaRunHistoryEntry[];
1046
+ jobInfo?: AreaJobInfo;
891
1047
  };
892
- type CalendarEventAddSuccess = ApiSuccess<{
893
- event: CalendarEventData;
894
- }>;
895
- type CalendarEventGetInput = {
896
- eventId: CalendarEventId;
1048
+ //#endregion
1049
+ //#region src/models/area/api.d.ts
1050
+ type AreaSortCursor = string | number | boolean | (string | number | boolean)[];
1051
+ type AreaGetInput = {
1052
+ areaId: AreaId;
897
1053
  };
898
- type CalendarEventGetSuccess = ApiSuccess<{
899
- event: CalendarEventDataWithDetails;
1054
+ type AreaGetSuccess = ApiSuccess<{
1055
+ area: AreaData;
900
1056
  }>;
901
- type CalendarEventListInput = {
902
- startTime?: number;
903
- endTime?: number;
904
- ownerId?: UserId;
905
- locationId?: LocationId;
906
- companyId?: string; /** @deprecated use teamIds */
1057
+ type AreaListInput = {
1058
+ userId?: UserId;
907
1059
  teamId?: TeamId;
908
1060
  teamIds?: TeamId[];
909
- roleIds?: RoleId[];
910
- occurred?: BooleanFilter;
911
- closed?: BooleanFilter;
912
- eventType?: EventType;
913
- filterByRoles?: CalendarEventRoleFilter[];
914
- };
915
- type CalendarEventListSuccess = ApiSuccess<{
916
- events: CalendarEventDataWithDetails[];
917
- }>;
918
- type CalendarEventUpdateInput = {
919
- event: Partial<CalendarEventData> & {
920
- eventId: CalendarEventId;
921
- attendeeId?: UserId | null;
922
- };
923
- errorOnCloserUnavailable?: boolean;
1061
+ downlineTeamIds?: TeamId[];
1062
+ cursor?: AreaSortCursor;
1063
+ size?: number;
924
1064
  };
925
- type CalendarEventUpdateSuccess = ApiSuccess<{
926
- event: CalendarEventData;
1065
+ type AreaListSuccess = ApiSuccess<{
1066
+ areas: AreaData[];
1067
+ cursor?: AreaSortCursor;
927
1068
  }>;
928
- type CalendarEventUpsertInput = {
929
- event: Partial<{
930
- eventId: CalendarEventId;
931
- sourceId: string; /** Defaults to 'Consultation' on create. */
932
- eventType: string;
933
- title: string; /** Defaults to now on create. */
934
- eventDate: string | number; /** An EventOutcomeId, integration mapping string, or case-insensitive name. */
935
- outcomeId: string; /** Minutes. */
936
- duration: number;
937
- accountId: AccountId;
938
- location: OptionalCalendarEventLocation; /** A UserId or email. Defaults to the authenticated user on create. */
939
- ownerId: string; /** A UserId or email. Pass null to clear on update. */
940
- attendeeId: string | null; /** A UserId or email. */
941
- dispatcherId: string;
942
- occurredOwner: boolean;
943
- occurredAttendee: boolean;
944
- notes: string;
945
- previousEventId: CalendarEventId;
946
- }>;
947
- };
948
- type CalendarEventUpsertSuccess = ApiSuccess<{
949
- event: CalendarEventData;
1069
+ type AreaAddInput = UnsavedArea;
1070
+ type AreaAddSuccess = ApiSuccess<{
1071
+ area: AreaData;
950
1072
  }>;
951
- type CalendarEventConfirmInput = {
952
- eventId: CalendarEventId;
953
- occurred?: boolean;
1073
+ type AreaUpdateInput = {
1074
+ area: AreaData;
954
1075
  };
955
- type CalendarEventConfirmSuccess = ApiSuccess<{
956
- event: CalendarEventData;
957
- }>;
958
- type CalendarEventRemoveInput = {
1076
+ type AreaUpdateSuccess = AreaAddSuccess;
1077
+ type AreaRemoveInput = {
1078
+ areaId: AreaId;
959
1079
  archive?: boolean;
960
- eventId: CalendarEventId;
1080
+ };
1081
+ type AreaAssignInput = {
1082
+ areas: AreaData[];
1083
+ runType: AreaRunType;
961
1084
  };
962
1085
  //#endregion
963
1086
  //#region src/models/connect/app/model.d.ts
@@ -1089,6 +1212,18 @@ declare class AccountClient {
1089
1212
  upsert(input: AccountUpsertInput): Promise<AccountUpsertSuccess>;
1090
1213
  }
1091
1214
  //#endregion
1215
+ //#region src/clients/area.d.ts
1216
+ declare class AreaClient {
1217
+ private readonly api;
1218
+ constructor(api: TerrosApiClient);
1219
+ list(input: AreaListInput): Promise<AreaListSuccess>;
1220
+ get(input: AreaGetInput): Promise<AreaGetSuccess>;
1221
+ add(input: AreaAddInput): Promise<AreaAddSuccess>;
1222
+ update(input: AreaUpdateInput): Promise<AreaUpdateSuccess>;
1223
+ remove(input: AreaRemoveInput): Promise<ApiSuccess>;
1224
+ assign(input: AreaAssignInput): Promise<ApiSuccess>;
1225
+ }
1226
+ //#endregion
1092
1227
  //#region src/clients/calendar.d.ts
1093
1228
  declare class CalendarEventClient {
1094
1229
  private readonly api;
@@ -1150,6 +1285,7 @@ declare class UserClient {
1150
1285
  //#region src/client.d.ts
1151
1286
  declare class TerrosClient {
1152
1287
  readonly account: AccountClient;
1288
+ readonly area: AreaClient;
1153
1289
  readonly calendar: CalendarClient;
1154
1290
  readonly connect: ConnectClient;
1155
1291
  readonly user: UserClient;
@@ -1157,7 +1293,7 @@ declare class TerrosClient {
1157
1293
  }
1158
1294
  //#endregion
1159
1295
  //#region src/connect/handler.d.ts
1160
- type ConnectHandlerFunction<Input, Result> = (payload: ConnectExecutionInput<Input>, client: TerrosApiClient) => Promise<Result>;
1296
+ type ConnectHandlerFunction<Input, Result> = (payload: ConnectExecutionInput<Input>, client: TerrosClient) => Promise<Result>;
1161
1297
  type ConnectExecutionConfig = {
1162
1298
  scriptConfig: Record<string, string>;
1163
1299
  secrets: Record<string, string>;
@@ -1174,4 +1310,4 @@ type ConnectExecutionInput<Payload> = {
1174
1310
  type WrappedHandler<Input, Result> = (input: ConnectExecutionInput<Input>) => Promise<Result>;
1175
1311
  declare function wrapConnectHandler<Input, Result = void>(handler: ConnectHandlerFunction<Input, Result>): WrappedHandler<Input, Result>;
1176
1312
  //#endregion
1177
- export { AccessStatus, AccountAddInput, AccountAddSuccess, AccountContact, AccountData, AccountDataResponse, AccountGetInput, AccountGetSuccess, AccountHooksInput, AccountId, AccountListInput, AccountListSuccess, AccountMatchInput, AccountMatchSuccess, AccountNote, AccountPartialUpdateInput, AccountRemoveInput, AccountSortBy, AccountSortOrder, AccountStatusAddInput, AccountStatusAddSuccess, AccountStatusCode, AccountStatusData, AccountStatusId, AccountStatusListInput, AccountStatusListSuccess, AccountStatusRemoveInput, AccountStatusSearchInput, AccountStatusUpdateInput, AccountStatusUpdateSuccess, AccountUpdateBatchInput, AccountUpdateBatchSuccess, AccountUpdateInput, AccountUpdateSuccess, AccountUpsertInput, AccountUpsertSuccess, AccountUserDetails, Address, AppId, AppVersionData, AppVersionId, AttachmentId, AuditLog, AuditProps, AvailableCloser, BillingMethod, BulkModifyAccountsAction, BulkModifyAccountsInput, CalendarAvailabilityInput, CalendarAvailabilitySuccess, CalendarClosersInput, CalendarClosersSuccess, CalendarEventAddInput, CalendarEventAddSuccess, CalendarEventConfirmInput, CalendarEventConfirmSuccess, CalendarEventData, CalendarEventDataWithDetails, CalendarEventGetInput, CalendarEventGetSuccess, CalendarEventId, CalendarEventListInput, CalendarEventListSuccess, CalendarEventLocation, CalendarEventRemoveInput, CalendarEventUpdateInput, CalendarEventUpdateSuccess, CalendarEventUpsertInput, CalendarEventUpsertSuccess, CalendarTimeslotsInput, CalendarTimeslotsSuccess, CloserSettings, CloserStatus, CompanyData, CompanyId, CompanyIndustry, CompanyKind, CompanyState, CompanyWebhook, CompanyWebhookData, ConfigSchemaField, ConnectHandlerFunction, ContactId, CustomFieldFilter, CustomFieldMap, DispositionId, ElasticFilter, EntityId, EventOutcomeHistory, EventOutcomeId, EventType, IncomingScript, InterviewId, LatLng, LocationId, NoteId, NotificationPreference, OutgoingScript, PartialAddress, PermissionMap, RangeFilter, RoleId, ScheduledScript, ScriptAddInput, ScriptAddSuccess, ScriptBase, ScriptData, SmallAddress, SmallCloser, SmallUser, SortCursor, SpecialtyAttachments, StatusHistoryItem, SyncedCalendarEvent, TagId, TeamId, TerrosClient, TinyAccountStatus, TinyCloser, TinyResidentData, TinyRole, TinyTeam, TinyUser, TinyWorkflowAccount, UnsavedAccount, UnsavedAccountContact, UnsavedAccountNote, UnsavedAccountStatus, UnsavedAppVersion, UnsavedCalendarEventData, UnsavedScript, UnsavedUser, UpsertLatLng, UpsertTinyResidentData, UserAddInput, UserAddSuccess, UserBulkUpdateInput, UserBulkUpdateSuccess, UserClosersInput, UserClosersSuccess, UserData, UserGetInput, UserGetSuccess, UserHistory, UserId, UserIdentifier, UserListInput, UserListSuccess, UserManagerInput, UserManagerSuccess, UserPreferences, UserProfileData, UserProfileInput, UserProfileSuccess, UserRemoveInput, UserReportInput, UserReportSuccess, UserSearchInput, UserSearchSuccess, UserTeamData, UserTeamsByLevel, UserTimezoneInput, UserUpdateInput, UserUpdateSuccess, UserWebhook, UserWebhookData, VersionAddInput, VersionAddSuccess, VersionUpdateInput, VersionUpdateSuccess, WebhookAddUpdatePayload, WebhookAuditProps, WebhookPayload, WebhookRemovePayload, Weekday, WorkflowActionId, WorkflowHistoryItem, WorkflowId, WorkflowStageId, wrapConnectHandler };
1313
+ export { AccessStatus, AccountAddInput, AccountAddSuccess, AccountContact, AccountData, AccountDataResponse, AccountGetInput, AccountGetSuccess, AccountHooksInput, AccountId, AccountListInput, AccountListSuccess, AccountMatchInput, AccountMatchSuccess, AccountNote, AccountPartialUpdateInput, AccountRemoveInput, AccountSortBy, AccountSortOrder, AccountStatusAddInput, AccountStatusAddSuccess, AccountStatusCode, AccountStatusData, AccountStatusId, AccountStatusListInput, AccountStatusListSuccess, AccountStatusRemoveInput, AccountStatusSearchInput, AccountStatusUpdateInput, AccountStatusUpdateSuccess, AccountUpdateBatchInput, AccountUpdateBatchSuccess, AccountUpdateInput, AccountUpdateSuccess, AccountUpsertInput, AccountUpsertSuccess, AccountUserDetails, Address, AppId, AppVersionData, AppVersionId, AreaAddInput, AreaAddSuccess, AreaAssignInput, AreaAssignmentConfig, AreaAssignmentType, AreaData, AreaFilters, AreaGetInput, AreaGetSuccess, AreaId, AreaJobInfo, AreaListInput, AreaListSuccess, AreaRemoveInput, AreaRunHistoryEntry, AreaRunType, AreaScheduleEntry, AreaSortCursor, AreaUpdateInput, AreaUpdateSuccess, AttachmentId, AuditLog, AuditProps, AvailableCloser, BillingMethod, BulkModifyAccountsAction, BulkModifyAccountsInput, CalendarAvailabilityInput, CalendarAvailabilitySuccess, CalendarClosersInput, CalendarClosersSuccess, CalendarEventAddInput, CalendarEventAddSuccess, CalendarEventConfirmInput, CalendarEventConfirmSuccess, CalendarEventData, CalendarEventDataWithDetails, CalendarEventGetInput, CalendarEventGetSuccess, CalendarEventId, CalendarEventListInput, CalendarEventListSuccess, CalendarEventLocation, CalendarEventRemoveInput, CalendarEventUpdateInput, CalendarEventUpdateSuccess, CalendarEventUpsertInput, CalendarEventUpsertSuccess, CalendarTimeslotsInput, CalendarTimeslotsSuccess, CloserSettings, CloserStatus, CompanyData, CompanyId, CompanyIndustry, CompanyKind, CompanyWebhook, CompanyWebhookData, ConfigSchemaField, ConnectHandlerFunction, ContactId, DispositionId, ElasticFilter, EntityId, EventOutcomeHistory, EventOutcomeId, EventType, IncomingScript, InterviewId, LatLng, LocationId, NoteId, NotificationPreference, OutgoingScript, PartialAddress, PermissionMap, RoleId, ScheduledScript, ScriptAddInput, ScriptAddSuccess, ScriptBase, ScriptData, SmallAddress, SmallCloser, SmallUser, SortCursor, SpecialtyAttachments, StatusHistoryItem, SyncedCalendarEvent, TagId, TeamId, TerrosClient, TinyAccountStatus, TinyCloser, TinyResidentData, TinyRole, TinyTeam, TinyUser, TinyWorkflowAccount, UnsavedAccount, UnsavedAccountContact, UnsavedAccountNote, UnsavedAccountStatus, UnsavedAppVersion, UnsavedArea, UnsavedCalendarEventData, UnsavedScript, UnsavedUser, UpsertLatLng, UpsertTinyResidentData, UserAddInput, UserAddSuccess, UserBulkUpdateInput, UserBulkUpdateSuccess, UserClosersInput, UserClosersSuccess, UserData, UserGetInput, UserGetSuccess, UserHistory, UserId, UserIdentifier, UserListInput, UserListSuccess, UserManagerInput, UserManagerSuccess, UserPreferences, UserProfileData, UserProfileInput, UserProfileSuccess, UserRemoveInput, UserReportInput, UserReportSuccess, UserSearchInput, UserSearchSuccess, UserTeamData, UserTeamsByLevel, UserTimezoneInput, UserUpdateInput, UserUpdateSuccess, UserWebhook, UserWebhookData, VersionAddInput, VersionAddSuccess, VersionUpdateInput, VersionUpdateSuccess, WebhookAddUpdatePayload, WebhookAuditProps, WebhookPayload, WebhookRemovePayload, Weekday, WorkflowActionId, WorkflowHistoryItem, WorkflowId, WorkflowStageId, wrapConnectHandler };
package/dist/index.mjs CHANGED
@@ -149,7 +149,7 @@ function readProcessEnv(key) {
149
149
  }
150
150
  //#endregion
151
151
  //#region package.json
152
- var version = "1.0.9";
152
+ var version = "1.0.11";
153
153
  //#endregion
154
154
  //#region src/clients/account.ts
155
155
  var AccountStatusClient = class {
@@ -206,6 +206,32 @@ var AccountClient = class {
206
206
  }
207
207
  };
208
208
  //#endregion
209
+ //#region src/clients/area.ts
210
+ var AreaClient = class {
211
+ api;
212
+ constructor(api) {
213
+ this.api = api;
214
+ }
215
+ list(input) {
216
+ return this.api.call("area/list", input);
217
+ }
218
+ get(input) {
219
+ return this.api.call("area/get", input);
220
+ }
221
+ add(input) {
222
+ return this.api.call("area/add", input);
223
+ }
224
+ update(input) {
225
+ return this.api.call("area/update", input);
226
+ }
227
+ remove(input) {
228
+ return this.api.call("area/remove", input);
229
+ }
230
+ assign(input) {
231
+ return this.api.call("area/assign", input);
232
+ }
233
+ };
234
+ //#endregion
209
235
  //#region src/clients/calendar.ts
210
236
  var CalendarEventClient = class {
211
237
  api;
@@ -332,6 +358,7 @@ var UserClient = class {
332
358
  //#region src/client.ts
333
359
  var TerrosClient = class {
334
360
  account;
361
+ area;
335
362
  calendar;
336
363
  connect;
337
364
  user;
@@ -341,6 +368,7 @@ var TerrosClient = class {
341
368
  analytics: { "Terros-App-Version": version }
342
369
  });
343
370
  this.account = new AccountClient(api);
371
+ this.area = new AreaClient(api);
344
372
  this.calendar = new CalendarClient(api);
345
373
  this.connect = new ConnectClient(api);
346
374
  this.user = new UserClient(api);
@@ -352,7 +380,7 @@ function wrapConnectHandler(handler) {
352
380
  return async (input) => {
353
381
  const apiKey = input.context.config.authorization;
354
382
  delete input.context.config.authorization;
355
- return await handler(input, new TerrosApiClient({ apiKey }));
383
+ return await handler(input, new TerrosClient({ apiKey: apiKey?.replace(/^ApiKey /, "") }));
356
384
  };
357
385
  }
358
386
  //#endregion
package/package.json CHANGED
@@ -39,7 +39,7 @@
39
39
  "sideEffects": false,
40
40
  "type": "module",
41
41
  "types": "./dist/index.d.mts",
42
- "version": "1.0.9",
42
+ "version": "1.0.11",
43
43
  "scripts": {
44
44
  "build": "tsdown",
45
45
  "test": "vitest run"