@develit-io/backend-sdk 5.34.0 → 5.35.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 +61 -89
- package/dist/index.d.ts +61 -89
- package/dist/index.mjs +42 -45
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -53,6 +53,38 @@ declare const bankAccountPostgres: {
|
|
|
53
53
|
countryCode: drizzle_orm.NotNull<drizzle_orm.$Type<drizzle_orm_pg_core.PgEnumColumnBuilderInitial<"", ["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" | "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" | "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" | "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" | "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" | "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" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW">>;
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
+
declare const COMPATIBILITY_DATE = "2025-06-04";
|
|
57
|
+
declare const COMPATIBILITY_FLAGS: string[];
|
|
58
|
+
declare const QUEUE_DELIVERY_DELAY = 5;
|
|
59
|
+
declare const QUEUE_MESSAGE_RETENTION_PERIOD = 259200;
|
|
60
|
+
declare const QUEUE_MAX_BATCH_SIZE = 1;
|
|
61
|
+
declare const QUEUE_MAX_BATCH_TIMEOUT = 5;
|
|
62
|
+
declare const D1_LOCATION_HINT = "weur";
|
|
63
|
+
declare const R2_STORAGE_CLASS = "Standard";
|
|
64
|
+
declare const R2_JURISDICTION = "eu";
|
|
65
|
+
declare const R2_LOCATION_HINT = "weur";
|
|
66
|
+
declare const composeWranglerBase: ({ project, name, }: {
|
|
67
|
+
project: string;
|
|
68
|
+
name: string;
|
|
69
|
+
}) => {
|
|
70
|
+
$schema: string;
|
|
71
|
+
name: string;
|
|
72
|
+
main: string;
|
|
73
|
+
compatibility_date: string;
|
|
74
|
+
compatibility_flags: string[];
|
|
75
|
+
observability: {
|
|
76
|
+
enabled: boolean;
|
|
77
|
+
head_sampling_rate: number;
|
|
78
|
+
logs: {
|
|
79
|
+
enabled: boolean;
|
|
80
|
+
invocation_logs: boolean;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
preview_urls: boolean;
|
|
84
|
+
workers_dev: boolean;
|
|
85
|
+
keep_vars: boolean;
|
|
86
|
+
};
|
|
87
|
+
|
|
56
88
|
declare const ENVIRONMENT: string[];
|
|
57
89
|
|
|
58
90
|
type Environment = string | 'localhost' | 'dev' | 'test' | 'staging' | 'production';
|
|
@@ -307,16 +339,14 @@ declare function createAuditLogWriter<TAuditAction = string>(table: AuditLogTabl
|
|
|
307
339
|
|
|
308
340
|
declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string): string;
|
|
309
341
|
declare const getD1DatabaseIdFromWrangler: () => string | undefined;
|
|
310
|
-
declare const getD1Credentials: (
|
|
311
|
-
instanceName: string;
|
|
312
|
-
}) => Promise<{
|
|
342
|
+
declare const getD1Credentials: () => {
|
|
313
343
|
driver?: undefined;
|
|
314
344
|
dbCredentials?: undefined;
|
|
315
345
|
} | {
|
|
316
346
|
driver: string;
|
|
317
347
|
dbCredentials: {
|
|
318
348
|
accountId: string | undefined;
|
|
319
|
-
databaseId: string
|
|
349
|
+
databaseId: string;
|
|
320
350
|
token: string | undefined;
|
|
321
351
|
url?: undefined;
|
|
322
352
|
};
|
|
@@ -328,90 +358,32 @@ declare const getD1Credentials: ({ instanceName, }: {
|
|
|
328
358
|
token?: undefined;
|
|
329
359
|
};
|
|
330
360
|
driver?: undefined;
|
|
331
|
-
}
|
|
332
|
-
declare const getDrizzleD1Config: (
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
} | {
|
|
358
|
-
driver: string;
|
|
359
|
-
dbCredentials: {
|
|
360
|
-
accountId: string | undefined;
|
|
361
|
-
databaseId: string | undefined;
|
|
362
|
-
token: string | undefined;
|
|
363
|
-
url?: undefined;
|
|
364
|
-
};
|
|
365
|
-
} | {
|
|
366
|
-
dbCredentials: {
|
|
367
|
-
url: string | undefined;
|
|
368
|
-
accountId?: undefined;
|
|
369
|
-
databaseId?: undefined;
|
|
370
|
-
token?: undefined;
|
|
371
|
-
};
|
|
372
|
-
driver?: undefined;
|
|
373
|
-
}) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
|
|
374
|
-
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<{
|
|
375
|
-
driver?: undefined;
|
|
376
|
-
dbCredentials?: undefined;
|
|
377
|
-
} | {
|
|
378
|
-
driver: string;
|
|
379
|
-
dbCredentials: {
|
|
380
|
-
accountId: string | undefined;
|
|
381
|
-
databaseId: string | undefined;
|
|
382
|
-
token: string | undefined;
|
|
383
|
-
url?: undefined;
|
|
384
|
-
};
|
|
385
|
-
} | {
|
|
386
|
-
dbCredentials: {
|
|
387
|
-
url: string | undefined;
|
|
388
|
-
accountId?: undefined;
|
|
389
|
-
databaseId?: undefined;
|
|
390
|
-
token?: undefined;
|
|
391
|
-
};
|
|
392
|
-
driver?: undefined;
|
|
393
|
-
} | TResult>;
|
|
394
|
-
finally(onfinally?: (() => void) | null | undefined): Promise<{
|
|
395
|
-
driver?: undefined;
|
|
396
|
-
dbCredentials?: undefined;
|
|
397
|
-
} | {
|
|
398
|
-
driver: string;
|
|
399
|
-
dbCredentials: {
|
|
400
|
-
accountId: string | undefined;
|
|
401
|
-
databaseId: string | undefined;
|
|
402
|
-
token: string | undefined;
|
|
403
|
-
url?: undefined;
|
|
404
|
-
};
|
|
405
|
-
} | {
|
|
406
|
-
dbCredentials: {
|
|
407
|
-
url: string | undefined;
|
|
408
|
-
accountId?: undefined;
|
|
409
|
-
databaseId?: undefined;
|
|
410
|
-
token?: undefined;
|
|
411
|
-
};
|
|
412
|
-
driver?: undefined;
|
|
413
|
-
}>;
|
|
414
|
-
[Symbol.toStringTag]: string;
|
|
361
|
+
};
|
|
362
|
+
declare const getDrizzleD1Config: () => {
|
|
363
|
+
driver?: undefined;
|
|
364
|
+
dbCredentials?: undefined;
|
|
365
|
+
schema: string;
|
|
366
|
+
out: string;
|
|
367
|
+
dialect: "sqlite";
|
|
368
|
+
} | {
|
|
369
|
+
driver: string;
|
|
370
|
+
dbCredentials: {
|
|
371
|
+
accountId: string | undefined;
|
|
372
|
+
databaseId: string;
|
|
373
|
+
token: string | undefined;
|
|
374
|
+
url?: undefined;
|
|
375
|
+
};
|
|
376
|
+
schema: string;
|
|
377
|
+
out: string;
|
|
378
|
+
dialect: "sqlite";
|
|
379
|
+
} | {
|
|
380
|
+
dbCredentials: {
|
|
381
|
+
url: string | undefined;
|
|
382
|
+
accountId?: undefined;
|
|
383
|
+
databaseId?: undefined;
|
|
384
|
+
token?: undefined;
|
|
385
|
+
};
|
|
386
|
+
driver?: undefined;
|
|
415
387
|
schema: string;
|
|
416
388
|
out: string;
|
|
417
389
|
dialect: "sqlite";
|
|
@@ -568,5 +540,5 @@ interface WithRetryCounterOptions {
|
|
|
568
540
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
569
541
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
570
542
|
|
|
571
|
-
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, action, bankAccount, bankAccountBankCodeEnum, bankAccountCountryCodeEnum, bankAccountCurrencyEnum, bankAccountMetadataSchema, bankAccountPostgres, base, basePostgres, bicSchema, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, paginationQuerySchema, paginationSchema, service, useFetch, useResult, useResultSync, uuidv4 };
|
|
543
|
+
export { COMPATIBILITY_DATE, COMPATIBILITY_FLAGS, D1_LOCATION_HINT, DatabaseTransaction, ENVIRONMENT, QUEUE_DELIVERY_DELAY, QUEUE_MAX_BATCH_SIZE, QUEUE_MAX_BATCH_TIMEOUT, QUEUE_MESSAGE_RETENTION_PERIOD, R2_JURISDICTION, R2_LOCATION_HINT, R2_STORAGE_CLASS, RPCResponse, action, bankAccount, bankAccountBankCodeEnum, bankAccountCountryCodeEnum, bankAccountCurrencyEnum, bankAccountMetadataSchema, bankAccountPostgres, base, basePostgres, bicSchema, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, paginationQuerySchema, paginationSchema, service, useFetch, useResult, useResultSync, uuidv4 };
|
|
572
544
|
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, ValidatedInput };
|
package/dist/index.d.ts
CHANGED
|
@@ -53,6 +53,38 @@ declare const bankAccountPostgres: {
|
|
|
53
53
|
countryCode: drizzle_orm.NotNull<drizzle_orm.$Type<drizzle_orm_pg_core.PgEnumColumnBuilderInitial<"", ["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" | "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" | "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" | "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" | "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" | "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" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW">>;
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
+
declare const COMPATIBILITY_DATE = "2025-06-04";
|
|
57
|
+
declare const COMPATIBILITY_FLAGS: string[];
|
|
58
|
+
declare const QUEUE_DELIVERY_DELAY = 5;
|
|
59
|
+
declare const QUEUE_MESSAGE_RETENTION_PERIOD = 259200;
|
|
60
|
+
declare const QUEUE_MAX_BATCH_SIZE = 1;
|
|
61
|
+
declare const QUEUE_MAX_BATCH_TIMEOUT = 5;
|
|
62
|
+
declare const D1_LOCATION_HINT = "weur";
|
|
63
|
+
declare const R2_STORAGE_CLASS = "Standard";
|
|
64
|
+
declare const R2_JURISDICTION = "eu";
|
|
65
|
+
declare const R2_LOCATION_HINT = "weur";
|
|
66
|
+
declare const composeWranglerBase: ({ project, name, }: {
|
|
67
|
+
project: string;
|
|
68
|
+
name: string;
|
|
69
|
+
}) => {
|
|
70
|
+
$schema: string;
|
|
71
|
+
name: string;
|
|
72
|
+
main: string;
|
|
73
|
+
compatibility_date: string;
|
|
74
|
+
compatibility_flags: string[];
|
|
75
|
+
observability: {
|
|
76
|
+
enabled: boolean;
|
|
77
|
+
head_sampling_rate: number;
|
|
78
|
+
logs: {
|
|
79
|
+
enabled: boolean;
|
|
80
|
+
invocation_logs: boolean;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
preview_urls: boolean;
|
|
84
|
+
workers_dev: boolean;
|
|
85
|
+
keep_vars: boolean;
|
|
86
|
+
};
|
|
87
|
+
|
|
56
88
|
declare const ENVIRONMENT: string[];
|
|
57
89
|
|
|
58
90
|
type Environment = string | 'localhost' | 'dev' | 'test' | 'staging' | 'production';
|
|
@@ -307,16 +339,14 @@ declare function createAuditLogWriter<TAuditAction = string>(table: AuditLogTabl
|
|
|
307
339
|
|
|
308
340
|
declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string): string;
|
|
309
341
|
declare const getD1DatabaseIdFromWrangler: () => string | undefined;
|
|
310
|
-
declare const getD1Credentials: (
|
|
311
|
-
instanceName: string;
|
|
312
|
-
}) => Promise<{
|
|
342
|
+
declare const getD1Credentials: () => {
|
|
313
343
|
driver?: undefined;
|
|
314
344
|
dbCredentials?: undefined;
|
|
315
345
|
} | {
|
|
316
346
|
driver: string;
|
|
317
347
|
dbCredentials: {
|
|
318
348
|
accountId: string | undefined;
|
|
319
|
-
databaseId: string
|
|
349
|
+
databaseId: string;
|
|
320
350
|
token: string | undefined;
|
|
321
351
|
url?: undefined;
|
|
322
352
|
};
|
|
@@ -328,90 +358,32 @@ declare const getD1Credentials: ({ instanceName, }: {
|
|
|
328
358
|
token?: undefined;
|
|
329
359
|
};
|
|
330
360
|
driver?: undefined;
|
|
331
|
-
}
|
|
332
|
-
declare const getDrizzleD1Config: (
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
} | {
|
|
358
|
-
driver: string;
|
|
359
|
-
dbCredentials: {
|
|
360
|
-
accountId: string | undefined;
|
|
361
|
-
databaseId: string | undefined;
|
|
362
|
-
token: string | undefined;
|
|
363
|
-
url?: undefined;
|
|
364
|
-
};
|
|
365
|
-
} | {
|
|
366
|
-
dbCredentials: {
|
|
367
|
-
url: string | undefined;
|
|
368
|
-
accountId?: undefined;
|
|
369
|
-
databaseId?: undefined;
|
|
370
|
-
token?: undefined;
|
|
371
|
-
};
|
|
372
|
-
driver?: undefined;
|
|
373
|
-
}) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
|
|
374
|
-
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<{
|
|
375
|
-
driver?: undefined;
|
|
376
|
-
dbCredentials?: undefined;
|
|
377
|
-
} | {
|
|
378
|
-
driver: string;
|
|
379
|
-
dbCredentials: {
|
|
380
|
-
accountId: string | undefined;
|
|
381
|
-
databaseId: string | undefined;
|
|
382
|
-
token: string | undefined;
|
|
383
|
-
url?: undefined;
|
|
384
|
-
};
|
|
385
|
-
} | {
|
|
386
|
-
dbCredentials: {
|
|
387
|
-
url: string | undefined;
|
|
388
|
-
accountId?: undefined;
|
|
389
|
-
databaseId?: undefined;
|
|
390
|
-
token?: undefined;
|
|
391
|
-
};
|
|
392
|
-
driver?: undefined;
|
|
393
|
-
} | TResult>;
|
|
394
|
-
finally(onfinally?: (() => void) | null | undefined): Promise<{
|
|
395
|
-
driver?: undefined;
|
|
396
|
-
dbCredentials?: undefined;
|
|
397
|
-
} | {
|
|
398
|
-
driver: string;
|
|
399
|
-
dbCredentials: {
|
|
400
|
-
accountId: string | undefined;
|
|
401
|
-
databaseId: string | undefined;
|
|
402
|
-
token: string | undefined;
|
|
403
|
-
url?: undefined;
|
|
404
|
-
};
|
|
405
|
-
} | {
|
|
406
|
-
dbCredentials: {
|
|
407
|
-
url: string | undefined;
|
|
408
|
-
accountId?: undefined;
|
|
409
|
-
databaseId?: undefined;
|
|
410
|
-
token?: undefined;
|
|
411
|
-
};
|
|
412
|
-
driver?: undefined;
|
|
413
|
-
}>;
|
|
414
|
-
[Symbol.toStringTag]: string;
|
|
361
|
+
};
|
|
362
|
+
declare const getDrizzleD1Config: () => {
|
|
363
|
+
driver?: undefined;
|
|
364
|
+
dbCredentials?: undefined;
|
|
365
|
+
schema: string;
|
|
366
|
+
out: string;
|
|
367
|
+
dialect: "sqlite";
|
|
368
|
+
} | {
|
|
369
|
+
driver: string;
|
|
370
|
+
dbCredentials: {
|
|
371
|
+
accountId: string | undefined;
|
|
372
|
+
databaseId: string;
|
|
373
|
+
token: string | undefined;
|
|
374
|
+
url?: undefined;
|
|
375
|
+
};
|
|
376
|
+
schema: string;
|
|
377
|
+
out: string;
|
|
378
|
+
dialect: "sqlite";
|
|
379
|
+
} | {
|
|
380
|
+
dbCredentials: {
|
|
381
|
+
url: string | undefined;
|
|
382
|
+
accountId?: undefined;
|
|
383
|
+
databaseId?: undefined;
|
|
384
|
+
token?: undefined;
|
|
385
|
+
};
|
|
386
|
+
driver?: undefined;
|
|
415
387
|
schema: string;
|
|
416
388
|
out: string;
|
|
417
389
|
dialect: "sqlite";
|
|
@@ -568,5 +540,5 @@ interface WithRetryCounterOptions {
|
|
|
568
540
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
569
541
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
570
542
|
|
|
571
|
-
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, action, bankAccount, bankAccountBankCodeEnum, bankAccountCountryCodeEnum, bankAccountCurrencyEnum, bankAccountMetadataSchema, bankAccountPostgres, base, basePostgres, bicSchema, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, paginationQuerySchema, paginationSchema, service, useFetch, useResult, useResultSync, uuidv4 };
|
|
543
|
+
export { COMPATIBILITY_DATE, COMPATIBILITY_FLAGS, D1_LOCATION_HINT, DatabaseTransaction, ENVIRONMENT, QUEUE_DELIVERY_DELAY, QUEUE_MAX_BATCH_SIZE, QUEUE_MAX_BATCH_TIMEOUT, QUEUE_MESSAGE_RETENTION_PERIOD, R2_JURISDICTION, R2_LOCATION_HINT, R2_STORAGE_CLASS, RPCResponse, action, bankAccount, bankAccountBankCodeEnum, bankAccountCountryCodeEnum, bankAccountCurrencyEnum, bankAccountMetadataSchema, bankAccountPostgres, base, basePostgres, bicSchema, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, paginationQuerySchema, paginationSchema, service, useFetch, useResult, useResultSync, uuidv4 };
|
|
572
544
|
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, ValidatedInput };
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { z as z$1 } from 'zod';
|
|
|
6
6
|
import * as z from 'zod/v4/core';
|
|
7
7
|
import 'http-status-codes';
|
|
8
8
|
import { createError } from 'h3';
|
|
9
|
-
import
|
|
9
|
+
import 'cloudflare';
|
|
10
10
|
import fs from 'node:fs';
|
|
11
11
|
import crypto$1 from 'node:crypto';
|
|
12
12
|
import path from 'node:path';
|
|
@@ -62,6 +62,40 @@ const bankAccountPostgres = {
|
|
|
62
62
|
countryCode: bankAccountCountryCodeEnum().$type().notNull()
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
+
const COMPATIBILITY_DATE = "2025-06-04";
|
|
66
|
+
const COMPATIBILITY_FLAGS = ["nodejs_compat"];
|
|
67
|
+
const QUEUE_DELIVERY_DELAY = 5;
|
|
68
|
+
const QUEUE_MESSAGE_RETENTION_PERIOD = 259200;
|
|
69
|
+
const QUEUE_MAX_BATCH_SIZE = 1;
|
|
70
|
+
const QUEUE_MAX_BATCH_TIMEOUT = 5;
|
|
71
|
+
const D1_LOCATION_HINT = "weur";
|
|
72
|
+
const R2_STORAGE_CLASS = "Standard";
|
|
73
|
+
const R2_JURISDICTION = "eu";
|
|
74
|
+
const R2_LOCATION_HINT = "weur";
|
|
75
|
+
const composeWranglerBase = ({
|
|
76
|
+
project,
|
|
77
|
+
name
|
|
78
|
+
}) => {
|
|
79
|
+
return {
|
|
80
|
+
$schema: "../../node_modules/wrangler/config-schema.json",
|
|
81
|
+
name: `${project}-${name}`,
|
|
82
|
+
main: "./src/index.ts",
|
|
83
|
+
compatibility_date: COMPATIBILITY_DATE,
|
|
84
|
+
compatibility_flags: COMPATIBILITY_FLAGS,
|
|
85
|
+
observability: {
|
|
86
|
+
enabled: true,
|
|
87
|
+
head_sampling_rate: 1,
|
|
88
|
+
logs: {
|
|
89
|
+
enabled: true,
|
|
90
|
+
invocation_logs: false
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
preview_urls: false,
|
|
94
|
+
workers_dev: false,
|
|
95
|
+
keep_vars: true
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
65
99
|
const ENVIRONMENT = ["dev", "test", "staging", "production"];
|
|
66
100
|
|
|
67
101
|
const ibanSchema = z$1.string().min(1).regex(/^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$/, {
|
|
@@ -345,37 +379,6 @@ function durableObjectNamespaceIdFromName(uniqueKey, name) {
|
|
|
345
379
|
const hmac = crypto$1.createHmac("sha256", key).update(nameHmac).digest().subarray(0, 16);
|
|
346
380
|
return Buffer.concat([nameHmac, hmac]).toString("hex");
|
|
347
381
|
}
|
|
348
|
-
const getD1DatabaseId = async ({
|
|
349
|
-
instanceName,
|
|
350
|
-
environment
|
|
351
|
-
}) => {
|
|
352
|
-
const remoteD1s = [];
|
|
353
|
-
const cloudflare = new Cloudflare({
|
|
354
|
-
apiToken: process.env.CLOUDFLARE_API_TOKEN
|
|
355
|
-
});
|
|
356
|
-
let currentPage = await cloudflare.d1.database.list({
|
|
357
|
-
account_id: process.env.CLOUDFLARE_ACCOUNT_ID
|
|
358
|
-
});
|
|
359
|
-
remoteD1s.push(...currentPage.getPaginatedItems());
|
|
360
|
-
while (currentPage.hasNextPage()) {
|
|
361
|
-
const pageInfo = currentPage.nextPageInfo();
|
|
362
|
-
let nextPageParams;
|
|
363
|
-
if ("params" in pageInfo) {
|
|
364
|
-
nextPageParams = pageInfo.params;
|
|
365
|
-
} else {
|
|
366
|
-
nextPageParams = Object.fromEntries(pageInfo.url.searchParams);
|
|
367
|
-
}
|
|
368
|
-
currentPage = await cloudflare.d1.database.list({
|
|
369
|
-
account_id: process.env.CLOUDFLARE_ACCOUNT_ID,
|
|
370
|
-
...nextPageParams
|
|
371
|
-
});
|
|
372
|
-
remoteD1s.push(...currentPage.getPaginatedItems());
|
|
373
|
-
}
|
|
374
|
-
const instancesByName = remoteD1s.filter(
|
|
375
|
-
(d1) => d1.name?.includes(instanceName)
|
|
376
|
-
);
|
|
377
|
-
return instancesByName.filter((name) => name.name?.includes(environment)).at(0)?.uuid;
|
|
378
|
-
};
|
|
379
382
|
const getD1DatabaseIdFromWrangler = () => {
|
|
380
383
|
try {
|
|
381
384
|
const wranglerPath = path.resolve("./wrangler.jsonc");
|
|
@@ -432,40 +435,34 @@ const getLocalD1 = (databaseId) => {
|
|
|
432
435
|
}
|
|
433
436
|
}
|
|
434
437
|
};
|
|
435
|
-
const getD1Credentials =
|
|
436
|
-
instanceName
|
|
437
|
-
}) => {
|
|
438
|
+
const getD1Credentials = () => {
|
|
438
439
|
const environment = process.env.ENVIRONMENT;
|
|
439
440
|
if (environment === "localhost") {
|
|
440
441
|
return {};
|
|
441
442
|
}
|
|
443
|
+
const databaseId = getD1DatabaseIdFromWrangler() ?? "";
|
|
442
444
|
if (isRemoteEnvironment()) {
|
|
443
445
|
return {
|
|
444
446
|
driver: "d1-http",
|
|
445
447
|
dbCredentials: {
|
|
446
448
|
accountId: process.env.CLOUDFLARE_ACCOUNT_ID,
|
|
447
|
-
databaseId
|
|
448
|
-
environment,
|
|
449
|
-
instanceName
|
|
450
|
-
}),
|
|
449
|
+
databaseId,
|
|
451
450
|
token: process.env.CLOUDFLARE_API_TOKEN
|
|
452
451
|
}
|
|
453
452
|
};
|
|
454
453
|
} else {
|
|
455
454
|
return {
|
|
456
455
|
dbCredentials: {
|
|
457
|
-
url: getLocalD1(
|
|
456
|
+
url: getLocalD1(databaseId)
|
|
458
457
|
}
|
|
459
458
|
};
|
|
460
459
|
}
|
|
461
460
|
};
|
|
462
|
-
const getDrizzleD1Config = ({
|
|
463
|
-
instanceName
|
|
464
|
-
}) => ({
|
|
461
|
+
const getDrizzleD1Config = () => ({
|
|
465
462
|
schema: "./src/database/schema/",
|
|
466
463
|
out: "./src/database/migrations/",
|
|
467
464
|
dialect: "sqlite",
|
|
468
|
-
...getD1Credentials(
|
|
465
|
+
...getD1Credentials()
|
|
469
466
|
});
|
|
470
467
|
|
|
471
468
|
class DatabaseTransaction {
|
|
@@ -764,4 +761,4 @@ function develitWorker(Worker) {
|
|
|
764
761
|
return DevelitWorker;
|
|
765
762
|
}
|
|
766
763
|
|
|
767
|
-
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, action, bankAccount, bankAccountBankCodeEnum, bankAccountCountryCodeEnum, bankAccountCurrencyEnum, bankAccountMetadataSchema, bankAccountPostgres, base, basePostgres, bicSchema, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, paginationQuerySchema, paginationSchema, service, useFetch, useResult, useResultSync, uuidv4 };
|
|
764
|
+
export { COMPATIBILITY_DATE, COMPATIBILITY_FLAGS, D1_LOCATION_HINT, DatabaseTransaction, ENVIRONMENT, QUEUE_DELIVERY_DELAY, QUEUE_MAX_BATCH_SIZE, QUEUE_MAX_BATCH_TIMEOUT, QUEUE_MESSAGE_RETENTION_PERIOD, R2_JURISDICTION, R2_LOCATION_HINT, R2_STORAGE_CLASS, RPCResponse, action, bankAccount, bankAccountBankCodeEnum, bankAccountCountryCodeEnum, bankAccountCurrencyEnum, bankAccountMetadataSchema, bankAccountPostgres, base, basePostgres, bicSchema, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, paginationQuerySchema, paginationSchema, service, useFetch, useResult, useResultSync, uuidv4 };
|