@terros-inc/sdk 1.0.8 → 1.0.9
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 +44 -1
- package/dist/index.mjs +11 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1040,6 +1040,31 @@ type VersionUpdateSuccess = ApiSuccess<{
|
|
|
1040
1040
|
appVersion: AppVersionData;
|
|
1041
1041
|
}>;
|
|
1042
1042
|
//#endregion
|
|
1043
|
+
//#region src/models/webhook.d.ts
|
|
1044
|
+
type WebhookAuditProps = {
|
|
1045
|
+
createdAt: string;
|
|
1046
|
+
updatedAt: string;
|
|
1047
|
+
};
|
|
1048
|
+
type WebhookAddUpdatePayload<Entity extends string, Payload> = {
|
|
1049
|
+
entity: Entity;
|
|
1050
|
+
action: 'add' | 'update';
|
|
1051
|
+
data: Payload;
|
|
1052
|
+
};
|
|
1053
|
+
type WebhookRemovePayload<Entity extends string, Payload> = {
|
|
1054
|
+
entity: Entity;
|
|
1055
|
+
action: 'remove';
|
|
1056
|
+
data: Payload;
|
|
1057
|
+
};
|
|
1058
|
+
type WebhookPayload<Entity extends string, DataPayload, Key extends keyof DataPayload> = WebhookAddUpdatePayload<Entity, DataPayload> | WebhookRemovePayload<Entity, DataPayload[Key]>;
|
|
1059
|
+
type UserWebhookData = WebhookAuditProps & Pick<UserProfileData, 'firstName' | 'lastName' | 'email' | 'phone' | 'clientUserId' | 'preferredName' | 'timeZone' | 'closerStatus' | 'isDeleted' | 'customFields'> & {
|
|
1060
|
+
id: UserId;
|
|
1061
|
+
};
|
|
1062
|
+
type UserWebhook = WebhookPayload<'User', UserWebhookData, 'id'>;
|
|
1063
|
+
type CompanyWebhookData = WebhookAuditProps & Omit<CompanyData, 'companyId'> & {
|
|
1064
|
+
id: CompanyId;
|
|
1065
|
+
};
|
|
1066
|
+
type CompanyWebhook = WebhookPayload<'Company', CompanyWebhookData, 'id'>;
|
|
1067
|
+
//#endregion
|
|
1043
1068
|
//#region src/clients/account.d.ts
|
|
1044
1069
|
declare class AccountStatusClient {
|
|
1045
1070
|
private readonly api;
|
|
@@ -1131,4 +1156,22 @@ declare class TerrosClient {
|
|
|
1131
1156
|
constructor(config?: TerrosClientConfig);
|
|
1132
1157
|
}
|
|
1133
1158
|
//#endregion
|
|
1134
|
-
|
|
1159
|
+
//#region src/connect/handler.d.ts
|
|
1160
|
+
type ConnectHandlerFunction<Input, Result> = (payload: ConnectExecutionInput<Input>, client: TerrosApiClient) => Promise<Result>;
|
|
1161
|
+
type ConnectExecutionConfig = {
|
|
1162
|
+
scriptConfig: Record<string, string>;
|
|
1163
|
+
secrets: Record<string, string>;
|
|
1164
|
+
authorization?: string;
|
|
1165
|
+
};
|
|
1166
|
+
type ConnectExecutionContext<Payload> = {
|
|
1167
|
+
payload: Payload;
|
|
1168
|
+
config: ConnectExecutionConfig;
|
|
1169
|
+
};
|
|
1170
|
+
type ConnectExecutionInput<Payload> = {
|
|
1171
|
+
runId: `ConnectRun.${string}`;
|
|
1172
|
+
context: ConnectExecutionContext<Payload>;
|
|
1173
|
+
};
|
|
1174
|
+
type WrappedHandler<Input, Result> = (input: ConnectExecutionInput<Input>) => Promise<Result>;
|
|
1175
|
+
declare function wrapConnectHandler<Input, Result = void>(handler: ConnectHandlerFunction<Input, Result>): WrappedHandler<Input, Result>;
|
|
1176
|
+
//#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 };
|
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.9";
|
|
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 }));
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
//#endregion
|
|
359
|
+
export { TerrosClient, wrapConnectHandler };
|