@develit-io/backend-sdk 5.4.5 → 5.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.cjs +8 -3
- package/dist/index.d.cts +5 -3
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.mjs +8 -3
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -32,12 +32,17 @@ const base = {
|
|
|
32
32
|
createdAt: sqliteCore.integer("created_at", { mode: "timestamp_ms" }).default(
|
|
33
33
|
drizzleOrm.sql`(unixepoch('subsec') * 1000)`
|
|
34
34
|
),
|
|
35
|
-
modifiedAt: sqliteCore.integer("modified_at", { mode: "timestamp_ms" }).default(drizzleOrm.sql`null`).$onUpdate(() => /* @__PURE__ */ new Date())
|
|
35
|
+
modifiedAt: sqliteCore.integer("modified_at", { mode: "timestamp_ms" }).default(drizzleOrm.sql`null`).$onUpdate(() => /* @__PURE__ */ new Date()),
|
|
36
|
+
deletedAt: sqliteCore.integer("deleted_at", { mode: "timestamp_ms" }).default(drizzleOrm.sql`null`)
|
|
36
37
|
};
|
|
37
38
|
const basePostgres = {
|
|
38
39
|
id: pgCore.uuid("id").primaryKey(),
|
|
39
40
|
createdAt: pgCore.timestamp("created_at", { mode: "date", withTimezone: false }).defaultNow().notNull(),
|
|
40
|
-
modifiedAt: pgCore.timestamp("modified_at", { mode: "date", withTimezone: false }).default(drizzleOrm.sql`null`).$onUpdate(() => /* @__PURE__ */ new Date())
|
|
41
|
+
modifiedAt: pgCore.timestamp("modified_at", { mode: "date", withTimezone: false }).default(drizzleOrm.sql`null`).$onUpdate(() => /* @__PURE__ */ new Date()),
|
|
42
|
+
deletedAt: pgCore.timestamp("deleted_at", {
|
|
43
|
+
mode: "date",
|
|
44
|
+
withTimezone: false
|
|
45
|
+
}).default(drizzleOrm.sql`null`)
|
|
41
46
|
};
|
|
42
47
|
|
|
43
48
|
const ibanZodSchema = new z__namespace.$ZodString({
|
|
@@ -187,7 +192,7 @@ async function handleAction(worker, input, options = {}, actionExecution) {
|
|
|
187
192
|
});
|
|
188
193
|
}
|
|
189
194
|
const [data, error] = await useResult(
|
|
190
|
-
actionExecution(validatedInput)
|
|
195
|
+
validatedInput ? actionExecution(validatedInput) : actionExecution()
|
|
191
196
|
);
|
|
192
197
|
if (error) {
|
|
193
198
|
worker.logError(error);
|
package/dist/index.d.cts
CHANGED
|
@@ -16,11 +16,13 @@ declare const base: {
|
|
|
16
16
|
id: drizzle_orm.IsPrimaryKey<drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
|
|
17
17
|
createdAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"created_at">>;
|
|
18
18
|
modifiedAt: drizzle_orm.HasDefault<drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"modified_at">>>;
|
|
19
|
+
deletedAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"deleted_at">>;
|
|
19
20
|
};
|
|
20
21
|
declare const basePostgres: {
|
|
21
22
|
id: drizzle_orm.IsPrimaryKey<drizzle_orm.NotNull<drizzle_orm_pg_core.PgUUIDBuilderInitial<"id">>>;
|
|
22
23
|
createdAt: drizzle_orm.NotNull<drizzle_orm.HasDefault<drizzle_orm_pg_core.PgTimestampBuilderInitial<"created_at">>>;
|
|
23
24
|
modifiedAt: drizzle_orm.HasDefault<drizzle_orm.HasDefault<drizzle_orm_pg_core.PgTimestampBuilderInitial<"modified_at">>>;
|
|
25
|
+
deletedAt: drizzle_orm.HasDefault<drizzle_orm_pg_core.PgTimestampBuilderInitial<"deleted_at">>;
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
type InternalErrorResponseStatus = Exclude<StatusCodes, 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207>;
|
|
@@ -105,7 +107,7 @@ interface DevelitWorkerMethods {
|
|
|
105
107
|
handleAction<TInput, TOutput>(input: {
|
|
106
108
|
data: TInput;
|
|
107
109
|
schema: z.$ZodType<TInput>;
|
|
108
|
-
} | null, options: ActionHandlerOptions<TInput, TOutput>, actionExecution: (validatedInput: TInput
|
|
110
|
+
} | null, options: ActionHandlerOptions<TInput, TOutput>, actionExecution: TInput extends null ? () => Promise<TOutput> : (validatedInput: TInput) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
|
|
109
111
|
}
|
|
110
112
|
declare function develitWorker<TWorker extends Constructor>(Worker: TWorker): TWorker & Constructor<DevelitWorkerMethods>;
|
|
111
113
|
|
|
@@ -150,7 +152,7 @@ interface ActionHandlerOptions<TInput, TOutput> {
|
|
|
150
152
|
declare function handleAction<TInput, TOutput>(worker: DevelitWorkerMethods, input: {
|
|
151
153
|
data: TInput;
|
|
152
154
|
schema: z.$ZodType<TInput>;
|
|
153
|
-
} | null, options: ActionHandlerOptions<TInput, TOutput> | undefined, actionExecution: (validatedInput: TInput
|
|
155
|
+
} | null, options: ActionHandlerOptions<TInput, TOutput> | undefined, actionExecution: TInput extends null ? () => Promise<TOutput> : (validatedInput: TInput) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
|
|
154
156
|
/**
|
|
155
157
|
* Utility type to extract the validated input type from a schema
|
|
156
158
|
*/
|
|
@@ -158,7 +160,7 @@ type ValidatedInput<T extends z.$ZodType> = z.infer<T>;
|
|
|
158
160
|
/**
|
|
159
161
|
* Utility type for action execution functions
|
|
160
162
|
*/
|
|
161
|
-
type ActionExecution<TInput, TOutput> = (input: TInput) => Promise<TOutput>;
|
|
163
|
+
type ActionExecution<TInput, TOutput> = TInput extends null ? () => Promise<TOutput> : (input: TInput) => Promise<TOutput>;
|
|
162
164
|
|
|
163
165
|
declare const drizzleConfig: drizzle_kit.Config;
|
|
164
166
|
declare function first<T>(rows: T[]): T | undefined;
|
package/dist/index.d.mts
CHANGED
|
@@ -16,11 +16,13 @@ declare const base: {
|
|
|
16
16
|
id: drizzle_orm.IsPrimaryKey<drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
|
|
17
17
|
createdAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"created_at">>;
|
|
18
18
|
modifiedAt: drizzle_orm.HasDefault<drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"modified_at">>>;
|
|
19
|
+
deletedAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"deleted_at">>;
|
|
19
20
|
};
|
|
20
21
|
declare const basePostgres: {
|
|
21
22
|
id: drizzle_orm.IsPrimaryKey<drizzle_orm.NotNull<drizzle_orm_pg_core.PgUUIDBuilderInitial<"id">>>;
|
|
22
23
|
createdAt: drizzle_orm.NotNull<drizzle_orm.HasDefault<drizzle_orm_pg_core.PgTimestampBuilderInitial<"created_at">>>;
|
|
23
24
|
modifiedAt: drizzle_orm.HasDefault<drizzle_orm.HasDefault<drizzle_orm_pg_core.PgTimestampBuilderInitial<"modified_at">>>;
|
|
25
|
+
deletedAt: drizzle_orm.HasDefault<drizzle_orm_pg_core.PgTimestampBuilderInitial<"deleted_at">>;
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
type InternalErrorResponseStatus = Exclude<StatusCodes, 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207>;
|
|
@@ -105,7 +107,7 @@ interface DevelitWorkerMethods {
|
|
|
105
107
|
handleAction<TInput, TOutput>(input: {
|
|
106
108
|
data: TInput;
|
|
107
109
|
schema: z.$ZodType<TInput>;
|
|
108
|
-
} | null, options: ActionHandlerOptions<TInput, TOutput>, actionExecution: (validatedInput: TInput
|
|
110
|
+
} | null, options: ActionHandlerOptions<TInput, TOutput>, actionExecution: TInput extends null ? () => Promise<TOutput> : (validatedInput: TInput) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
|
|
109
111
|
}
|
|
110
112
|
declare function develitWorker<TWorker extends Constructor>(Worker: TWorker): TWorker & Constructor<DevelitWorkerMethods>;
|
|
111
113
|
|
|
@@ -150,7 +152,7 @@ interface ActionHandlerOptions<TInput, TOutput> {
|
|
|
150
152
|
declare function handleAction<TInput, TOutput>(worker: DevelitWorkerMethods, input: {
|
|
151
153
|
data: TInput;
|
|
152
154
|
schema: z.$ZodType<TInput>;
|
|
153
|
-
} | null, options: ActionHandlerOptions<TInput, TOutput> | undefined, actionExecution: (validatedInput: TInput
|
|
155
|
+
} | null, options: ActionHandlerOptions<TInput, TOutput> | undefined, actionExecution: TInput extends null ? () => Promise<TOutput> : (validatedInput: TInput) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
|
|
154
156
|
/**
|
|
155
157
|
* Utility type to extract the validated input type from a schema
|
|
156
158
|
*/
|
|
@@ -158,7 +160,7 @@ type ValidatedInput<T extends z.$ZodType> = z.infer<T>;
|
|
|
158
160
|
/**
|
|
159
161
|
* Utility type for action execution functions
|
|
160
162
|
*/
|
|
161
|
-
type ActionExecution<TInput, TOutput> = (input: TInput) => Promise<TOutput>;
|
|
163
|
+
type ActionExecution<TInput, TOutput> = TInput extends null ? () => Promise<TOutput> : (input: TInput) => Promise<TOutput>;
|
|
162
164
|
|
|
163
165
|
declare const drizzleConfig: drizzle_kit.Config;
|
|
164
166
|
declare function first<T>(rows: T[]): T | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -16,11 +16,13 @@ declare const base: {
|
|
|
16
16
|
id: drizzle_orm.IsPrimaryKey<drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
|
|
17
17
|
createdAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"created_at">>;
|
|
18
18
|
modifiedAt: drizzle_orm.HasDefault<drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"modified_at">>>;
|
|
19
|
+
deletedAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"deleted_at">>;
|
|
19
20
|
};
|
|
20
21
|
declare const basePostgres: {
|
|
21
22
|
id: drizzle_orm.IsPrimaryKey<drizzle_orm.NotNull<drizzle_orm_pg_core.PgUUIDBuilderInitial<"id">>>;
|
|
22
23
|
createdAt: drizzle_orm.NotNull<drizzle_orm.HasDefault<drizzle_orm_pg_core.PgTimestampBuilderInitial<"created_at">>>;
|
|
23
24
|
modifiedAt: drizzle_orm.HasDefault<drizzle_orm.HasDefault<drizzle_orm_pg_core.PgTimestampBuilderInitial<"modified_at">>>;
|
|
25
|
+
deletedAt: drizzle_orm.HasDefault<drizzle_orm_pg_core.PgTimestampBuilderInitial<"deleted_at">>;
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
type InternalErrorResponseStatus = Exclude<StatusCodes, 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207>;
|
|
@@ -105,7 +107,7 @@ interface DevelitWorkerMethods {
|
|
|
105
107
|
handleAction<TInput, TOutput>(input: {
|
|
106
108
|
data: TInput;
|
|
107
109
|
schema: z.$ZodType<TInput>;
|
|
108
|
-
} | null, options: ActionHandlerOptions<TInput, TOutput>, actionExecution: (validatedInput: TInput
|
|
110
|
+
} | null, options: ActionHandlerOptions<TInput, TOutput>, actionExecution: TInput extends null ? () => Promise<TOutput> : (validatedInput: TInput) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
|
|
109
111
|
}
|
|
110
112
|
declare function develitWorker<TWorker extends Constructor>(Worker: TWorker): TWorker & Constructor<DevelitWorkerMethods>;
|
|
111
113
|
|
|
@@ -150,7 +152,7 @@ interface ActionHandlerOptions<TInput, TOutput> {
|
|
|
150
152
|
declare function handleAction<TInput, TOutput>(worker: DevelitWorkerMethods, input: {
|
|
151
153
|
data: TInput;
|
|
152
154
|
schema: z.$ZodType<TInput>;
|
|
153
|
-
} | null, options: ActionHandlerOptions<TInput, TOutput> | undefined, actionExecution: (validatedInput: TInput
|
|
155
|
+
} | null, options: ActionHandlerOptions<TInput, TOutput> | undefined, actionExecution: TInput extends null ? () => Promise<TOutput> : (validatedInput: TInput) => Promise<TOutput>): Promise<IRPCResponse<TOutput>>;
|
|
154
156
|
/**
|
|
155
157
|
* Utility type to extract the validated input type from a schema
|
|
156
158
|
*/
|
|
@@ -158,7 +160,7 @@ type ValidatedInput<T extends z.$ZodType> = z.infer<T>;
|
|
|
158
160
|
/**
|
|
159
161
|
* Utility type for action execution functions
|
|
160
162
|
*/
|
|
161
|
-
type ActionExecution<TInput, TOutput> = (input: TInput) => Promise<TOutput>;
|
|
163
|
+
type ActionExecution<TInput, TOutput> = TInput extends null ? () => Promise<TOutput> : (input: TInput) => Promise<TOutput>;
|
|
162
164
|
|
|
163
165
|
declare const drizzleConfig: drizzle_kit.Config;
|
|
164
166
|
declare function first<T>(rows: T[]): T | undefined;
|
package/dist/index.mjs
CHANGED
|
@@ -13,12 +13,17 @@ const base = {
|
|
|
13
13
|
createdAt: integer("created_at", { mode: "timestamp_ms" }).default(
|
|
14
14
|
sql`(unixepoch('subsec') * 1000)`
|
|
15
15
|
),
|
|
16
|
-
modifiedAt: integer("modified_at", { mode: "timestamp_ms" }).default(sql`null`).$onUpdate(() => /* @__PURE__ */ new Date())
|
|
16
|
+
modifiedAt: integer("modified_at", { mode: "timestamp_ms" }).default(sql`null`).$onUpdate(() => /* @__PURE__ */ new Date()),
|
|
17
|
+
deletedAt: integer("deleted_at", { mode: "timestamp_ms" }).default(sql`null`)
|
|
17
18
|
};
|
|
18
19
|
const basePostgres = {
|
|
19
20
|
id: uuid("id").primaryKey(),
|
|
20
21
|
createdAt: timestamp("created_at", { mode: "date", withTimezone: false }).defaultNow().notNull(),
|
|
21
|
-
modifiedAt: timestamp("modified_at", { mode: "date", withTimezone: false }).default(sql`null`).$onUpdate(() => /* @__PURE__ */ new Date())
|
|
22
|
+
modifiedAt: timestamp("modified_at", { mode: "date", withTimezone: false }).default(sql`null`).$onUpdate(() => /* @__PURE__ */ new Date()),
|
|
23
|
+
deletedAt: timestamp("deleted_at", {
|
|
24
|
+
mode: "date",
|
|
25
|
+
withTimezone: false
|
|
26
|
+
}).default(sql`null`)
|
|
22
27
|
};
|
|
23
28
|
|
|
24
29
|
const ibanZodSchema = new z.$ZodString({
|
|
@@ -168,7 +173,7 @@ async function handleAction(worker, input, options = {}, actionExecution) {
|
|
|
168
173
|
});
|
|
169
174
|
}
|
|
170
175
|
const [data, error] = await useResult(
|
|
171
|
-
actionExecution(validatedInput)
|
|
176
|
+
validatedInput ? actionExecution(validatedInput) : actionExecution()
|
|
172
177
|
);
|
|
173
178
|
if (error) {
|
|
174
179
|
worker.logError(error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@develit-io/backend-sdk",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.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.
|
|
28
|
+
"@cloudflare/workers-types": "^4.20250722.0",
|
|
29
29
|
"consola": "^3.4.2",
|
|
30
|
-
"drizzle-kit": "^0.
|
|
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.
|
|
37
|
+
"zod": "^4.0.11"
|
|
38
38
|
}
|
|
39
39
|
}
|