@develit-io/backend-sdk 5.32.3 → 5.33.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.mts +12 -10
- package/dist/index.d.ts +12 -10
- package/dist/index.mjs +13 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -305,7 +305,7 @@ type AuditLogWriter<TAuditAction = string> = (logs: AuditLogPayload<TAuditAction
|
|
|
305
305
|
*/
|
|
306
306
|
declare function createAuditLogWriter<TAuditAction = string>(table: AuditLogTable): AuditLogWriter<TAuditAction>;
|
|
307
307
|
|
|
308
|
-
declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string):
|
|
308
|
+
declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string): string;
|
|
309
309
|
declare const getD1DatabaseIdFromWrangler: () => string | undefined;
|
|
310
310
|
declare const getD1Credentials: () => {
|
|
311
311
|
driver?: undefined;
|
|
@@ -313,14 +313,14 @@ declare const getD1Credentials: () => {
|
|
|
313
313
|
} | {
|
|
314
314
|
driver: string;
|
|
315
315
|
dbCredentials: {
|
|
316
|
-
accountId:
|
|
316
|
+
accountId: string | undefined;
|
|
317
317
|
databaseId: string;
|
|
318
|
-
token:
|
|
318
|
+
token: string | undefined;
|
|
319
319
|
url?: undefined;
|
|
320
320
|
};
|
|
321
321
|
} | {
|
|
322
322
|
dbCredentials: {
|
|
323
|
-
url:
|
|
323
|
+
url: string | undefined;
|
|
324
324
|
accountId?: undefined;
|
|
325
325
|
databaseId?: undefined;
|
|
326
326
|
token?: undefined;
|
|
@@ -336,9 +336,9 @@ declare const getDrizzleD1Config: () => {
|
|
|
336
336
|
} | {
|
|
337
337
|
driver: string;
|
|
338
338
|
dbCredentials: {
|
|
339
|
-
accountId:
|
|
339
|
+
accountId: string | undefined;
|
|
340
340
|
databaseId: string;
|
|
341
|
-
token:
|
|
341
|
+
token: string | undefined;
|
|
342
342
|
url?: undefined;
|
|
343
343
|
};
|
|
344
344
|
schema: string;
|
|
@@ -346,7 +346,7 @@ declare const getDrizzleD1Config: () => {
|
|
|
346
346
|
dialect: "sqlite";
|
|
347
347
|
} | {
|
|
348
348
|
dbCredentials: {
|
|
349
|
-
url:
|
|
349
|
+
url: string | undefined;
|
|
350
350
|
accountId?: undefined;
|
|
351
351
|
databaseId?: undefined;
|
|
352
352
|
token?: undefined;
|
|
@@ -403,7 +403,7 @@ declare const getPgLocalConnectionString: (id: string) => string;
|
|
|
403
403
|
declare const getPgDatabaseIdFromWrangler: () => string | undefined;
|
|
404
404
|
declare const getPgCredentials: (serviceName?: string) => {
|
|
405
405
|
dbCredentials: {
|
|
406
|
-
url:
|
|
406
|
+
url: string;
|
|
407
407
|
};
|
|
408
408
|
};
|
|
409
409
|
declare const getDrizzlePgConfig: () => {
|
|
@@ -412,7 +412,7 @@ declare const getDrizzlePgConfig: () => {
|
|
|
412
412
|
schema: string;
|
|
413
413
|
};
|
|
414
414
|
dbCredentials: {
|
|
415
|
-
url:
|
|
415
|
+
url: string;
|
|
416
416
|
};
|
|
417
417
|
schema: string;
|
|
418
418
|
out: string;
|
|
@@ -487,6 +487,8 @@ declare const useResult: <T>(promise: Promise<T>) => Promise<Result<T>>;
|
|
|
487
487
|
*/
|
|
488
488
|
declare const useResultSync: <T>(fn: () => T) => Result<T>;
|
|
489
489
|
|
|
490
|
+
declare const getSecret: (secretName: string, env: unknown) => Promise<string>;
|
|
491
|
+
|
|
490
492
|
declare const service: (serviceName: string) => <T extends new (...args: any[]) => object>(constructor: T) => {
|
|
491
493
|
new (...args: any[]): {
|
|
492
494
|
name: string;
|
|
@@ -506,5 +508,5 @@ interface WithRetryCounterOptions {
|
|
|
506
508
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
507
509
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
508
510
|
|
|
509
|
-
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, handleAction, handleActionResponse, ibanSchema, isInternalError, paginationQuerySchema, paginationSchema, service, useFetch, useResult, useResultSync, uuidv4 };
|
|
511
|
+
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 };
|
|
510
512
|
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, ValidatedInput };
|
package/dist/index.d.ts
CHANGED
|
@@ -305,7 +305,7 @@ type AuditLogWriter<TAuditAction = string> = (logs: AuditLogPayload<TAuditAction
|
|
|
305
305
|
*/
|
|
306
306
|
declare function createAuditLogWriter<TAuditAction = string>(table: AuditLogTable): AuditLogWriter<TAuditAction>;
|
|
307
307
|
|
|
308
|
-
declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string):
|
|
308
|
+
declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string): string;
|
|
309
309
|
declare const getD1DatabaseIdFromWrangler: () => string | undefined;
|
|
310
310
|
declare const getD1Credentials: () => {
|
|
311
311
|
driver?: undefined;
|
|
@@ -313,14 +313,14 @@ declare const getD1Credentials: () => {
|
|
|
313
313
|
} | {
|
|
314
314
|
driver: string;
|
|
315
315
|
dbCredentials: {
|
|
316
|
-
accountId:
|
|
316
|
+
accountId: string | undefined;
|
|
317
317
|
databaseId: string;
|
|
318
|
-
token:
|
|
318
|
+
token: string | undefined;
|
|
319
319
|
url?: undefined;
|
|
320
320
|
};
|
|
321
321
|
} | {
|
|
322
322
|
dbCredentials: {
|
|
323
|
-
url:
|
|
323
|
+
url: string | undefined;
|
|
324
324
|
accountId?: undefined;
|
|
325
325
|
databaseId?: undefined;
|
|
326
326
|
token?: undefined;
|
|
@@ -336,9 +336,9 @@ declare const getDrizzleD1Config: () => {
|
|
|
336
336
|
} | {
|
|
337
337
|
driver: string;
|
|
338
338
|
dbCredentials: {
|
|
339
|
-
accountId:
|
|
339
|
+
accountId: string | undefined;
|
|
340
340
|
databaseId: string;
|
|
341
|
-
token:
|
|
341
|
+
token: string | undefined;
|
|
342
342
|
url?: undefined;
|
|
343
343
|
};
|
|
344
344
|
schema: string;
|
|
@@ -346,7 +346,7 @@ declare const getDrizzleD1Config: () => {
|
|
|
346
346
|
dialect: "sqlite";
|
|
347
347
|
} | {
|
|
348
348
|
dbCredentials: {
|
|
349
|
-
url:
|
|
349
|
+
url: string | undefined;
|
|
350
350
|
accountId?: undefined;
|
|
351
351
|
databaseId?: undefined;
|
|
352
352
|
token?: undefined;
|
|
@@ -403,7 +403,7 @@ declare const getPgLocalConnectionString: (id: string) => string;
|
|
|
403
403
|
declare const getPgDatabaseIdFromWrangler: () => string | undefined;
|
|
404
404
|
declare const getPgCredentials: (serviceName?: string) => {
|
|
405
405
|
dbCredentials: {
|
|
406
|
-
url:
|
|
406
|
+
url: string;
|
|
407
407
|
};
|
|
408
408
|
};
|
|
409
409
|
declare const getDrizzlePgConfig: () => {
|
|
@@ -412,7 +412,7 @@ declare const getDrizzlePgConfig: () => {
|
|
|
412
412
|
schema: string;
|
|
413
413
|
};
|
|
414
414
|
dbCredentials: {
|
|
415
|
-
url:
|
|
415
|
+
url: string;
|
|
416
416
|
};
|
|
417
417
|
schema: string;
|
|
418
418
|
out: string;
|
|
@@ -487,6 +487,8 @@ declare const useResult: <T>(promise: Promise<T>) => Promise<Result<T>>;
|
|
|
487
487
|
*/
|
|
488
488
|
declare const useResultSync: <T>(fn: () => T) => Result<T>;
|
|
489
489
|
|
|
490
|
+
declare const getSecret: (secretName: string, env: unknown) => Promise<string>;
|
|
491
|
+
|
|
490
492
|
declare const service: (serviceName: string) => <T extends new (...args: any[]) => object>(constructor: T) => {
|
|
491
493
|
new (...args: any[]): {
|
|
492
494
|
name: string;
|
|
@@ -506,5 +508,5 @@ interface WithRetryCounterOptions {
|
|
|
506
508
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
507
509
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
508
510
|
|
|
509
|
-
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, handleAction, handleActionResponse, ibanSchema, isInternalError, paginationQuerySchema, paginationSchema, service, useFetch, useResult, useResultSync, uuidv4 };
|
|
511
|
+
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 };
|
|
510
512
|
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, ValidatedInput };
|
package/dist/index.mjs
CHANGED
|
@@ -574,6 +574,18 @@ const calculateExponentialBackoff = (attempts, baseDelaySeconds) => {
|
|
|
574
574
|
return baseDelaySeconds ** attempts;
|
|
575
575
|
};
|
|
576
576
|
|
|
577
|
+
const getSecret = async (secretName, env) => {
|
|
578
|
+
const environment = env;
|
|
579
|
+
if (!(secretName in environment)) {
|
|
580
|
+
throw new Error(`Could not find a secret named '${secretName}'.`);
|
|
581
|
+
}
|
|
582
|
+
const secret = environment[secretName];
|
|
583
|
+
if (typeof secret === "string") {
|
|
584
|
+
return secret;
|
|
585
|
+
}
|
|
586
|
+
return await secret.get();
|
|
587
|
+
};
|
|
588
|
+
|
|
577
589
|
const service = (serviceName) => {
|
|
578
590
|
return function(constructor) {
|
|
579
591
|
return class extends constructor {
|
|
@@ -714,4 +726,4 @@ function develitWorker(Worker) {
|
|
|
714
726
|
return DevelitWorker;
|
|
715
727
|
}
|
|
716
728
|
|
|
717
|
-
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, handleAction, handleActionResponse, ibanSchema, isInternalError, paginationQuerySchema, paginationSchema, service, useFetch, useResult, useResultSync, uuidv4 };
|
|
729
|
+
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 };
|