@develit-io/backend-sdk 12.4.1 → 12.5.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/dist/index.d.mts CHANGED
@@ -40,6 +40,7 @@ declare const structuredAddressSchema: z$1.ZodObject<{
40
40
  city: z$1.ZodOptional<z$1.ZodString>;
41
41
  postalCode: z$1.ZodOptional<z$1.ZodString>;
42
42
  countryCode: z$1.ZodOptional<z$1.ZodEnum<{
43
+ IM: "IM";
43
44
  AF: "AF";
44
45
  AL: "AL";
45
46
  DZ: "DZ";
@@ -129,7 +130,6 @@ declare const structuredAddressSchema: z$1.ZodObject<{
129
130
  IR: "IR";
130
131
  IQ: "IQ";
131
132
  IE: "IE";
132
- IM: "IM";
133
133
  IL: "IL";
134
134
  IT: "IT";
135
135
  CI: "CI";
@@ -330,6 +330,7 @@ declare const bankAccountMetadataSchema: z$1.ZodObject<{
330
330
  city: z$1.ZodOptional<z$1.ZodString>;
331
331
  postalCode: z$1.ZodOptional<z$1.ZodString>;
332
332
  countryCode: z$1.ZodOptional<z$1.ZodEnum<{
333
+ IM: "IM";
333
334
  AF: "AF";
334
335
  AL: "AL";
335
336
  DZ: "DZ";
@@ -419,7 +420,6 @@ declare const bankAccountMetadataSchema: z$1.ZodObject<{
419
420
  IR: "IR";
420
421
  IQ: "IQ";
421
422
  IE: "IE";
422
- IM: "IM";
423
423
  IL: "IL";
424
424
  IT: "IT";
425
425
  CI: "CI";
@@ -602,6 +602,7 @@ declare const bankAccountMetadataSchema: z$1.ZodObject<{
602
602
  AVAX: "AVAX";
603
603
  }>>;
604
604
  countryCode: z$1.ZodOptional<z$1.ZodEnum<{
605
+ IM: "IM";
605
606
  AF: "AF";
606
607
  AL: "AL";
607
608
  DZ: "DZ";
@@ -691,7 +692,6 @@ declare const bankAccountMetadataSchema: z$1.ZodObject<{
691
692
  IR: "IR";
692
693
  IQ: "IQ";
693
694
  IE: "IE";
694
- IM: "IM";
695
695
  IL: "IL";
696
696
  IT: "IT";
697
697
  CI: "CI";
@@ -833,7 +833,7 @@ declare const bankAccount: {
833
833
  swiftBic: drizzle_orm_sqlite_core.SQLiteTextBuilder<[string, ...string[]]>;
834
834
  bicCor: drizzle_orm_sqlite_core.SQLiteTextBuilder<[string, ...string[]]>;
835
835
  currency: drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilder<["CZK" | "EUR" | "USD" | "PLN" | "RON" | "GBP" | "RUB" | "HUF" | "CHF" | "DKK" | "SEK" | "HRK" | "NOK" | "BGN" | "TRY" | "AUD" | "CAD" | "JPY" | "CNY" | "INR" | "BRL" | "MXN" | "ZAR" | "SGD" | "HKD" | "KRW" | "MYR" | "THB" | "IDR" | "PHP" | "AED" | "SAR" | "ILS" | "EGP" | "NGN" | "PKR" | "COP" | "CLP" | "PEN" | "VND" | "KZT" | "UAH" | "BTC" | "ETH" | "ADA" | "DOT" | "ATOM" | "XRP" | "LTC" | "SOL" | "DOGE" | "MATIC" | "AVAX", ...("CZK" | "EUR" | "USD" | "PLN" | "RON" | "GBP" | "RUB" | "HUF" | "CHF" | "DKK" | "SEK" | "HRK" | "NOK" | "BGN" | "TRY" | "AUD" | "CAD" | "JPY" | "CNY" | "INR" | "BRL" | "MXN" | "ZAR" | "SGD" | "HKD" | "KRW" | "MYR" | "THB" | "IDR" | "PHP" | "AED" | "SAR" | "ILS" | "EGP" | "NGN" | "PKR" | "COP" | "CLP" | "PEN" | "VND" | "KZT" | "UAH" | "BTC" | "ETH" | "ADA" | "DOT" | "ATOM" | "XRP" | "LTC" | "SOL" | "DOGE" | "MATIC" | "AVAX")[]]>>;
836
- countryCode: drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilder<["AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HK" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "US" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW", ...("AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HK" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "US" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW")[]]>>;
836
+ countryCode: drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilder<["IM" | "AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HK" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "US" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW", ...("IM" | "AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HK" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "US" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW")[]]>>;
837
837
  routingNumber: drizzle_orm_sqlite_core.SQLiteTextBuilder<[string, ...string[]]>;
838
838
  sortCode: drizzle_orm_sqlite_core.SQLiteTextBuilder<[string, ...string[]]>;
839
839
  clabe: drizzle_orm_sqlite_core.SQLiteTextBuilder<[string, ...string[]]>;
@@ -1292,14 +1292,21 @@ type DlqAlert = {
1292
1292
  subject: string;
1293
1293
  text: string;
1294
1294
  };
1295
+ /** Minimal shape of a dead-lettered message used to build a safe alert. */
1296
+ type DlqMessageInfo = {
1297
+ id?: string;
1298
+ attempts?: number;
1299
+ body: unknown;
1300
+ };
1295
1301
  /**
1296
- * Builds the alert subject + plain-text body summarizing the dead-lettered
1297
- * messages. Bodies are stringified defensively — DLQ messages may come from any
1298
- * consumed queue, so no shape is assumed.
1302
+ * Builds the alert subject + plain-text body for dead-lettered messages.
1303
+ *
1304
+ * SAFETY: emits only non-sensitive identifiers (`eventType`, `eventSignal`,
1305
+ * `metadata.entityId`/`correlationId`, message `id`, `attempts`) — never the
1306
+ * raw payload, which for FX/payment events holds PII and financial data. Use
1307
+ * the identifiers to look the full record up via access-controlled tooling.
1299
1308
  */
1300
- declare function buildDlqAlert(queueName: string, messages: ReadonlyArray<{
1301
- body: unknown;
1302
- }>): DlqAlert;
1309
+ declare function buildDlqAlert(queueName: string, messages: ReadonlyArray<DlqMessageInfo>): DlqAlert;
1303
1310
  type HandleDlqBatchOptions = {
1304
1311
  /** Comma-separated recipient list (e.g. from an env var). */
1305
1312
  recipientsRaw: string | undefined;
@@ -1315,6 +1322,12 @@ type HandleDlqBatchOptions = {
1315
1322
  }) => Promise<{
1316
1323
  error?: unknown;
1317
1324
  }>;
1325
+ /**
1326
+ * Optional custom alert formatter. Defaults to `buildDlqAlert` (safe —
1327
+ * identifiers only). Override only if you deliberately need a different
1328
+ * format; take care not to include sensitive payload.
1329
+ */
1330
+ formatAlert?: (queueName: string, messages: ReadonlyArray<DlqMessageInfo>) => DlqAlert;
1318
1331
  /** Alert immediately once a batch reaches this size. Default 50. */
1319
1332
  minSize?: number;
1320
1333
  /** Min seconds between alerts for the same queue while batches are small. Default 21600. */
@@ -1489,4 +1502,4 @@ type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...a
1489
1502
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
1490
1503
 
1491
1504
  export { DLQ_ALERT_DEFAULT_MAX_INTERVAL, DLQ_ALERT_DEFAULT_MIN_SIZE, DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildDlqAlert, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, chunkQueueMessages, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInsertSchema, createInternalError, createPatchSchema, createSelectSchema, createUpdateSchema, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getDrizzleD1Config, getLocalD1DatabaseIdFromWrangler, getSecret, handleAction, handleDlqBatch, ibanSchema, isDlqQueue, isInternalError, nullToOptional, optionalToNull, paginationQuerySchema, paginationSchema, parseDlqAlertRecipients, pushToQueue, queryInChunks, redact, resolveColumn, service, shouldAlertDlq, structuredAddressSchema, useFetch, useResult, useResultSync, uuidv4, uuidv5, workflowInstanceStatusSchema };
1492
- export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, DlqAlert, Environment, GatewayResponse, HandleDlqBatchOptions, IRPCResponse, IdempotencyContextVariables, IdentityContextVariables, InternalError, InternalErrorResponseStatus, Project, RequestLog, ResponseLog, ShouldAlertDlqParams, StructuredAddress, UserRole, ValidatedInput, WorkflowInstanceStatus };
1505
+ export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, DlqAlert, DlqMessageInfo, Environment, GatewayResponse, HandleDlqBatchOptions, IRPCResponse, IdempotencyContextVariables, IdentityContextVariables, InternalError, InternalErrorResponseStatus, Project, RequestLog, ResponseLog, ShouldAlertDlqParams, StructuredAddress, UserRole, ValidatedInput, WorkflowInstanceStatus };
package/dist/index.d.ts CHANGED
@@ -40,6 +40,7 @@ declare const structuredAddressSchema: z$1.ZodObject<{
40
40
  city: z$1.ZodOptional<z$1.ZodString>;
41
41
  postalCode: z$1.ZodOptional<z$1.ZodString>;
42
42
  countryCode: z$1.ZodOptional<z$1.ZodEnum<{
43
+ IM: "IM";
43
44
  AF: "AF";
44
45
  AL: "AL";
45
46
  DZ: "DZ";
@@ -129,7 +130,6 @@ declare const structuredAddressSchema: z$1.ZodObject<{
129
130
  IR: "IR";
130
131
  IQ: "IQ";
131
132
  IE: "IE";
132
- IM: "IM";
133
133
  IL: "IL";
134
134
  IT: "IT";
135
135
  CI: "CI";
@@ -330,6 +330,7 @@ declare const bankAccountMetadataSchema: z$1.ZodObject<{
330
330
  city: z$1.ZodOptional<z$1.ZodString>;
331
331
  postalCode: z$1.ZodOptional<z$1.ZodString>;
332
332
  countryCode: z$1.ZodOptional<z$1.ZodEnum<{
333
+ IM: "IM";
333
334
  AF: "AF";
334
335
  AL: "AL";
335
336
  DZ: "DZ";
@@ -419,7 +420,6 @@ declare const bankAccountMetadataSchema: z$1.ZodObject<{
419
420
  IR: "IR";
420
421
  IQ: "IQ";
421
422
  IE: "IE";
422
- IM: "IM";
423
423
  IL: "IL";
424
424
  IT: "IT";
425
425
  CI: "CI";
@@ -602,6 +602,7 @@ declare const bankAccountMetadataSchema: z$1.ZodObject<{
602
602
  AVAX: "AVAX";
603
603
  }>>;
604
604
  countryCode: z$1.ZodOptional<z$1.ZodEnum<{
605
+ IM: "IM";
605
606
  AF: "AF";
606
607
  AL: "AL";
607
608
  DZ: "DZ";
@@ -691,7 +692,6 @@ declare const bankAccountMetadataSchema: z$1.ZodObject<{
691
692
  IR: "IR";
692
693
  IQ: "IQ";
693
694
  IE: "IE";
694
- IM: "IM";
695
695
  IL: "IL";
696
696
  IT: "IT";
697
697
  CI: "CI";
@@ -833,7 +833,7 @@ declare const bankAccount: {
833
833
  swiftBic: drizzle_orm_sqlite_core.SQLiteTextBuilder<[string, ...string[]]>;
834
834
  bicCor: drizzle_orm_sqlite_core.SQLiteTextBuilder<[string, ...string[]]>;
835
835
  currency: drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilder<["CZK" | "EUR" | "USD" | "PLN" | "RON" | "GBP" | "RUB" | "HUF" | "CHF" | "DKK" | "SEK" | "HRK" | "NOK" | "BGN" | "TRY" | "AUD" | "CAD" | "JPY" | "CNY" | "INR" | "BRL" | "MXN" | "ZAR" | "SGD" | "HKD" | "KRW" | "MYR" | "THB" | "IDR" | "PHP" | "AED" | "SAR" | "ILS" | "EGP" | "NGN" | "PKR" | "COP" | "CLP" | "PEN" | "VND" | "KZT" | "UAH" | "BTC" | "ETH" | "ADA" | "DOT" | "ATOM" | "XRP" | "LTC" | "SOL" | "DOGE" | "MATIC" | "AVAX", ...("CZK" | "EUR" | "USD" | "PLN" | "RON" | "GBP" | "RUB" | "HUF" | "CHF" | "DKK" | "SEK" | "HRK" | "NOK" | "BGN" | "TRY" | "AUD" | "CAD" | "JPY" | "CNY" | "INR" | "BRL" | "MXN" | "ZAR" | "SGD" | "HKD" | "KRW" | "MYR" | "THB" | "IDR" | "PHP" | "AED" | "SAR" | "ILS" | "EGP" | "NGN" | "PKR" | "COP" | "CLP" | "PEN" | "VND" | "KZT" | "UAH" | "BTC" | "ETH" | "ADA" | "DOT" | "ATOM" | "XRP" | "LTC" | "SOL" | "DOGE" | "MATIC" | "AVAX")[]]>>;
836
- countryCode: drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilder<["AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HK" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "US" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW", ...("AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HK" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "US" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW")[]]>>;
836
+ countryCode: drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilder<["IM" | "AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HK" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "US" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW", ...("IM" | "AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HK" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "US" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW")[]]>>;
837
837
  routingNumber: drizzle_orm_sqlite_core.SQLiteTextBuilder<[string, ...string[]]>;
838
838
  sortCode: drizzle_orm_sqlite_core.SQLiteTextBuilder<[string, ...string[]]>;
839
839
  clabe: drizzle_orm_sqlite_core.SQLiteTextBuilder<[string, ...string[]]>;
@@ -1292,14 +1292,21 @@ type DlqAlert = {
1292
1292
  subject: string;
1293
1293
  text: string;
1294
1294
  };
1295
+ /** Minimal shape of a dead-lettered message used to build a safe alert. */
1296
+ type DlqMessageInfo = {
1297
+ id?: string;
1298
+ attempts?: number;
1299
+ body: unknown;
1300
+ };
1295
1301
  /**
1296
- * Builds the alert subject + plain-text body summarizing the dead-lettered
1297
- * messages. Bodies are stringified defensively — DLQ messages may come from any
1298
- * consumed queue, so no shape is assumed.
1302
+ * Builds the alert subject + plain-text body for dead-lettered messages.
1303
+ *
1304
+ * SAFETY: emits only non-sensitive identifiers (`eventType`, `eventSignal`,
1305
+ * `metadata.entityId`/`correlationId`, message `id`, `attempts`) — never the
1306
+ * raw payload, which for FX/payment events holds PII and financial data. Use
1307
+ * the identifiers to look the full record up via access-controlled tooling.
1299
1308
  */
1300
- declare function buildDlqAlert(queueName: string, messages: ReadonlyArray<{
1301
- body: unknown;
1302
- }>): DlqAlert;
1309
+ declare function buildDlqAlert(queueName: string, messages: ReadonlyArray<DlqMessageInfo>): DlqAlert;
1303
1310
  type HandleDlqBatchOptions = {
1304
1311
  /** Comma-separated recipient list (e.g. from an env var). */
1305
1312
  recipientsRaw: string | undefined;
@@ -1315,6 +1322,12 @@ type HandleDlqBatchOptions = {
1315
1322
  }) => Promise<{
1316
1323
  error?: unknown;
1317
1324
  }>;
1325
+ /**
1326
+ * Optional custom alert formatter. Defaults to `buildDlqAlert` (safe —
1327
+ * identifiers only). Override only if you deliberately need a different
1328
+ * format; take care not to include sensitive payload.
1329
+ */
1330
+ formatAlert?: (queueName: string, messages: ReadonlyArray<DlqMessageInfo>) => DlqAlert;
1318
1331
  /** Alert immediately once a batch reaches this size. Default 50. */
1319
1332
  minSize?: number;
1320
1333
  /** Min seconds between alerts for the same queue while batches are small. Default 21600. */
@@ -1489,4 +1502,4 @@ type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...a
1489
1502
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
1490
1503
 
1491
1504
  export { DLQ_ALERT_DEFAULT_MAX_INTERVAL, DLQ_ALERT_DEFAULT_MIN_SIZE, DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildDlqAlert, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, chunkQueueMessages, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInsertSchema, createInternalError, createPatchSchema, createSelectSchema, createUpdateSchema, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getDrizzleD1Config, getLocalD1DatabaseIdFromWrangler, getSecret, handleAction, handleDlqBatch, ibanSchema, isDlqQueue, isInternalError, nullToOptional, optionalToNull, paginationQuerySchema, paginationSchema, parseDlqAlertRecipients, pushToQueue, queryInChunks, redact, resolveColumn, service, shouldAlertDlq, structuredAddressSchema, useFetch, useResult, useResultSync, uuidv4, uuidv5, workflowInstanceStatusSchema };
1492
- export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, DlqAlert, Environment, GatewayResponse, HandleDlqBatchOptions, IRPCResponse, IdempotencyContextVariables, IdentityContextVariables, InternalError, InternalErrorResponseStatus, Project, RequestLog, ResponseLog, ShouldAlertDlqParams, StructuredAddress, UserRole, ValidatedInput, WorkflowInstanceStatus };
1505
+ export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, DlqAlert, DlqMessageInfo, Environment, GatewayResponse, HandleDlqBatchOptions, IRPCResponse, IdempotencyContextVariables, IdentityContextVariables, InternalError, InternalErrorResponseStatus, Project, RequestLog, ResponseLog, ShouldAlertDlqParams, StructuredAddress, UserRole, ValidatedInput, WorkflowInstanceStatus };
package/dist/index.mjs CHANGED
@@ -719,20 +719,29 @@ function shouldAlertDlq({
719
719
  const suppress = batchSize < minSize && secondsSinceLastAlert < maxInterval;
720
720
  return !suppress;
721
721
  }
722
+ const asString = (value) => typeof value === "string" ? value : void 0;
722
723
  function buildDlqAlert(queueName, messages) {
723
724
  const summary = messages.map((message, index) => {
724
- let serialized;
725
- try {
726
- serialized = JSON.stringify(message.body, null, 2);
727
- } catch {
728
- serialized = "[unserializable message body]";
729
- }
730
- return `#${index + 1}:
731
- ${serialized}`;
732
- }).join("\n\n");
725
+ const body = typeof message.body === "object" && message.body !== null ? message.body : void 0;
726
+ const metadata = body && typeof body.metadata === "object" && body.metadata !== null ? body.metadata : void 0;
727
+ const fields = [
728
+ ["eventType", asString(body?.eventType)],
729
+ ["eventSignal", asString(body?.eventSignal)],
730
+ ["entityId", asString(metadata?.entityId)],
731
+ ["correlationId", asString(metadata?.correlationId)],
732
+ ["id", message.id],
733
+ [
734
+ "attempts",
735
+ message.attempts === void 0 ? void 0 : String(message.attempts)
736
+ ]
737
+ ];
738
+ const known = fields.filter(([, value]) => value !== void 0);
739
+ const label = known.length ? known.map(([key, value]) => `${key}=${value}`).join(" ") : "(no safe identifiers available)";
740
+ return `#${index + 1} ${label}`;
741
+ }).join("\n");
733
742
  return {
734
743
  subject: `\u{1F534} DLQ events in ${queueName} (${messages.length})`,
735
- text: `${messages.length} dead-lettered message(s) on queue "${queueName}".
744
+ text: `${messages.length} dead-lettered message(s) on queue "${queueName}". Identifiers only \u2014 no payload.
736
745
 
737
746
  ${summary}`
738
747
  };
@@ -765,7 +774,10 @@ async function handleDlqBatch(batch, opts) {
765
774
  batch.ackAll();
766
775
  return;
767
776
  }
768
- const { subject, text } = buildDlqAlert(queueName, batch.messages);
777
+ const { subject, text } = (opts.formatAlert ?? buildDlqAlert)(
778
+ queueName,
779
+ batch.messages
780
+ );
769
781
  try {
770
782
  const { error } = await opts.sendAlert({ recipients, subject, text });
771
783
  if (error) throw error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-io/backend-sdk",
3
- "version": "12.4.1",
3
+ "version": "12.5.0",
4
4
  "description": "Develit Backend SDK",
5
5
  "author": "Develit.io",
6
6
  "license": "ISC",