@terros-inc/sdk 1.0.11 → 1.0.13
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 +136 -10
- package/dist/index.mjs +52 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -18,11 +18,13 @@ type TerrosClientConfig = {
|
|
|
18
18
|
apiKey?: string;
|
|
19
19
|
baseUrl?: string;
|
|
20
20
|
analytics?: TerrosHeaderMetadata;
|
|
21
|
+
impersonateUserId?: string;
|
|
21
22
|
};
|
|
22
23
|
declare class TerrosApiClient {
|
|
23
24
|
private readonly baseUrl;
|
|
24
25
|
private readonly authStrategy;
|
|
25
26
|
private readonly analytics;
|
|
27
|
+
private readonly impersonateUserId;
|
|
26
28
|
constructor(config?: TerrosClientConfig);
|
|
27
29
|
call<Success>(route: ApiRoute, input: object): Promise<Success>;
|
|
28
30
|
private getAuthorizationHeader;
|
|
@@ -293,21 +295,36 @@ type CustomFieldFilterValue = {
|
|
|
293
295
|
type CompanyKind = 'customer' | 'sandbox' | 'demo' | 'template' | 'development';
|
|
294
296
|
type AccessStatus = 'active' | 'suspended';
|
|
295
297
|
type BillingMethod = 'stripe' | 'none';
|
|
298
|
+
type CompanySize = number;
|
|
296
299
|
type CompanyIndustry = 'solar' | 'pest' | 'alarm' | 'roofing' | 'fiber' | 'insurance' | 'home_improvement' | 'windows' | 'satellite_tv' | 'retail' | 'other' | 'solar_cleaning';
|
|
297
300
|
type CompanyId = `C:${string}` | `C.${string}`;
|
|
298
|
-
type
|
|
299
|
-
|
|
301
|
+
type DemoState = 'Ready' | 'Copying' | 'Failed';
|
|
302
|
+
type ManualAccessOverride = AuditProps & {
|
|
303
|
+
accessStatus: AccessStatus;
|
|
304
|
+
note?: string;
|
|
305
|
+
expiresAt: number;
|
|
306
|
+
};
|
|
307
|
+
type UnsavedCompany = {
|
|
300
308
|
name: string;
|
|
301
309
|
legalName?: string;
|
|
302
|
-
kind
|
|
303
|
-
accessStatus
|
|
310
|
+
kind?: CompanyKind;
|
|
311
|
+
accessStatus?: AccessStatus;
|
|
304
312
|
internalOwnerId?: UserId;
|
|
305
313
|
billingEmail?: string;
|
|
306
314
|
billingMethod?: BillingMethod;
|
|
307
315
|
maxUsers?: number;
|
|
308
|
-
|
|
316
|
+
parentCompanyId?: CompanyId;
|
|
317
|
+
salesforceAccountId?: string;
|
|
318
|
+
size?: CompanySize;
|
|
309
319
|
industries?: CompanyIndustry[];
|
|
310
320
|
salesChannels?: string[];
|
|
321
|
+
demoOwnerId?: UserId;
|
|
322
|
+
};
|
|
323
|
+
type CompanyData = AuditProps & UnsavedCompany & {
|
|
324
|
+
companyId: CompanyId;
|
|
325
|
+
kind: CompanyKind;
|
|
326
|
+
accessStatus: AccessStatus;
|
|
327
|
+
accessOverride?: ManualAccessOverride;
|
|
311
328
|
highestTeamLevel?: number;
|
|
312
329
|
lowestTeamLevel?: number;
|
|
313
330
|
levelNames?: Record<string, string>;
|
|
@@ -318,12 +335,64 @@ type CompanyData = {
|
|
|
318
335
|
iconUrl?: string;
|
|
319
336
|
iconBlurhash?: string;
|
|
320
337
|
uploadIconUrl?: string;
|
|
338
|
+
demoState?: DemoState;
|
|
339
|
+
activeUserCount?: number;
|
|
321
340
|
isDeleted?: boolean;
|
|
322
|
-
createdAt?: number;
|
|
323
|
-
createdBy?: UserId;
|
|
324
|
-
updatedAt?: number;
|
|
325
|
-
updatedBy?: UserId;
|
|
326
341
|
};
|
|
342
|
+
type PartialCompanyData = Partial<CompanyData> & {
|
|
343
|
+
companyId: CompanyId;
|
|
344
|
+
legalName?: string | null;
|
|
345
|
+
internalOwnerId?: UserId | null;
|
|
346
|
+
salesforceAccountId?: string | null;
|
|
347
|
+
demoOwnerId?: UserId | null;
|
|
348
|
+
};
|
|
349
|
+
type TinyCompany = Pick<CompanyData, 'companyId' | 'name' | 'kind' | 'accessStatus' | 'modifiedBy' | 'demoState' | 'avatarUrl' | 'avatarBlurhash' | 'maxUsers'>;
|
|
350
|
+
//#endregion
|
|
351
|
+
//#region src/models/company/api.d.ts
|
|
352
|
+
type CompanyListInput = {
|
|
353
|
+
archived?: true | false | 'all';
|
|
354
|
+
owners?: UserId[];
|
|
355
|
+
accessStatuses?: AccessStatus[];
|
|
356
|
+
billingMethods?: BillingMethod[];
|
|
357
|
+
kinds?: CompanyKind[];
|
|
358
|
+
};
|
|
359
|
+
type CompanyListSuccess = ApiSuccess<{
|
|
360
|
+
companies: TinyCompany[];
|
|
361
|
+
}>;
|
|
362
|
+
type CompanyGetInput = {
|
|
363
|
+
companyId?: CompanyId;
|
|
364
|
+
};
|
|
365
|
+
type CompanyGetSuccess = ApiSuccess<{
|
|
366
|
+
company: CompanyData;
|
|
367
|
+
}>;
|
|
368
|
+
type CompanyAddInput = UnsavedCompany;
|
|
369
|
+
type CompanyAddSuccess = ApiSuccess<{
|
|
370
|
+
company: CompanyData;
|
|
371
|
+
roles: RoleData[];
|
|
372
|
+
}>;
|
|
373
|
+
type CompanyUpdateInput = {
|
|
374
|
+
company: PartialCompanyData;
|
|
375
|
+
};
|
|
376
|
+
type CompanyUpdateSuccess = ApiSuccess<{
|
|
377
|
+
company: CompanyData;
|
|
378
|
+
}>;
|
|
379
|
+
type CompanyRemoveInput = {
|
|
380
|
+
companyId: CompanyId;
|
|
381
|
+
archive?: boolean;
|
|
382
|
+
};
|
|
383
|
+
type CompanyRemoveSuccess = ApiSuccess;
|
|
384
|
+
type CompanySetupInput = {
|
|
385
|
+
company: UnsavedCompany;
|
|
386
|
+
admin: UnsavedUser;
|
|
387
|
+
templateId?: CompanyId;
|
|
388
|
+
workflowId?: WorkflowId;
|
|
389
|
+
};
|
|
390
|
+
type CompanySetupSuccess = ApiSuccess<{
|
|
391
|
+
company: CompanyData;
|
|
392
|
+
roles: RoleData[];
|
|
393
|
+
user: UserProfileData;
|
|
394
|
+
password?: string;
|
|
395
|
+
}>;
|
|
327
396
|
//#endregion
|
|
328
397
|
//#region src/models/user/model.d.ts
|
|
329
398
|
type UserId = `U:${string}` | `U.${string}`;
|
|
@@ -337,6 +406,19 @@ type TinyRole = {
|
|
|
337
406
|
roleType: 'admin' | 'manager' | 'recruit' | null;
|
|
338
407
|
name: string;
|
|
339
408
|
};
|
|
409
|
+
type RoleData = AuditProps & {
|
|
410
|
+
roleId: RoleId;
|
|
411
|
+
companyId: CompanyId;
|
|
412
|
+
name: string;
|
|
413
|
+
roleType?: 'admin' | 'manager' | 'recruit' | null;
|
|
414
|
+
description?: string;
|
|
415
|
+
assignment?: 'user' | 'team';
|
|
416
|
+
avatarBlurhash?: string;
|
|
417
|
+
avatarUrl?: string;
|
|
418
|
+
uploadAvatarUrl?: string;
|
|
419
|
+
canAssign?: boolean;
|
|
420
|
+
isDeleted?: boolean;
|
|
421
|
+
};
|
|
340
422
|
type TinyUser = {
|
|
341
423
|
userId: UserId;
|
|
342
424
|
clientUserId?: string;
|
|
@@ -1085,6 +1167,9 @@ type AreaAssignInput = {
|
|
|
1085
1167
|
//#endregion
|
|
1086
1168
|
//#region src/models/connect/app/model.d.ts
|
|
1087
1169
|
type AppId = `App.${string}`;
|
|
1170
|
+
type AppData = {
|
|
1171
|
+
appId: AppId;
|
|
1172
|
+
};
|
|
1088
1173
|
//#endregion
|
|
1089
1174
|
//#region src/models/connect/script/model.d.ts
|
|
1090
1175
|
type ConfigSchemaField = {
|
|
@@ -1150,6 +1235,14 @@ type AppVersionData = UnsavedAppVersion & {
|
|
|
1150
1235
|
};
|
|
1151
1236
|
//#endregion
|
|
1152
1237
|
//#region src/models/connect/version/api.d.ts
|
|
1238
|
+
type VersionGetInput = {
|
|
1239
|
+
appId: AppId;
|
|
1240
|
+
appVersion: string;
|
|
1241
|
+
};
|
|
1242
|
+
type VersionGetSuccess = ApiSuccess<{
|
|
1243
|
+
appVersion: AppVersionData;
|
|
1244
|
+
scripts: ScriptData[];
|
|
1245
|
+
}>;
|
|
1153
1246
|
type VersionAddInput = {
|
|
1154
1247
|
versionData: UnsavedAppVersion;
|
|
1155
1248
|
};
|
|
@@ -1163,6 +1256,15 @@ type VersionUpdateSuccess = ApiSuccess<{
|
|
|
1163
1256
|
appVersion: AppVersionData;
|
|
1164
1257
|
}>;
|
|
1165
1258
|
//#endregion
|
|
1259
|
+
//#region src/models/connect/app/api.d.ts
|
|
1260
|
+
type AppGetInput = {
|
|
1261
|
+
appId: AppId;
|
|
1262
|
+
};
|
|
1263
|
+
type AppGetSuccess = ApiSuccess<{
|
|
1264
|
+
app: AppData;
|
|
1265
|
+
versions: AppVersionData[];
|
|
1266
|
+
}>;
|
|
1267
|
+
//#endregion
|
|
1166
1268
|
//#region src/models/webhook.d.ts
|
|
1167
1269
|
type WebhookAuditProps = {
|
|
1168
1270
|
createdAt: string;
|
|
@@ -1187,6 +1289,10 @@ type CompanyWebhookData = WebhookAuditProps & Omit<CompanyData, 'companyId'> & {
|
|
|
1187
1289
|
id: CompanyId;
|
|
1188
1290
|
};
|
|
1189
1291
|
type CompanyWebhook = WebhookPayload<'Company', CompanyWebhookData, 'id'>;
|
|
1292
|
+
type AccountWebhookData = WebhookAuditProps & Omit<AccountData, 'accountId' | 'resident'> & {
|
|
1293
|
+
id: AccountId;
|
|
1294
|
+
};
|
|
1295
|
+
type AccountWebhook = WebhookPayload<'Account', AccountWebhookData, 'id'>;
|
|
1190
1296
|
//#endregion
|
|
1191
1297
|
//#region src/clients/account.d.ts
|
|
1192
1298
|
declare class AccountStatusClient {
|
|
@@ -1245,10 +1351,28 @@ declare class CalendarClient {
|
|
|
1245
1351
|
timeslots(input: CalendarTimeslotsInput): Promise<CalendarTimeslotsSuccess>;
|
|
1246
1352
|
}
|
|
1247
1353
|
//#endregion
|
|
1354
|
+
//#region src/clients/company.d.ts
|
|
1355
|
+
declare class CompanyClient {
|
|
1356
|
+
private readonly api;
|
|
1357
|
+
constructor(api: TerrosApiClient);
|
|
1358
|
+
list(input?: CompanyListInput): Promise<CompanyListSuccess>;
|
|
1359
|
+
get(input?: CompanyGetInput): Promise<CompanyGetSuccess>;
|
|
1360
|
+
add(input: CompanyAddInput): Promise<CompanyAddSuccess>;
|
|
1361
|
+
update(input: CompanyUpdateInput): Promise<CompanyUpdateSuccess>;
|
|
1362
|
+
remove(input: CompanyRemoveInput): Promise<CompanyRemoveSuccess>;
|
|
1363
|
+
setup(input: CompanySetupInput): Promise<CompanySetupSuccess>;
|
|
1364
|
+
}
|
|
1365
|
+
//#endregion
|
|
1248
1366
|
//#region src/clients/connect.d.ts
|
|
1367
|
+
declare class ConnectAppClient {
|
|
1368
|
+
private readonly api;
|
|
1369
|
+
constructor(api: TerrosApiClient);
|
|
1370
|
+
get(input: AppGetInput): Promise<AppGetSuccess>;
|
|
1371
|
+
}
|
|
1249
1372
|
declare class ConnectAppVersionClient {
|
|
1250
1373
|
private readonly api;
|
|
1251
1374
|
constructor(api: TerrosApiClient);
|
|
1375
|
+
get(input: VersionGetInput): Promise<VersionGetSuccess>;
|
|
1252
1376
|
add(input: VersionAddInput): Promise<VersionAddSuccess>;
|
|
1253
1377
|
update(input: VersionUpdateInput): Promise<VersionUpdateSuccess>;
|
|
1254
1378
|
}
|
|
@@ -1259,6 +1383,7 @@ declare class ConnectScriptClient {
|
|
|
1259
1383
|
}
|
|
1260
1384
|
declare class ConnectClient {
|
|
1261
1385
|
private readonly api;
|
|
1386
|
+
readonly app: ConnectAppClient;
|
|
1262
1387
|
readonly version: ConnectAppVersionClient;
|
|
1263
1388
|
readonly script: ConnectScriptClient;
|
|
1264
1389
|
constructor(api: TerrosApiClient);
|
|
@@ -1287,6 +1412,7 @@ declare class TerrosClient {
|
|
|
1287
1412
|
readonly account: AccountClient;
|
|
1288
1413
|
readonly area: AreaClient;
|
|
1289
1414
|
readonly calendar: CalendarClient;
|
|
1415
|
+
readonly company: CompanyClient;
|
|
1290
1416
|
readonly connect: ConnectClient;
|
|
1291
1417
|
readonly user: UserClient;
|
|
1292
1418
|
constructor(config?: TerrosClientConfig);
|
|
@@ -1310,4 +1436,4 @@ type ConnectExecutionInput<Payload> = {
|
|
|
1310
1436
|
type WrappedHandler<Input, Result> = (input: ConnectExecutionInput<Input>) => Promise<Result>;
|
|
1311
1437
|
declare function wrapConnectHandler<Input, Result = void>(handler: ConnectHandlerFunction<Input, Result>): WrappedHandler<Input, Result>;
|
|
1312
1438
|
//#endregion
|
|
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 };
|
|
1439
|
+
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, 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, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -92,22 +92,26 @@ var TerrosApiClient = class {
|
|
|
92
92
|
baseUrl;
|
|
93
93
|
authStrategy;
|
|
94
94
|
analytics;
|
|
95
|
+
impersonateUserId;
|
|
95
96
|
constructor(config = {}) {
|
|
96
97
|
this.baseUrl = this.determineBaseUrl(config);
|
|
97
98
|
this.analytics = getAnalyticsHeaders(config.analytics);
|
|
98
99
|
this.authStrategy = this.determineAuthStrategy(config);
|
|
100
|
+
this.impersonateUserId = config.impersonateUserId ?? readProcessEnv("TERROS_IMPERSONATE");
|
|
99
101
|
}
|
|
100
102
|
async call(route, input) {
|
|
101
103
|
let response;
|
|
102
104
|
try {
|
|
103
105
|
const authorization = await this.getAuthorizationHeader();
|
|
106
|
+
const headers = {
|
|
107
|
+
...this.analytics,
|
|
108
|
+
"Content-Type": "application/json",
|
|
109
|
+
authorization
|
|
110
|
+
};
|
|
111
|
+
if (this.impersonateUserId) headers.impersonate_user_id = this.impersonateUserId;
|
|
104
112
|
response = await fetch(`${this.baseUrl}/${route}`, {
|
|
105
113
|
method: "POST",
|
|
106
|
-
headers
|
|
107
|
-
...this.analytics,
|
|
108
|
-
"Content-Type": "application/json",
|
|
109
|
-
authorization
|
|
110
|
-
},
|
|
114
|
+
headers,
|
|
111
115
|
body: JSON.stringify(input)
|
|
112
116
|
});
|
|
113
117
|
} catch (cause) {
|
|
@@ -149,7 +153,7 @@ function readProcessEnv(key) {
|
|
|
149
153
|
}
|
|
150
154
|
//#endregion
|
|
151
155
|
//#region package.json
|
|
152
|
-
var version = "1.0.
|
|
156
|
+
var version = "1.0.13";
|
|
153
157
|
//#endregion
|
|
154
158
|
//#region src/clients/account.ts
|
|
155
159
|
var AccountStatusClient = class {
|
|
@@ -278,12 +282,50 @@ var CalendarClient = class {
|
|
|
278
282
|
}
|
|
279
283
|
};
|
|
280
284
|
//#endregion
|
|
285
|
+
//#region src/clients/company.ts
|
|
286
|
+
var CompanyClient = class {
|
|
287
|
+
api;
|
|
288
|
+
constructor(api) {
|
|
289
|
+
this.api = api;
|
|
290
|
+
}
|
|
291
|
+
list(input = {}) {
|
|
292
|
+
return this.api.call("company/list", input);
|
|
293
|
+
}
|
|
294
|
+
get(input = {}) {
|
|
295
|
+
return this.api.call("company/get", input);
|
|
296
|
+
}
|
|
297
|
+
add(input) {
|
|
298
|
+
return this.api.call("company/add", input);
|
|
299
|
+
}
|
|
300
|
+
update(input) {
|
|
301
|
+
return this.api.call("company/update", input);
|
|
302
|
+
}
|
|
303
|
+
remove(input) {
|
|
304
|
+
return this.api.call("company/remove", input);
|
|
305
|
+
}
|
|
306
|
+
setup(input) {
|
|
307
|
+
return this.api.call("company/setup", input);
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
//#endregion
|
|
281
311
|
//#region src/clients/connect.ts
|
|
312
|
+
var ConnectAppClient = class {
|
|
313
|
+
api;
|
|
314
|
+
constructor(api) {
|
|
315
|
+
this.api = api;
|
|
316
|
+
}
|
|
317
|
+
get(input) {
|
|
318
|
+
return this.api.call("connect/app/get", input);
|
|
319
|
+
}
|
|
320
|
+
};
|
|
282
321
|
var ConnectAppVersionClient = class {
|
|
283
322
|
api;
|
|
284
323
|
constructor(api) {
|
|
285
324
|
this.api = api;
|
|
286
325
|
}
|
|
326
|
+
get(input) {
|
|
327
|
+
return this.api.call("connect/app/version/get", input);
|
|
328
|
+
}
|
|
287
329
|
add(input) {
|
|
288
330
|
return this.api.call("connect/app/version/add", input);
|
|
289
331
|
}
|
|
@@ -302,10 +344,12 @@ var ConnectScriptClient = class {
|
|
|
302
344
|
};
|
|
303
345
|
var ConnectClient = class {
|
|
304
346
|
api;
|
|
347
|
+
app;
|
|
305
348
|
version;
|
|
306
349
|
script;
|
|
307
350
|
constructor(api) {
|
|
308
351
|
this.api = api;
|
|
352
|
+
this.app = new ConnectAppClient(api);
|
|
309
353
|
this.version = new ConnectAppVersionClient(api);
|
|
310
354
|
this.script = new ConnectScriptClient(api);
|
|
311
355
|
}
|
|
@@ -360,6 +404,7 @@ var TerrosClient = class {
|
|
|
360
404
|
account;
|
|
361
405
|
area;
|
|
362
406
|
calendar;
|
|
407
|
+
company;
|
|
363
408
|
connect;
|
|
364
409
|
user;
|
|
365
410
|
constructor(config = {}) {
|
|
@@ -370,6 +415,7 @@ var TerrosClient = class {
|
|
|
370
415
|
this.account = new AccountClient(api);
|
|
371
416
|
this.area = new AreaClient(api);
|
|
372
417
|
this.calendar = new CalendarClient(api);
|
|
418
|
+
this.company = new CompanyClient(api);
|
|
373
419
|
this.connect = new ConnectClient(api);
|
|
374
420
|
this.user = new UserClient(api);
|
|
375
421
|
}
|