@develit-io/backend-sdk 9.10.4 → 9.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/README.md CHANGED
@@ -60,7 +60,7 @@ export { defineCommand, DatabaseTransaction, createAuditLogWriter } from '@devel
60
60
 
61
61
  ## Requirements
62
62
 
63
- - Node.js 18+
63
+ - Node.js 22+
64
64
  - TypeScript 5.0+
65
65
  - Cloudflare Workers environment
66
66
  - Drizzle ORM setup
package/dist/index.d.mts CHANGED
@@ -18,6 +18,7 @@ type Environment = string | 'localhost' | 'dev' | 'test' | 'staging' | 'producti
18
18
  type Project = 'creditio' | 'cryptobyte-website' | 'dbu-fiat-processor' | 'dbu-mdm' | 'dbu-txs' | 'develit-sdk' | 'lrf-website' | 'moneio' | 'stable-labs-emi-processor';
19
19
 
20
20
  declare const uuidv4: () => `${string}-${string}-${string}-${string}-${string}`;
21
+ declare const uuidv5: (name: string, namespace: string) => Promise<string>;
21
22
 
22
23
  declare const base: {
23
24
  id: drizzle_orm.IsPrimaryKey<drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
@@ -879,5 +880,5 @@ interface WithRetryCounterOptions {
879
880
  type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
880
881
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
881
882
 
882
- 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, useFetch, useResult, useResultSync, uuidv4, workflowInstanceStatusSchema };
883
+ 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, useFetch, useResult, useResultSync, uuidv4, uuidv5, workflowInstanceStatusSchema };
883
884
  export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyContextVariables, IdentityContextVariables, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, RequestLog, ResponseLog, UserRole, ValidatedInput, WorkflowInstanceStatus };
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ type Environment = string | 'localhost' | 'dev' | 'test' | 'staging' | 'producti
18
18
  type Project = 'creditio' | 'cryptobyte-website' | 'dbu-fiat-processor' | 'dbu-mdm' | 'dbu-txs' | 'develit-sdk' | 'lrf-website' | 'moneio' | 'stable-labs-emi-processor';
19
19
 
20
20
  declare const uuidv4: () => `${string}-${string}-${string}-${string}-${string}`;
21
+ declare const uuidv5: (name: string, namespace: string) => Promise<string>;
21
22
 
22
23
  declare const base: {
23
24
  id: drizzle_orm.IsPrimaryKey<drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
@@ -879,5 +880,5 @@ interface WithRetryCounterOptions {
879
880
  type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
880
881
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
881
882
 
882
- 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, useFetch, useResult, useResultSync, uuidv4, workflowInstanceStatusSchema };
883
+ 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, useFetch, useResult, useResultSync, uuidv4, uuidv5, workflowInstanceStatusSchema };
883
884
  export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyContextVariables, IdentityContextVariables, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, RequestLog, ResponseLog, UserRole, ValidatedInput, WorkflowInstanceStatus };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { u as uuidv4 } from './shared/backend-sdk.ZjCbR507.mjs';
1
+ export { u as uuidv4, a as uuidv5 } from './shared/backend-sdk.D_gzDKeC.mjs';
2
2
  import { sql, inArray, eq, gte, lte, and, or } from 'drizzle-orm';
3
3
  import { text, integer } from 'drizzle-orm/sqlite-core';
4
4
  import { COUNTRY_CODES_2, CURRENCY_CODES, BANK_CODES } from '@develit-io/general-codes';
@@ -372,7 +372,7 @@ async function handleAction(worker, input, options = {}, actionExecution) {
372
372
  }
373
373
  return RPCResponse.ok(successMessage, { data });
374
374
  } catch (error) {
375
- const internalError = createInternalError(error);
375
+ const internalError = isInternalError(error) ? error : createInternalError(error);
376
376
  worker.logError(internalError);
377
377
  return RPCResponse.serviceError(internalError);
378
378
  }
@@ -7,7 +7,7 @@ import 'node:crypto';
7
7
  import 'node:path';
8
8
  import 'comment-json';
9
9
  import 'drizzle-orm';
10
- import { u as uuidv4 } from './shared/backend-sdk.ZjCbR507.mjs';
10
+ import { u as uuidv4 } from './shared/backend-sdk.D_gzDKeC.mjs';
11
11
  import { verifyPayloadSignature } from './utils/signature.util.mjs';
12
12
 
13
13
  const validateBearerScheme = (header) => {
@@ -0,0 +1,30 @@
1
+ const uuidv4 = () => crypto.randomUUID();
2
+ function parseUUID(uuid) {
3
+ const hex = uuid.replace(/-/g, "");
4
+ const bytes = new Uint8Array(16);
5
+ for (let i = 0; i < 16; i++) {
6
+ bytes[i] = Number.parseInt(hex.slice(i * 2, i * 2 + 2), 16);
7
+ }
8
+ return bytes;
9
+ }
10
+ const uuidv5 = async (name, namespace) => {
11
+ const namespaceBytes = parseUUID(namespace);
12
+ const nameBytes = new TextEncoder().encode(name);
13
+ const data = new Uint8Array(namespaceBytes.length + nameBytes.length);
14
+ data.set(namespaceBytes);
15
+ data.set(nameBytes, namespaceBytes.length);
16
+ const hashBuffer = await crypto.subtle.digest("SHA-1", data);
17
+ const bytes = new Uint8Array(hashBuffer);
18
+ bytes[6] = bytes[6] & 15 | 80;
19
+ bytes[8] = bytes[8] & 63 | 128;
20
+ const hex = [...bytes.slice(0, 16)].map((b) => b.toString(16).padStart(2, "0")).join("");
21
+ return [
22
+ hex.slice(0, 8),
23
+ hex.slice(8, 12),
24
+ hex.slice(12, 16),
25
+ hex.slice(16, 20),
26
+ hex.slice(20, 32)
27
+ ].join("-");
28
+ };
29
+
30
+ export { uuidv5 as a, uuidv4 as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-io/backend-sdk",
3
- "version": "9.10.4",
3
+ "version": "9.11.1",
4
4
  "description": "Develit Backend SDK",
5
5
  "author": "Develit.io",
6
6
  "license": "ISC",
@@ -1,3 +0,0 @@
1
- const uuidv4 = () => crypto.randomUUID();
2
-
3
- export { uuidv4 as u };