@develit-io/backend-sdk 5.11.0 → 5.11.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 +7 -7
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +6 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -253,7 +253,6 @@ function derivePortFromId(id, base = 4e3, range = 1e4) {
|
|
|
253
253
|
}
|
|
254
254
|
return base + hash % range;
|
|
255
255
|
}
|
|
256
|
-
const getPgLocalConnectionString = (id) => `postgres://db_user:db_password@127.0.0.1:${derivePortFromId(id)}/db`;
|
|
257
256
|
|
|
258
257
|
function durableObjectNamespaceIdFromName(uniqueKey, name) {
|
|
259
258
|
const key = crypto__default.createHash("sha256").update(uniqueKey).digest();
|
|
@@ -340,12 +339,12 @@ const getD1Credentials = () => {
|
|
|
340
339
|
};
|
|
341
340
|
}
|
|
342
341
|
};
|
|
343
|
-
const
|
|
342
|
+
const getDrizzleD1Config = () => ({
|
|
344
343
|
schema: "./src/database/schema/",
|
|
345
344
|
out: "./src/database/migrations/",
|
|
346
345
|
dialect: "sqlite",
|
|
347
346
|
...getD1Credentials()
|
|
348
|
-
};
|
|
347
|
+
});
|
|
349
348
|
|
|
350
349
|
class DatabaseTransaction {
|
|
351
350
|
constructor(db, serviceName, auditLogWriter) {
|
|
@@ -409,6 +408,7 @@ const defineCommand = (handler) => {
|
|
|
409
408
|
}));
|
|
410
409
|
};
|
|
411
410
|
|
|
411
|
+
const getPgLocalConnectionString = (id) => `postgres://db_user:db_password@127.0.0.1:${derivePortFromId(id)}/db`;
|
|
412
412
|
const getPgDatabaseIdFromWrangler = () => {
|
|
413
413
|
try {
|
|
414
414
|
const wranglerPath = path__default.resolve("./wrangler.jsonc");
|
|
@@ -442,7 +442,7 @@ const getPgCredentials = () => {
|
|
|
442
442
|
};
|
|
443
443
|
}
|
|
444
444
|
};
|
|
445
|
-
const
|
|
445
|
+
const getDrizzlePgConfig = () => ({
|
|
446
446
|
schema: "./src/database/schema/",
|
|
447
447
|
out: "./src/database/migrations/",
|
|
448
448
|
dialect: "postgresql",
|
|
@@ -451,7 +451,7 @@ const drizzlePgConfig = {
|
|
|
451
451
|
table: "__drizzle_migrations",
|
|
452
452
|
schema: "public"
|
|
453
453
|
}
|
|
454
|
-
};
|
|
454
|
+
});
|
|
455
455
|
|
|
456
456
|
const calculateExponentialBackoff = (attempts, baseDelaySeconds) => {
|
|
457
457
|
return baseDelaySeconds ** attempts;
|
|
@@ -605,13 +605,13 @@ exports.createInternalError = createInternalError;
|
|
|
605
605
|
exports.defineCommand = defineCommand;
|
|
606
606
|
exports.derivePortFromId = derivePortFromId;
|
|
607
607
|
exports.develitWorker = develitWorker;
|
|
608
|
-
exports.drizzleD1Config = drizzleD1Config;
|
|
609
|
-
exports.drizzlePgConfig = drizzlePgConfig;
|
|
610
608
|
exports.durableObjectNamespaceIdFromName = durableObjectNamespaceIdFromName;
|
|
611
609
|
exports.first = first;
|
|
612
610
|
exports.firstOrError = firstOrError;
|
|
613
611
|
exports.getD1Credentials = getD1Credentials;
|
|
614
612
|
exports.getD1DatabaseIdFromWrangler = getD1DatabaseIdFromWrangler;
|
|
613
|
+
exports.getDrizzleD1Config = getDrizzleD1Config;
|
|
614
|
+
exports.getDrizzlePgConfig = getDrizzlePgConfig;
|
|
615
615
|
exports.getPgCredentials = getPgCredentials;
|
|
616
616
|
exports.getPgDatabaseIdFromWrangler = getPgDatabaseIdFromWrangler;
|
|
617
617
|
exports.getPgLocalConnectionString = getPgLocalConnectionString;
|
package/dist/index.d.cts
CHANGED
|
@@ -212,7 +212,7 @@ declare const getD1Credentials: () => {
|
|
|
212
212
|
};
|
|
213
213
|
driver?: undefined;
|
|
214
214
|
};
|
|
215
|
-
declare const
|
|
215
|
+
declare const getDrizzleD1Config: () => {
|
|
216
216
|
driver?: undefined;
|
|
217
217
|
dbCredentials?: undefined;
|
|
218
218
|
schema: string;
|
|
@@ -272,7 +272,6 @@ declare function first<T>(rows: T[]): T | undefined;
|
|
|
272
272
|
declare function firstOrError<T>(rows: T[]): T;
|
|
273
273
|
declare const uuidv4: () => `${string}-${string}-${string}-${string}-${string}`;
|
|
274
274
|
declare function derivePortFromId(id: string, base?: number, range?: number): number;
|
|
275
|
-
declare const getPgLocalConnectionString: (id: string) => string;
|
|
276
275
|
|
|
277
276
|
declare const createInternalError: (error: unknown, details?: {
|
|
278
277
|
status?: InternalErrorResponseStatus;
|
|
@@ -281,13 +280,14 @@ declare const createInternalError: (error: unknown, details?: {
|
|
|
281
280
|
}) => InternalError;
|
|
282
281
|
declare const isInternalError: (error: unknown) => error is InternalError;
|
|
283
282
|
|
|
283
|
+
declare const getPgLocalConnectionString: (id: string) => string;
|
|
284
284
|
declare const getPgDatabaseIdFromWrangler: () => string | undefined;
|
|
285
285
|
declare const getPgCredentials: () => {
|
|
286
286
|
dbCredentials: {
|
|
287
287
|
url: string;
|
|
288
288
|
};
|
|
289
289
|
};
|
|
290
|
-
declare const
|
|
290
|
+
declare const getDrizzlePgConfig: () => {
|
|
291
291
|
migrations: {
|
|
292
292
|
table: string;
|
|
293
293
|
schema: string;
|
|
@@ -399,5 +399,5 @@ interface WithRetryCounterOptions {
|
|
|
399
399
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
400
400
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
401
401
|
|
|
402
|
-
export { DatabaseTransaction, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker,
|
|
402
|
+
export { DatabaseTransaction, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
|
|
403
403
|
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, ValidatedInput };
|
package/dist/index.d.mts
CHANGED
|
@@ -212,7 +212,7 @@ declare const getD1Credentials: () => {
|
|
|
212
212
|
};
|
|
213
213
|
driver?: undefined;
|
|
214
214
|
};
|
|
215
|
-
declare const
|
|
215
|
+
declare const getDrizzleD1Config: () => {
|
|
216
216
|
driver?: undefined;
|
|
217
217
|
dbCredentials?: undefined;
|
|
218
218
|
schema: string;
|
|
@@ -272,7 +272,6 @@ declare function first<T>(rows: T[]): T | undefined;
|
|
|
272
272
|
declare function firstOrError<T>(rows: T[]): T;
|
|
273
273
|
declare const uuidv4: () => `${string}-${string}-${string}-${string}-${string}`;
|
|
274
274
|
declare function derivePortFromId(id: string, base?: number, range?: number): number;
|
|
275
|
-
declare const getPgLocalConnectionString: (id: string) => string;
|
|
276
275
|
|
|
277
276
|
declare const createInternalError: (error: unknown, details?: {
|
|
278
277
|
status?: InternalErrorResponseStatus;
|
|
@@ -281,13 +280,14 @@ declare const createInternalError: (error: unknown, details?: {
|
|
|
281
280
|
}) => InternalError;
|
|
282
281
|
declare const isInternalError: (error: unknown) => error is InternalError;
|
|
283
282
|
|
|
283
|
+
declare const getPgLocalConnectionString: (id: string) => string;
|
|
284
284
|
declare const getPgDatabaseIdFromWrangler: () => string | undefined;
|
|
285
285
|
declare const getPgCredentials: () => {
|
|
286
286
|
dbCredentials: {
|
|
287
287
|
url: string;
|
|
288
288
|
};
|
|
289
289
|
};
|
|
290
|
-
declare const
|
|
290
|
+
declare const getDrizzlePgConfig: () => {
|
|
291
291
|
migrations: {
|
|
292
292
|
table: string;
|
|
293
293
|
schema: string;
|
|
@@ -399,5 +399,5 @@ interface WithRetryCounterOptions {
|
|
|
399
399
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
400
400
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
401
401
|
|
|
402
|
-
export { DatabaseTransaction, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker,
|
|
402
|
+
export { DatabaseTransaction, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
|
|
403
403
|
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, ValidatedInput };
|
package/dist/index.d.ts
CHANGED
|
@@ -212,7 +212,7 @@ declare const getD1Credentials: () => {
|
|
|
212
212
|
};
|
|
213
213
|
driver?: undefined;
|
|
214
214
|
};
|
|
215
|
-
declare const
|
|
215
|
+
declare const getDrizzleD1Config: () => {
|
|
216
216
|
driver?: undefined;
|
|
217
217
|
dbCredentials?: undefined;
|
|
218
218
|
schema: string;
|
|
@@ -272,7 +272,6 @@ declare function first<T>(rows: T[]): T | undefined;
|
|
|
272
272
|
declare function firstOrError<T>(rows: T[]): T;
|
|
273
273
|
declare const uuidv4: () => `${string}-${string}-${string}-${string}-${string}`;
|
|
274
274
|
declare function derivePortFromId(id: string, base?: number, range?: number): number;
|
|
275
|
-
declare const getPgLocalConnectionString: (id: string) => string;
|
|
276
275
|
|
|
277
276
|
declare const createInternalError: (error: unknown, details?: {
|
|
278
277
|
status?: InternalErrorResponseStatus;
|
|
@@ -281,13 +280,14 @@ declare const createInternalError: (error: unknown, details?: {
|
|
|
281
280
|
}) => InternalError;
|
|
282
281
|
declare const isInternalError: (error: unknown) => error is InternalError;
|
|
283
282
|
|
|
283
|
+
declare const getPgLocalConnectionString: (id: string) => string;
|
|
284
284
|
declare const getPgDatabaseIdFromWrangler: () => string | undefined;
|
|
285
285
|
declare const getPgCredentials: () => {
|
|
286
286
|
dbCredentials: {
|
|
287
287
|
url: string;
|
|
288
288
|
};
|
|
289
289
|
};
|
|
290
|
-
declare const
|
|
290
|
+
declare const getDrizzlePgConfig: () => {
|
|
291
291
|
migrations: {
|
|
292
292
|
table: string;
|
|
293
293
|
schema: string;
|
|
@@ -399,5 +399,5 @@ interface WithRetryCounterOptions {
|
|
|
399
399
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
400
400
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
401
401
|
|
|
402
|
-
export { DatabaseTransaction, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker,
|
|
402
|
+
export { DatabaseTransaction, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
|
|
403
403
|
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, ValidatedInput };
|
package/dist/index.mjs
CHANGED
|
@@ -231,7 +231,6 @@ function derivePortFromId(id, base = 4e3, range = 1e4) {
|
|
|
231
231
|
}
|
|
232
232
|
return base + hash % range;
|
|
233
233
|
}
|
|
234
|
-
const getPgLocalConnectionString = (id) => `postgres://db_user:db_password@127.0.0.1:${derivePortFromId(id)}/db`;
|
|
235
234
|
|
|
236
235
|
function durableObjectNamespaceIdFromName(uniqueKey, name) {
|
|
237
236
|
const key = crypto$1.createHash("sha256").update(uniqueKey).digest();
|
|
@@ -318,12 +317,12 @@ const getD1Credentials = () => {
|
|
|
318
317
|
};
|
|
319
318
|
}
|
|
320
319
|
};
|
|
321
|
-
const
|
|
320
|
+
const getDrizzleD1Config = () => ({
|
|
322
321
|
schema: "./src/database/schema/",
|
|
323
322
|
out: "./src/database/migrations/",
|
|
324
323
|
dialect: "sqlite",
|
|
325
324
|
...getD1Credentials()
|
|
326
|
-
};
|
|
325
|
+
});
|
|
327
326
|
|
|
328
327
|
class DatabaseTransaction {
|
|
329
328
|
constructor(db, serviceName, auditLogWriter) {
|
|
@@ -387,6 +386,7 @@ const defineCommand = (handler) => {
|
|
|
387
386
|
}));
|
|
388
387
|
};
|
|
389
388
|
|
|
389
|
+
const getPgLocalConnectionString = (id) => `postgres://db_user:db_password@127.0.0.1:${derivePortFromId(id)}/db`;
|
|
390
390
|
const getPgDatabaseIdFromWrangler = () => {
|
|
391
391
|
try {
|
|
392
392
|
const wranglerPath = path.resolve("./wrangler.jsonc");
|
|
@@ -420,7 +420,7 @@ const getPgCredentials = () => {
|
|
|
420
420
|
};
|
|
421
421
|
}
|
|
422
422
|
};
|
|
423
|
-
const
|
|
423
|
+
const getDrizzlePgConfig = () => ({
|
|
424
424
|
schema: "./src/database/schema/",
|
|
425
425
|
out: "./src/database/migrations/",
|
|
426
426
|
dialect: "postgresql",
|
|
@@ -429,7 +429,7 @@ const drizzlePgConfig = {
|
|
|
429
429
|
table: "__drizzle_migrations",
|
|
430
430
|
schema: "public"
|
|
431
431
|
}
|
|
432
|
-
};
|
|
432
|
+
});
|
|
433
433
|
|
|
434
434
|
const calculateExponentialBackoff = (attempts, baseDelaySeconds) => {
|
|
435
435
|
return baseDelaySeconds ** attempts;
|
|
@@ -571,4 +571,4 @@ function develitWorker(Worker) {
|
|
|
571
571
|
return DevelitWorker;
|
|
572
572
|
}
|
|
573
573
|
|
|
574
|
-
export { DatabaseTransaction, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker,
|
|
574
|
+
export { DatabaseTransaction, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
|