@develit-io/backend-sdk 5.4.5 → 5.5.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.cjs CHANGED
@@ -187,7 +187,7 @@ async function handleAction(worker, input, options = {}, actionExecution) {
187
187
  });
188
188
  }
189
189
  const [data, error] = await useResult(
190
- actionExecution(validatedInput)
190
+ validatedInput ? actionExecution(validatedInput) : actionExecution()
191
191
  );
192
192
  if (error) {
193
193
  worker.logError(error);
package/dist/index.d.cts CHANGED
@@ -105,7 +105,7 @@ interface DevelitWorkerMethods {
105
105
  handleAction<TInput, TOutput>(input: {
106
106
  data: TInput;
107
107
  schema: z.$ZodType<TInput>;
108
- } | null, options: ActionHandlerOptions<TInput, TOutput>, actionExecution: (validatedInput: TInput | null) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
108
+ } | null, options: ActionHandlerOptions<TInput, TOutput>, actionExecution: TInput extends null ? () => Promise<TOutput> : (validatedInput: TInput) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
109
109
  }
110
110
  declare function develitWorker<TWorker extends Constructor>(Worker: TWorker): TWorker & Constructor<DevelitWorkerMethods>;
111
111
 
@@ -150,7 +150,7 @@ interface ActionHandlerOptions<TInput, TOutput> {
150
150
  declare function handleAction<TInput, TOutput>(worker: DevelitWorkerMethods, input: {
151
151
  data: TInput;
152
152
  schema: z.$ZodType<TInput>;
153
- } | null, options: ActionHandlerOptions<TInput, TOutput> | undefined, actionExecution: (validatedInput: TInput | null) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
153
+ } | null, options: ActionHandlerOptions<TInput, TOutput> | undefined, actionExecution: TInput extends null ? () => Promise<TOutput> : (validatedInput: TInput) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
154
154
  /**
155
155
  * Utility type to extract the validated input type from a schema
156
156
  */
@@ -158,7 +158,7 @@ type ValidatedInput<T extends z.$ZodType> = z.infer<T>;
158
158
  /**
159
159
  * Utility type for action execution functions
160
160
  */
161
- type ActionExecution<TInput, TOutput> = (input: TInput) => Promise<TOutput>;
161
+ type ActionExecution<TInput, TOutput> = TInput extends null ? () => Promise<TOutput> : (input: TInput) => Promise<TOutput>;
162
162
 
163
163
  declare const drizzleConfig: drizzle_kit.Config;
164
164
  declare function first<T>(rows: T[]): T | undefined;
@@ -326,5 +326,4 @@ interface WithRetryCounterOptions {
326
326
  type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
327
327
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
328
328
 
329
- export { DatabaseTransaction, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, develitWorker, drizzleConfig, first, firstOrError, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
330
- export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, ValidatedInput };
329
+ export { type ActionExecution, type ActionHandlerOptions, type AuditLogWriter, type Command, type CommandLogPayload, DatabaseTransaction, type DevelitWorkerMethods, type GatewayResponse, type IRPCResponse, type IncludeRelation, type InferResultType, type InternalError, type InternalErrorResponseStatus, RPCResponse, type ValidatedInput, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, develitWorker, drizzleConfig, first, firstOrError, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
package/dist/index.d.mts CHANGED
@@ -105,7 +105,7 @@ interface DevelitWorkerMethods {
105
105
  handleAction<TInput, TOutput>(input: {
106
106
  data: TInput;
107
107
  schema: z.$ZodType<TInput>;
108
- } | null, options: ActionHandlerOptions<TInput, TOutput>, actionExecution: (validatedInput: TInput | null) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
108
+ } | null, options: ActionHandlerOptions<TInput, TOutput>, actionExecution: TInput extends null ? () => Promise<TOutput> : (validatedInput: TInput) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
109
109
  }
110
110
  declare function develitWorker<TWorker extends Constructor>(Worker: TWorker): TWorker & Constructor<DevelitWorkerMethods>;
111
111
 
@@ -150,7 +150,7 @@ interface ActionHandlerOptions<TInput, TOutput> {
150
150
  declare function handleAction<TInput, TOutput>(worker: DevelitWorkerMethods, input: {
151
151
  data: TInput;
152
152
  schema: z.$ZodType<TInput>;
153
- } | null, options: ActionHandlerOptions<TInput, TOutput> | undefined, actionExecution: (validatedInput: TInput | null) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
153
+ } | null, options: ActionHandlerOptions<TInput, TOutput> | undefined, actionExecution: TInput extends null ? () => Promise<TOutput> : (validatedInput: TInput) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
154
154
  /**
155
155
  * Utility type to extract the validated input type from a schema
156
156
  */
@@ -158,7 +158,7 @@ type ValidatedInput<T extends z.$ZodType> = z.infer<T>;
158
158
  /**
159
159
  * Utility type for action execution functions
160
160
  */
161
- type ActionExecution<TInput, TOutput> = (input: TInput) => Promise<TOutput>;
161
+ type ActionExecution<TInput, TOutput> = TInput extends null ? () => Promise<TOutput> : (input: TInput) => Promise<TOutput>;
162
162
 
163
163
  declare const drizzleConfig: drizzle_kit.Config;
164
164
  declare function first<T>(rows: T[]): T | undefined;
@@ -326,5 +326,4 @@ interface WithRetryCounterOptions {
326
326
  type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
327
327
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
328
328
 
329
- export { DatabaseTransaction, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, develitWorker, drizzleConfig, first, firstOrError, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
330
- export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, ValidatedInput };
329
+ export { type ActionExecution, type ActionHandlerOptions, type AuditLogWriter, type Command, type CommandLogPayload, DatabaseTransaction, type DevelitWorkerMethods, type GatewayResponse, type IRPCResponse, type IncludeRelation, type InferResultType, type InternalError, type InternalErrorResponseStatus, RPCResponse, type ValidatedInput, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, develitWorker, drizzleConfig, first, firstOrError, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
package/dist/index.d.ts CHANGED
@@ -105,7 +105,7 @@ interface DevelitWorkerMethods {
105
105
  handleAction<TInput, TOutput>(input: {
106
106
  data: TInput;
107
107
  schema: z.$ZodType<TInput>;
108
- } | null, options: ActionHandlerOptions<TInput, TOutput>, actionExecution: (validatedInput: TInput | null) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
108
+ } | null, options: ActionHandlerOptions<TInput, TOutput>, actionExecution: TInput extends null ? () => Promise<TOutput> : (validatedInput: TInput) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
109
109
  }
110
110
  declare function develitWorker<TWorker extends Constructor>(Worker: TWorker): TWorker & Constructor<DevelitWorkerMethods>;
111
111
 
@@ -150,7 +150,7 @@ interface ActionHandlerOptions<TInput, TOutput> {
150
150
  declare function handleAction<TInput, TOutput>(worker: DevelitWorkerMethods, input: {
151
151
  data: TInput;
152
152
  schema: z.$ZodType<TInput>;
153
- } | null, options: ActionHandlerOptions<TInput, TOutput> | undefined, actionExecution: (validatedInput: TInput | null) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
153
+ } | null, options: ActionHandlerOptions<TInput, TOutput> | undefined, actionExecution: TInput extends null ? () => Promise<TOutput> : (validatedInput: TInput) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
154
154
  /**
155
155
  * Utility type to extract the validated input type from a schema
156
156
  */
@@ -158,7 +158,7 @@ type ValidatedInput<T extends z.$ZodType> = z.infer<T>;
158
158
  /**
159
159
  * Utility type for action execution functions
160
160
  */
161
- type ActionExecution<TInput, TOutput> = (input: TInput) => Promise<TOutput>;
161
+ type ActionExecution<TInput, TOutput> = TInput extends null ? () => Promise<TOutput> : (input: TInput) => Promise<TOutput>;
162
162
 
163
163
  declare const drizzleConfig: drizzle_kit.Config;
164
164
  declare function first<T>(rows: T[]): T | undefined;
@@ -326,5 +326,4 @@ interface WithRetryCounterOptions {
326
326
  type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
327
327
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
328
328
 
329
- export { DatabaseTransaction, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, develitWorker, drizzleConfig, first, firstOrError, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
330
- export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, ValidatedInput };
329
+ export { type ActionExecution, type ActionHandlerOptions, type AuditLogWriter, type Command, type CommandLogPayload, DatabaseTransaction, type DevelitWorkerMethods, type GatewayResponse, type IRPCResponse, type IncludeRelation, type InferResultType, type InternalError, type InternalErrorResponseStatus, RPCResponse, type ValidatedInput, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, develitWorker, drizzleConfig, first, firstOrError, handleAction, handleActionResponse, ibanZodSchema, isInternalError, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
package/dist/index.mjs CHANGED
@@ -168,7 +168,7 @@ async function handleAction(worker, input, options = {}, actionExecution) {
168
168
  });
169
169
  }
170
170
  const [data, error] = await useResult(
171
- actionExecution(validatedInput)
171
+ validatedInput ? actionExecution(validatedInput) : actionExecution()
172
172
  );
173
173
  if (error) {
174
174
  worker.logError(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-io/backend-sdk",
3
- "version": "5.4.5",
3
+ "version": "5.5.0",
4
4
  "description": "Develit Backend SDK",
5
5
  "author": "Develit.io",
6
6
  "license": "ISC",
@@ -25,15 +25,15 @@
25
25
  "types": "./dist/index.d.ts",
26
26
  "files": ["dist"],
27
27
  "dependencies": {
28
- "@cloudflare/workers-types": "^4.20250407.0",
28
+ "@cloudflare/workers-types": "^4.20250722.0",
29
29
  "consola": "^3.4.2",
30
- "drizzle-kit": "^0.30.6",
30
+ "drizzle-kit": "^0.31.4",
31
31
  "drizzle-orm": "^0.44.3",
32
32
  "h3": "^1.15.3",
33
33
  "http-status-codes": "2.3.0",
34
34
  "superjson": "^2.2.2"
35
35
  },
36
36
  "peerDependencies": {
37
- "zod": "^4.0.5"
37
+ "zod": "^4.0.11"
38
38
  }
39
39
  }