@develit-io/backend-sdk 5.33.0 → 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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +13 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -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
|
@@ -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 };
|