@develit-io/backend-sdk 10.0.4 → 10.0.5
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 +37 -8
- package/dist/index.d.ts +37 -8
- package/dist/index.mjs +62 -48
- package/dist/middlewares.mjs +2 -2
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as drizzle_orm from 'drizzle-orm';
|
|
2
|
-
import { Table, AnyColumn } from 'drizzle-orm';
|
|
2
|
+
import { Table, ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult, AnyColumn } from 'drizzle-orm';
|
|
3
3
|
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
4
4
|
import { AnySQLiteTable } from 'drizzle-orm/sqlite-core';
|
|
5
5
|
import { z as z$1, ZodObject, ZodType, ZodOptional } from 'zod';
|
|
@@ -944,6 +944,26 @@ type IdentityContextVariables = {
|
|
|
944
944
|
};
|
|
945
945
|
};
|
|
946
946
|
|
|
947
|
+
/**
|
|
948
|
+
* Utility type to infer possible relation includes (`with`) for a given table.
|
|
949
|
+
* This helps define which relations (one-to-many, many-to-one) can be included in a query.
|
|
950
|
+
*
|
|
951
|
+
* @template Tables - The Drizzle ORM schema object.
|
|
952
|
+
* @template TableName - The table for which relations should be inferred.
|
|
953
|
+
*/
|
|
954
|
+
type IncludeRelation<Tables extends Record<string, unknown>, TableName extends keyof ExtractTablesWithRelations<Tables>> = DBQueryConfig<'one' | 'many', boolean, ExtractTablesWithRelations<Tables>, ExtractTablesWithRelations<Tables>[TableName]>['with'];
|
|
955
|
+
/**
|
|
956
|
+
* Infers the result type of Drizzle ORM select query with optional relations.
|
|
957
|
+
* This ensures correct TypeScript inference when querying tables and their relations.
|
|
958
|
+
*
|
|
959
|
+
* @template Tables - The Drizzle ORM schema object.
|
|
960
|
+
* @template TableName - The table for which the query result is being inferred.
|
|
961
|
+
* @template With - (Optional) Specifies which relations should be included in the result.
|
|
962
|
+
*/
|
|
963
|
+
type InferResultType<Tables extends Record<string, unknown>, TableName extends keyof ExtractTablesWithRelations<Tables>, With extends IncludeRelation<Tables, TableName> | undefined = undefined> = BuildQueryResult<ExtractTablesWithRelations<Tables>, ExtractTablesWithRelations<Tables>[TableName], {
|
|
964
|
+
with: With;
|
|
965
|
+
}>;
|
|
966
|
+
|
|
947
967
|
interface RequestLog {
|
|
948
968
|
method: string;
|
|
949
969
|
path: string;
|
|
@@ -1117,8 +1137,11 @@ type AuditLogWriter<TAuditAction = string> = (logs: AuditLogPayload<TAuditAction
|
|
|
1117
1137
|
declare function createAuditLogWriter<TAuditAction = string>(table: AuditLogTable): AuditLogWriter<TAuditAction>;
|
|
1118
1138
|
|
|
1119
1139
|
declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string): string;
|
|
1120
|
-
declare const
|
|
1121
|
-
declare const getD1Credentials: () =>
|
|
1140
|
+
declare const getD1DatabaseIdFromWrangler: () => string | undefined;
|
|
1141
|
+
declare const getD1Credentials: () => {
|
|
1142
|
+
driver?: undefined;
|
|
1143
|
+
dbCredentials?: undefined;
|
|
1144
|
+
} | {
|
|
1122
1145
|
driver: string;
|
|
1123
1146
|
dbCredentials: {
|
|
1124
1147
|
accountId: string | undefined;
|
|
@@ -1134,8 +1157,14 @@ declare const getD1Credentials: () => Promise<{
|
|
|
1134
1157
|
token?: undefined;
|
|
1135
1158
|
};
|
|
1136
1159
|
driver?: undefined;
|
|
1137
|
-
}
|
|
1138
|
-
declare const getDrizzleD1Config: () =>
|
|
1160
|
+
};
|
|
1161
|
+
declare const getDrizzleD1Config: () => {
|
|
1162
|
+
driver?: undefined;
|
|
1163
|
+
dbCredentials?: undefined;
|
|
1164
|
+
schema: string;
|
|
1165
|
+
out: string;
|
|
1166
|
+
dialect: "sqlite";
|
|
1167
|
+
} | {
|
|
1139
1168
|
driver: string;
|
|
1140
1169
|
dbCredentials: {
|
|
1141
1170
|
accountId: string | undefined;
|
|
@@ -1157,7 +1186,7 @@ declare const getDrizzleD1Config: () => Promise<{
|
|
|
1157
1186
|
schema: string;
|
|
1158
1187
|
out: string;
|
|
1159
1188
|
dialect: "sqlite";
|
|
1160
|
-
}
|
|
1189
|
+
};
|
|
1161
1190
|
|
|
1162
1191
|
type Operator = 'like' | 'ilike';
|
|
1163
1192
|
type Wrap = 'both' | 'prefix' | 'suffix' | 'none';
|
|
@@ -1310,5 +1339,5 @@ interface WithRetryCounterOptions {
|
|
|
1310
1339
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
1311
1340
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
1312
1341
|
|
|
1313
|
-
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInsertSchema, createInternalError, createPatchSchema, createUpdateSchema, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials,
|
|
1314
|
-
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyContextVariables, IdentityContextVariables, InternalError, InternalErrorResponseStatus, Project, RequestLog, ResponseLog, StructuredAddress, UserRole, ValidatedInput, WorkflowInstanceStatus };
|
|
1342
|
+
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInsertSchema, createInternalError, createPatchSchema, createUpdateSchema, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, ibanSchema, isInternalError, nullToOptional, optionalToNull, paginationQuerySchema, paginationSchema, resolveColumn, service, structuredAddressSchema, useFetch, useResult, useResultSync, uuidv4, uuidv5, workflowInstanceStatusSchema };
|
|
1343
|
+
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyContextVariables, IdentityContextVariables, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, RequestLog, ResponseLog, StructuredAddress, UserRole, ValidatedInput, WorkflowInstanceStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as drizzle_orm from 'drizzle-orm';
|
|
2
|
-
import { Table, AnyColumn } from 'drizzle-orm';
|
|
2
|
+
import { Table, ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult, AnyColumn } from 'drizzle-orm';
|
|
3
3
|
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
4
4
|
import { AnySQLiteTable } from 'drizzle-orm/sqlite-core';
|
|
5
5
|
import { z as z$1, ZodObject, ZodType, ZodOptional } from 'zod';
|
|
@@ -944,6 +944,26 @@ type IdentityContextVariables = {
|
|
|
944
944
|
};
|
|
945
945
|
};
|
|
946
946
|
|
|
947
|
+
/**
|
|
948
|
+
* Utility type to infer possible relation includes (`with`) for a given table.
|
|
949
|
+
* This helps define which relations (one-to-many, many-to-one) can be included in a query.
|
|
950
|
+
*
|
|
951
|
+
* @template Tables - The Drizzle ORM schema object.
|
|
952
|
+
* @template TableName - The table for which relations should be inferred.
|
|
953
|
+
*/
|
|
954
|
+
type IncludeRelation<Tables extends Record<string, unknown>, TableName extends keyof ExtractTablesWithRelations<Tables>> = DBQueryConfig<'one' | 'many', boolean, ExtractTablesWithRelations<Tables>, ExtractTablesWithRelations<Tables>[TableName]>['with'];
|
|
955
|
+
/**
|
|
956
|
+
* Infers the result type of Drizzle ORM select query with optional relations.
|
|
957
|
+
* This ensures correct TypeScript inference when querying tables and their relations.
|
|
958
|
+
*
|
|
959
|
+
* @template Tables - The Drizzle ORM schema object.
|
|
960
|
+
* @template TableName - The table for which the query result is being inferred.
|
|
961
|
+
* @template With - (Optional) Specifies which relations should be included in the result.
|
|
962
|
+
*/
|
|
963
|
+
type InferResultType<Tables extends Record<string, unknown>, TableName extends keyof ExtractTablesWithRelations<Tables>, With extends IncludeRelation<Tables, TableName> | undefined = undefined> = BuildQueryResult<ExtractTablesWithRelations<Tables>, ExtractTablesWithRelations<Tables>[TableName], {
|
|
964
|
+
with: With;
|
|
965
|
+
}>;
|
|
966
|
+
|
|
947
967
|
interface RequestLog {
|
|
948
968
|
method: string;
|
|
949
969
|
path: string;
|
|
@@ -1117,8 +1137,11 @@ type AuditLogWriter<TAuditAction = string> = (logs: AuditLogPayload<TAuditAction
|
|
|
1117
1137
|
declare function createAuditLogWriter<TAuditAction = string>(table: AuditLogTable): AuditLogWriter<TAuditAction>;
|
|
1118
1138
|
|
|
1119
1139
|
declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string): string;
|
|
1120
|
-
declare const
|
|
1121
|
-
declare const getD1Credentials: () =>
|
|
1140
|
+
declare const getD1DatabaseIdFromWrangler: () => string | undefined;
|
|
1141
|
+
declare const getD1Credentials: () => {
|
|
1142
|
+
driver?: undefined;
|
|
1143
|
+
dbCredentials?: undefined;
|
|
1144
|
+
} | {
|
|
1122
1145
|
driver: string;
|
|
1123
1146
|
dbCredentials: {
|
|
1124
1147
|
accountId: string | undefined;
|
|
@@ -1134,8 +1157,14 @@ declare const getD1Credentials: () => Promise<{
|
|
|
1134
1157
|
token?: undefined;
|
|
1135
1158
|
};
|
|
1136
1159
|
driver?: undefined;
|
|
1137
|
-
}
|
|
1138
|
-
declare const getDrizzleD1Config: () =>
|
|
1160
|
+
};
|
|
1161
|
+
declare const getDrizzleD1Config: () => {
|
|
1162
|
+
driver?: undefined;
|
|
1163
|
+
dbCredentials?: undefined;
|
|
1164
|
+
schema: string;
|
|
1165
|
+
out: string;
|
|
1166
|
+
dialect: "sqlite";
|
|
1167
|
+
} | {
|
|
1139
1168
|
driver: string;
|
|
1140
1169
|
dbCredentials: {
|
|
1141
1170
|
accountId: string | undefined;
|
|
@@ -1157,7 +1186,7 @@ declare const getDrizzleD1Config: () => Promise<{
|
|
|
1157
1186
|
schema: string;
|
|
1158
1187
|
out: string;
|
|
1159
1188
|
dialect: "sqlite";
|
|
1160
|
-
}
|
|
1189
|
+
};
|
|
1161
1190
|
|
|
1162
1191
|
type Operator = 'like' | 'ilike';
|
|
1163
1192
|
type Wrap = 'both' | 'prefix' | 'suffix' | 'none';
|
|
@@ -1310,5 +1339,5 @@ interface WithRetryCounterOptions {
|
|
|
1310
1339
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
1311
1340
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
1312
1341
|
|
|
1313
|
-
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInsertSchema, createInternalError, createPatchSchema, createUpdateSchema, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials,
|
|
1314
|
-
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyContextVariables, IdentityContextVariables, InternalError, InternalErrorResponseStatus, Project, RequestLog, ResponseLog, StructuredAddress, UserRole, ValidatedInput, WorkflowInstanceStatus };
|
|
1342
|
+
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInsertSchema, createInternalError, createPatchSchema, createUpdateSchema, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, ibanSchema, isInternalError, nullToOptional, optionalToNull, paginationQuerySchema, paginationSchema, resolveColumn, service, structuredAddressSchema, useFetch, useResult, useResultSync, uuidv4, uuidv5, workflowInstanceStatusSchema };
|
|
1343
|
+
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyContextVariables, IdentityContextVariables, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, RequestLog, ResponseLog, StructuredAddress, UserRole, ValidatedInput, WorkflowInstanceStatus };
|
package/dist/index.mjs
CHANGED
|
@@ -6,11 +6,11 @@ import { createInsertSchema as createInsertSchema$1 } from 'drizzle-zod';
|
|
|
6
6
|
export { createSelectSchema } from 'drizzle-zod';
|
|
7
7
|
import { z as z$1 } from 'zod';
|
|
8
8
|
import * as z from 'zod/v4/core';
|
|
9
|
-
import
|
|
10
|
-
import { parse } from 'comment-json';
|
|
11
|
-
import crypto$1 from 'node:crypto';
|
|
9
|
+
import 'cloudflare';
|
|
12
10
|
import fs from 'node:fs';
|
|
11
|
+
import crypto$1 from 'node:crypto';
|
|
13
12
|
import path from 'node:path';
|
|
13
|
+
import { parse } from 'comment-json';
|
|
14
14
|
import superjson from 'superjson';
|
|
15
15
|
|
|
16
16
|
const ENVIRONMENT = ["dev", "test", "staging", "production"];
|
|
@@ -470,42 +470,41 @@ function derivePortFromId(id, base = 4e3, range = 1e4) {
|
|
|
470
470
|
return base + hash % range;
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
-
const readWranglerConfig = () => {
|
|
474
|
-
try {
|
|
475
|
-
const content = fs.readFileSync(path.resolve("./wrangler.jsonc"), "utf-8");
|
|
476
|
-
return parse(content);
|
|
477
|
-
} catch (err) {
|
|
478
|
-
console.warn(`Warning: Could not read wrangler.jsonc: ${err}`);
|
|
479
|
-
}
|
|
480
|
-
};
|
|
481
473
|
function durableObjectNamespaceIdFromName(uniqueKey, name) {
|
|
482
474
|
const key = crypto$1.createHash("sha256").update(uniqueKey).digest();
|
|
483
475
|
const nameHmac = crypto$1.createHmac("sha256", key).update(name).digest().subarray(0, 16);
|
|
484
476
|
const hmac = crypto$1.createHmac("sha256", key).update(nameHmac).digest().subarray(0, 16);
|
|
485
477
|
return Buffer.concat([nameHmac, hmac]).toString("hex");
|
|
486
478
|
}
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
479
|
+
const getD1DatabaseIdFromWrangler = () => {
|
|
480
|
+
try {
|
|
481
|
+
const wranglerPath = path.resolve("./wrangler.jsonc");
|
|
482
|
+
const wranglerContent = fs.readFileSync(wranglerPath, "utf-8");
|
|
483
|
+
const config = parse(wranglerContent);
|
|
484
|
+
const environment = process.env.ENVIRONMENT || "localhost";
|
|
485
|
+
let databaseId;
|
|
486
|
+
if (environment !== "localhost" && config.env?.[environment]) {
|
|
487
|
+
databaseId = config.env[environment].d1_databases?.[0]?.database_id;
|
|
488
|
+
console.log(
|
|
489
|
+
`Using database_id for environment '${environment}': ${databaseId}`
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
if (!databaseId) {
|
|
493
|
+
databaseId = config.d1_databases?.[0]?.database_id;
|
|
494
|
+
console.log(
|
|
495
|
+
`Using default database_id for environment '${environment}': ${databaseId}`
|
|
496
|
+
);
|
|
497
497
|
}
|
|
498
|
+
if (!databaseId) {
|
|
499
|
+
throw new Error("database_id not found in wrangler.jsonc");
|
|
500
|
+
}
|
|
501
|
+
return databaseId;
|
|
502
|
+
} catch (err) {
|
|
503
|
+
console.warn(
|
|
504
|
+
`Warning: Could not read database_id from wrangler.jsonc: ${err}`
|
|
505
|
+
);
|
|
498
506
|
}
|
|
499
507
|
};
|
|
500
|
-
const getLocalD1DatabaseIdFromWrangler = () => {
|
|
501
|
-
const databaseId = readWranglerConfig()?.d1_databases?.[0]?.database_id;
|
|
502
|
-
if (!databaseId) {
|
|
503
|
-
console.warn("Warning: database_id not found in wrangler.jsonc");
|
|
504
|
-
return;
|
|
505
|
-
}
|
|
506
|
-
console.log(`Using local database_id: ${databaseId}`);
|
|
507
|
-
return databaseId;
|
|
508
|
-
};
|
|
509
508
|
const getLocalD1 = (databaseId) => {
|
|
510
509
|
const name = durableObjectNamespaceIdFromName(
|
|
511
510
|
"miniflare-D1DatabaseObject",
|
|
@@ -533,12 +532,13 @@ const getLocalD1 = (databaseId) => {
|
|
|
533
532
|
}
|
|
534
533
|
}
|
|
535
534
|
};
|
|
536
|
-
const getD1Credentials =
|
|
535
|
+
const getD1Credentials = () => {
|
|
537
536
|
const environment = process.env.ENVIRONMENT;
|
|
537
|
+
if (environment === "localhost") {
|
|
538
|
+
return {};
|
|
539
|
+
}
|
|
540
|
+
const databaseId = getD1DatabaseIdFromWrangler() ?? "";
|
|
538
541
|
if (isRemoteEnvironment()) {
|
|
539
|
-
const workerName = readWranglerConfig()?.name ?? "";
|
|
540
|
-
const instanceName = environment === "production" ? workerName : `${workerName}-${environment}`;
|
|
541
|
-
const databaseId = await getD1DatabaseId(instanceName) ?? "";
|
|
542
542
|
return {
|
|
543
543
|
driver: "d1-http",
|
|
544
544
|
dbCredentials: {
|
|
@@ -547,18 +547,19 @@ const getD1Credentials = async () => {
|
|
|
547
547
|
token: process.env.CLOUDFLARE_API_TOKEN
|
|
548
548
|
}
|
|
549
549
|
};
|
|
550
|
+
} else {
|
|
551
|
+
return {
|
|
552
|
+
dbCredentials: {
|
|
553
|
+
url: getLocalD1(databaseId)
|
|
554
|
+
}
|
|
555
|
+
};
|
|
550
556
|
}
|
|
551
|
-
return {
|
|
552
|
-
dbCredentials: {
|
|
553
|
-
url: getLocalD1(getLocalD1DatabaseIdFromWrangler() ?? "")
|
|
554
|
-
}
|
|
555
|
-
};
|
|
556
557
|
};
|
|
557
|
-
const getDrizzleD1Config =
|
|
558
|
+
const getDrizzleD1Config = () => ({
|
|
558
559
|
schema: "./src/database/schema/",
|
|
559
560
|
out: "./src/database/migrations/",
|
|
560
561
|
dialect: "sqlite",
|
|
561
|
-
...
|
|
562
|
+
...getD1Credentials()
|
|
562
563
|
});
|
|
563
564
|
|
|
564
565
|
const buildSearchConditions = (search, columns, opts = {}) => {
|
|
@@ -794,9 +795,24 @@ function develitWorker(Worker) {
|
|
|
794
795
|
class DevelitWorker extends Worker {
|
|
795
796
|
name = "not-set";
|
|
796
797
|
action = "not-set";
|
|
798
|
+
// public db!: DatabaseTransaction<string>
|
|
797
799
|
async fetch() {
|
|
798
800
|
return new Response("Service is up and running!");
|
|
799
801
|
}
|
|
802
|
+
// initializeDB<TAuditAction = string>(
|
|
803
|
+
// database: D1Database,
|
|
804
|
+
// schema: Record<string, unknown>,
|
|
805
|
+
// auditLogWriter?: AuditLogWriter<TAuditAction>,
|
|
806
|
+
// ): void {
|
|
807
|
+
// const drizzleInstance = drizzle(database, {
|
|
808
|
+
// schema,
|
|
809
|
+
// }) as DrizzleD1Database<Record<string, unknown>>
|
|
810
|
+
// this.db = new DatabaseTransaction<TAuditAction>(
|
|
811
|
+
// drizzleInstance,
|
|
812
|
+
// this.name,
|
|
813
|
+
// auditLogWriter,
|
|
814
|
+
// ) as unknown as DatabaseTransaction<string>
|
|
815
|
+
// }
|
|
800
816
|
handleInput({
|
|
801
817
|
input,
|
|
802
818
|
schema
|
|
@@ -863,17 +879,15 @@ function develitWorker(Worker) {
|
|
|
863
879
|
`${this.name}:${this.action}:error`
|
|
864
880
|
);
|
|
865
881
|
}
|
|
866
|
-
|
|
882
|
+
pushToQueue(queue, message) {
|
|
867
883
|
if (!queue) {
|
|
868
884
|
throw new Error(
|
|
869
885
|
"[pushToQueue] Queue binding is undefined \u2014 check your wrangler config"
|
|
870
886
|
);
|
|
871
887
|
}
|
|
872
|
-
if (!Array.isArray(message))
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
}
|
|
876
|
-
await queue.sendBatch(
|
|
888
|
+
if (!Array.isArray(message))
|
|
889
|
+
return queue.send(message, { contentType: "v8" });
|
|
890
|
+
return queue.sendBatch(
|
|
877
891
|
message.map((m) => ({
|
|
878
892
|
body: m,
|
|
879
893
|
contentType: "v8"
|
|
@@ -891,4 +905,4 @@ function develitWorker(Worker) {
|
|
|
891
905
|
return DevelitWorker;
|
|
892
906
|
}
|
|
893
907
|
|
|
894
|
-
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInsertSchema, createInternalError, createPatchSchema, createUpdateSchema, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials,
|
|
908
|
+
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInsertSchema, createInternalError, createPatchSchema, createUpdateSchema, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, ibanSchema, isInternalError, nullToOptional, optionalToNull, paginationQuerySchema, paginationSchema, resolveColumn, service, structuredAddressSchema, useFetch, useResult, useResultSync, workflowInstanceStatusSchema };
|
package/dist/middlewares.mjs
CHANGED
|
@@ -2,10 +2,10 @@ import { createMiddleware } from 'hono/factory';
|
|
|
2
2
|
import { HTTPException } from 'hono/http-exception';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import 'cloudflare';
|
|
5
|
-
import 'comment-json';
|
|
6
|
-
import 'node:crypto';
|
|
7
5
|
import 'node:fs';
|
|
6
|
+
import 'node:crypto';
|
|
8
7
|
import 'node:path';
|
|
8
|
+
import 'comment-json';
|
|
9
9
|
import 'drizzle-orm';
|
|
10
10
|
import { u as uuidv4 } from './shared/backend-sdk.D_gzDKeC.mjs';
|
|
11
11
|
import { verifyPayloadSignature } from './utils/signature.util.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@develit-io/backend-sdk",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.5",
|
|
4
4
|
"description": "Develit Backend SDK",
|
|
5
5
|
"author": "Develit.io",
|
|
6
6
|
"license": "ISC",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@develit-io/general-codes": "^1.19.0",
|
|
44
|
-
"drizzle-orm": "
|
|
45
|
-
"drizzle-zod": "
|
|
44
|
+
"drizzle-orm": "^0.45.1",
|
|
45
|
+
"drizzle-zod": "^0.8.3",
|
|
46
46
|
"hono": "^4.12.7",
|
|
47
47
|
"zod": "^4.3.6"
|
|
48
48
|
},
|