@terros-inc/sdk 1.0.8 → 1.0.10
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 +46 -5
- package/dist/index.mjs +11 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -89,7 +89,6 @@ type SmallAddress = Pick<Address, 'countrySubd' | 'line1' | 'locality' | 'postal
|
|
|
89
89
|
};
|
|
90
90
|
//#endregion
|
|
91
91
|
//#region src/models/company/model.d.ts
|
|
92
|
-
type CompanyState = 'active' | 'trial' | 'internal' | 'demo' | 'sandbox' | 'template' | 'suspended';
|
|
93
92
|
type CompanyKind = 'customer' | 'sandbox' | 'demo' | 'template' | 'development';
|
|
94
93
|
type AccessStatus = 'active' | 'suspended';
|
|
95
94
|
type BillingMethod = 'stripe' | 'none';
|
|
@@ -99,12 +98,11 @@ type CompanyData = {
|
|
|
99
98
|
companyId: CompanyId;
|
|
100
99
|
name: string;
|
|
101
100
|
legalName?: string;
|
|
102
|
-
kind
|
|
103
|
-
accessStatus
|
|
101
|
+
kind: CompanyKind;
|
|
102
|
+
accessStatus: AccessStatus;
|
|
104
103
|
internalOwnerId?: UserId;
|
|
105
104
|
billingEmail?: string;
|
|
106
105
|
billingMethod?: BillingMethod;
|
|
107
|
-
state: CompanyState;
|
|
108
106
|
maxUsers?: number;
|
|
109
107
|
size?: number;
|
|
110
108
|
industries?: CompanyIndustry[];
|
|
@@ -1040,6 +1038,31 @@ type VersionUpdateSuccess = ApiSuccess<{
|
|
|
1040
1038
|
appVersion: AppVersionData;
|
|
1041
1039
|
}>;
|
|
1042
1040
|
//#endregion
|
|
1041
|
+
//#region src/models/webhook.d.ts
|
|
1042
|
+
type WebhookAuditProps = {
|
|
1043
|
+
createdAt: string;
|
|
1044
|
+
updatedAt: string;
|
|
1045
|
+
};
|
|
1046
|
+
type WebhookAddUpdatePayload<Entity extends string, Payload> = {
|
|
1047
|
+
entity: Entity;
|
|
1048
|
+
action: 'add' | 'update';
|
|
1049
|
+
data: Payload;
|
|
1050
|
+
};
|
|
1051
|
+
type WebhookRemovePayload<Entity extends string, Payload> = {
|
|
1052
|
+
entity: Entity;
|
|
1053
|
+
action: 'remove';
|
|
1054
|
+
data: Payload;
|
|
1055
|
+
};
|
|
1056
|
+
type WebhookPayload<Entity extends string, DataPayload, Key extends keyof DataPayload> = WebhookAddUpdatePayload<Entity, DataPayload> | WebhookRemovePayload<Entity, DataPayload[Key]>;
|
|
1057
|
+
type UserWebhookData = WebhookAuditProps & Pick<UserProfileData, 'firstName' | 'lastName' | 'email' | 'phone' | 'clientUserId' | 'preferredName' | 'timeZone' | 'closerStatus' | 'isDeleted' | 'customFields'> & {
|
|
1058
|
+
id: UserId;
|
|
1059
|
+
};
|
|
1060
|
+
type UserWebhook = WebhookPayload<'User', UserWebhookData, 'id'>;
|
|
1061
|
+
type CompanyWebhookData = WebhookAuditProps & Omit<CompanyData, 'companyId'> & {
|
|
1062
|
+
id: CompanyId;
|
|
1063
|
+
};
|
|
1064
|
+
type CompanyWebhook = WebhookPayload<'Company', CompanyWebhookData, 'id'>;
|
|
1065
|
+
//#endregion
|
|
1043
1066
|
//#region src/clients/account.d.ts
|
|
1044
1067
|
declare class AccountStatusClient {
|
|
1045
1068
|
private readonly api;
|
|
@@ -1131,4 +1154,22 @@ declare class TerrosClient {
|
|
|
1131
1154
|
constructor(config?: TerrosClientConfig);
|
|
1132
1155
|
}
|
|
1133
1156
|
//#endregion
|
|
1134
|
-
|
|
1157
|
+
//#region src/connect/handler.d.ts
|
|
1158
|
+
type ConnectHandlerFunction<Input, Result> = (payload: ConnectExecutionInput<Input>, client: TerrosApiClient) => Promise<Result>;
|
|
1159
|
+
type ConnectExecutionConfig = {
|
|
1160
|
+
scriptConfig: Record<string, string>;
|
|
1161
|
+
secrets: Record<string, string>;
|
|
1162
|
+
authorization?: string;
|
|
1163
|
+
};
|
|
1164
|
+
type ConnectExecutionContext<Payload> = {
|
|
1165
|
+
payload: Payload;
|
|
1166
|
+
config: ConnectExecutionConfig;
|
|
1167
|
+
};
|
|
1168
|
+
type ConnectExecutionInput<Payload> = {
|
|
1169
|
+
runId: `ConnectRun.${string}`;
|
|
1170
|
+
context: ConnectExecutionContext<Payload>;
|
|
1171
|
+
};
|
|
1172
|
+
type WrappedHandler<Input, Result> = (input: ConnectExecutionInput<Input>) => Promise<Result>;
|
|
1173
|
+
declare function wrapConnectHandler<Input, Result = void>(handler: ConnectHandlerFunction<Input, Result>): WrappedHandler<Input, Result>;
|
|
1174
|
+
//#endregion
|
|
1175
|
+
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, 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 };
|
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.
|
|
152
|
+
var version = "1.0.10";
|
|
153
153
|
//#endregion
|
|
154
154
|
//#region src/clients/account.ts
|
|
155
155
|
var AccountStatusClient = class {
|
|
@@ -347,4 +347,13 @@ var TerrosClient = class {
|
|
|
347
347
|
}
|
|
348
348
|
};
|
|
349
349
|
//#endregion
|
|
350
|
-
|
|
350
|
+
//#region src/connect/handler.ts
|
|
351
|
+
function wrapConnectHandler(handler) {
|
|
352
|
+
return async (input) => {
|
|
353
|
+
const apiKey = input.context.config.authorization;
|
|
354
|
+
delete input.context.config.authorization;
|
|
355
|
+
return await handler(input, new TerrosApiClient({ apiKey: apiKey?.replace(/^ApiKey /, "") }));
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
//#endregion
|
|
359
|
+
export { TerrosClient, wrapConnectHandler };
|