@madewithremy/admin 0.1.0 → 0.1.1

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.ts CHANGED
@@ -1907,7 +1907,10 @@ declare namespace domains {
1907
1907
  * src/http/routes/V2Apps/manage/emailDomains.ts
1908
1908
  * src/http/routes/V2Apps/manage/requestLog.ts (inbox route only)
1909
1909
  * src/common/Db/v2Apps/V2EmailMessagesDao/index.ts
1910
+ * src/common/Db/v2Apps/V2EmailBatchesDao/index.ts
1911
+ * src/common/Db/v2Apps/V2EmailTenantStateDao/index.ts
1910
1912
  * src/common/Db/v2Apps/AppEmailSuppressionsDao/index.ts
1913
+ * src/common/OutboundEmail/batchView.ts
1911
1914
  * src/common/Aws/SesIdentityService.ts
1912
1915
  * src/common/Db/v2Apps/RequestLogDao.ts
1913
1916
  */
@@ -1959,7 +1962,20 @@ interface EmailSummary {
1959
1962
  }>;
1960
1963
  }
1961
1964
  /**
1962
- * One fan-out blast, aggregated (V2EmailMessagesDao.listBatches / getBatch).
1965
+ * Lifecycle of a QUEUED send (batchView.ts / V2EmailBatchesDao). Large or
1966
+ * marketing sends are accepted immediately and delivered by a worker in
1967
+ * chunks, so a blast can legitimately be observed mid-flight.
1968
+ *
1969
+ * accepted queued, nothing delivered yet
1970
+ * sending chunks are draining
1971
+ * completed every recipient was handed to the provider
1972
+ * partial finished, but some recipients were not sent to
1973
+ * failed finished and nothing was sent
1974
+ */
1975
+ type EmailBatchLifecycle = 'accepted' | 'sending' | 'completed' | 'partial' | 'failed';
1976
+ /**
1977
+ * One fan-out blast, aggregated (batchView.ts — the per-recipient aggregate
1978
+ * enriched with the queued-send lifecycle where one exists).
1963
1979
  * `recipients` is every row in the blast including ones that never reached SES;
1964
1980
  * `accepted` is only those SES took and is the denominator for any rate.
1965
1981
  */
@@ -1970,6 +1986,17 @@ interface EmailBatchSummary {
1970
1986
  recipients: number;
1971
1987
  accepted: number;
1972
1988
  counts: Record<EmailMessageStatus, number>;
1989
+ /**
1990
+ * Lifecycle of the send, when it was QUEUED. `null` for a send delivered
1991
+ * inline (small transactional) and for blasts predating the send queue —
1992
+ * that is a normal, finished send with no in-flight state, NOT an error.
1993
+ */
1994
+ status: EmailBatchLifecycle | null;
1995
+ /** Delivery-chunk progress, when queued. Null otherwise. */
1996
+ chunksTotal: number | null;
1997
+ chunksDone: number | null;
1998
+ /** Recipients not yet attempted, when queued. Null otherwise. */
1999
+ pending: number | null;
1973
2000
  }
1974
2001
  /** One row from app_email_suppressions (AppEmailSuppressionsDao). */
1975
2002
  interface AppEmailSuppression {
@@ -2095,12 +2122,85 @@ interface EmailSuppressionsResult {
2095
2122
  interface EmailSuppressResult {
2096
2123
  ok: true;
2097
2124
  }
2098
- /** email unsuppress → POST /outbound-email/suppressions/remove */
2125
+ /**
2126
+ * email unsuppress → POST /outbound-email/suppressions/remove
2127
+ *
2128
+ * Three independent outcomes, and only the tenant entry decides deliverability:
2129
+ * removed this app's own suppression row is gone
2130
+ * tenantEntryRemoved the app's SES TENANT suppression entry (a prior hard
2131
+ * bounce or spam report against THIS app) is gone — this
2132
+ * is what actually unblocks mail
2133
+ * platformSuppression non-null = still on SES's ACCOUNT-wide list, which is
2134
+ * never cleared; removal changed nothing about delivery
2135
+ */
2099
2136
  interface EmailUnsuppressResult {
2100
2137
  ok: true;
2101
2138
  removed: boolean;
2139
+ tenantEntryRemoved: boolean;
2102
2140
  platformSuppression: PlatformSuppression | null;
2103
2141
  }
2142
+ /**
2143
+ * email status → GET /outbound-email/status
2144
+ *
2145
+ * Whether this app can send right now, and up to what. Two independent
2146
+ * verdicts, deliberately not collapsed: `ses` is Amazon's view of the app's
2147
+ * tenant and `enforcement` is the platform's own. The fields that decide what
2148
+ * to tell the owner:
2149
+ *
2150
+ * sending.source 'ses' = AMAZON paused it (we cannot lift it; it
2151
+ * clears when the finding clears); 'platform' = we did
2152
+ * enforcement.origin 'operator' = a person placed the hold — it will NOT
2153
+ * lift itself when rates recover; 'platform' = the
2154
+ * automatic sweep, which steps down on its own
2155
+ * ses.status 'REINSTATED' still sends — it means "resuming with
2156
+ * findings open" and returns to ENABLED on recovery
2157
+ */
2158
+ interface EmailSendingStatusResult {
2159
+ sending: {
2160
+ allowed: boolean;
2161
+ reason: string | null;
2162
+ source: 'ses' | 'platform' | null;
2163
+ };
2164
+ enforcement: {
2165
+ level: 'none' | 'throttled' | 'paused';
2166
+ origin: 'platform' | 'operator' | null;
2167
+ reason: string | null;
2168
+ at: string | null;
2169
+ };
2170
+ ses: {
2171
+ status: 'ENABLED' | 'DISABLED' | 'REINSTATED' | null;
2172
+ origin: 'CUSTOMER_MANAGED' | 'AWS_SES_MANAGED' | null;
2173
+ cause: string | null;
2174
+ at: string | null;
2175
+ };
2176
+ /**
2177
+ * The enforcement sweep's last measurement, with its denominator — a rate
2178
+ * without `accepted` is unreadable (1 bounce in 10 sends is "10%" and means
2179
+ * nothing). All null until the sweep has evaluated this app.
2180
+ */
2181
+ evaluation: {
2182
+ accepted: number | null;
2183
+ bounceRate: number | null;
2184
+ complaintRate: number | null;
2185
+ at: string | null;
2186
+ };
2187
+ quota: {
2188
+ unit: string;
2189
+ window: 'day' | 'month' | 'total';
2190
+ /** `null` = unlimited. */
2191
+ limit: number | null;
2192
+ used: number;
2193
+ remaining: number | null;
2194
+ resetsAt: string | null;
2195
+ /**
2196
+ * Where the limit came from: 'platform' is the default; 'app'/'org'/'plan'
2197
+ * is an override — support-granted, or the sweep's automatic throttle.
2198
+ */
2199
+ source: 'app' | 'org' | 'plan' | 'platform';
2200
+ /** When an override lapses and the limit reverts. */
2201
+ expiresAt: string | null;
2202
+ };
2203
+ }
2104
2204
  /** email inbox → GET /inbox */
2105
2205
  interface EmailInboxResult {
2106
2206
  emails: InboxEmailPreview[];
@@ -2155,9 +2255,10 @@ interface EmailListParams {
2155
2255
  /**
2156
2256
  * Comma-separated statuses to include. Values: `suppressed`, `failed`,
2157
2257
  * `sent`, `delivered`, `blocked`, `bounced`, `complained`, `delayed`,
2158
- * `rejected`. Default: all statuses. `blocked` means the platform-wide SES
2159
- * suppression list dropped the message — usually from another tenant's hard
2160
- * bounce — not the app's own suppression list.
2258
+ * `rejected`. Default: all statuses. `blocked` means an SES suppression list
2259
+ * dropped the message before delivery — usually this app's OWN tenant list
2260
+ * (a prior hard bounce or spam report from that address), occasionally the
2261
+ * shared account-wide list. `unsuppress` reports which.
2161
2262
  */
2162
2263
  status?: string;
2163
2264
  /** Origin to filter by: `method` (app-sent) or `auth` (sign-in codes). Default: all. */
@@ -4985,6 +5086,7 @@ declare function buildClient(ctx: AdminContext): {
4985
5086
  list: (params?: EmailListParams | undefined) => Promise<EmailListResult>;
4986
5087
  get: (messageId: string) => Promise<V2EmailMessage>;
4987
5088
  stats: (params?: EmailWindowParams | undefined) => Promise<EmailSummary>;
5089
+ status: () => Promise<EmailSendingStatusResult>;
4988
5090
  batches: (params?: EmailBatchesParams | undefined) => Promise<EmailBatchesResult>;
4989
5091
  batch: (batchId: string) => Promise<EmailBatchSummary>;
4990
5092
  suppressions: (params?: EmailSuppressionsParams | undefined) => Promise<EmailSuppressionsResult>;
@@ -5047,4 +5149,4 @@ declare class AdminTimeoutError extends Error {
5047
5149
 
5048
5150
  declare const admin: AdminClient;
5049
5151
 
5050
- export { AdminApiError, type AdminClient, type AdminClientOptions, type AdminContext, AdminTimeoutError, type AnalyticsAiHostRow, type AnalyticsAiSourcesResult, type AnalyticsAiVendorRow, type AnalyticsBatchResult, type AnalyticsCrawlersOverviewResult, type AnalyticsCrawlersRecentResult, type AnalyticsCrawlersRecentRow, type AnalyticsCrawlersResult, type AnalyticsCrawlersTimeseriesBucket, type AnalyticsCrawlersTimeseriesResult, type AnalyticsLiveResult, type AnalyticsMapPoint, type AnalyticsMapResult, type AnalyticsMetric, type AnalyticsQueryResult, type AnalyticsQueryResultRow, type AnalyticsSourceRow, type AnalyticsSourcesResult, type AppCronJobStatus, type AppCronJobStatusReason, type AppCronRunState, type AppEmailSuppression, type AppSecretRow, type CrashGroup, type CrashOccurrenceRow, type CrashesGetResult, type CrashesListResult, type CrashesOccurrencesResult, type CrashesStatsBucket, type CrashesStatsResult, type CronJobDecorated, type CronOverviewResult, type CronRunResult, type CronRunSummary, type DashboardLiveRelease, type DashboardReleaseMethod, type DashboardResult, type DataLiftFromDevResult, type DataLiftFromLiveResult, type DataSourcesBuildProgress, type DataSourcesChunkingConfig, type DataSourcesConfigResult, type DataSourcesConfigUpdateResult, type DataSourcesDeleteResult, type DataSourcesDocument, type DataSourcesDocumentConfirmResult, type DataSourcesDocumentDeleteResult, type DataSourcesDocumentStatus, type DataSourcesDocumentsResult, type DataSourcesDropResult, type DataSourcesIngestConfig, type DataSourcesIngestUpdate, type DataSourcesListEntry, type DataSourcesListResult, type DataSourcesPromoteResult, type DataSourcesRetrievalConfig, type DataSourcesRetrievalUpdate, type DataSourcesRevectorizeResult, type DataSourcesSearchCitation, type DataSourcesSearchResult, type DataSourcesSearchResultItem, type DataSourcesUploadTokenResult, type DatasetFile, type DbQueryResult, type DiagnosticsAuditEnvironment, type DiagnosticsDashboardResult, type DiagnosticsFinding, type DiagnosticsLighthouseScores, type DiagnosticsPayload, type DiagnosticsReleaseResult, type DiagnosticsRuntimeFindings, type DomainsCheckResult, type DomainsCustomAddResult, type DomainsCustomCheckResult, type DomainsCustomHostnameUiStatus, type DomainsCustomHostnameView, type DomainsCustomListResult, type DomainsCustomRemoveResult, type DomainsCustomRetryResult, type DomainsDnsInstructions, type DomainsGetResult, type DomainsSetResult, type EmailBatchResult, type EmailBatchSummary, type EmailBatchesResult, type EmailDomainBase, type EmailEffectiveSender, type EmailInboxResult, type EmailListResult, type EmailMessageKind, type EmailMessageResult, type EmailMessageStatus, type EmailSenderTier, type EmailStatsResult, type EmailSummary, type EmailSuppressResult, type EmailSuppressionsResult, type EmailUnsuppressResult, type FilesDeleteResult, type FilesFileMeta, type FilesListEntry, type FilesListResult, type FilesLsResult, type FilesScanBadge, type FilesScanFlagged, type FilesScanStore, type FilesStatResult, type FilesStoreSummaryEntry, type FilesUploadUrlResult, type FilesUrlResult, type FrontendErrorType, type InboundDnsInstructions, type InboundEmailDomainAddResult, type InboundEmailDomainCheckResult, type InboundEmailDomainDeleteResult, type InboundEmailDomainUiStatus, type InboundEmailDomainVerifyResult, type InboundEmailDomainView, type InboundEmailDomainsListResult, type InboxEmailPreview, type IssueAuthorKind, type IssueCommentRow, type IssueEventType, type IssueKind, type IssueRow, type IssueStatus, type IssuesCommentResult, type IssuesCreateResult, type IssuesDeleteResult, type IssuesGetResult, type IssuesListResult, type IssuesUpdateResult, type JewelPairRow, type JewelPairSummaryRow, type JewelVerdict, type JewelsDatasetSummary, type JewelsDryrunResult, type JewelsExportResult, type JewelsGradeResult, type JewelsGrading, type JewelsOverviewResult, type JewelsPairResult, type JewelsPairsResult, type JewelsQueueResult, type JewelsResolveResult, type JewelsRunResult, type JewelsRunsResult, type JewelsTimeseriesBucket, type JewelsTimeseriesResult, type JewelsTrainResult, type LiftedDatabase, type MethodsInvokeResult, type OutboundDnsInstructions, type OutboundEmailDomainAddResult, type OutboundEmailDomainCheckResult, type OutboundEmailDomainDeleteResult, type OutboundEmailDomainUiStatus, type OutboundEmailDomainVerifyResult, type OutboundEmailDomainView, type OutboundEmailDomainsListResult, type PlatformSuppression, type PrerenderGetResult, type PrerenderInvalidateResult, type PrerenderPage, type PrerenderPagesResult, type PrerenderViewResult, type ReleaseFragment, type ReleasesByCommitResult, type ReleasesGetResult, type ReleasesListResult, type RequestsGetResult, type RequestsListResult, type RequestsListRow, type RequestsStatsMethodBucket, type RequestsStatsMethodResult, type RequestsStatsSummaryBucket, type RequestsStatsSummaryResult, type SecretsDeleteResult, type SecretsGetResult, type SecretsListResult, type SecretsSetResult, type SettingsResult, type SuppressionSource, type TrainingLogEntry, type TrainingRunRow, type TrainingRunStatus, type UserAuthProvider, type UserListItem, type UserRecord, type UsersCreateApiKeyResult, type UsersListResult, type UsersRevokeApiKeyResult, type UsersSetRoleResult, type V2AppSettings, type V2BuildLogEntry, type V2BuildStats, type V2CommitInfo, type V2EmailMessage, type V2ReleaseStatus, type VoiceAvailableNumber, type VoiceNumbersBuyResult, type VoiceNumbersListResult, type VoiceNumbersReleaseResult, type VoiceNumbersSearchResult, type VoiceNumbersSetNameResult, type VoicePhoneNumberStatus, type VoicePhoneNumberView, type VoiceResolvedPolicy, type VoiceSessionChannel, type VoiceSessionCost, type VoiceSessionCostLine, type VoiceSessionDetail, type VoiceSessionGetResult, type VoiceSessionListItem, type VoiceSessionSip, type VoiceSessionSpeechEntry, type VoiceSessionStatus, type VoiceSessionToolEntry, type VoiceSessionTranscriptEntry, type VoiceSessionsListResult, type VoiceSettingsCeilings, type VoiceSettingsGetResult, type VoiceSettingsOverrides, type VoiceSettingsSetResult, admin, createAdminClient, admin as default };
5152
+ export { AdminApiError, type AdminClient, type AdminClientOptions, type AdminContext, AdminTimeoutError, type AnalyticsAiHostRow, type AnalyticsAiSourcesResult, type AnalyticsAiVendorRow, type AnalyticsBatchResult, type AnalyticsCrawlersOverviewResult, type AnalyticsCrawlersRecentResult, type AnalyticsCrawlersRecentRow, type AnalyticsCrawlersResult, type AnalyticsCrawlersTimeseriesBucket, type AnalyticsCrawlersTimeseriesResult, type AnalyticsLiveResult, type AnalyticsMapPoint, type AnalyticsMapResult, type AnalyticsMetric, type AnalyticsQueryResult, type AnalyticsQueryResultRow, type AnalyticsSourceRow, type AnalyticsSourcesResult, type AppCronJobStatus, type AppCronJobStatusReason, type AppCronRunState, type AppEmailSuppression, type AppSecretRow, type CrashGroup, type CrashOccurrenceRow, type CrashesGetResult, type CrashesListResult, type CrashesOccurrencesResult, type CrashesStatsBucket, type CrashesStatsResult, type CronJobDecorated, type CronOverviewResult, type CronRunResult, type CronRunSummary, type DashboardLiveRelease, type DashboardReleaseMethod, type DashboardResult, type DataLiftFromDevResult, type DataLiftFromLiveResult, type DataSourcesBuildProgress, type DataSourcesChunkingConfig, type DataSourcesConfigResult, type DataSourcesConfigUpdateResult, type DataSourcesDeleteResult, type DataSourcesDocument, type DataSourcesDocumentConfirmResult, type DataSourcesDocumentDeleteResult, type DataSourcesDocumentStatus, type DataSourcesDocumentsResult, type DataSourcesDropResult, type DataSourcesIngestConfig, type DataSourcesIngestUpdate, type DataSourcesListEntry, type DataSourcesListResult, type DataSourcesPromoteResult, type DataSourcesRetrievalConfig, type DataSourcesRetrievalUpdate, type DataSourcesRevectorizeResult, type DataSourcesSearchCitation, type DataSourcesSearchResult, type DataSourcesSearchResultItem, type DataSourcesUploadTokenResult, type DatasetFile, type DbQueryResult, type DiagnosticsAuditEnvironment, type DiagnosticsDashboardResult, type DiagnosticsFinding, type DiagnosticsLighthouseScores, type DiagnosticsPayload, type DiagnosticsReleaseResult, type DiagnosticsRuntimeFindings, type DomainsCheckResult, type DomainsCustomAddResult, type DomainsCustomCheckResult, type DomainsCustomHostnameUiStatus, type DomainsCustomHostnameView, type DomainsCustomListResult, type DomainsCustomRemoveResult, type DomainsCustomRetryResult, type DomainsDnsInstructions, type DomainsGetResult, type DomainsSetResult, type EmailBatchLifecycle, type EmailBatchResult, type EmailBatchSummary, type EmailBatchesResult, type EmailDomainBase, type EmailEffectiveSender, type EmailInboxResult, type EmailListResult, type EmailMessageKind, type EmailMessageResult, type EmailMessageStatus, type EmailSenderTier, type EmailSendingStatusResult, type EmailStatsResult, type EmailSummary, type EmailSuppressResult, type EmailSuppressionsResult, type EmailUnsuppressResult, type FilesDeleteResult, type FilesFileMeta, type FilesListEntry, type FilesListResult, type FilesLsResult, type FilesScanBadge, type FilesScanFlagged, type FilesScanStore, type FilesStatResult, type FilesStoreSummaryEntry, type FilesUploadUrlResult, type FilesUrlResult, type FrontendErrorType, type InboundDnsInstructions, type InboundEmailDomainAddResult, type InboundEmailDomainCheckResult, type InboundEmailDomainDeleteResult, type InboundEmailDomainUiStatus, type InboundEmailDomainVerifyResult, type InboundEmailDomainView, type InboundEmailDomainsListResult, type InboxEmailPreview, type IssueAuthorKind, type IssueCommentRow, type IssueEventType, type IssueKind, type IssueRow, type IssueStatus, type IssuesCommentResult, type IssuesCreateResult, type IssuesDeleteResult, type IssuesGetResult, type IssuesListResult, type IssuesUpdateResult, type JewelPairRow, type JewelPairSummaryRow, type JewelVerdict, type JewelsDatasetSummary, type JewelsDryrunResult, type JewelsExportResult, type JewelsGradeResult, type JewelsGrading, type JewelsOverviewResult, type JewelsPairResult, type JewelsPairsResult, type JewelsQueueResult, type JewelsResolveResult, type JewelsRunResult, type JewelsRunsResult, type JewelsTimeseriesBucket, type JewelsTimeseriesResult, type JewelsTrainResult, type LiftedDatabase, type MethodsInvokeResult, type OutboundDnsInstructions, type OutboundEmailDomainAddResult, type OutboundEmailDomainCheckResult, type OutboundEmailDomainDeleteResult, type OutboundEmailDomainUiStatus, type OutboundEmailDomainVerifyResult, type OutboundEmailDomainView, type OutboundEmailDomainsListResult, type PlatformSuppression, type PrerenderGetResult, type PrerenderInvalidateResult, type PrerenderPage, type PrerenderPagesResult, type PrerenderViewResult, type ReleaseFragment, type ReleasesByCommitResult, type ReleasesGetResult, type ReleasesListResult, type RequestsGetResult, type RequestsListResult, type RequestsListRow, type RequestsStatsMethodBucket, type RequestsStatsMethodResult, type RequestsStatsSummaryBucket, type RequestsStatsSummaryResult, type SecretsDeleteResult, type SecretsGetResult, type SecretsListResult, type SecretsSetResult, type SettingsResult, type SuppressionSource, type TrainingLogEntry, type TrainingRunRow, type TrainingRunStatus, type UserAuthProvider, type UserListItem, type UserRecord, type UsersCreateApiKeyResult, type UsersListResult, type UsersRevokeApiKeyResult, type UsersSetRoleResult, type V2AppSettings, type V2BuildLogEntry, type V2BuildStats, type V2CommitInfo, type V2EmailMessage, type V2ReleaseStatus, type VoiceAvailableNumber, type VoiceNumbersBuyResult, type VoiceNumbersListResult, type VoiceNumbersReleaseResult, type VoiceNumbersSearchResult, type VoiceNumbersSetNameResult, type VoicePhoneNumberStatus, type VoicePhoneNumberView, type VoiceResolvedPolicy, type VoiceSessionChannel, type VoiceSessionCost, type VoiceSessionCostLine, type VoiceSessionDetail, type VoiceSessionGetResult, type VoiceSessionListItem, type VoiceSessionSip, type VoiceSessionSpeechEntry, type VoiceSessionStatus, type VoiceSessionToolEntry, type VoiceSessionTranscriptEntry, type VoiceSessionsListResult, type VoiceSettingsCeilings, type VoiceSettingsGetResult, type VoiceSettingsOverrides, type VoiceSettingsSetResult, admin, createAdminClient, admin as default };
package/dist/index.js CHANGED
@@ -72,11 +72,11 @@ __export(analytics_exports, {
72
72
 
73
73
  // src/errors.ts
74
74
  var AdminApiError = class extends Error {
75
- constructor(method, path3, status, body) {
76
- super(`API ${method} ${path3} returned ${status}: ${JSON.stringify(body)}`);
75
+ constructor(method, path3, status2, body) {
76
+ super(`API ${method} ${path3} returned ${status2}: ${JSON.stringify(body)}`);
77
77
  this.method = method;
78
78
  this.path = path3;
79
- this.status = status;
79
+ this.status = status2;
80
80
  this.body = body;
81
81
  this.name = "AdminApiError";
82
82
  }
@@ -833,6 +833,7 @@ __export(email_exports, {
833
833
  listDomains: () => listDomains,
834
834
  removeDomain: () => removeDomain,
835
835
  stats: () => stats2,
836
+ status: () => status,
836
837
  suppress: () => suppress,
837
838
  suppressions: () => suppressions,
838
839
  unsuppress: () => unsuppress,
@@ -884,6 +885,13 @@ function stats2(ctx, params = {}) {
884
885
  `/_internal/v2/apps/${ctx.appId}/outbound-email/summary${qs(params)}`
885
886
  );
886
887
  }
888
+ function status(ctx) {
889
+ return call(
890
+ ctx,
891
+ "GET",
892
+ `/_internal/v2/apps/${ctx.appId}/outbound-email/status`
893
+ );
894
+ }
887
895
  function batches(ctx, params = {}) {
888
896
  return call(
889
897
  ctx,