@madewithremy/admin 0.1.0 → 0.1.2

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
@@ -875,6 +875,7 @@ interface DataSourcesIngestUpdate {
875
875
  };
876
876
  contextual?: {
877
877
  enabled?: boolean;
878
+ modelId?: string;
878
879
  };
879
880
  images?: {
880
881
  describe?: boolean;
@@ -1907,7 +1908,10 @@ declare namespace domains {
1907
1908
  * src/http/routes/V2Apps/manage/emailDomains.ts
1908
1909
  * src/http/routes/V2Apps/manage/requestLog.ts (inbox route only)
1909
1910
  * src/common/Db/v2Apps/V2EmailMessagesDao/index.ts
1911
+ * src/common/Db/v2Apps/V2EmailBatchesDao/index.ts
1912
+ * src/common/Db/v2Apps/V2EmailTenantStateDao/index.ts
1910
1913
  * src/common/Db/v2Apps/AppEmailSuppressionsDao/index.ts
1914
+ * src/common/OutboundEmail/batchView.ts
1911
1915
  * src/common/Aws/SesIdentityService.ts
1912
1916
  * src/common/Db/v2Apps/RequestLogDao.ts
1913
1917
  */
@@ -1959,7 +1963,20 @@ interface EmailSummary {
1959
1963
  }>;
1960
1964
  }
1961
1965
  /**
1962
- * One fan-out blast, aggregated (V2EmailMessagesDao.listBatches / getBatch).
1966
+ * Lifecycle of a QUEUED send (batchView.ts / V2EmailBatchesDao). Large or
1967
+ * marketing sends are accepted immediately and delivered by a worker in
1968
+ * chunks, so a blast can legitimately be observed mid-flight.
1969
+ *
1970
+ * accepted queued, nothing delivered yet
1971
+ * sending chunks are draining
1972
+ * completed every recipient was handed to the provider
1973
+ * partial finished, but some recipients were not sent to
1974
+ * failed finished and nothing was sent
1975
+ */
1976
+ type EmailBatchLifecycle = 'accepted' | 'sending' | 'completed' | 'partial' | 'failed';
1977
+ /**
1978
+ * One fan-out blast, aggregated (batchView.ts — the per-recipient aggregate
1979
+ * enriched with the queued-send lifecycle where one exists).
1963
1980
  * `recipients` is every row in the blast including ones that never reached SES;
1964
1981
  * `accepted` is only those SES took and is the denominator for any rate.
1965
1982
  */
@@ -1970,6 +1987,17 @@ interface EmailBatchSummary {
1970
1987
  recipients: number;
1971
1988
  accepted: number;
1972
1989
  counts: Record<EmailMessageStatus, number>;
1990
+ /**
1991
+ * Lifecycle of the send, when it was QUEUED. `null` for a send delivered
1992
+ * inline (small transactional) and for blasts predating the send queue —
1993
+ * that is a normal, finished send with no in-flight state, NOT an error.
1994
+ */
1995
+ status: EmailBatchLifecycle | null;
1996
+ /** Delivery-chunk progress, when queued. Null otherwise. */
1997
+ chunksTotal: number | null;
1998
+ chunksDone: number | null;
1999
+ /** Recipients not yet attempted, when queued. Null otherwise. */
2000
+ pending: number | null;
1973
2001
  }
1974
2002
  /** One row from app_email_suppressions (AppEmailSuppressionsDao). */
1975
2003
  interface AppEmailSuppression {
@@ -2095,12 +2123,85 @@ interface EmailSuppressionsResult {
2095
2123
  interface EmailSuppressResult {
2096
2124
  ok: true;
2097
2125
  }
2098
- /** email unsuppress → POST /outbound-email/suppressions/remove */
2126
+ /**
2127
+ * email unsuppress → POST /outbound-email/suppressions/remove
2128
+ *
2129
+ * Three independent outcomes, and only the tenant entry decides deliverability:
2130
+ * removed this app's own suppression row is gone
2131
+ * tenantEntryRemoved the app's SES TENANT suppression entry (a prior hard
2132
+ * bounce or spam report against THIS app) is gone — this
2133
+ * is what actually unblocks mail
2134
+ * platformSuppression non-null = still on SES's ACCOUNT-wide list, which is
2135
+ * never cleared; removal changed nothing about delivery
2136
+ */
2099
2137
  interface EmailUnsuppressResult {
2100
2138
  ok: true;
2101
2139
  removed: boolean;
2140
+ tenantEntryRemoved: boolean;
2102
2141
  platformSuppression: PlatformSuppression | null;
2103
2142
  }
2143
+ /**
2144
+ * email status → GET /outbound-email/status
2145
+ *
2146
+ * Whether this app can send right now, and up to what. Two independent
2147
+ * verdicts, deliberately not collapsed: `ses` is Amazon's view of the app's
2148
+ * tenant and `enforcement` is the platform's own. The fields that decide what
2149
+ * to tell the owner:
2150
+ *
2151
+ * sending.source 'ses' = AMAZON paused it (we cannot lift it; it
2152
+ * clears when the finding clears); 'platform' = we did
2153
+ * enforcement.origin 'operator' = a person placed the hold — it will NOT
2154
+ * lift itself when rates recover; 'platform' = the
2155
+ * automatic sweep, which steps down on its own
2156
+ * ses.status 'REINSTATED' still sends — it means "resuming with
2157
+ * findings open" and returns to ENABLED on recovery
2158
+ */
2159
+ interface EmailSendingStatusResult {
2160
+ sending: {
2161
+ allowed: boolean;
2162
+ reason: string | null;
2163
+ source: 'ses' | 'platform' | null;
2164
+ };
2165
+ enforcement: {
2166
+ level: 'none' | 'throttled' | 'paused';
2167
+ origin: 'platform' | 'operator' | null;
2168
+ reason: string | null;
2169
+ at: string | null;
2170
+ };
2171
+ ses: {
2172
+ status: 'ENABLED' | 'DISABLED' | 'REINSTATED' | null;
2173
+ origin: 'CUSTOMER_MANAGED' | 'AWS_SES_MANAGED' | null;
2174
+ cause: string | null;
2175
+ at: string | null;
2176
+ };
2177
+ /**
2178
+ * The enforcement sweep's last measurement, with its denominator — a rate
2179
+ * without `accepted` is unreadable (1 bounce in 10 sends is "10%" and means
2180
+ * nothing). All null until the sweep has evaluated this app.
2181
+ */
2182
+ evaluation: {
2183
+ accepted: number | null;
2184
+ bounceRate: number | null;
2185
+ complaintRate: number | null;
2186
+ at: string | null;
2187
+ };
2188
+ quota: {
2189
+ unit: string;
2190
+ window: 'day' | 'month' | 'total';
2191
+ /** `null` = unlimited. */
2192
+ limit: number | null;
2193
+ used: number;
2194
+ remaining: number | null;
2195
+ resetsAt: string | null;
2196
+ /**
2197
+ * Where the limit came from: 'platform' is the default; 'app'/'org'/'plan'
2198
+ * is an override — support-granted, or the sweep's automatic throttle.
2199
+ */
2200
+ source: 'app' | 'org' | 'plan' | 'platform';
2201
+ /** When an override lapses and the limit reverts. */
2202
+ expiresAt: string | null;
2203
+ };
2204
+ }
2104
2205
  /** email inbox → GET /inbox */
2105
2206
  interface EmailInboxResult {
2106
2207
  emails: InboxEmailPreview[];
@@ -2155,9 +2256,10 @@ interface EmailListParams {
2155
2256
  /**
2156
2257
  * Comma-separated statuses to include. Values: `suppressed`, `failed`,
2157
2258
  * `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.
2259
+ * `rejected`. Default: all statuses. `blocked` means an SES suppression list
2260
+ * dropped the message before delivery — usually this app's OWN tenant list
2261
+ * (a prior hard bounce or spam report from that address), occasionally the
2262
+ * shared account-wide list. `unsuppress` reports which.
2161
2263
  */
2162
2264
  status?: string;
2163
2265
  /** Origin to filter by: `method` (app-sent) or `auth` (sign-in codes). Default: all. */
@@ -4985,6 +5087,7 @@ declare function buildClient(ctx: AdminContext): {
4985
5087
  list: (params?: EmailListParams | undefined) => Promise<EmailListResult>;
4986
5088
  get: (messageId: string) => Promise<V2EmailMessage>;
4987
5089
  stats: (params?: EmailWindowParams | undefined) => Promise<EmailSummary>;
5090
+ status: () => Promise<EmailSendingStatusResult>;
4988
5091
  batches: (params?: EmailBatchesParams | undefined) => Promise<EmailBatchesResult>;
4989
5092
  batch: (batchId: string) => Promise<EmailBatchSummary>;
4990
5093
  suppressions: (params?: EmailSuppressionsParams | undefined) => Promise<EmailSuppressionsResult>;
@@ -5047,4 +5150,4 @@ declare class AdminTimeoutError extends Error {
5047
5150
 
5048
5151
  declare const admin: AdminClient;
5049
5152
 
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 };
5153
+ 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,