@mitralab.io/sdk-core 0.2.15 → 0.2.16-beta.0
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/CHANGELOG.md +16 -0
- package/README.md +3 -2
- package/contracts/README.md +5 -0
- package/contracts/manifest.json +6 -1
- package/contracts/v0.2.16-beta.0/sdk-parity.json +2902 -0
- package/dist/index.cjs +99 -1
- package/dist/index.d.cts +67 -1
- package/dist/index.d.ts +67 -1
- package/dist/index.js +99 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -798,6 +798,41 @@ function expectEmailTemplatePreview(value, context, errors = defaultSdkCoreError
|
|
|
798
798
|
if (!isNullableString(preview.textBody)) invalidField(context, "textBody", errors);
|
|
799
799
|
return preview;
|
|
800
800
|
}
|
|
801
|
+
function expectEmailSender(value, context, errors = defaultSdkCoreErrorFactory) {
|
|
802
|
+
const sender = expectObject(value, context, errors);
|
|
803
|
+
if (typeof sender.id !== "string") invalidField(context, "id", errors);
|
|
804
|
+
if (typeof sender.email !== "string") invalidField(context, "email", errors);
|
|
805
|
+
if (typeof sender.displayName !== "string") invalidField(context, "displayName", errors);
|
|
806
|
+
if (!isNonEmptyString(sender.status)) invalidField(context, "status", errors);
|
|
807
|
+
if (typeof sender.sharedWithCurrentWorkspace !== "boolean") {
|
|
808
|
+
invalidField(context, "sharedWithCurrentWorkspace", errors);
|
|
809
|
+
}
|
|
810
|
+
if (typeof sender.ownerConfirmationPending !== "boolean") {
|
|
811
|
+
invalidField(context, "ownerConfirmationPending", errors);
|
|
812
|
+
}
|
|
813
|
+
if (typeof sender.createdAt !== "string") invalidField(context, "createdAt", errors);
|
|
814
|
+
if (typeof sender.updatedAt !== "string") invalidField(context, "updatedAt", errors);
|
|
815
|
+
return sender;
|
|
816
|
+
}
|
|
817
|
+
function expectEmailSettings(value, context, errors = defaultSdkCoreErrorFactory) {
|
|
818
|
+
const settings = expectObject(value, context, errors);
|
|
819
|
+
if (typeof settings.appId !== "string") invalidField(context, "appId", errors);
|
|
820
|
+
if (!isNullableString(settings.senderIdentityId)) {
|
|
821
|
+
invalidField(context, "senderIdentityId", errors);
|
|
822
|
+
}
|
|
823
|
+
if (!isNullableString(settings.displayName)) invalidField(context, "displayName", errors);
|
|
824
|
+
if (!isNullableString(settings.replyTo)) invalidField(context, "replyTo", errors);
|
|
825
|
+
if (typeof settings.ownTemplateSendsFromBrand !== "boolean") {
|
|
826
|
+
invalidField(context, "ownTemplateSendsFromBrand", errors);
|
|
827
|
+
}
|
|
828
|
+
const senderContext = `${context} effectiveSender`;
|
|
829
|
+
const sender = expectObject(settings.effectiveSender, senderContext, errors);
|
|
830
|
+
if (typeof sender.email !== "string") invalidField(senderContext, "email", errors);
|
|
831
|
+
if (!isNullableString(sender.displayName)) invalidField(senderContext, "displayName", errors);
|
|
832
|
+
if (!isNonEmptyString(sender.source)) invalidField(senderContext, "source", errors);
|
|
833
|
+
if (!isNullableString(sender.reason)) invalidField(senderContext, "reason", errors);
|
|
834
|
+
return settings;
|
|
835
|
+
}
|
|
801
836
|
function expectAgentDefinition(value, context, errors = defaultSdkCoreErrorFactory) {
|
|
802
837
|
const agent = expectObject(value, context, errors);
|
|
803
838
|
if (typeof agent.id !== "string") invalidField(context, "id", errors);
|
|
@@ -2971,11 +3006,13 @@ function createMembersModule(transport, errors = defaultSdkCoreErrorFactory) {
|
|
|
2971
3006
|
// src/modules/messenger.ts
|
|
2972
3007
|
function createMessengerModule(transport, errors = defaultSdkCoreErrorFactory, getAppId) {
|
|
2973
3008
|
const templatePath = (type) => `/api/v1/email/templates/${encodePathSegment(type, "email template type", errors)}`;
|
|
3009
|
+
const senderPath = (senderId) => `/api/v1/email/identities/${encodePathSegment(senderId, "email sender id", errors)}`;
|
|
2974
3010
|
const currentAppId = () => {
|
|
2975
3011
|
const appId = getAppId?.();
|
|
2976
|
-
if (!appId) configurationError("An appId is required for email
|
|
3012
|
+
if (!appId) configurationError("An appId is required for app email calls", errors);
|
|
2977
3013
|
return appId;
|
|
2978
3014
|
};
|
|
3015
|
+
const settingsPath = () => `/api/v1/email/apps/${encodePathSegment(currentAppId(), "app id", errors)}/settings`;
|
|
2979
3016
|
const preview = async (type, appId) => expectEmailTemplatePreview(
|
|
2980
3017
|
await transport.request(`${templatePath(type)}/preview`, {
|
|
2981
3018
|
method: "GET",
|
|
@@ -3064,6 +3101,60 @@ function createMessengerModule(transport, errors = defaultSdkCoreErrorFactory, g
|
|
|
3064
3101
|
"Delete email template response",
|
|
3065
3102
|
errors
|
|
3066
3103
|
);
|
|
3104
|
+
},
|
|
3105
|
+
async listEmailSenders() {
|
|
3106
|
+
return expectObjectArray(
|
|
3107
|
+
await transport.request("/api/v1/email/identities/workspace", { method: "GET" }),
|
|
3108
|
+
"Email sender list response",
|
|
3109
|
+
errors,
|
|
3110
|
+
expectEmailSender
|
|
3111
|
+
);
|
|
3112
|
+
},
|
|
3113
|
+
async registerEmailSender(input) {
|
|
3114
|
+
return expectEmailSender(
|
|
3115
|
+
await transport.request("/api/v1/email/identities", {
|
|
3116
|
+
method: "POST",
|
|
3117
|
+
body: { email: input.email, displayName: input.displayName }
|
|
3118
|
+
}),
|
|
3119
|
+
"Register email sender response",
|
|
3120
|
+
errors
|
|
3121
|
+
);
|
|
3122
|
+
},
|
|
3123
|
+
async resendEmailSenderVerification(senderId) {
|
|
3124
|
+
return expectEmailSender(
|
|
3125
|
+
await transport.request(`${senderPath(senderId)}/resend-verification`, {
|
|
3126
|
+
method: "POST"
|
|
3127
|
+
}),
|
|
3128
|
+
"Resend email sender verification response",
|
|
3129
|
+
errors
|
|
3130
|
+
);
|
|
3131
|
+
},
|
|
3132
|
+
async confirmEmailSender(senderId, code) {
|
|
3133
|
+
return expectEmailSender(
|
|
3134
|
+
await transport.request(`${senderPath(senderId)}/confirm`, {
|
|
3135
|
+
method: "POST",
|
|
3136
|
+
body: { code }
|
|
3137
|
+
}),
|
|
3138
|
+
"Confirm email sender response",
|
|
3139
|
+
errors
|
|
3140
|
+
);
|
|
3141
|
+
},
|
|
3142
|
+
async getEmailSettings() {
|
|
3143
|
+
return expectEmailSettings(
|
|
3144
|
+
await transport.request(settingsPath(), { method: "GET" }),
|
|
3145
|
+
"Email settings response",
|
|
3146
|
+
errors
|
|
3147
|
+
);
|
|
3148
|
+
},
|
|
3149
|
+
async updateEmailSettings(input) {
|
|
3150
|
+
return expectEmailSettings(
|
|
3151
|
+
await transport.request(settingsPath(), {
|
|
3152
|
+
method: "PUT",
|
|
3153
|
+
body: settingsBody(input)
|
|
3154
|
+
}),
|
|
3155
|
+
"Update email settings response",
|
|
3156
|
+
errors
|
|
3157
|
+
);
|
|
3067
3158
|
}
|
|
3068
3159
|
};
|
|
3069
3160
|
}
|
|
@@ -3087,6 +3178,13 @@ function templateBody(appId, input) {
|
|
|
3087
3178
|
...input.textBody === void 0 ? {} : { textBody: input.textBody }
|
|
3088
3179
|
};
|
|
3089
3180
|
}
|
|
3181
|
+
function settingsBody(input) {
|
|
3182
|
+
return {
|
|
3183
|
+
...input.senderIdentityId === void 0 ? {} : { senderIdentityId: input.senderIdentityId },
|
|
3184
|
+
...input.displayName === void 0 ? {} : { displayName: input.displayName },
|
|
3185
|
+
...input.replyTo === void 0 ? {} : { replyTo: input.replyTo }
|
|
3186
|
+
};
|
|
3187
|
+
}
|
|
3090
3188
|
|
|
3091
3189
|
// src/modules/publicFunctions.ts
|
|
3092
3190
|
function createPublicFunctionsModule(transport, errors = defaultSdkCoreErrorFactory) {
|
package/dist/index.d.cts
CHANGED
|
@@ -1358,6 +1358,53 @@ interface EmailTemplateUpsertResult {
|
|
|
1358
1358
|
/** The transport or response error of the preview, unchanged, when `preview` is null. */
|
|
1359
1359
|
previewError?: unknown;
|
|
1360
1360
|
}
|
|
1361
|
+
/** An address of a person, available as a sender in the app's workspace. */
|
|
1362
|
+
interface EmailSender {
|
|
1363
|
+
id: string;
|
|
1364
|
+
email: string;
|
|
1365
|
+
displayName: string;
|
|
1366
|
+
/**
|
|
1367
|
+
* `PENDING`, `VERIFIED` or `FAILED`. Kept as a string so a status Messenger adds later does not
|
|
1368
|
+
* break the list. Only a `VERIFIED` address signs the app's emails.
|
|
1369
|
+
*/
|
|
1370
|
+
status: string;
|
|
1371
|
+
sharedWithCurrentWorkspace: boolean;
|
|
1372
|
+
/** True until the person confirms the 6-digit code Messenger sent to the address. */
|
|
1373
|
+
ownerConfirmationPending: boolean;
|
|
1374
|
+
createdAt: string;
|
|
1375
|
+
updatedAt: string;
|
|
1376
|
+
}
|
|
1377
|
+
interface EmailSenderInput {
|
|
1378
|
+
email: string;
|
|
1379
|
+
/** Name of the address; the app settings may override it in the From header. */
|
|
1380
|
+
displayName: string;
|
|
1381
|
+
}
|
|
1382
|
+
/** The From the app's emails use now, which falls back to the brand while the app sender cannot sign. */
|
|
1383
|
+
interface EffectiveEmailSender {
|
|
1384
|
+
email: string;
|
|
1385
|
+
displayName: string | null;
|
|
1386
|
+
/** `APP_SENDER` or `BRAND_DEFAULT`, as a string for the same reason as `EmailSender.status`. */
|
|
1387
|
+
source: string;
|
|
1388
|
+
/** Why the brand signs: `NO_SETTINGS`, `IDENTITY_NOT_VERIFIED` or `IDENTITY_NOT_SHARED`. */
|
|
1389
|
+
reason: string | null;
|
|
1390
|
+
}
|
|
1391
|
+
interface EmailSettings {
|
|
1392
|
+
appId: string;
|
|
1393
|
+
senderIdentityId: string | null;
|
|
1394
|
+
displayName: string | null;
|
|
1395
|
+
replyTo: string | null;
|
|
1396
|
+
effectiveSender: EffectiveEmailSender;
|
|
1397
|
+
/** True when the app's own templates go out even while the brand signs. */
|
|
1398
|
+
ownTemplateSendsFromBrand: boolean;
|
|
1399
|
+
}
|
|
1400
|
+
/** Replaces the app's settings as a whole: a field left out or null is cleared. */
|
|
1401
|
+
interface EmailSettingsInput {
|
|
1402
|
+
/** An `EmailSender.id` from `listEmailSenders`; without it the app sends from the brand. */
|
|
1403
|
+
senderIdentityId?: string | null;
|
|
1404
|
+
/** Single line, shown in the From header. */
|
|
1405
|
+
displayName?: string | null;
|
|
1406
|
+
replyTo?: string | null;
|
|
1407
|
+
}
|
|
1361
1408
|
interface AppContext {
|
|
1362
1409
|
appId: string;
|
|
1363
1410
|
app: AppDefinition;
|
|
@@ -1871,6 +1918,25 @@ interface MessengerModule {
|
|
|
1871
1918
|
previewEmailTemplate(type: EmailTemplateType): Promise<EmailTemplatePreview>;
|
|
1872
1919
|
/** Deletes the current app's version of a template, so the platform text applies again. */
|
|
1873
1920
|
deleteEmailTemplate(type: EmailTemplateType): Promise<void>;
|
|
1921
|
+
/** Lists the addresses available as senders in the workspace of the token. */
|
|
1922
|
+
listEmailSenders(): Promise<EmailSender[]>;
|
|
1923
|
+
/**
|
|
1924
|
+
* Registers an address in the name of the person in the token and makes it available in the
|
|
1925
|
+
* app's workspace. An address the person already owns comes back as saved, made available too.
|
|
1926
|
+
* Messenger mails a verification link and a 6-digit code to the address.
|
|
1927
|
+
*/
|
|
1928
|
+
registerEmailSender(input: EmailSenderInput): Promise<EmailSender>;
|
|
1929
|
+
/**
|
|
1930
|
+
* Mails the AWS link again while AWS has not verified the address, and a new code only while
|
|
1931
|
+
* the person has not confirmed one yet.
|
|
1932
|
+
*/
|
|
1933
|
+
resendEmailSenderVerification(senderId: string): Promise<EmailSender>;
|
|
1934
|
+
/** Confirms the 6-digit code the person read in the mailbox of the address. */
|
|
1935
|
+
confirmEmailSender(senderId: string, code: string): Promise<EmailSender>;
|
|
1936
|
+
/** Gets the current app's sender settings and the From its emails use now. */
|
|
1937
|
+
getEmailSettings(): Promise<EmailSettings>;
|
|
1938
|
+
/** Replaces the current app's sender settings; a field left out is cleared. */
|
|
1939
|
+
updateEmailSettings(input: EmailSettingsInput): Promise<EmailSettings>;
|
|
1874
1940
|
}
|
|
1875
1941
|
declare function createMessengerModule(transport: Transport, errors?: SdkCoreErrorFactory, getAppId?: () => string | undefined): MessengerModule;
|
|
1876
1942
|
|
|
@@ -2264,4 +2330,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
|
|
|
2264
2330
|
declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
|
|
2265
2331
|
declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
|
|
2266
2332
|
|
|
2267
|
-
export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentInput, type AgentMessage, type AgentModel, type AgentProviderUsage, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CredentialUsage, type CredentialUsageWindow, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmailTemplate, type EmailTemplateInput, type EmailTemplatePreview, type EmailTemplateType, type EmailTemplateTypeCatalog, type EmailTemplateUpsertResult, type EmailTemplateVariable, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SendEmailInput, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
|
|
2333
|
+
export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentInput, type AgentMessage, type AgentModel, type AgentProviderUsage, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CredentialUsage, type CredentialUsageWindow, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EffectiveEmailSender, type EmailSender, type EmailSenderInput, type EmailSettings, type EmailSettingsInput, type EmailTemplate, type EmailTemplateInput, type EmailTemplatePreview, type EmailTemplateType, type EmailTemplateTypeCatalog, type EmailTemplateUpsertResult, type EmailTemplateVariable, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SendEmailInput, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1358,6 +1358,53 @@ interface EmailTemplateUpsertResult {
|
|
|
1358
1358
|
/** The transport or response error of the preview, unchanged, when `preview` is null. */
|
|
1359
1359
|
previewError?: unknown;
|
|
1360
1360
|
}
|
|
1361
|
+
/** An address of a person, available as a sender in the app's workspace. */
|
|
1362
|
+
interface EmailSender {
|
|
1363
|
+
id: string;
|
|
1364
|
+
email: string;
|
|
1365
|
+
displayName: string;
|
|
1366
|
+
/**
|
|
1367
|
+
* `PENDING`, `VERIFIED` or `FAILED`. Kept as a string so a status Messenger adds later does not
|
|
1368
|
+
* break the list. Only a `VERIFIED` address signs the app's emails.
|
|
1369
|
+
*/
|
|
1370
|
+
status: string;
|
|
1371
|
+
sharedWithCurrentWorkspace: boolean;
|
|
1372
|
+
/** True until the person confirms the 6-digit code Messenger sent to the address. */
|
|
1373
|
+
ownerConfirmationPending: boolean;
|
|
1374
|
+
createdAt: string;
|
|
1375
|
+
updatedAt: string;
|
|
1376
|
+
}
|
|
1377
|
+
interface EmailSenderInput {
|
|
1378
|
+
email: string;
|
|
1379
|
+
/** Name of the address; the app settings may override it in the From header. */
|
|
1380
|
+
displayName: string;
|
|
1381
|
+
}
|
|
1382
|
+
/** The From the app's emails use now, which falls back to the brand while the app sender cannot sign. */
|
|
1383
|
+
interface EffectiveEmailSender {
|
|
1384
|
+
email: string;
|
|
1385
|
+
displayName: string | null;
|
|
1386
|
+
/** `APP_SENDER` or `BRAND_DEFAULT`, as a string for the same reason as `EmailSender.status`. */
|
|
1387
|
+
source: string;
|
|
1388
|
+
/** Why the brand signs: `NO_SETTINGS`, `IDENTITY_NOT_VERIFIED` or `IDENTITY_NOT_SHARED`. */
|
|
1389
|
+
reason: string | null;
|
|
1390
|
+
}
|
|
1391
|
+
interface EmailSettings {
|
|
1392
|
+
appId: string;
|
|
1393
|
+
senderIdentityId: string | null;
|
|
1394
|
+
displayName: string | null;
|
|
1395
|
+
replyTo: string | null;
|
|
1396
|
+
effectiveSender: EffectiveEmailSender;
|
|
1397
|
+
/** True when the app's own templates go out even while the brand signs. */
|
|
1398
|
+
ownTemplateSendsFromBrand: boolean;
|
|
1399
|
+
}
|
|
1400
|
+
/** Replaces the app's settings as a whole: a field left out or null is cleared. */
|
|
1401
|
+
interface EmailSettingsInput {
|
|
1402
|
+
/** An `EmailSender.id` from `listEmailSenders`; without it the app sends from the brand. */
|
|
1403
|
+
senderIdentityId?: string | null;
|
|
1404
|
+
/** Single line, shown in the From header. */
|
|
1405
|
+
displayName?: string | null;
|
|
1406
|
+
replyTo?: string | null;
|
|
1407
|
+
}
|
|
1361
1408
|
interface AppContext {
|
|
1362
1409
|
appId: string;
|
|
1363
1410
|
app: AppDefinition;
|
|
@@ -1871,6 +1918,25 @@ interface MessengerModule {
|
|
|
1871
1918
|
previewEmailTemplate(type: EmailTemplateType): Promise<EmailTemplatePreview>;
|
|
1872
1919
|
/** Deletes the current app's version of a template, so the platform text applies again. */
|
|
1873
1920
|
deleteEmailTemplate(type: EmailTemplateType): Promise<void>;
|
|
1921
|
+
/** Lists the addresses available as senders in the workspace of the token. */
|
|
1922
|
+
listEmailSenders(): Promise<EmailSender[]>;
|
|
1923
|
+
/**
|
|
1924
|
+
* Registers an address in the name of the person in the token and makes it available in the
|
|
1925
|
+
* app's workspace. An address the person already owns comes back as saved, made available too.
|
|
1926
|
+
* Messenger mails a verification link and a 6-digit code to the address.
|
|
1927
|
+
*/
|
|
1928
|
+
registerEmailSender(input: EmailSenderInput): Promise<EmailSender>;
|
|
1929
|
+
/**
|
|
1930
|
+
* Mails the AWS link again while AWS has not verified the address, and a new code only while
|
|
1931
|
+
* the person has not confirmed one yet.
|
|
1932
|
+
*/
|
|
1933
|
+
resendEmailSenderVerification(senderId: string): Promise<EmailSender>;
|
|
1934
|
+
/** Confirms the 6-digit code the person read in the mailbox of the address. */
|
|
1935
|
+
confirmEmailSender(senderId: string, code: string): Promise<EmailSender>;
|
|
1936
|
+
/** Gets the current app's sender settings and the From its emails use now. */
|
|
1937
|
+
getEmailSettings(): Promise<EmailSettings>;
|
|
1938
|
+
/** Replaces the current app's sender settings; a field left out is cleared. */
|
|
1939
|
+
updateEmailSettings(input: EmailSettingsInput): Promise<EmailSettings>;
|
|
1874
1940
|
}
|
|
1875
1941
|
declare function createMessengerModule(transport: Transport, errors?: SdkCoreErrorFactory, getAppId?: () => string | undefined): MessengerModule;
|
|
1876
1942
|
|
|
@@ -2264,4 +2330,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
|
|
|
2264
2330
|
declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
|
|
2265
2331
|
declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
|
|
2266
2332
|
|
|
2267
|
-
export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentInput, type AgentMessage, type AgentModel, type AgentProviderUsage, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CredentialUsage, type CredentialUsageWindow, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmailTemplate, type EmailTemplateInput, type EmailTemplatePreview, type EmailTemplateType, type EmailTemplateTypeCatalog, type EmailTemplateUpsertResult, type EmailTemplateVariable, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SendEmailInput, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
|
|
2333
|
+
export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentInput, type AgentMessage, type AgentModel, type AgentProviderUsage, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CredentialUsage, type CredentialUsageWindow, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EffectiveEmailSender, type EmailSender, type EmailSenderInput, type EmailSettings, type EmailSettingsInput, type EmailTemplate, type EmailTemplateInput, type EmailTemplatePreview, type EmailTemplateType, type EmailTemplateTypeCatalog, type EmailTemplateUpsertResult, type EmailTemplateVariable, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SendEmailInput, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
|
package/dist/index.js
CHANGED
|
@@ -726,6 +726,41 @@ function expectEmailTemplatePreview(value, context, errors = defaultSdkCoreError
|
|
|
726
726
|
if (!isNullableString(preview.textBody)) invalidField(context, "textBody", errors);
|
|
727
727
|
return preview;
|
|
728
728
|
}
|
|
729
|
+
function expectEmailSender(value, context, errors = defaultSdkCoreErrorFactory) {
|
|
730
|
+
const sender = expectObject(value, context, errors);
|
|
731
|
+
if (typeof sender.id !== "string") invalidField(context, "id", errors);
|
|
732
|
+
if (typeof sender.email !== "string") invalidField(context, "email", errors);
|
|
733
|
+
if (typeof sender.displayName !== "string") invalidField(context, "displayName", errors);
|
|
734
|
+
if (!isNonEmptyString(sender.status)) invalidField(context, "status", errors);
|
|
735
|
+
if (typeof sender.sharedWithCurrentWorkspace !== "boolean") {
|
|
736
|
+
invalidField(context, "sharedWithCurrentWorkspace", errors);
|
|
737
|
+
}
|
|
738
|
+
if (typeof sender.ownerConfirmationPending !== "boolean") {
|
|
739
|
+
invalidField(context, "ownerConfirmationPending", errors);
|
|
740
|
+
}
|
|
741
|
+
if (typeof sender.createdAt !== "string") invalidField(context, "createdAt", errors);
|
|
742
|
+
if (typeof sender.updatedAt !== "string") invalidField(context, "updatedAt", errors);
|
|
743
|
+
return sender;
|
|
744
|
+
}
|
|
745
|
+
function expectEmailSettings(value, context, errors = defaultSdkCoreErrorFactory) {
|
|
746
|
+
const settings = expectObject(value, context, errors);
|
|
747
|
+
if (typeof settings.appId !== "string") invalidField(context, "appId", errors);
|
|
748
|
+
if (!isNullableString(settings.senderIdentityId)) {
|
|
749
|
+
invalidField(context, "senderIdentityId", errors);
|
|
750
|
+
}
|
|
751
|
+
if (!isNullableString(settings.displayName)) invalidField(context, "displayName", errors);
|
|
752
|
+
if (!isNullableString(settings.replyTo)) invalidField(context, "replyTo", errors);
|
|
753
|
+
if (typeof settings.ownTemplateSendsFromBrand !== "boolean") {
|
|
754
|
+
invalidField(context, "ownTemplateSendsFromBrand", errors);
|
|
755
|
+
}
|
|
756
|
+
const senderContext = `${context} effectiveSender`;
|
|
757
|
+
const sender = expectObject(settings.effectiveSender, senderContext, errors);
|
|
758
|
+
if (typeof sender.email !== "string") invalidField(senderContext, "email", errors);
|
|
759
|
+
if (!isNullableString(sender.displayName)) invalidField(senderContext, "displayName", errors);
|
|
760
|
+
if (!isNonEmptyString(sender.source)) invalidField(senderContext, "source", errors);
|
|
761
|
+
if (!isNullableString(sender.reason)) invalidField(senderContext, "reason", errors);
|
|
762
|
+
return settings;
|
|
763
|
+
}
|
|
729
764
|
function expectAgentDefinition(value, context, errors = defaultSdkCoreErrorFactory) {
|
|
730
765
|
const agent = expectObject(value, context, errors);
|
|
731
766
|
if (typeof agent.id !== "string") invalidField(context, "id", errors);
|
|
@@ -2899,11 +2934,13 @@ function createMembersModule(transport, errors = defaultSdkCoreErrorFactory) {
|
|
|
2899
2934
|
// src/modules/messenger.ts
|
|
2900
2935
|
function createMessengerModule(transport, errors = defaultSdkCoreErrorFactory, getAppId) {
|
|
2901
2936
|
const templatePath = (type) => `/api/v1/email/templates/${encodePathSegment(type, "email template type", errors)}`;
|
|
2937
|
+
const senderPath = (senderId) => `/api/v1/email/identities/${encodePathSegment(senderId, "email sender id", errors)}`;
|
|
2902
2938
|
const currentAppId = () => {
|
|
2903
2939
|
const appId = getAppId?.();
|
|
2904
|
-
if (!appId) configurationError("An appId is required for email
|
|
2940
|
+
if (!appId) configurationError("An appId is required for app email calls", errors);
|
|
2905
2941
|
return appId;
|
|
2906
2942
|
};
|
|
2943
|
+
const settingsPath = () => `/api/v1/email/apps/${encodePathSegment(currentAppId(), "app id", errors)}/settings`;
|
|
2907
2944
|
const preview = async (type, appId) => expectEmailTemplatePreview(
|
|
2908
2945
|
await transport.request(`${templatePath(type)}/preview`, {
|
|
2909
2946
|
method: "GET",
|
|
@@ -2992,6 +3029,60 @@ function createMessengerModule(transport, errors = defaultSdkCoreErrorFactory, g
|
|
|
2992
3029
|
"Delete email template response",
|
|
2993
3030
|
errors
|
|
2994
3031
|
);
|
|
3032
|
+
},
|
|
3033
|
+
async listEmailSenders() {
|
|
3034
|
+
return expectObjectArray(
|
|
3035
|
+
await transport.request("/api/v1/email/identities/workspace", { method: "GET" }),
|
|
3036
|
+
"Email sender list response",
|
|
3037
|
+
errors,
|
|
3038
|
+
expectEmailSender
|
|
3039
|
+
);
|
|
3040
|
+
},
|
|
3041
|
+
async registerEmailSender(input) {
|
|
3042
|
+
return expectEmailSender(
|
|
3043
|
+
await transport.request("/api/v1/email/identities", {
|
|
3044
|
+
method: "POST",
|
|
3045
|
+
body: { email: input.email, displayName: input.displayName }
|
|
3046
|
+
}),
|
|
3047
|
+
"Register email sender response",
|
|
3048
|
+
errors
|
|
3049
|
+
);
|
|
3050
|
+
},
|
|
3051
|
+
async resendEmailSenderVerification(senderId) {
|
|
3052
|
+
return expectEmailSender(
|
|
3053
|
+
await transport.request(`${senderPath(senderId)}/resend-verification`, {
|
|
3054
|
+
method: "POST"
|
|
3055
|
+
}),
|
|
3056
|
+
"Resend email sender verification response",
|
|
3057
|
+
errors
|
|
3058
|
+
);
|
|
3059
|
+
},
|
|
3060
|
+
async confirmEmailSender(senderId, code) {
|
|
3061
|
+
return expectEmailSender(
|
|
3062
|
+
await transport.request(`${senderPath(senderId)}/confirm`, {
|
|
3063
|
+
method: "POST",
|
|
3064
|
+
body: { code }
|
|
3065
|
+
}),
|
|
3066
|
+
"Confirm email sender response",
|
|
3067
|
+
errors
|
|
3068
|
+
);
|
|
3069
|
+
},
|
|
3070
|
+
async getEmailSettings() {
|
|
3071
|
+
return expectEmailSettings(
|
|
3072
|
+
await transport.request(settingsPath(), { method: "GET" }),
|
|
3073
|
+
"Email settings response",
|
|
3074
|
+
errors
|
|
3075
|
+
);
|
|
3076
|
+
},
|
|
3077
|
+
async updateEmailSettings(input) {
|
|
3078
|
+
return expectEmailSettings(
|
|
3079
|
+
await transport.request(settingsPath(), {
|
|
3080
|
+
method: "PUT",
|
|
3081
|
+
body: settingsBody(input)
|
|
3082
|
+
}),
|
|
3083
|
+
"Update email settings response",
|
|
3084
|
+
errors
|
|
3085
|
+
);
|
|
2995
3086
|
}
|
|
2996
3087
|
};
|
|
2997
3088
|
}
|
|
@@ -3015,6 +3106,13 @@ function templateBody(appId, input) {
|
|
|
3015
3106
|
...input.textBody === void 0 ? {} : { textBody: input.textBody }
|
|
3016
3107
|
};
|
|
3017
3108
|
}
|
|
3109
|
+
function settingsBody(input) {
|
|
3110
|
+
return {
|
|
3111
|
+
...input.senderIdentityId === void 0 ? {} : { senderIdentityId: input.senderIdentityId },
|
|
3112
|
+
...input.displayName === void 0 ? {} : { displayName: input.displayName },
|
|
3113
|
+
...input.replyTo === void 0 ? {} : { replyTo: input.replyTo }
|
|
3114
|
+
};
|
|
3115
|
+
}
|
|
3018
3116
|
|
|
3019
3117
|
// src/modules/publicFunctions.ts
|
|
3020
3118
|
function createPublicFunctionsModule(transport, errors = defaultSdkCoreErrorFactory) {
|