@develit-io/backend-sdk 5.9.0 → 5.9.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.cjs +5 -1
- package/dist/index.d.cts +27 -1
- package/dist/index.d.mts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.mjs +3 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -246,6 +246,7 @@ const isRemoteEnvironment = () => {
|
|
|
246
246
|
const environment = process.env.ENVIRONMENT;
|
|
247
247
|
return environment && environment !== "localhost";
|
|
248
248
|
};
|
|
249
|
+
const getPostgresLocalConnectionString = () => `postgres://db_user:db_password@127.0.0.1:${process.env.DB_LOCAL_PORT}/db`;
|
|
249
250
|
|
|
250
251
|
function durableObjectNamespaceIdFromName(uniqueKey, name) {
|
|
251
252
|
const key = crypto__default.createHash("sha256").update(uniqueKey).digest();
|
|
@@ -411,7 +412,7 @@ const getPgCredentials = () => {
|
|
|
411
412
|
} else {
|
|
412
413
|
return {
|
|
413
414
|
dbCredentials: {
|
|
414
|
-
url:
|
|
415
|
+
url: getPostgresLocalConnectionString()
|
|
415
416
|
}
|
|
416
417
|
};
|
|
417
418
|
}
|
|
@@ -583,6 +584,9 @@ exports.drizzlePgConfig = drizzlePgConfig;
|
|
|
583
584
|
exports.durableObjectNamespaceIdFromName = durableObjectNamespaceIdFromName;
|
|
584
585
|
exports.first = first;
|
|
585
586
|
exports.firstOrError = firstOrError;
|
|
587
|
+
exports.getD1Credentials = getD1Credentials;
|
|
588
|
+
exports.getPgCredentials = getPgCredentials;
|
|
589
|
+
exports.getPostgresLocalConnectionString = getPostgresLocalConnectionString;
|
|
586
590
|
exports.handleAction = handleAction;
|
|
587
591
|
exports.handleActionResponse = handleActionResponse;
|
|
588
592
|
exports.ibanZodSchema = ibanZodSchema;
|
package/dist/index.d.cts
CHANGED
|
@@ -191,6 +191,26 @@ type AuditLogWriter<TAuditAction = string> = (logs: AuditLogPayload<TAuditAction
|
|
|
191
191
|
declare function createAuditLogWriter<TAuditAction = string>(table: AuditLogTable): AuditLogWriter<TAuditAction>;
|
|
192
192
|
|
|
193
193
|
declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string): string;
|
|
194
|
+
declare const getD1Credentials: () => {
|
|
195
|
+
driver?: undefined;
|
|
196
|
+
dbCredentials?: undefined;
|
|
197
|
+
} | {
|
|
198
|
+
driver: string;
|
|
199
|
+
dbCredentials: {
|
|
200
|
+
accountId: string | undefined;
|
|
201
|
+
databaseId: string;
|
|
202
|
+
token: string | undefined;
|
|
203
|
+
url?: undefined;
|
|
204
|
+
};
|
|
205
|
+
} | {
|
|
206
|
+
dbCredentials: {
|
|
207
|
+
url: string | undefined;
|
|
208
|
+
accountId?: undefined;
|
|
209
|
+
databaseId?: undefined;
|
|
210
|
+
token?: undefined;
|
|
211
|
+
};
|
|
212
|
+
driver?: undefined;
|
|
213
|
+
};
|
|
194
214
|
declare const drizzleD1Config: {
|
|
195
215
|
driver?: undefined;
|
|
196
216
|
dbCredentials?: undefined;
|
|
@@ -250,6 +270,7 @@ declare class DatabaseTransaction<TAuditAction = string> {
|
|
|
250
270
|
declare function first<T>(rows: T[]): T | undefined;
|
|
251
271
|
declare function firstOrError<T>(rows: T[]): T;
|
|
252
272
|
declare const uuidv4: () => `${string}-${string}-${string}-${string}-${string}`;
|
|
273
|
+
declare const getPostgresLocalConnectionString: () => string;
|
|
253
274
|
|
|
254
275
|
declare const createInternalError: (error: unknown, details?: {
|
|
255
276
|
status?: InternalErrorResponseStatus;
|
|
@@ -258,6 +279,11 @@ declare const createInternalError: (error: unknown, details?: {
|
|
|
258
279
|
}) => InternalError;
|
|
259
280
|
declare const isInternalError: (error: unknown) => error is InternalError;
|
|
260
281
|
|
|
282
|
+
declare const getPgCredentials: () => {
|
|
283
|
+
dbCredentials: {
|
|
284
|
+
url: string;
|
|
285
|
+
};
|
|
286
|
+
};
|
|
261
287
|
declare const drizzlePgConfig: {
|
|
262
288
|
migrations: {
|
|
263
289
|
table: string;
|
|
@@ -370,4 +396,4 @@ interface WithRetryCounterOptions {
|
|
|
370
396
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
371
397
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
372
398
|
|
|
373
|
-
export { type ActionExecution, type ActionHandlerOptions, type AuditLogWriter, type Command, type CommandLogPayload, DatabaseTransaction, type DevelitWorkerMethods, type GatewayResponse, type IRPCResponse, type IncludeRelation, type InferResultType, type InternalError, type InternalErrorResponseStatus, RPCResponse, type ValidatedInput, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, develitWorker, drizzleD1Config, drizzlePgConfig, durableObjectNamespaceIdFromName, first, firstOrError, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
|
|
399
|
+
export { type ActionExecution, type ActionHandlerOptions, type AuditLogWriter, type Command, type CommandLogPayload, DatabaseTransaction, type DevelitWorkerMethods, type GatewayResponse, type IRPCResponse, type IncludeRelation, type InferResultType, type InternalError, type InternalErrorResponseStatus, RPCResponse, type ValidatedInput, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, develitWorker, drizzleD1Config, drizzlePgConfig, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getPgCredentials, getPostgresLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
|
package/dist/index.d.mts
CHANGED
|
@@ -191,6 +191,26 @@ type AuditLogWriter<TAuditAction = string> = (logs: AuditLogPayload<TAuditAction
|
|
|
191
191
|
declare function createAuditLogWriter<TAuditAction = string>(table: AuditLogTable): AuditLogWriter<TAuditAction>;
|
|
192
192
|
|
|
193
193
|
declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string): string;
|
|
194
|
+
declare const getD1Credentials: () => {
|
|
195
|
+
driver?: undefined;
|
|
196
|
+
dbCredentials?: undefined;
|
|
197
|
+
} | {
|
|
198
|
+
driver: string;
|
|
199
|
+
dbCredentials: {
|
|
200
|
+
accountId: string | undefined;
|
|
201
|
+
databaseId: string;
|
|
202
|
+
token: string | undefined;
|
|
203
|
+
url?: undefined;
|
|
204
|
+
};
|
|
205
|
+
} | {
|
|
206
|
+
dbCredentials: {
|
|
207
|
+
url: string | undefined;
|
|
208
|
+
accountId?: undefined;
|
|
209
|
+
databaseId?: undefined;
|
|
210
|
+
token?: undefined;
|
|
211
|
+
};
|
|
212
|
+
driver?: undefined;
|
|
213
|
+
};
|
|
194
214
|
declare const drizzleD1Config: {
|
|
195
215
|
driver?: undefined;
|
|
196
216
|
dbCredentials?: undefined;
|
|
@@ -250,6 +270,7 @@ declare class DatabaseTransaction<TAuditAction = string> {
|
|
|
250
270
|
declare function first<T>(rows: T[]): T | undefined;
|
|
251
271
|
declare function firstOrError<T>(rows: T[]): T;
|
|
252
272
|
declare const uuidv4: () => `${string}-${string}-${string}-${string}-${string}`;
|
|
273
|
+
declare const getPostgresLocalConnectionString: () => string;
|
|
253
274
|
|
|
254
275
|
declare const createInternalError: (error: unknown, details?: {
|
|
255
276
|
status?: InternalErrorResponseStatus;
|
|
@@ -258,6 +279,11 @@ declare const createInternalError: (error: unknown, details?: {
|
|
|
258
279
|
}) => InternalError;
|
|
259
280
|
declare const isInternalError: (error: unknown) => error is InternalError;
|
|
260
281
|
|
|
282
|
+
declare const getPgCredentials: () => {
|
|
283
|
+
dbCredentials: {
|
|
284
|
+
url: string;
|
|
285
|
+
};
|
|
286
|
+
};
|
|
261
287
|
declare const drizzlePgConfig: {
|
|
262
288
|
migrations: {
|
|
263
289
|
table: string;
|
|
@@ -370,4 +396,4 @@ interface WithRetryCounterOptions {
|
|
|
370
396
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
371
397
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
372
398
|
|
|
373
|
-
export { type ActionExecution, type ActionHandlerOptions, type AuditLogWriter, type Command, type CommandLogPayload, DatabaseTransaction, type DevelitWorkerMethods, type GatewayResponse, type IRPCResponse, type IncludeRelation, type InferResultType, type InternalError, type InternalErrorResponseStatus, RPCResponse, type ValidatedInput, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, develitWorker, drizzleD1Config, drizzlePgConfig, durableObjectNamespaceIdFromName, first, firstOrError, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
|
|
399
|
+
export { type ActionExecution, type ActionHandlerOptions, type AuditLogWriter, type Command, type CommandLogPayload, DatabaseTransaction, type DevelitWorkerMethods, type GatewayResponse, type IRPCResponse, type IncludeRelation, type InferResultType, type InternalError, type InternalErrorResponseStatus, RPCResponse, type ValidatedInput, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, develitWorker, drizzleD1Config, drizzlePgConfig, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getPgCredentials, getPostgresLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
|
package/dist/index.d.ts
CHANGED
|
@@ -191,6 +191,26 @@ type AuditLogWriter<TAuditAction = string> = (logs: AuditLogPayload<TAuditAction
|
|
|
191
191
|
declare function createAuditLogWriter<TAuditAction = string>(table: AuditLogTable): AuditLogWriter<TAuditAction>;
|
|
192
192
|
|
|
193
193
|
declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string): string;
|
|
194
|
+
declare const getD1Credentials: () => {
|
|
195
|
+
driver?: undefined;
|
|
196
|
+
dbCredentials?: undefined;
|
|
197
|
+
} | {
|
|
198
|
+
driver: string;
|
|
199
|
+
dbCredentials: {
|
|
200
|
+
accountId: string | undefined;
|
|
201
|
+
databaseId: string;
|
|
202
|
+
token: string | undefined;
|
|
203
|
+
url?: undefined;
|
|
204
|
+
};
|
|
205
|
+
} | {
|
|
206
|
+
dbCredentials: {
|
|
207
|
+
url: string | undefined;
|
|
208
|
+
accountId?: undefined;
|
|
209
|
+
databaseId?: undefined;
|
|
210
|
+
token?: undefined;
|
|
211
|
+
};
|
|
212
|
+
driver?: undefined;
|
|
213
|
+
};
|
|
194
214
|
declare const drizzleD1Config: {
|
|
195
215
|
driver?: undefined;
|
|
196
216
|
dbCredentials?: undefined;
|
|
@@ -250,6 +270,7 @@ declare class DatabaseTransaction<TAuditAction = string> {
|
|
|
250
270
|
declare function first<T>(rows: T[]): T | undefined;
|
|
251
271
|
declare function firstOrError<T>(rows: T[]): T;
|
|
252
272
|
declare const uuidv4: () => `${string}-${string}-${string}-${string}-${string}`;
|
|
273
|
+
declare const getPostgresLocalConnectionString: () => string;
|
|
253
274
|
|
|
254
275
|
declare const createInternalError: (error: unknown, details?: {
|
|
255
276
|
status?: InternalErrorResponseStatus;
|
|
@@ -258,6 +279,11 @@ declare const createInternalError: (error: unknown, details?: {
|
|
|
258
279
|
}) => InternalError;
|
|
259
280
|
declare const isInternalError: (error: unknown) => error is InternalError;
|
|
260
281
|
|
|
282
|
+
declare const getPgCredentials: () => {
|
|
283
|
+
dbCredentials: {
|
|
284
|
+
url: string;
|
|
285
|
+
};
|
|
286
|
+
};
|
|
261
287
|
declare const drizzlePgConfig: {
|
|
262
288
|
migrations: {
|
|
263
289
|
table: string;
|
|
@@ -370,4 +396,4 @@ interface WithRetryCounterOptions {
|
|
|
370
396
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
371
397
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
372
398
|
|
|
373
|
-
export { type ActionExecution, type ActionHandlerOptions, type AuditLogWriter, type Command, type CommandLogPayload, DatabaseTransaction, type DevelitWorkerMethods, type GatewayResponse, type IRPCResponse, type IncludeRelation, type InferResultType, type InternalError, type InternalErrorResponseStatus, RPCResponse, type ValidatedInput, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, develitWorker, drizzleD1Config, drizzlePgConfig, durableObjectNamespaceIdFromName, first, firstOrError, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
|
|
399
|
+
export { type ActionExecution, type ActionHandlerOptions, type AuditLogWriter, type Command, type CommandLogPayload, DatabaseTransaction, type DevelitWorkerMethods, type GatewayResponse, type IRPCResponse, type IncludeRelation, type InferResultType, type InternalError, type InternalErrorResponseStatus, RPCResponse, type ValidatedInput, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, develitWorker, drizzleD1Config, drizzlePgConfig, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getPgCredentials, getPostgresLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
|
package/dist/index.mjs
CHANGED
|
@@ -224,6 +224,7 @@ const isRemoteEnvironment = () => {
|
|
|
224
224
|
const environment = process.env.ENVIRONMENT;
|
|
225
225
|
return environment && environment !== "localhost";
|
|
226
226
|
};
|
|
227
|
+
const getPostgresLocalConnectionString = () => `postgres://db_user:db_password@127.0.0.1:${process.env.DB_LOCAL_PORT}/db`;
|
|
227
228
|
|
|
228
229
|
function durableObjectNamespaceIdFromName(uniqueKey, name) {
|
|
229
230
|
const key = crypto$1.createHash("sha256").update(uniqueKey).digest();
|
|
@@ -389,7 +390,7 @@ const getPgCredentials = () => {
|
|
|
389
390
|
} else {
|
|
390
391
|
return {
|
|
391
392
|
dbCredentials: {
|
|
392
|
-
url:
|
|
393
|
+
url: getPostgresLocalConnectionString()
|
|
393
394
|
}
|
|
394
395
|
};
|
|
395
396
|
}
|
|
@@ -545,4 +546,4 @@ function develitWorker(Worker) {
|
|
|
545
546
|
return DevelitWorker;
|
|
546
547
|
}
|
|
547
548
|
|
|
548
|
-
export { DatabaseTransaction, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, develitWorker, drizzleD1Config, drizzlePgConfig, durableObjectNamespaceIdFromName, first, firstOrError, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
|
|
549
|
+
export { DatabaseTransaction, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, develitWorker, drizzleD1Config, drizzlePgConfig, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getPgCredentials, getPostgresLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
|