@terros-inc/sdk 1.0.14 → 1.0.16
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 +199 -102
- package/dist/index.mjs +44 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -16,6 +16,7 @@ type TerrosHeaderMetadata = {
|
|
|
16
16
|
//#region ../packages/connect-common/dist/terrosApiClient.d.ts
|
|
17
17
|
type TerrosClientConfig = {
|
|
18
18
|
apiKey?: string;
|
|
19
|
+
authType?: 'ApiKey' | 'ConnectKey';
|
|
19
20
|
baseUrl?: string;
|
|
20
21
|
analytics?: TerrosHeaderMetadata;
|
|
21
22
|
impersonateUserId?: string;
|
|
@@ -32,24 +33,6 @@ declare class TerrosApiClient {
|
|
|
32
33
|
private determineBaseUrl;
|
|
33
34
|
}
|
|
34
35
|
//#endregion
|
|
35
|
-
//#region src/models/team/model.d.ts
|
|
36
|
-
type TinyTeam = {
|
|
37
|
-
teamId: TeamId;
|
|
38
|
-
name: string;
|
|
39
|
-
parentId?: TeamId;
|
|
40
|
-
isDeleted?: boolean;
|
|
41
|
-
externalId?: string;
|
|
42
|
-
avatarBlurhash?: string;
|
|
43
|
-
avatarUrl?: string;
|
|
44
|
-
restrictVisibility?: boolean;
|
|
45
|
-
level: number;
|
|
46
|
-
meetingTimes?: {
|
|
47
|
-
day: number;
|
|
48
|
-
start: number;
|
|
49
|
-
end: number;
|
|
50
|
-
}[];
|
|
51
|
-
};
|
|
52
|
-
//#endregion
|
|
53
36
|
//#region src/models/shared.d.ts
|
|
54
37
|
type AuditLog = {
|
|
55
38
|
userId: UserId;
|
|
@@ -66,6 +49,109 @@ type AuditProps = {
|
|
|
66
49
|
version?: number;
|
|
67
50
|
};
|
|
68
51
|
//#endregion
|
|
52
|
+
//#region src/models/company/model.d.ts
|
|
53
|
+
type CompanyKind = 'customer' | 'sandbox' | 'demo' | 'template' | 'development';
|
|
54
|
+
type AccessStatus = 'active' | 'suspended';
|
|
55
|
+
type BillingMethod = 'stripe' | 'none';
|
|
56
|
+
type CompanySize = number;
|
|
57
|
+
type CompanyIndustry = 'solar' | 'pest' | 'alarm' | 'roofing' | 'fiber' | 'insurance' | 'home_improvement' | 'windows' | 'satellite_tv' | 'retail' | 'other' | 'solar_cleaning';
|
|
58
|
+
type CompanyId = `C:${string}` | `C.${string}`;
|
|
59
|
+
type DemoState = 'Ready' | 'Copying' | 'Failed';
|
|
60
|
+
type ManualAccessOverride = AuditProps & {
|
|
61
|
+
accessStatus: AccessStatus;
|
|
62
|
+
note?: string;
|
|
63
|
+
expiresAt: number;
|
|
64
|
+
};
|
|
65
|
+
type UnsavedCompany = {
|
|
66
|
+
name: string;
|
|
67
|
+
legalName?: string;
|
|
68
|
+
kind?: CompanyKind;
|
|
69
|
+
accessStatus?: AccessStatus;
|
|
70
|
+
internalOwnerId?: UserId;
|
|
71
|
+
billingEmail?: string;
|
|
72
|
+
billingMethod?: BillingMethod;
|
|
73
|
+
maxUsers?: number;
|
|
74
|
+
parentCompanyId?: CompanyId;
|
|
75
|
+
salesforceAccountId?: string;
|
|
76
|
+
size?: CompanySize;
|
|
77
|
+
industries?: CompanyIndustry[];
|
|
78
|
+
salesChannels?: string[];
|
|
79
|
+
demoOwnerId?: UserId;
|
|
80
|
+
};
|
|
81
|
+
type CompanyData = AuditProps & UnsavedCompany & {
|
|
82
|
+
companyId: CompanyId;
|
|
83
|
+
kind: CompanyKind;
|
|
84
|
+
accessStatus: AccessStatus;
|
|
85
|
+
accessOverride?: ManualAccessOverride;
|
|
86
|
+
highestTeamLevel?: number;
|
|
87
|
+
lowestTeamLevel?: number;
|
|
88
|
+
levelNames?: Record<string, string>;
|
|
89
|
+
timeZone?: string;
|
|
90
|
+
avatarUrl?: string;
|
|
91
|
+
avatarBlurhash?: string;
|
|
92
|
+
uploadAvatarUrl?: string;
|
|
93
|
+
iconUrl?: string;
|
|
94
|
+
iconBlurhash?: string;
|
|
95
|
+
uploadIconUrl?: string;
|
|
96
|
+
demoState?: DemoState;
|
|
97
|
+
activeUserCount?: number;
|
|
98
|
+
isDeleted?: boolean;
|
|
99
|
+
};
|
|
100
|
+
type PartialCompanyData = Partial<CompanyData> & {
|
|
101
|
+
companyId: CompanyId;
|
|
102
|
+
legalName?: string | null;
|
|
103
|
+
internalOwnerId?: UserId | null;
|
|
104
|
+
salesforceAccountId?: string | null;
|
|
105
|
+
demoOwnerId?: UserId | null;
|
|
106
|
+
};
|
|
107
|
+
type TinyCompany = Pick<CompanyData, 'companyId' | 'name' | 'kind' | 'accessStatus' | 'modifiedBy' | 'demoState' | 'avatarUrl' | 'avatarBlurhash' | 'maxUsers' | 'activeUserCount' | 'salesforceAccountId'>;
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/models/company/api.d.ts
|
|
110
|
+
type CompanyListInput = {
|
|
111
|
+
archived?: true | false | 'all';
|
|
112
|
+
owners?: UserId[];
|
|
113
|
+
accessStatuses?: AccessStatus[];
|
|
114
|
+
billingMethods?: BillingMethod[];
|
|
115
|
+
kinds?: CompanyKind[];
|
|
116
|
+
};
|
|
117
|
+
type CompanyListSuccess = ApiSuccess<{
|
|
118
|
+
companies: TinyCompany[];
|
|
119
|
+
}>;
|
|
120
|
+
type CompanyGetInput = {
|
|
121
|
+
companyId?: CompanyId;
|
|
122
|
+
};
|
|
123
|
+
type CompanyGetSuccess = ApiSuccess<{
|
|
124
|
+
company: CompanyData;
|
|
125
|
+
}>;
|
|
126
|
+
type CompanyAddInput = UnsavedCompany;
|
|
127
|
+
type CompanyAddSuccess = ApiSuccess<{
|
|
128
|
+
company: CompanyData;
|
|
129
|
+
roles: RoleData[];
|
|
130
|
+
}>;
|
|
131
|
+
type CompanyUpdateInput = {
|
|
132
|
+
company: PartialCompanyData;
|
|
133
|
+
};
|
|
134
|
+
type CompanyUpdateSuccess = ApiSuccess<{
|
|
135
|
+
company: CompanyData;
|
|
136
|
+
}>;
|
|
137
|
+
type CompanyRemoveInput = {
|
|
138
|
+
companyId: CompanyId;
|
|
139
|
+
archive?: boolean;
|
|
140
|
+
};
|
|
141
|
+
type CompanyRemoveSuccess = ApiSuccess;
|
|
142
|
+
type CompanySetupInput = {
|
|
143
|
+
company: UnsavedCompany;
|
|
144
|
+
admin: UnsavedUser;
|
|
145
|
+
templateId?: CompanyId;
|
|
146
|
+
workflowId?: WorkflowId;
|
|
147
|
+
};
|
|
148
|
+
type CompanySetupSuccess = ApiSuccess<{
|
|
149
|
+
company: CompanyData;
|
|
150
|
+
roles: RoleData[];
|
|
151
|
+
user: UserProfileData;
|
|
152
|
+
password?: string;
|
|
153
|
+
}>;
|
|
154
|
+
//#endregion
|
|
69
155
|
//#region src/models/location/model.d.ts
|
|
70
156
|
type LatLng = {
|
|
71
157
|
latitude: number;
|
|
@@ -291,107 +377,101 @@ type CustomFieldFilterValue = {
|
|
|
291
377
|
exists: boolean;
|
|
292
378
|
};
|
|
293
379
|
//#endregion
|
|
294
|
-
//#region src/models/
|
|
295
|
-
type
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
type CompanyIndustry = 'solar' | 'pest' | 'alarm' | 'roofing' | 'fiber' | 'insurance' | 'home_improvement' | 'windows' | 'satellite_tv' | 'retail' | 'other' | 'solar_cleaning';
|
|
300
|
-
type CompanyId = `C:${string}` | `C.${string}`;
|
|
301
|
-
type DemoState = 'Ready' | 'Copying' | 'Failed';
|
|
302
|
-
type ManualAccessOverride = AuditProps & {
|
|
303
|
-
accessStatus: AccessStatus;
|
|
304
|
-
note?: string;
|
|
305
|
-
expiresAt: number;
|
|
380
|
+
//#region src/models/team/model.d.ts
|
|
381
|
+
type MeetingTime = {
|
|
382
|
+
day: number;
|
|
383
|
+
start: number;
|
|
384
|
+
end: number;
|
|
306
385
|
};
|
|
307
|
-
type
|
|
386
|
+
type UnsavedTeam = {
|
|
387
|
+
teamId?: TeamId;
|
|
308
388
|
name: string;
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
billingMethod?: BillingMethod;
|
|
315
|
-
maxUsers?: number;
|
|
316
|
-
parentCompanyId?: CompanyId;
|
|
317
|
-
salesforceAccountId?: string;
|
|
318
|
-
size?: CompanySize;
|
|
319
|
-
industries?: CompanyIndustry[];
|
|
320
|
-
salesChannels?: string[];
|
|
321
|
-
demoOwnerId?: UserId;
|
|
389
|
+
parentId?: TeamId;
|
|
390
|
+
level: number;
|
|
391
|
+
externalId?: string;
|
|
392
|
+
description?: string;
|
|
393
|
+
customFields?: CustomFieldMap;
|
|
322
394
|
};
|
|
323
|
-
type
|
|
324
|
-
|
|
325
|
-
kind: CompanyKind;
|
|
326
|
-
accessStatus: AccessStatus;
|
|
327
|
-
accessOverride?: ManualAccessOverride;
|
|
328
|
-
highestTeamLevel?: number;
|
|
329
|
-
lowestTeamLevel?: number;
|
|
330
|
-
levelNames?: Record<string, string>;
|
|
395
|
+
type TeamData = AuditProps & UnsavedTeam & {
|
|
396
|
+
teamId: TeamId;
|
|
331
397
|
timeZone?: string;
|
|
332
|
-
|
|
398
|
+
officeLocation?: LatLng;
|
|
399
|
+
officeAddress?: string;
|
|
400
|
+
meetingTimes?: MeetingTime[];
|
|
401
|
+
isCloserBoundary?: boolean;
|
|
402
|
+
restrictVisibility?: boolean;
|
|
333
403
|
avatarBlurhash?: string;
|
|
404
|
+
avatarUrl?: string;
|
|
405
|
+
parentTeamIds: TeamId[];
|
|
334
406
|
uploadAvatarUrl?: string;
|
|
335
|
-
iconUrl?: string;
|
|
336
|
-
iconBlurhash?: string;
|
|
337
|
-
uploadIconUrl?: string;
|
|
338
|
-
demoState?: DemoState;
|
|
339
|
-
activeUserCount?: number;
|
|
340
407
|
isDeleted?: boolean;
|
|
341
408
|
};
|
|
342
|
-
type
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
409
|
+
type TinyTeam = {
|
|
410
|
+
teamId: TeamId;
|
|
411
|
+
name: string;
|
|
412
|
+
parentId?: TeamId;
|
|
413
|
+
isDeleted?: boolean;
|
|
414
|
+
externalId?: string;
|
|
415
|
+
avatarBlurhash?: string;
|
|
416
|
+
avatarUrl?: string;
|
|
417
|
+
restrictVisibility?: boolean;
|
|
418
|
+
level: number;
|
|
419
|
+
meetingTimes?: MeetingTime[];
|
|
420
|
+
};
|
|
421
|
+
type PartialTeamData = Partial<TeamData> & {
|
|
422
|
+
teamId: TeamId;
|
|
423
|
+
};
|
|
424
|
+
type TeamMemberData = AuditProps & {
|
|
425
|
+
user: UserData; /** @deprecated Use roleIds instead. */
|
|
426
|
+
membership: string;
|
|
427
|
+
locked?: boolean;
|
|
428
|
+
roleIds?: RoleId[];
|
|
429
|
+
lastInterviewDate?: number;
|
|
430
|
+
lastShadowDate?: number;
|
|
348
431
|
};
|
|
349
|
-
type TinyCompany = Pick<CompanyData, 'companyId' | 'name' | 'kind' | 'accessStatus' | 'modifiedBy' | 'demoState' | 'avatarUrl' | 'avatarBlurhash' | 'maxUsers' | 'activeUserCount' | 'salesforceAccountId'>;
|
|
350
432
|
//#endregion
|
|
351
|
-
//#region src/models/
|
|
352
|
-
type
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
accessStatuses?: AccessStatus[];
|
|
356
|
-
billingMethods?: BillingMethod[];
|
|
357
|
-
kinds?: CompanyKind[];
|
|
433
|
+
//#region src/models/team/api.d.ts
|
|
434
|
+
type TeamListInput = {
|
|
435
|
+
showArchived?: true | false | 'all';
|
|
436
|
+
companyId?: CompanyId;
|
|
358
437
|
};
|
|
359
|
-
type
|
|
360
|
-
|
|
438
|
+
type TeamListSuccess = ApiSuccess<{
|
|
439
|
+
teams: TeamData[];
|
|
361
440
|
}>;
|
|
362
|
-
type
|
|
363
|
-
|
|
441
|
+
type TeamGetInput = {
|
|
442
|
+
teamId: TeamId;
|
|
364
443
|
};
|
|
365
|
-
type
|
|
366
|
-
|
|
444
|
+
type TeamGetSuccess = ApiSuccess<{
|
|
445
|
+
team: TeamData;
|
|
446
|
+
childTeams: TinyTeam[];
|
|
447
|
+
members: TeamMemberData[];
|
|
367
448
|
}>;
|
|
368
|
-
type
|
|
369
|
-
type
|
|
370
|
-
|
|
371
|
-
roles: RoleData[];
|
|
449
|
+
type TeamAddInput = UnsavedTeam;
|
|
450
|
+
type TeamAddSuccess = ApiSuccess<{
|
|
451
|
+
team: TeamData;
|
|
372
452
|
}>;
|
|
373
|
-
type
|
|
374
|
-
|
|
453
|
+
type TeamUpdateData = Omit<PartialTeamData, 'parentId'> & {
|
|
454
|
+
parentId?: TeamId | null;
|
|
375
455
|
};
|
|
376
|
-
type
|
|
377
|
-
|
|
456
|
+
type TeamUpdateInput = {
|
|
457
|
+
team: TeamUpdateData;
|
|
458
|
+
};
|
|
459
|
+
type TeamUpdateSuccess = ApiSuccess<{
|
|
460
|
+
team: TeamData;
|
|
461
|
+
childTeams: TinyTeam[];
|
|
462
|
+
members: TeamMemberData[];
|
|
378
463
|
}>;
|
|
379
|
-
type
|
|
380
|
-
|
|
464
|
+
type TeamRemoveInput = {
|
|
465
|
+
teamId: TeamId;
|
|
381
466
|
archive?: boolean;
|
|
382
467
|
};
|
|
383
|
-
type
|
|
384
|
-
type
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
templateId?: CompanyId;
|
|
388
|
-
workflowId?: WorkflowId;
|
|
468
|
+
type TeamRemoveSuccess = ApiSuccess;
|
|
469
|
+
type TeamDownlineInput = {
|
|
470
|
+
entityId: TeamId | CompanyId;
|
|
471
|
+
archived?: true | false | 'all';
|
|
389
472
|
};
|
|
390
|
-
type
|
|
391
|
-
|
|
392
|
-
roles: RoleData[];
|
|
393
|
-
user: UserProfileData;
|
|
394
|
-
password?: string;
|
|
473
|
+
type TeamDownlineSuccess = ApiSuccess<{
|
|
474
|
+
users: TinyUser[];
|
|
395
475
|
}>;
|
|
396
476
|
//#endregion
|
|
397
477
|
//#region src/models/user/model.d.ts
|
|
@@ -1212,15 +1292,18 @@ type ConfigSchemaField = {
|
|
|
1212
1292
|
description?: string;
|
|
1213
1293
|
dataType?: 'None' | 'Account' | 'User' | 'Event';
|
|
1214
1294
|
};
|
|
1295
|
+
type AuthSchemaField = string | {
|
|
1296
|
+
description: string;
|
|
1297
|
+
mapping?: boolean;
|
|
1298
|
+
};
|
|
1215
1299
|
type ScriptBase = {
|
|
1216
1300
|
appId: AppId;
|
|
1217
1301
|
appVersion: string;
|
|
1218
1302
|
name: string;
|
|
1219
1303
|
description?: string;
|
|
1220
1304
|
configSchema: ConfigSchemaField[];
|
|
1221
|
-
authSchema: Record<string,
|
|
1305
|
+
authSchema: Record<string, AuthSchemaField>;
|
|
1222
1306
|
scriptStorage?: 'inline' | 'blob';
|
|
1223
|
-
mainScript?: string;
|
|
1224
1307
|
permissions: string[];
|
|
1225
1308
|
slug?: string;
|
|
1226
1309
|
};
|
|
@@ -1423,6 +1506,18 @@ declare class ConnectClient {
|
|
|
1423
1506
|
constructor(api: TerrosApiClient);
|
|
1424
1507
|
}
|
|
1425
1508
|
//#endregion
|
|
1509
|
+
//#region src/clients/team.d.ts
|
|
1510
|
+
declare class TeamClient {
|
|
1511
|
+
private readonly api;
|
|
1512
|
+
constructor(api: TerrosApiClient);
|
|
1513
|
+
list(input?: TeamListInput): Promise<TeamListSuccess>;
|
|
1514
|
+
get(input: TeamGetInput): Promise<TeamGetSuccess>;
|
|
1515
|
+
add(input: TeamAddInput): Promise<TeamAddSuccess>;
|
|
1516
|
+
update(input: TeamUpdateInput): Promise<TeamUpdateSuccess>;
|
|
1517
|
+
remove(input: TeamRemoveInput): Promise<TeamRemoveSuccess>;
|
|
1518
|
+
downline(input: TeamDownlineInput): Promise<TeamDownlineSuccess>;
|
|
1519
|
+
}
|
|
1520
|
+
//#endregion
|
|
1426
1521
|
//#region src/clients/user.d.ts
|
|
1427
1522
|
declare class UserClient {
|
|
1428
1523
|
private readonly api;
|
|
@@ -1448,6 +1543,7 @@ declare class TerrosClient {
|
|
|
1448
1543
|
readonly calendar: CalendarClient;
|
|
1449
1544
|
readonly company: CompanyClient;
|
|
1450
1545
|
readonly connect: ConnectClient;
|
|
1546
|
+
readonly team: TeamClient;
|
|
1451
1547
|
readonly user: UserClient;
|
|
1452
1548
|
constructor(config?: TerrosClientConfig);
|
|
1453
1549
|
}
|
|
@@ -1458,6 +1554,7 @@ type ConnectExecutionConfig = {
|
|
|
1458
1554
|
scriptConfig: Record<string, string>;
|
|
1459
1555
|
secrets: Record<string, string>;
|
|
1460
1556
|
authorization?: string;
|
|
1557
|
+
authType?: 'ApiKey' | 'ConnectKey';
|
|
1461
1558
|
};
|
|
1462
1559
|
type ConnectExecutionContext<Payload> = {
|
|
1463
1560
|
payload: Payload;
|
|
@@ -1470,4 +1567,4 @@ type ConnectExecutionInput<Payload> = {
|
|
|
1470
1567
|
type WrappedHandler<Input, Result> = (input: ConnectExecutionInput<Input>) => Promise<Result>;
|
|
1471
1568
|
declare function wrapConnectHandler<Input, Result = void>(handler: ConnectHandlerFunction<Input, Result>): WrappedHandler<Input, Result>;
|
|
1472
1569
|
//#endregion
|
|
1473
|
-
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, AccountWebhook, AccountWebhookData, Address, AppData, AppGetInput, AppGetSuccess, AppId, AppVersionData, AppVersionId, AreaAddInput, AreaAddSuccess, AreaAssignInput, AreaAssignmentConfig, AreaAssignmentType, AreaData, AreaFilters, AreaGetInput, AreaGetSuccess, AreaId, AreaJobInfo, AreaListInput, AreaListSortBy, AreaListSortOrder, AreaListSuccess, AreaRemoveInput, AreaRunHistoryEntry, AreaRunType, AreaScheduleEntry, AreaSortCursor, AreaStateName, 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, CompanyAddInput, CompanyAddSuccess, CompanyData, CompanyGetInput, CompanyGetSuccess, CompanyId, CompanyIndustry, CompanyKind, CompanyListInput, CompanyListSuccess, CompanyRemoveInput, CompanyRemoveSuccess, CompanySetupInput, CompanySetupSuccess, CompanySize, CompanyUpdateInput, CompanyUpdateSuccess, CompanyWebhook, CompanyWebhookData, ConfigSchemaField, ConnectHandlerFunction, ContactId, CustomFieldFilter, CustomFieldFilterValue, CustomFieldId, CustomFieldMap, CustomFieldType, DemoState, DispositionId, ElasticFilter, EntityId, EventOutcomeHistory, EventOutcomeId, EventType, IncomingScript, InterviewId, LatLng, LocationId, ManualAccessOverride, NoteId, NotificationPreference, OutgoingScript, PartialAddress, PartialCompanyData, PermissionMap, RangeFilter, RoleData, RoleId, ScheduledScript, ScriptAddInput, ScriptAddSuccess, ScriptBase, ScriptData, SmallAddress, SmallCloser, SmallUser, SortCursor, SpecialtyAttachments, StatusHistoryItem, SyncedCalendarEvent, TagId, TeamId, TerrosClient, TinyAccountStatus, TinyCloser, TinyCompany, TinyResidentData, TinyRole, TinyTeam, TinyUser, TinyWorkflowAccount, UnsavedAccount, UnsavedAccountContact, UnsavedAccountNote, UnsavedAccountStatus, UnsavedAppVersion, UnsavedArea, UnsavedCalendarEventData, UnsavedCompany, 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, VersionGetInput, VersionGetSuccess, VersionUpdateInput, VersionUpdateSuccess, WebhookAddUpdatePayload, WebhookAuditProps, WebhookPayload, WebhookRemovePayload, Weekday, WorkflowActionId, WorkflowHistoryItem, WorkflowId, WorkflowStageId, wrapConnectHandler };
|
|
1570
|
+
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, AccountWebhook, AccountWebhookData, Address, AppData, AppGetInput, AppGetSuccess, AppId, AppVersionData, AppVersionId, AreaAddInput, AreaAddSuccess, AreaAssignInput, AreaAssignmentConfig, AreaAssignmentType, AreaData, AreaFilters, AreaGetInput, AreaGetSuccess, AreaId, AreaJobInfo, AreaListInput, AreaListSortBy, AreaListSortOrder, AreaListSuccess, AreaRemoveInput, AreaRunHistoryEntry, AreaRunType, AreaScheduleEntry, AreaSortCursor, AreaStateName, AreaUpdateInput, AreaUpdateSuccess, AttachmentId, AuditLog, AuditProps, AuthSchemaField, 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, CompanyAddInput, CompanyAddSuccess, CompanyData, CompanyGetInput, CompanyGetSuccess, CompanyId, CompanyIndustry, CompanyKind, CompanyListInput, CompanyListSuccess, CompanyRemoveInput, CompanyRemoveSuccess, CompanySetupInput, CompanySetupSuccess, CompanySize, CompanyUpdateInput, CompanyUpdateSuccess, CompanyWebhook, CompanyWebhookData, ConfigSchemaField, ConnectHandlerFunction, ContactId, CustomFieldFilter, CustomFieldFilterValue, CustomFieldId, CustomFieldMap, CustomFieldType, DemoState, DispositionId, ElasticFilter, EntityId, EventOutcomeHistory, EventOutcomeId, EventType, IncomingScript, InterviewId, LatLng, LocationId, ManualAccessOverride, MeetingTime, NoteId, NotificationPreference, OutgoingScript, PartialAddress, PartialCompanyData, PartialTeamData, PermissionMap, RangeFilter, RoleData, RoleId, ScheduledScript, ScriptAddInput, ScriptAddSuccess, ScriptBase, ScriptData, SmallAddress, SmallCloser, SmallUser, SortCursor, SpecialtyAttachments, StatusHistoryItem, SyncedCalendarEvent, TagId, TeamAddInput, TeamAddSuccess, TeamData, TeamDownlineInput, TeamDownlineSuccess, TeamGetInput, TeamGetSuccess, TeamId, TeamListInput, TeamListSuccess, TeamMemberData, TeamRemoveInput, TeamRemoveSuccess, TeamUpdateData, TeamUpdateInput, TeamUpdateSuccess, TerrosClient, TinyAccountStatus, TinyCloser, TinyCompany, TinyResidentData, TinyRole, TinyTeam, TinyUser, TinyWorkflowAccount, UnsavedAccount, UnsavedAccountContact, UnsavedAccountNote, UnsavedAccountStatus, UnsavedAppVersion, UnsavedArea, UnsavedCalendarEventData, UnsavedCompany, UnsavedScript, UnsavedTeam, 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, VersionGetInput, VersionGetSuccess, VersionUpdateInput, VersionUpdateSuccess, WebhookAddUpdatePayload, WebhookAuditProps, WebhookPayload, WebhookRemovePayload, Weekday, WorkflowActionId, WorkflowHistoryItem, WorkflowId, WorkflowStageId, wrapConnectHandler };
|
package/dist/index.mjs
CHANGED
|
@@ -123,28 +123,32 @@ var TerrosApiClient = class {
|
|
|
123
123
|
return output;
|
|
124
124
|
}
|
|
125
125
|
async getAuthorizationHeader() {
|
|
126
|
-
if (this.authStrategy.type === "apikey") return
|
|
126
|
+
if (this.authStrategy.type === "apikey") return `${this.authStrategy.authType} ${this.authStrategy.apiKey}`;
|
|
127
127
|
const cliTokens = await getTokens();
|
|
128
128
|
if (cliTokens === null) throw new Error("No authorization found. Log in with Terros CLI or provide an API key via environment variables or client config.");
|
|
129
129
|
return `Bearer ${cliTokens.access_token}`;
|
|
130
130
|
}
|
|
131
131
|
determineAuthStrategy(config) {
|
|
132
|
+
const authType = config.authType ?? "ApiKey";
|
|
132
133
|
if (config.apiKey) return {
|
|
133
134
|
type: "apikey",
|
|
134
|
-
apiKey: config.apiKey
|
|
135
|
+
apiKey: config.apiKey,
|
|
136
|
+
authType
|
|
135
137
|
};
|
|
136
138
|
const apiKeyFromEnv = readProcessEnv("TERROS_API_KEY");
|
|
137
139
|
if (apiKeyFromEnv) return {
|
|
138
140
|
type: "apikey",
|
|
139
|
-
apiKey: apiKeyFromEnv
|
|
141
|
+
apiKey: apiKeyFromEnv,
|
|
142
|
+
authType
|
|
140
143
|
};
|
|
141
144
|
return { type: "oauth" };
|
|
142
145
|
}
|
|
143
146
|
determineBaseUrl(config) {
|
|
144
147
|
if (config.baseUrl) return config.baseUrl;
|
|
145
148
|
const envEndpoint = readProcessEnv("TERROS_API_ENDPOINT");
|
|
146
|
-
if (envEndpoint) return
|
|
147
|
-
return
|
|
149
|
+
if (!envEndpoint) return PROD_BASE_URL;
|
|
150
|
+
if (/^https?:\/\//i.test(envEndpoint)) return envEndpoint;
|
|
151
|
+
return `https://${envEndpoint}`;
|
|
148
152
|
}
|
|
149
153
|
};
|
|
150
154
|
function readProcessEnv(key) {
|
|
@@ -153,7 +157,7 @@ function readProcessEnv(key) {
|
|
|
153
157
|
}
|
|
154
158
|
//#endregion
|
|
155
159
|
//#region package.json
|
|
156
|
-
var version = "1.0.
|
|
160
|
+
var version = "1.0.16";
|
|
157
161
|
//#endregion
|
|
158
162
|
//#region src/clients/account.ts
|
|
159
163
|
var AccountStatusClient = class {
|
|
@@ -355,6 +359,32 @@ var ConnectClient = class {
|
|
|
355
359
|
}
|
|
356
360
|
};
|
|
357
361
|
//#endregion
|
|
362
|
+
//#region src/clients/team.ts
|
|
363
|
+
var TeamClient = class {
|
|
364
|
+
api;
|
|
365
|
+
constructor(api) {
|
|
366
|
+
this.api = api;
|
|
367
|
+
}
|
|
368
|
+
list(input = {}) {
|
|
369
|
+
return this.api.call("team/list", input);
|
|
370
|
+
}
|
|
371
|
+
get(input) {
|
|
372
|
+
return this.api.call("team/get", input);
|
|
373
|
+
}
|
|
374
|
+
add(input) {
|
|
375
|
+
return this.api.call("team/add", input);
|
|
376
|
+
}
|
|
377
|
+
update(input) {
|
|
378
|
+
return this.api.call("team/update", input);
|
|
379
|
+
}
|
|
380
|
+
remove(input) {
|
|
381
|
+
return this.api.call("team/remove", input);
|
|
382
|
+
}
|
|
383
|
+
downline(input) {
|
|
384
|
+
return this.api.call("team/downline", input);
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
//#endregion
|
|
358
388
|
//#region src/clients/user.ts
|
|
359
389
|
var UserClient = class {
|
|
360
390
|
api;
|
|
@@ -406,6 +436,7 @@ var TerrosClient = class {
|
|
|
406
436
|
calendar;
|
|
407
437
|
company;
|
|
408
438
|
connect;
|
|
439
|
+
team;
|
|
409
440
|
user;
|
|
410
441
|
constructor(config = {}) {
|
|
411
442
|
const api = new TerrosApiClient({
|
|
@@ -417,6 +448,7 @@ var TerrosClient = class {
|
|
|
417
448
|
this.calendar = new CalendarClient(api);
|
|
418
449
|
this.company = new CompanyClient(api);
|
|
419
450
|
this.connect = new ConnectClient(api);
|
|
451
|
+
this.team = new TeamClient(api);
|
|
420
452
|
this.user = new UserClient(api);
|
|
421
453
|
}
|
|
422
454
|
};
|
|
@@ -424,9 +456,13 @@ var TerrosClient = class {
|
|
|
424
456
|
//#region src/connect/handler.ts
|
|
425
457
|
function wrapConnectHandler(handler) {
|
|
426
458
|
return async (input) => {
|
|
427
|
-
const
|
|
459
|
+
const auth = input.context.config.authorization;
|
|
460
|
+
const authType = input.context.config.authType;
|
|
428
461
|
delete input.context.config.authorization;
|
|
429
|
-
return await handler(input, new TerrosClient({
|
|
462
|
+
return await handler(input, new TerrosClient({
|
|
463
|
+
apiKey: auth?.replace(/^(ApiKey|ConnectKey) /, ""),
|
|
464
|
+
authType
|
|
465
|
+
}));
|
|
430
466
|
};
|
|
431
467
|
}
|
|
432
468
|
//#endregion
|