@develit-io/backend-sdk 9.1.6 → 9.3.0
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 +5 -17
- package/dist/index.d.ts +5 -17
- package/dist/index.mjs +6 -3
- package/dist/middlewares.mjs +6 -5
- package/dist/shared/backend-sdk.ZjCbR507.mjs +3 -0
- package/dist/utils/signature.util.d.mts +25 -0
- package/dist/utils/signature.util.d.ts +25 -0
- package/dist/{shared/backend-sdk.Cp_yMf_u.mjs → utils/signature.util.mjs} +1 -3
- package/package.json +8 -3
package/dist/index.d.mts
CHANGED
|
@@ -14,15 +14,18 @@ declare const ENVIRONMENT: string[];
|
|
|
14
14
|
|
|
15
15
|
type Environment = string | 'localhost' | 'dev' | 'test' | 'staging' | 'production';
|
|
16
16
|
|
|
17
|
-
type Project = 'creditio' | 'dbu-mdm' | 'dbu-txs' | 'cryptobyte-website' | 'lrf-website' | 'moneio'
|
|
17
|
+
type Project = 'creditio' | 'dbu-fiat-processor' | 'dbu-mdm' | 'dbu-txs' | 'cryptobyte-website' | 'lrf-website' | 'moneio';
|
|
18
18
|
|
|
19
19
|
declare const uuidv4: () => `${string}-${string}-${string}-${string}-${string}`;
|
|
20
20
|
|
|
21
21
|
declare const base: {
|
|
22
22
|
id: drizzle_orm.IsPrimaryKey<drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
|
|
23
23
|
createdAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"created_at">>;
|
|
24
|
+
createdBy: drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"created_by", [string, ...string[]], number | undefined>;
|
|
24
25
|
updatedAt: drizzle_orm.HasDefault<drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"updated_at">>>;
|
|
26
|
+
updatedBy: drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"updated_by", [string, ...string[]], number | undefined>;
|
|
25
27
|
deletedAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"deleted_at">>;
|
|
28
|
+
deletedBy: drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"deleted_by", [string, ...string[]], number | undefined>;
|
|
26
29
|
};
|
|
27
30
|
|
|
28
31
|
declare const bankAccount: {
|
|
@@ -821,21 +824,6 @@ declare const useResultSync: <T>(fn: () => T) => Result<T>;
|
|
|
821
824
|
|
|
822
825
|
declare const getSecret: (secretName: string, env: unknown) => Promise<string>;
|
|
823
826
|
|
|
824
|
-
declare const createSignatureKeyPair: () => Promise<{
|
|
825
|
-
publicKey: string;
|
|
826
|
-
privateKey: string;
|
|
827
|
-
}>;
|
|
828
|
-
declare const signPayload: ({ payload, privateKey, }: {
|
|
829
|
-
payload: string;
|
|
830
|
-
privateKey: string;
|
|
831
|
-
}) => Promise<string>;
|
|
832
|
-
declare const verifyPayloadSignature: ({ signature, data, publicKey, algorithm, }: {
|
|
833
|
-
signature: string;
|
|
834
|
-
data: string;
|
|
835
|
-
publicKey: string;
|
|
836
|
-
algorithm?: "RSA" | "EC" | "HMAC";
|
|
837
|
-
}) => Promise<boolean>;
|
|
838
|
-
|
|
839
827
|
declare const service: (serviceName: string) => <T extends new (...args: any[]) => object>(constructor: T) => {
|
|
840
828
|
new (...args: any[]): {
|
|
841
829
|
name: string;
|
|
@@ -855,5 +843,5 @@ interface WithRetryCounterOptions {
|
|
|
855
843
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
856
844
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
857
845
|
|
|
858
|
-
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError,
|
|
846
|
+
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, ibanSchema, isInternalError, nullToOptional, optionalToNull, paginationQuerySchema, paginationSchema, resolveColumn, service, useFetch, useResult, useResultSync, uuidv4, workflowInstanceStatusSchema };
|
|
859
847
|
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyContextVariables, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, RequestLog, ResponseLog, UserContextVariables, UserRole, ValidatedInput, WorkflowInstanceStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -14,15 +14,18 @@ declare const ENVIRONMENT: string[];
|
|
|
14
14
|
|
|
15
15
|
type Environment = string | 'localhost' | 'dev' | 'test' | 'staging' | 'production';
|
|
16
16
|
|
|
17
|
-
type Project = 'creditio' | 'dbu-mdm' | 'dbu-txs' | 'cryptobyte-website' | 'lrf-website' | 'moneio'
|
|
17
|
+
type Project = 'creditio' | 'dbu-fiat-processor' | 'dbu-mdm' | 'dbu-txs' | 'cryptobyte-website' | 'lrf-website' | 'moneio';
|
|
18
18
|
|
|
19
19
|
declare const uuidv4: () => `${string}-${string}-${string}-${string}-${string}`;
|
|
20
20
|
|
|
21
21
|
declare const base: {
|
|
22
22
|
id: drizzle_orm.IsPrimaryKey<drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
|
|
23
23
|
createdAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"created_at">>;
|
|
24
|
+
createdBy: drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"created_by", [string, ...string[]], number | undefined>;
|
|
24
25
|
updatedAt: drizzle_orm.HasDefault<drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"updated_at">>>;
|
|
26
|
+
updatedBy: drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"updated_by", [string, ...string[]], number | undefined>;
|
|
25
27
|
deletedAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"deleted_at">>;
|
|
28
|
+
deletedBy: drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"deleted_by", [string, ...string[]], number | undefined>;
|
|
26
29
|
};
|
|
27
30
|
|
|
28
31
|
declare const bankAccount: {
|
|
@@ -821,21 +824,6 @@ declare const useResultSync: <T>(fn: () => T) => Result<T>;
|
|
|
821
824
|
|
|
822
825
|
declare const getSecret: (secretName: string, env: unknown) => Promise<string>;
|
|
823
826
|
|
|
824
|
-
declare const createSignatureKeyPair: () => Promise<{
|
|
825
|
-
publicKey: string;
|
|
826
|
-
privateKey: string;
|
|
827
|
-
}>;
|
|
828
|
-
declare const signPayload: ({ payload, privateKey, }: {
|
|
829
|
-
payload: string;
|
|
830
|
-
privateKey: string;
|
|
831
|
-
}) => Promise<string>;
|
|
832
|
-
declare const verifyPayloadSignature: ({ signature, data, publicKey, algorithm, }: {
|
|
833
|
-
signature: string;
|
|
834
|
-
data: string;
|
|
835
|
-
publicKey: string;
|
|
836
|
-
algorithm?: "RSA" | "EC" | "HMAC";
|
|
837
|
-
}) => Promise<boolean>;
|
|
838
|
-
|
|
839
827
|
declare const service: (serviceName: string) => <T extends new (...args: any[]) => object>(constructor: T) => {
|
|
840
828
|
new (...args: any[]): {
|
|
841
829
|
name: string;
|
|
@@ -855,5 +843,5 @@ interface WithRetryCounterOptions {
|
|
|
855
843
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
856
844
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
857
845
|
|
|
858
|
-
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError,
|
|
846
|
+
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, ibanSchema, isInternalError, nullToOptional, optionalToNull, paginationQuerySchema, paginationSchema, resolveColumn, service, useFetch, useResult, useResultSync, uuidv4, workflowInstanceStatusSchema };
|
|
859
847
|
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyContextVariables, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, RequestLog, ResponseLog, UserContextVariables, UserRole, ValidatedInput, WorkflowInstanceStatus };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { u as uuidv4 } from './shared/backend-sdk.ZjCbR507.mjs';
|
|
2
2
|
import { sql, inArray, eq, gte, lte, and, or } from 'drizzle-orm';
|
|
3
|
-
import {
|
|
3
|
+
import { text, integer } from 'drizzle-orm/sqlite-core';
|
|
4
4
|
import { COUNTRY_CODES_2, CURRENCY_CODES, BANK_CODES } from '@develit-io/general-codes';
|
|
5
5
|
import { z as z$1 } from 'zod';
|
|
6
6
|
import * as z from 'zod/v4/core';
|
|
@@ -21,8 +21,11 @@ const base = {
|
|
|
21
21
|
createdAt: integer("created_at", { mode: "timestamp_ms" }).default(
|
|
22
22
|
sql`(unixepoch('subsec') * 1000)`
|
|
23
23
|
),
|
|
24
|
+
createdBy: text("created_by"),
|
|
24
25
|
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).default(sql`(unixepoch('subsec') * 1000)`).$onUpdate(() => /* @__PURE__ */ new Date()),
|
|
25
|
-
|
|
26
|
+
updatedBy: text("updated_by"),
|
|
27
|
+
deletedAt: integer("deleted_at", { mode: "timestamp_ms" }).default(sql`null`),
|
|
28
|
+
deletedBy: text("deleted_by")
|
|
26
29
|
};
|
|
27
30
|
|
|
28
31
|
const bankAccount = {
|
package/dist/middlewares.mjs
CHANGED
|
@@ -7,7 +7,8 @@ import 'node:crypto';
|
|
|
7
7
|
import 'node:path';
|
|
8
8
|
import 'comment-json';
|
|
9
9
|
import 'drizzle-orm';
|
|
10
|
-
import { u as uuidv4
|
|
10
|
+
import { u as uuidv4 } from './shared/backend-sdk.ZjCbR507.mjs';
|
|
11
|
+
import { verifyPayloadSignature } from './utils/signature.util.mjs';
|
|
11
12
|
|
|
12
13
|
const validateBearerScheme = (header) => {
|
|
13
14
|
return header.startsWith("Bearer ") && header.length > 7 && !header.slice(7).includes(" ");
|
|
@@ -175,8 +176,8 @@ const logger = () => {
|
|
|
175
176
|
method: requestLog.method,
|
|
176
177
|
path: requestLog.path,
|
|
177
178
|
actor: {
|
|
178
|
-
email: userContext?.email || "
|
|
179
|
-
organizationId: userContext?.organizationId || "
|
|
179
|
+
email: userContext?.email || "NOT_AUTHORIZED",
|
|
180
|
+
organizationId: userContext?.organizationId || "NOT_AUTHORIZED"
|
|
180
181
|
},
|
|
181
182
|
metadata: {
|
|
182
183
|
ip: getRequestIpAddress(context.req),
|
|
@@ -204,8 +205,8 @@ const logger = () => {
|
|
|
204
205
|
method: responseLog.method,
|
|
205
206
|
path: responseLog.path,
|
|
206
207
|
actor: {
|
|
207
|
-
email: userContext?.email || "
|
|
208
|
-
organizationId: userContext?.organizationId || "
|
|
208
|
+
email: userContext?.email || "NOT_AUTHORIZED",
|
|
209
|
+
organizationId: userContext?.organizationId || "NOT_AUTHORIZED"
|
|
209
210
|
},
|
|
210
211
|
metadata: {
|
|
211
212
|
ip: getRequestIpAddress(context.req),
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const createSignatureKeyPair: () => Promise<{
|
|
2
|
+
publicKey: string;
|
|
3
|
+
privateKey: string;
|
|
4
|
+
}>;
|
|
5
|
+
declare const signPayload: ({ payload, privateKey, }: {
|
|
6
|
+
payload: string;
|
|
7
|
+
privateKey: string;
|
|
8
|
+
}) => Promise<string>;
|
|
9
|
+
declare const algParams: {
|
|
10
|
+
[key: string]: {
|
|
11
|
+
name: string;
|
|
12
|
+
hash?: {
|
|
13
|
+
name: string;
|
|
14
|
+
};
|
|
15
|
+
namedCurve?: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
declare const verifyPayloadSignature: ({ signature, data, publicKey, algorithm, }: {
|
|
19
|
+
signature: string;
|
|
20
|
+
data: string;
|
|
21
|
+
publicKey: string;
|
|
22
|
+
algorithm?: "RSA" | "EC" | "HMAC";
|
|
23
|
+
}) => Promise<boolean>;
|
|
24
|
+
|
|
25
|
+
export { algParams, createSignatureKeyPair, signPayload, verifyPayloadSignature };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const createSignatureKeyPair: () => Promise<{
|
|
2
|
+
publicKey: string;
|
|
3
|
+
privateKey: string;
|
|
4
|
+
}>;
|
|
5
|
+
declare const signPayload: ({ payload, privateKey, }: {
|
|
6
|
+
payload: string;
|
|
7
|
+
privateKey: string;
|
|
8
|
+
}) => Promise<string>;
|
|
9
|
+
declare const algParams: {
|
|
10
|
+
[key: string]: {
|
|
11
|
+
name: string;
|
|
12
|
+
hash?: {
|
|
13
|
+
name: string;
|
|
14
|
+
};
|
|
15
|
+
namedCurve?: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
declare const verifyPayloadSignature: ({ signature, data, publicKey, algorithm, }: {
|
|
19
|
+
signature: string;
|
|
20
|
+
data: string;
|
|
21
|
+
publicKey: string;
|
|
22
|
+
algorithm?: "RSA" | "EC" | "HMAC";
|
|
23
|
+
}) => Promise<boolean>;
|
|
24
|
+
|
|
25
|
+
export { algParams, createSignatureKeyPair, signPayload, verifyPayloadSignature };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const uuidv4 = () => crypto.randomUUID();
|
|
2
|
-
|
|
3
1
|
const createSignatureKeyPair = async () => {
|
|
4
2
|
const { publicKey, privateKey } = await crypto.subtle.generateKey(
|
|
5
3
|
{
|
|
@@ -95,4 +93,4 @@ const verifyPayloadSignature = async ({
|
|
|
95
93
|
return isValid;
|
|
96
94
|
};
|
|
97
95
|
|
|
98
|
-
export { createSignatureKeyPair
|
|
96
|
+
export { algParams, createSignatureKeyPair, signPayload, verifyPayloadSignature };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@develit-io/backend-sdk",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0",
|
|
4
4
|
"description": "Develit Backend SDK",
|
|
5
5
|
"author": "Develit.io",
|
|
6
6
|
"license": "ISC",
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
"import": "./dist/middlewares.mjs",
|
|
24
24
|
"default": "./dist/middlewares.mjs"
|
|
25
25
|
},
|
|
26
|
+
"./signature": {
|
|
27
|
+
"types": "./dist/utils/signature.util.d.ts",
|
|
28
|
+
"import": "./dist/utils/signature.util.mjs",
|
|
29
|
+
"default": "./dist/utils/signature.util.mjs"
|
|
30
|
+
},
|
|
26
31
|
"./package.json": "./package.json"
|
|
27
32
|
},
|
|
28
33
|
"files": [
|
|
@@ -31,7 +36,7 @@
|
|
|
31
36
|
"dependencies": {
|
|
32
37
|
"@cloudflare/workers-types": "4.20251121.0",
|
|
33
38
|
"comment-json": "^4.4.1",
|
|
34
|
-
"drizzle-kit": "^0.31.
|
|
39
|
+
"drizzle-kit": "^0.31.8",
|
|
35
40
|
"drizzle-orm": "^0.44.7",
|
|
36
41
|
"superjson": "^2.2.5"
|
|
37
42
|
},
|
|
@@ -41,7 +46,7 @@
|
|
|
41
46
|
"zod": "^4.1.13"
|
|
42
47
|
},
|
|
43
48
|
"devDependencies": {
|
|
44
|
-
"hono": "^4.10.
|
|
49
|
+
"hono": "^4.10.8",
|
|
45
50
|
"zod": "^4.1.13"
|
|
46
51
|
}
|
|
47
52
|
}
|