@develit-io/backend-sdk 8.5.0 → 8.6.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
CHANGED
|
@@ -521,7 +521,10 @@ declare const workflowInstanceStatusSchema: z$1.ZodObject<{
|
|
|
521
521
|
waiting: "waiting";
|
|
522
522
|
waitingForPause: "waitingForPause";
|
|
523
523
|
}>;
|
|
524
|
-
error: z$1.ZodOptional<z$1.
|
|
524
|
+
error: z$1.ZodOptional<z$1.ZodObject<{
|
|
525
|
+
message: z$1.ZodString;
|
|
526
|
+
name: z$1.ZodOptional<z$1.ZodString>;
|
|
527
|
+
}, z$1.core.$strip>>;
|
|
525
528
|
output: z$1.ZodOptional<z$1.ZodUnknown>;
|
|
526
529
|
}, z$1.core.$strip>;
|
|
527
530
|
type WorkflowInstanceStatus = z$1.infer<typeof workflowInstanceStatusSchema>;
|
|
@@ -737,10 +740,6 @@ interface UseFetchOptions extends RequestInit {
|
|
|
737
740
|
}
|
|
738
741
|
declare function useFetch<T = unknown>(url: string, { parseAs, ...options }?: UseFetchOptions): Promise<Result<T>>;
|
|
739
742
|
|
|
740
|
-
declare const createSignatureKeyPair: () => Promise<{
|
|
741
|
-
publicKey: string;
|
|
742
|
-
privateKey: string;
|
|
743
|
-
}>;
|
|
744
743
|
declare const signPayload: ({ payload, privateKey, }: {
|
|
745
744
|
payload: string;
|
|
746
745
|
privateKey: string;
|
|
@@ -850,5 +849,5 @@ interface WithRetryCounterOptions {
|
|
|
850
849
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
851
850
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
852
851
|
|
|
853
|
-
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError,
|
|
852
|
+
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, handleActionResponse, ibanSchema, isInternalError, nullToOptional, optionalToNull, paginationQuerySchema, paginationSchema, resolveColumn, service, signPayload, useFetch, useResult, useResultSync, uuidv4, verifyPayloadSignature, workflowInstanceStatusSchema };
|
|
854
853
|
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, AuthUser, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyVariables, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, UserRole, UserVariables, ValidatedInput, WorkflowInstanceStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -521,7 +521,10 @@ declare const workflowInstanceStatusSchema: z$1.ZodObject<{
|
|
|
521
521
|
waiting: "waiting";
|
|
522
522
|
waitingForPause: "waitingForPause";
|
|
523
523
|
}>;
|
|
524
|
-
error: z$1.ZodOptional<z$1.
|
|
524
|
+
error: z$1.ZodOptional<z$1.ZodObject<{
|
|
525
|
+
message: z$1.ZodString;
|
|
526
|
+
name: z$1.ZodOptional<z$1.ZodString>;
|
|
527
|
+
}, z$1.core.$strip>>;
|
|
525
528
|
output: z$1.ZodOptional<z$1.ZodUnknown>;
|
|
526
529
|
}, z$1.core.$strip>;
|
|
527
530
|
type WorkflowInstanceStatus = z$1.infer<typeof workflowInstanceStatusSchema>;
|
|
@@ -737,10 +740,6 @@ interface UseFetchOptions extends RequestInit {
|
|
|
737
740
|
}
|
|
738
741
|
declare function useFetch<T = unknown>(url: string, { parseAs, ...options }?: UseFetchOptions): Promise<Result<T>>;
|
|
739
742
|
|
|
740
|
-
declare const createSignatureKeyPair: () => Promise<{
|
|
741
|
-
publicKey: string;
|
|
742
|
-
privateKey: string;
|
|
743
|
-
}>;
|
|
744
743
|
declare const signPayload: ({ payload, privateKey, }: {
|
|
745
744
|
payload: string;
|
|
746
745
|
privateKey: string;
|
|
@@ -850,5 +849,5 @@ interface WithRetryCounterOptions {
|
|
|
850
849
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
851
850
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
852
851
|
|
|
853
|
-
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError,
|
|
852
|
+
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, handleActionResponse, ibanSchema, isInternalError, nullToOptional, optionalToNull, paginationQuerySchema, paginationSchema, resolveColumn, service, signPayload, useFetch, useResult, useResultSync, uuidv4, verifyPayloadSignature, workflowInstanceStatusSchema };
|
|
854
853
|
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, AuthUser, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyVariables, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, UserRole, UserVariables, ValidatedInput, WorkflowInstanceStatus };
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import fs from 'node:fs';
|
|
|
9
9
|
import crypto$1 from 'node:crypto';
|
|
10
10
|
import path from 'node:path';
|
|
11
11
|
import { parse } from 'comment-json';
|
|
12
|
-
export {
|
|
12
|
+
export { s as signPayload, v as verifyPayloadSignature } from './shared/backend-sdk.BUgF1b5c.mjs';
|
|
13
13
|
import superjson from 'superjson';
|
|
14
14
|
|
|
15
15
|
const ENVIRONMENT = ["dev", "test", "staging", "production"];
|
|
@@ -205,7 +205,10 @@ const workflowInstanceStatusSchema = z$1.object({
|
|
|
205
205
|
// instance is finishing the current work to pause
|
|
206
206
|
"unknown"
|
|
207
207
|
]),
|
|
208
|
-
error: z$1.
|
|
208
|
+
error: z$1.object({
|
|
209
|
+
message: z$1.string(),
|
|
210
|
+
name: z$1.string().optional()
|
|
211
|
+
}).optional(),
|
|
209
212
|
output: z$1.unknown().optional()
|
|
210
213
|
});
|
|
211
214
|
|
package/dist/middlewares.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import 'node:crypto';
|
|
|
8
8
|
import 'node:path';
|
|
9
9
|
import 'comment-json';
|
|
10
10
|
import 'drizzle-orm';
|
|
11
|
-
import { v as verifyPayloadSignature } from './shared/backend-sdk.
|
|
11
|
+
import { v as verifyPayloadSignature } from './shared/backend-sdk.BUgF1b5c.mjs';
|
|
12
12
|
|
|
13
13
|
const validateBearerScheme = (header) => {
|
|
14
14
|
return header.startsWith("Bearer ") && header.length > 7 && !header.slice(7).includes(" ");
|
|
@@ -1,23 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'node:crypto';
|
|
2
2
|
|
|
3
|
-
const createSignatureKeyPair = async () => {
|
|
4
|
-
const { publicKey, privateKey } = await subtle.generateKey(
|
|
5
|
-
{
|
|
6
|
-
name: "RSASSA-PKCS1-v1_5",
|
|
7
|
-
modulusLength: 4096,
|
|
8
|
-
publicExponent: new Uint8Array([1, 0, 1]),
|
|
9
|
-
hash: "SHA-256"
|
|
10
|
-
},
|
|
11
|
-
true,
|
|
12
|
-
["sign", "verify"]
|
|
13
|
-
);
|
|
14
|
-
const exportedPublicKey = await subtle.exportKey("spki", publicKey);
|
|
15
|
-
const exportedPrivateKey = await subtle.exportKey("pkcs8", privateKey);
|
|
16
|
-
return {
|
|
17
|
-
publicKey: Buffer.from(exportedPublicKey).toString("base64"),
|
|
18
|
-
privateKey: Buffer.from(exportedPrivateKey).toString("base64")
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
3
|
const signPayload = async ({
|
|
22
4
|
payload,
|
|
23
5
|
privateKey
|
|
@@ -95,4 +77,4 @@ const verifyPayloadSignature = async ({
|
|
|
95
77
|
return isValid;
|
|
96
78
|
};
|
|
97
79
|
|
|
98
|
-
export {
|
|
80
|
+
export { signPayload as s, verifyPayloadSignature as v };
|