@develit-io/backend-sdk 5.15.0 → 5.15.2

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
@@ -3,6 +3,9 @@
3
3
  const drizzleOrm = require('drizzle-orm');
4
4
  const pgCore = require('drizzle-orm/pg-core');
5
5
  const sqliteCore = require('drizzle-orm/sqlite-core');
6
+ const commentJson = require('comment-json');
7
+ const node_fs = require('node:fs');
8
+ const path = require('@std/path');
6
9
  const text = require('@std/text');
7
10
  require('http-status-codes');
8
11
  const z = require('zod/v4/core');
@@ -10,8 +13,7 @@ const h3 = require('h3');
10
13
  const consola = require('consola');
11
14
  const fs = require('fs');
12
15
  const crypto$1 = require('node:crypto');
13
- const path = require('path');
14
- const commentJson = require('comment-json');
16
+ const path$1 = require('path');
15
17
  const superjson = require('superjson');
16
18
 
17
19
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
@@ -31,7 +33,7 @@ function _interopNamespaceCompat(e) {
31
33
  const z__namespace = /*#__PURE__*/_interopNamespaceCompat(z);
32
34
  const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
33
35
  const crypto__default = /*#__PURE__*/_interopDefaultCompat(crypto$1);
34
- const path__default = /*#__PURE__*/_interopDefaultCompat(path);
36
+ const path__default = /*#__PURE__*/_interopDefaultCompat(path$1);
35
37
  const superjson__default = /*#__PURE__*/_interopDefaultCompat(superjson);
36
38
 
37
39
  const base = {
@@ -52,6 +54,86 @@ const basePostgres = {
52
54
  }).default(drizzleOrm.sql`null`)
53
55
  };
54
56
 
57
+ const composeD1Arguments = ({
58
+ resourceName
59
+ }) => {
60
+ return {
61
+ transform: {
62
+ database: {
63
+ name: resourceName,
64
+ primaryLocationHint: "weur"
65
+ }
66
+ }
67
+ };
68
+ };
69
+
70
+ const composeKvArguments = ({
71
+ resourceName
72
+ }) => {
73
+ return {
74
+ transform: {
75
+ namespace: {
76
+ title: resourceName
77
+ }
78
+ }
79
+ };
80
+ };
81
+
82
+ const composeQueueArguments = ({
83
+ resourceName,
84
+ deliveryDelay = 5,
85
+ messageRetentionPeriod = 259200
86
+ }) => {
87
+ return {
88
+ transform: {
89
+ queue: {
90
+ queueName: resourceName,
91
+ settings: {
92
+ deliveryDelay,
93
+ messageRetentionPeriod
94
+ }
95
+ }
96
+ }
97
+ };
98
+ };
99
+
100
+ const composeR2Arguments = ({
101
+ resourceName,
102
+ storageClass = "Standard"
103
+ }) => {
104
+ return {
105
+ transform: {
106
+ bucket: {
107
+ name: resourceName,
108
+ jurisdiction: "eu",
109
+ location: "weur",
110
+ storageClass
111
+ }
112
+ }
113
+ };
114
+ };
115
+
116
+ async function loadWorkerConfig({ path: path$1 }) {
117
+ const workerConfigFile = node_fs.readFileSync(path.join(path$1, "./wrangler.jsonc"), "utf-8");
118
+ return commentJson.parse(workerConfigFile);
119
+ }
120
+
121
+ const composeBindingName = ({
122
+ resource,
123
+ resourceName,
124
+ bindingName
125
+ }) => {
126
+ const convertedBindingName = bindingName ? text.toSnakeCase(bindingName) : `${text.toSnakeCase(resourceName)}_${resource}`;
127
+ return convertedBindingName.toUpperCase();
128
+ };
129
+ const composeResourceName = ({
130
+ project,
131
+ environment,
132
+ resourceName
133
+ }) => {
134
+ return `${project}-${resourceName}-${environment}`;
135
+ };
136
+
55
137
  class Infrastructure {
56
138
  project;
57
139
  environment;
@@ -65,158 +147,19 @@ class Infrastructure {
65
147
  this.environment = environment;
66
148
  this.sst = sst;
67
149
  }
68
- // TODO(Pookensivee): Make tests for this util
69
- composeBindingName({
70
- resource,
71
- resourceName,
72
- bindingName
73
- }) {
74
- const convertedBindingName = bindingName ? text.toSnakeCase(bindingName) : `${text.toSnakeCase(resourceName)}_${resource}`;
75
- return convertedBindingName.toUpperCase();
76
- }
77
- // TODO(Pookensivee): Make tests for this util
78
- composeResourceName({ resourceName }) {
79
- return `${this.project}-${resourceName}-${this.environment}`;
80
- }
81
- // TODO(Pookensivee): Make tests for this util
82
- composeKvArguments({ resourceName }) {
83
- return {
84
- transform: {
85
- namespace: {
86
- title: resourceName
87
- }
88
- }
89
- };
90
- }
91
- // TODO(Pookensivee): Make tests for this util
92
- composeD1Arguments({ resourceName }) {
93
- return {
94
- transform: {
95
- database: {
96
- name: resourceName,
97
- primaryLocationHint: "weur"
98
- }
99
- }
100
- };
101
- }
102
- // TODO(Pookensivee): Make tests for this util
103
- composeQueueArguments({
104
- resourceName,
105
- deliveryDelay = 5,
106
- messageRetentionPeriod = 259200
107
- }) {
108
- return {
109
- transform: {
110
- queue: {
111
- queueName: resourceName,
112
- settings: {
113
- deliveryDelay,
114
- messageRetentionPeriod
115
- }
116
- }
117
- }
118
- };
119
- }
120
- // TODO(Pookensivee): Make tests for this util
121
- composeR2Arguments({
122
- resourceName,
123
- storageClass = "Standard"
124
- }) {
125
- return {
126
- transform: {
127
- bucket: {
128
- name: resourceName,
129
- jurisdiction: "eu",
130
- location: "weur",
131
- storageClass
132
- }
133
- }
134
- };
135
- }
136
- // TODO: Solve the circular dependency on post infrastructure deploy script
137
- // TODO: Cannot assign a queue as a producer, work around: https://developers.cloudflare.com/workers/wrangler/commands/#queues-consumer-add-script-name
138
- // async composeWorkerArguments({
139
- // resourceName,
140
- // path,
141
- // bindings = [],
142
- // }: {
143
- // resourceName: string
144
- // path: string
145
- // bindings?: Input<Kv | D1 | Queue | Worker | Bucket>[]
146
- // }) {
147
- // const workerConfig = this.loadWorkerConfig({ path })
148
- // const environmentVariables = this.extractEnvironmentVariables({ workerConfigEnv:
149
- // workerConfig.env as WorkerConfigEnv
150
- // })
151
- // // TODO: Fix this
152
- // if (
153
- // 'SERVICE_CONFIG' in environmentVariables &&
154
- // typeof environmentVariables.SERVICE_CONFIG === 'object'
155
- // ) {
156
- // environmentVariables.SERVICE_CONFIG = JSON.stringify(environmentVariables.SERVICE_CONFIG)
157
- // }
158
- // // TODO: Fix this
159
- // if (
160
- // 'EMAIL_SENDER' in environmentVariables &&
161
- // typeof environmentVariables.EMAIL_SENDER === 'object'
162
- // ) {
163
- // environmentVariables.EMAIL_SENDER = JSON.stringify(environmentVariables.EMAIL_SENDER)
164
- // }
165
- // return {
166
- // handler: join(path, './src/index.ts'),
167
- // environment: Object.entries(environmentVariables).reduce((acc, [key, value]) => ({
168
- // ...acc,
169
- // [key]: String(value)
170
- // }), {} as Record<string, string>),
171
- // link: bindings,
172
- // transform: {
173
- // worker: {
174
- // scriptName: this.composeResourceName({ resourceName }),
175
- // compatibilityDate: '2025-06-04',
176
- // compatibilityFlags: ['nodejs_compat'],
177
- // observability: {
178
- // enabled: true,
179
- // headSamplingRate: 1,
180
- // logs: {
181
- // // Check whether this disables logs completely or just invocation ones
182
- // enabled: false,
183
- // invocationLogs: false,
184
- // },
185
- // },
186
- // },
187
- // }
188
- // } satisfies Partial<WorkerArgs>
189
- // }
190
- // loadWorkerConfig({ path }: { path: string }) {
191
- // const workerConfigFile = readFileSync(
192
- // join(path, './wrangler.jsonc'),
193
- // 'utf-8',
194
- // )
195
- // TODO: Use parse from comment-json
196
- // const jsonString = workerConfigFile
197
- // .replace(/\/\*[\s\S]*?\*\//g, '')
198
- // .replace(/\/\/.*$/gm, '')
199
- // return JSON.parse(jsonString)
200
- // }
201
- // extractEnvironmentVariables({
202
- // workerConfigEnv,
203
- // }: {
204
- // workerConfigEnv: WorkerConfigEnv
205
- // }) {
206
- // if (typeof this.environment === 'number') {
207
- // return { ...workerConfigEnv.dev.vars, ENVIRONMENT: this.environment }
208
- // }
209
- // return { ...workerConfigEnv[this.environment].vars }
210
- // }
211
150
  /**
212
151
  * Creates an instance of Cloudflare KV.
213
152
  */
214
153
  kv(options) {
215
154
  const { resourceName, bindingName } = options;
216
155
  return new this.sst.cloudflare.Kv(
217
- `${this.composeBindingName({ resource: "kv", resourceName, bindingName })}`,
218
- this.composeKvArguments({
219
- resourceName: this.composeResourceName({ resourceName })
156
+ `${composeBindingName({ resource: "kv", resourceName, bindingName })}`,
157
+ composeKvArguments({
158
+ resourceName: composeResourceName({
159
+ project: this.project,
160
+ environment: this.environment,
161
+ resourceName
162
+ })
220
163
  })
221
164
  );
222
165
  }
@@ -226,9 +169,13 @@ class Infrastructure {
226
169
  d1(options) {
227
170
  const { resourceName, bindingName } = options;
228
171
  return new this.sst.cloudflare.D1(
229
- `${this.composeBindingName({ resource: "d1", resourceName, bindingName })}`,
230
- this.composeD1Arguments({
231
- resourceName: this.composeResourceName({ resourceName })
172
+ `${composeBindingName({ resource: "d1", resourceName, bindingName })}`,
173
+ composeD1Arguments({
174
+ resourceName: composeResourceName({
175
+ project: this.project,
176
+ environment: this.environment,
177
+ resourceName
178
+ })
232
179
  })
233
180
  );
234
181
  }
@@ -238,9 +185,13 @@ class Infrastructure {
238
185
  queue(options) {
239
186
  const { resourceName, bindingName, deliveryDelay, messageRetentionPeriod } = options;
240
187
  return new this.sst.cloudflare.Queue(
241
- `${this.composeBindingName({ resource: "queue", resourceName, bindingName })}`,
242
- this.composeQueueArguments({
243
- resourceName: this.composeResourceName({ resourceName }),
188
+ `${composeBindingName({ resource: "queue", resourceName, bindingName })}`,
189
+ composeQueueArguments({
190
+ resourceName: composeResourceName({
191
+ project: this.project,
192
+ environment: this.environment,
193
+ resourceName
194
+ }),
244
195
  deliveryDelay,
245
196
  messageRetentionPeriod
246
197
  })
@@ -252,77 +203,28 @@ class Infrastructure {
252
203
  r2(options) {
253
204
  const { resourceName, bindingName, storageClass } = options;
254
205
  return new this.sst.cloudflare.Bucket(
255
- `${this.composeBindingName({ resource: "r2", resourceName, bindingName })}`,
256
- this.composeR2Arguments({
257
- resourceName: this.composeResourceName({ resourceName }),
206
+ `${composeBindingName({ resource: "r2", resourceName, bindingName })}`,
207
+ composeR2Arguments({
208
+ resourceName: composeResourceName({
209
+ project: this.project,
210
+ environment: this.environment,
211
+ resourceName
212
+ }),
258
213
  storageClass
259
214
  })
260
215
  );
261
216
  }
262
- // TODO: Solve the circular dependency on post infrastructure deploy script
263
- // async worker({
264
- // resourceName,
265
- // bindingName,
266
- // path,
267
- // bindings = [],
268
- // }: {
269
- // resourceName: string
270
- // bindingName: string
271
- // path: string
272
- // bindings?: Input<Kv | D1 | Queue | Worker | Bucket>[]
273
- // }) {
274
- // return new sst.cloudflare.Worker(
275
- // this.composeBindingName({
276
- // resource: 'worker',
277
- // bindingName,
278
- // resourceName,
279
- // }),
280
- // await this.composeWorkerArguments({
281
- // resourceName: this.composeResourceName({ resourceName }),
282
- // path,
283
- // bindings,
284
- // }),
285
- // )
286
- // }
287
- // async service({
288
- // resourceName,
289
- // bindingName,
290
- // path,
291
- // bindings = [],
292
- // }: {
293
- // resourceName: string
294
- // bindingName?: string
295
- // path?: string
296
- // bindings?: Input<Kv | D1 | Queue | Worker | Bucket>[]
297
- // }) {
298
- // return this.worker({
299
- // resourceName: `${this.project}-${resourceName}-service-${this.environment}`,
300
- // bindingName: this.composeBindingName({
301
- // resource: 'service',
302
- // bindingName,
303
- // resourceName,
304
- // }),
305
- // path: `${path ?? `./services/${resourceName}`}`,
306
- // bindings,
307
- // })
308
- // }
309
- // // TODO: Add name
310
- // async orchestrator({
311
- // path,
312
- // bindings = [],
313
- // }: {
314
- // path?: string
315
- // bindings?: Input<Kv | D1 | Queue | Worker | Bucket>[]
316
- // }) {
317
- // return this.worker({
318
- // resourceName: `${this.project}-gateway-${this.environment}`,
319
- // bindingName: 'GATEWAY',
320
- // path: `${path ?? `./apps/gateway`}`,
321
- // bindings,
322
- // })
323
- // }
324
217
  }
325
218
 
219
+ const ENVIRONMENT = ["dev", "test", "staging", "production"];
220
+
221
+ const validateEnvironment = (environment) => {
222
+ if (ENVIRONMENT.includes(environment)) {
223
+ return environment;
224
+ }
225
+ return Number(environment);
226
+ };
227
+
326
228
  const ibanZodSchema = new z__namespace.$ZodString({
327
229
  type: "string",
328
230
  checks: [
@@ -951,6 +853,7 @@ function develitWorker(Worker) {
951
853
  }
952
854
 
953
855
  exports.DatabaseTransaction = DatabaseTransaction;
856
+ exports.ENVIRONMENT = ENVIRONMENT;
954
857
  exports.Infrastructure = Infrastructure;
955
858
  exports.RPCResponse = RPCResponse;
956
859
  exports.action = action;
@@ -958,6 +861,7 @@ exports.base = base;
958
861
  exports.basePostgres = basePostgres;
959
862
  exports.calculateExponentialBackoff = calculateExponentialBackoff;
960
863
  exports.cloudflareQueue = cloudflareQueue;
864
+ exports.composeBindingName = composeBindingName;
961
865
  exports.createAuditLogWriter = createAuditLogWriter;
962
866
  exports.createInternalError = createInternalError;
963
867
  exports.defineCommand = defineCommand;
@@ -977,6 +881,7 @@ exports.handleAction = handleAction;
977
881
  exports.handleActionResponse = handleActionResponse;
978
882
  exports.ibanZodSchema = ibanZodSchema;
979
883
  exports.isInternalError = isInternalError;
884
+ exports.loadWorkerConfig = loadWorkerConfig;
980
885
  exports.paginationQuerySchema = paginationQuerySchema;
981
886
  exports.paginationSchema = paginationSchema;
982
887
  exports.service = service;
@@ -984,3 +889,4 @@ exports.swiftZodSchema = swiftZodSchema;
984
889
  exports.useResult = useResult;
985
890
  exports.useResultSync = useResultSync;
986
891
  exports.uuidv4 = uuidv4;
892
+ exports.validateEnvironment = validateEnvironment;
package/dist/index.d.cts CHANGED
@@ -4,6 +4,7 @@ import * as drizzle_orm from 'drizzle-orm';
4
4
  import { ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult } from 'drizzle-orm';
5
5
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
6
6
  import { AnySQLiteTable } from 'drizzle-orm/sqlite-core';
7
+ import * as comment_json from 'comment-json';
7
8
  import { StatusCodes, ReasonPhrases } from 'http-status-codes';
8
9
  export { ReasonPhrases as InternalResponsePhrase, StatusCodes as InternalResponseStatus } from 'http-status-codes';
9
10
  import * as z from 'zod/v4/core';
@@ -26,8 +27,6 @@ declare const basePostgres: {
26
27
 
27
28
  type Project = 'creditio' | 'fp' | 'mdm' | 'moneio' | 'txs';
28
29
 
29
- type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
30
-
31
30
  type Environment = number | 'dev' | 'test' | 'staging' | 'production';
32
31
 
33
32
  interface SstInstance {
@@ -44,61 +43,6 @@ declare class Infrastructure {
44
43
  environment: Environment;
45
44
  sst: SstInstance;
46
45
  });
47
- composeBindingName({ resource, resourceName, bindingName, }: {
48
- resource: Resource;
49
- resourceName: string;
50
- bindingName?: string;
51
- }): string;
52
- composeResourceName({ resourceName }: {
53
- resourceName: string;
54
- }): string;
55
- composeKvArguments({ resourceName }: {
56
- resourceName: string;
57
- }): {
58
- transform: {
59
- namespace: {
60
- title: string;
61
- };
62
- };
63
- };
64
- composeD1Arguments({ resourceName }: {
65
- resourceName: string;
66
- }): {
67
- transform: {
68
- database: {
69
- name: string;
70
- primaryLocationHint: string;
71
- };
72
- };
73
- };
74
- composeQueueArguments({ resourceName, deliveryDelay, messageRetentionPeriod, }: {
75
- resourceName: string;
76
- deliveryDelay?: number;
77
- messageRetentionPeriod?: number;
78
- }): {
79
- transform: {
80
- queue: {
81
- queueName: string;
82
- settings: {
83
- deliveryDelay: number;
84
- messageRetentionPeriod: number;
85
- };
86
- };
87
- };
88
- };
89
- composeR2Arguments({ resourceName, storageClass, }: {
90
- resourceName: string;
91
- storageClass?: 'Standard' | 'InfrequentAccess';
92
- }): {
93
- transform: {
94
- bucket: {
95
- name: string;
96
- jurisdiction: string;
97
- location: string;
98
- storageClass: "Standard" | "InfrequentAccess";
99
- };
100
- };
101
- };
102
46
  /**
103
47
  * Creates an instance of Cloudflare KV.
104
48
  */
@@ -165,6 +109,12 @@ declare class Infrastructure {
165
109
  }): any;
166
110
  }
167
111
 
112
+ declare function loadWorkerConfig({ path }: {
113
+ path: string;
114
+ }): Promise<comment_json.CommentJSONValue>;
115
+
116
+ type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
117
+
168
118
  type InternalErrorResponseStatus = Exclude<StatusCodes, 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207>;
169
119
  interface InternalError {
170
120
  status: InternalErrorResponseStatus;
@@ -227,6 +177,16 @@ declare const paginationSchema: z.$ZodObject<Readonly<Readonly<{
227
177
  [k: string]: z.$ZodType<unknown, unknown, z.$ZodTypeInternals<unknown, unknown>>;
228
178
  }>>, z.$ZodObjectConfig>;
229
179
 
180
+ declare const composeBindingName: ({ resource, resourceName, bindingName, }: {
181
+ resource: Resource;
182
+ resourceName: string;
183
+ bindingName?: string;
184
+ }) => string;
185
+
186
+ declare const validateEnvironment: (environment: string) => Environment;
187
+
188
+ declare const ENVIRONMENT: string[];
189
+
230
190
  declare const handleActionResponse: <T>({ error, status, message, data, }: {
231
191
  error: boolean;
232
192
  status: number;
@@ -547,5 +507,5 @@ interface WithRetryCounterOptions {
547
507
  type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
548
508
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
549
509
 
550
- export { DatabaseTransaction, Infrastructure, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, paginationQuerySchema, paginationSchema, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
510
+ export { DatabaseTransaction, ENVIRONMENT, Infrastructure, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, composeBindingName, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, loadWorkerConfig, paginationQuerySchema, paginationSchema, service, swiftZodSchema, useResult, useResultSync, uuidv4, validateEnvironment };
551
511
  export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, ValidatedInput };
package/dist/index.d.mts CHANGED
@@ -4,6 +4,7 @@ import * as drizzle_orm from 'drizzle-orm';
4
4
  import { ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult } from 'drizzle-orm';
5
5
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
6
6
  import { AnySQLiteTable } from 'drizzle-orm/sqlite-core';
7
+ import * as comment_json from 'comment-json';
7
8
  import { StatusCodes, ReasonPhrases } from 'http-status-codes';
8
9
  export { ReasonPhrases as InternalResponsePhrase, StatusCodes as InternalResponseStatus } from 'http-status-codes';
9
10
  import * as z from 'zod/v4/core';
@@ -26,8 +27,6 @@ declare const basePostgres: {
26
27
 
27
28
  type Project = 'creditio' | 'fp' | 'mdm' | 'moneio' | 'txs';
28
29
 
29
- type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
30
-
31
30
  type Environment = number | 'dev' | 'test' | 'staging' | 'production';
32
31
 
33
32
  interface SstInstance {
@@ -44,61 +43,6 @@ declare class Infrastructure {
44
43
  environment: Environment;
45
44
  sst: SstInstance;
46
45
  });
47
- composeBindingName({ resource, resourceName, bindingName, }: {
48
- resource: Resource;
49
- resourceName: string;
50
- bindingName?: string;
51
- }): string;
52
- composeResourceName({ resourceName }: {
53
- resourceName: string;
54
- }): string;
55
- composeKvArguments({ resourceName }: {
56
- resourceName: string;
57
- }): {
58
- transform: {
59
- namespace: {
60
- title: string;
61
- };
62
- };
63
- };
64
- composeD1Arguments({ resourceName }: {
65
- resourceName: string;
66
- }): {
67
- transform: {
68
- database: {
69
- name: string;
70
- primaryLocationHint: string;
71
- };
72
- };
73
- };
74
- composeQueueArguments({ resourceName, deliveryDelay, messageRetentionPeriod, }: {
75
- resourceName: string;
76
- deliveryDelay?: number;
77
- messageRetentionPeriod?: number;
78
- }): {
79
- transform: {
80
- queue: {
81
- queueName: string;
82
- settings: {
83
- deliveryDelay: number;
84
- messageRetentionPeriod: number;
85
- };
86
- };
87
- };
88
- };
89
- composeR2Arguments({ resourceName, storageClass, }: {
90
- resourceName: string;
91
- storageClass?: 'Standard' | 'InfrequentAccess';
92
- }): {
93
- transform: {
94
- bucket: {
95
- name: string;
96
- jurisdiction: string;
97
- location: string;
98
- storageClass: "Standard" | "InfrequentAccess";
99
- };
100
- };
101
- };
102
46
  /**
103
47
  * Creates an instance of Cloudflare KV.
104
48
  */
@@ -165,6 +109,12 @@ declare class Infrastructure {
165
109
  }): any;
166
110
  }
167
111
 
112
+ declare function loadWorkerConfig({ path }: {
113
+ path: string;
114
+ }): Promise<comment_json.CommentJSONValue>;
115
+
116
+ type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
117
+
168
118
  type InternalErrorResponseStatus = Exclude<StatusCodes, 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207>;
169
119
  interface InternalError {
170
120
  status: InternalErrorResponseStatus;
@@ -227,6 +177,16 @@ declare const paginationSchema: z.$ZodObject<Readonly<Readonly<{
227
177
  [k: string]: z.$ZodType<unknown, unknown, z.$ZodTypeInternals<unknown, unknown>>;
228
178
  }>>, z.$ZodObjectConfig>;
229
179
 
180
+ declare const composeBindingName: ({ resource, resourceName, bindingName, }: {
181
+ resource: Resource;
182
+ resourceName: string;
183
+ bindingName?: string;
184
+ }) => string;
185
+
186
+ declare const validateEnvironment: (environment: string) => Environment;
187
+
188
+ declare const ENVIRONMENT: string[];
189
+
230
190
  declare const handleActionResponse: <T>({ error, status, message, data, }: {
231
191
  error: boolean;
232
192
  status: number;
@@ -547,5 +507,5 @@ interface WithRetryCounterOptions {
547
507
  type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
548
508
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
549
509
 
550
- export { DatabaseTransaction, Infrastructure, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, paginationQuerySchema, paginationSchema, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
510
+ export { DatabaseTransaction, ENVIRONMENT, Infrastructure, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, composeBindingName, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, loadWorkerConfig, paginationQuerySchema, paginationSchema, service, swiftZodSchema, useResult, useResultSync, uuidv4, validateEnvironment };
551
511
  export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, ValidatedInput };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import * as drizzle_orm from 'drizzle-orm';
4
4
  import { ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult } from 'drizzle-orm';
5
5
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
6
6
  import { AnySQLiteTable } from 'drizzle-orm/sqlite-core';
7
+ import * as comment_json from 'comment-json';
7
8
  import { StatusCodes, ReasonPhrases } from 'http-status-codes';
8
9
  export { ReasonPhrases as InternalResponsePhrase, StatusCodes as InternalResponseStatus } from 'http-status-codes';
9
10
  import * as z from 'zod/v4/core';
@@ -26,8 +27,6 @@ declare const basePostgres: {
26
27
 
27
28
  type Project = 'creditio' | 'fp' | 'mdm' | 'moneio' | 'txs';
28
29
 
29
- type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
30
-
31
30
  type Environment = number | 'dev' | 'test' | 'staging' | 'production';
32
31
 
33
32
  interface SstInstance {
@@ -44,61 +43,6 @@ declare class Infrastructure {
44
43
  environment: Environment;
45
44
  sst: SstInstance;
46
45
  });
47
- composeBindingName({ resource, resourceName, bindingName, }: {
48
- resource: Resource;
49
- resourceName: string;
50
- bindingName?: string;
51
- }): string;
52
- composeResourceName({ resourceName }: {
53
- resourceName: string;
54
- }): string;
55
- composeKvArguments({ resourceName }: {
56
- resourceName: string;
57
- }): {
58
- transform: {
59
- namespace: {
60
- title: string;
61
- };
62
- };
63
- };
64
- composeD1Arguments({ resourceName }: {
65
- resourceName: string;
66
- }): {
67
- transform: {
68
- database: {
69
- name: string;
70
- primaryLocationHint: string;
71
- };
72
- };
73
- };
74
- composeQueueArguments({ resourceName, deliveryDelay, messageRetentionPeriod, }: {
75
- resourceName: string;
76
- deliveryDelay?: number;
77
- messageRetentionPeriod?: number;
78
- }): {
79
- transform: {
80
- queue: {
81
- queueName: string;
82
- settings: {
83
- deliveryDelay: number;
84
- messageRetentionPeriod: number;
85
- };
86
- };
87
- };
88
- };
89
- composeR2Arguments({ resourceName, storageClass, }: {
90
- resourceName: string;
91
- storageClass?: 'Standard' | 'InfrequentAccess';
92
- }): {
93
- transform: {
94
- bucket: {
95
- name: string;
96
- jurisdiction: string;
97
- location: string;
98
- storageClass: "Standard" | "InfrequentAccess";
99
- };
100
- };
101
- };
102
46
  /**
103
47
  * Creates an instance of Cloudflare KV.
104
48
  */
@@ -165,6 +109,12 @@ declare class Infrastructure {
165
109
  }): any;
166
110
  }
167
111
 
112
+ declare function loadWorkerConfig({ path }: {
113
+ path: string;
114
+ }): Promise<comment_json.CommentJSONValue>;
115
+
116
+ type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
117
+
168
118
  type InternalErrorResponseStatus = Exclude<StatusCodes, 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207>;
169
119
  interface InternalError {
170
120
  status: InternalErrorResponseStatus;
@@ -227,6 +177,16 @@ declare const paginationSchema: z.$ZodObject<Readonly<Readonly<{
227
177
  [k: string]: z.$ZodType<unknown, unknown, z.$ZodTypeInternals<unknown, unknown>>;
228
178
  }>>, z.$ZodObjectConfig>;
229
179
 
180
+ declare const composeBindingName: ({ resource, resourceName, bindingName, }: {
181
+ resource: Resource;
182
+ resourceName: string;
183
+ bindingName?: string;
184
+ }) => string;
185
+
186
+ declare const validateEnvironment: (environment: string) => Environment;
187
+
188
+ declare const ENVIRONMENT: string[];
189
+
230
190
  declare const handleActionResponse: <T>({ error, status, message, data, }: {
231
191
  error: boolean;
232
192
  status: number;
@@ -547,5 +507,5 @@ interface WithRetryCounterOptions {
547
507
  type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
548
508
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
549
509
 
550
- export { DatabaseTransaction, Infrastructure, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, paginationQuerySchema, paginationSchema, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
510
+ export { DatabaseTransaction, ENVIRONMENT, Infrastructure, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, composeBindingName, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, loadWorkerConfig, paginationQuerySchema, paginationSchema, service, swiftZodSchema, useResult, useResultSync, uuidv4, validateEnvironment };
551
511
  export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, ValidatedInput };
package/dist/index.mjs CHANGED
@@ -1,6 +1,9 @@
1
1
  import { sql } from 'drizzle-orm';
2
2
  import { timestamp, uuid } from 'drizzle-orm/pg-core';
3
3
  import { integer, text } from 'drizzle-orm/sqlite-core';
4
+ import { parse } from 'comment-json';
5
+ import { readFileSync } from 'node:fs';
6
+ import { join } from '@std/path';
4
7
  import { toSnakeCase } from '@std/text';
5
8
  import 'http-status-codes';
6
9
  import * as z from 'zod/v4/core';
@@ -9,7 +12,6 @@ import { consola } from 'consola';
9
12
  import fs from 'fs';
10
13
  import crypto$1 from 'node:crypto';
11
14
  import path from 'path';
12
- import { parse } from 'comment-json';
13
15
  import superjson from 'superjson';
14
16
 
15
17
  const base = {
@@ -30,6 +32,86 @@ const basePostgres = {
30
32
  }).default(sql`null`)
31
33
  };
32
34
 
35
+ const composeD1Arguments = ({
36
+ resourceName
37
+ }) => {
38
+ return {
39
+ transform: {
40
+ database: {
41
+ name: resourceName,
42
+ primaryLocationHint: "weur"
43
+ }
44
+ }
45
+ };
46
+ };
47
+
48
+ const composeKvArguments = ({
49
+ resourceName
50
+ }) => {
51
+ return {
52
+ transform: {
53
+ namespace: {
54
+ title: resourceName
55
+ }
56
+ }
57
+ };
58
+ };
59
+
60
+ const composeQueueArguments = ({
61
+ resourceName,
62
+ deliveryDelay = 5,
63
+ messageRetentionPeriod = 259200
64
+ }) => {
65
+ return {
66
+ transform: {
67
+ queue: {
68
+ queueName: resourceName,
69
+ settings: {
70
+ deliveryDelay,
71
+ messageRetentionPeriod
72
+ }
73
+ }
74
+ }
75
+ };
76
+ };
77
+
78
+ const composeR2Arguments = ({
79
+ resourceName,
80
+ storageClass = "Standard"
81
+ }) => {
82
+ return {
83
+ transform: {
84
+ bucket: {
85
+ name: resourceName,
86
+ jurisdiction: "eu",
87
+ location: "weur",
88
+ storageClass
89
+ }
90
+ }
91
+ };
92
+ };
93
+
94
+ async function loadWorkerConfig({ path }) {
95
+ const workerConfigFile = readFileSync(join(path, "./wrangler.jsonc"), "utf-8");
96
+ return parse(workerConfigFile);
97
+ }
98
+
99
+ const composeBindingName = ({
100
+ resource,
101
+ resourceName,
102
+ bindingName
103
+ }) => {
104
+ const convertedBindingName = bindingName ? toSnakeCase(bindingName) : `${toSnakeCase(resourceName)}_${resource}`;
105
+ return convertedBindingName.toUpperCase();
106
+ };
107
+ const composeResourceName = ({
108
+ project,
109
+ environment,
110
+ resourceName
111
+ }) => {
112
+ return `${project}-${resourceName}-${environment}`;
113
+ };
114
+
33
115
  class Infrastructure {
34
116
  project;
35
117
  environment;
@@ -43,158 +125,19 @@ class Infrastructure {
43
125
  this.environment = environment;
44
126
  this.sst = sst;
45
127
  }
46
- // TODO(Pookensivee): Make tests for this util
47
- composeBindingName({
48
- resource,
49
- resourceName,
50
- bindingName
51
- }) {
52
- const convertedBindingName = bindingName ? toSnakeCase(bindingName) : `${toSnakeCase(resourceName)}_${resource}`;
53
- return convertedBindingName.toUpperCase();
54
- }
55
- // TODO(Pookensivee): Make tests for this util
56
- composeResourceName({ resourceName }) {
57
- return `${this.project}-${resourceName}-${this.environment}`;
58
- }
59
- // TODO(Pookensivee): Make tests for this util
60
- composeKvArguments({ resourceName }) {
61
- return {
62
- transform: {
63
- namespace: {
64
- title: resourceName
65
- }
66
- }
67
- };
68
- }
69
- // TODO(Pookensivee): Make tests for this util
70
- composeD1Arguments({ resourceName }) {
71
- return {
72
- transform: {
73
- database: {
74
- name: resourceName,
75
- primaryLocationHint: "weur"
76
- }
77
- }
78
- };
79
- }
80
- // TODO(Pookensivee): Make tests for this util
81
- composeQueueArguments({
82
- resourceName,
83
- deliveryDelay = 5,
84
- messageRetentionPeriod = 259200
85
- }) {
86
- return {
87
- transform: {
88
- queue: {
89
- queueName: resourceName,
90
- settings: {
91
- deliveryDelay,
92
- messageRetentionPeriod
93
- }
94
- }
95
- }
96
- };
97
- }
98
- // TODO(Pookensivee): Make tests for this util
99
- composeR2Arguments({
100
- resourceName,
101
- storageClass = "Standard"
102
- }) {
103
- return {
104
- transform: {
105
- bucket: {
106
- name: resourceName,
107
- jurisdiction: "eu",
108
- location: "weur",
109
- storageClass
110
- }
111
- }
112
- };
113
- }
114
- // TODO: Solve the circular dependency on post infrastructure deploy script
115
- // TODO: Cannot assign a queue as a producer, work around: https://developers.cloudflare.com/workers/wrangler/commands/#queues-consumer-add-script-name
116
- // async composeWorkerArguments({
117
- // resourceName,
118
- // path,
119
- // bindings = [],
120
- // }: {
121
- // resourceName: string
122
- // path: string
123
- // bindings?: Input<Kv | D1 | Queue | Worker | Bucket>[]
124
- // }) {
125
- // const workerConfig = this.loadWorkerConfig({ path })
126
- // const environmentVariables = this.extractEnvironmentVariables({ workerConfigEnv:
127
- // workerConfig.env as WorkerConfigEnv
128
- // })
129
- // // TODO: Fix this
130
- // if (
131
- // 'SERVICE_CONFIG' in environmentVariables &&
132
- // typeof environmentVariables.SERVICE_CONFIG === 'object'
133
- // ) {
134
- // environmentVariables.SERVICE_CONFIG = JSON.stringify(environmentVariables.SERVICE_CONFIG)
135
- // }
136
- // // TODO: Fix this
137
- // if (
138
- // 'EMAIL_SENDER' in environmentVariables &&
139
- // typeof environmentVariables.EMAIL_SENDER === 'object'
140
- // ) {
141
- // environmentVariables.EMAIL_SENDER = JSON.stringify(environmentVariables.EMAIL_SENDER)
142
- // }
143
- // return {
144
- // handler: join(path, './src/index.ts'),
145
- // environment: Object.entries(environmentVariables).reduce((acc, [key, value]) => ({
146
- // ...acc,
147
- // [key]: String(value)
148
- // }), {} as Record<string, string>),
149
- // link: bindings,
150
- // transform: {
151
- // worker: {
152
- // scriptName: this.composeResourceName({ resourceName }),
153
- // compatibilityDate: '2025-06-04',
154
- // compatibilityFlags: ['nodejs_compat'],
155
- // observability: {
156
- // enabled: true,
157
- // headSamplingRate: 1,
158
- // logs: {
159
- // // Check whether this disables logs completely or just invocation ones
160
- // enabled: false,
161
- // invocationLogs: false,
162
- // },
163
- // },
164
- // },
165
- // }
166
- // } satisfies Partial<WorkerArgs>
167
- // }
168
- // loadWorkerConfig({ path }: { path: string }) {
169
- // const workerConfigFile = readFileSync(
170
- // join(path, './wrangler.jsonc'),
171
- // 'utf-8',
172
- // )
173
- // TODO: Use parse from comment-json
174
- // const jsonString = workerConfigFile
175
- // .replace(/\/\*[\s\S]*?\*\//g, '')
176
- // .replace(/\/\/.*$/gm, '')
177
- // return JSON.parse(jsonString)
178
- // }
179
- // extractEnvironmentVariables({
180
- // workerConfigEnv,
181
- // }: {
182
- // workerConfigEnv: WorkerConfigEnv
183
- // }) {
184
- // if (typeof this.environment === 'number') {
185
- // return { ...workerConfigEnv.dev.vars, ENVIRONMENT: this.environment }
186
- // }
187
- // return { ...workerConfigEnv[this.environment].vars }
188
- // }
189
128
  /**
190
129
  * Creates an instance of Cloudflare KV.
191
130
  */
192
131
  kv(options) {
193
132
  const { resourceName, bindingName } = options;
194
133
  return new this.sst.cloudflare.Kv(
195
- `${this.composeBindingName({ resource: "kv", resourceName, bindingName })}`,
196
- this.composeKvArguments({
197
- resourceName: this.composeResourceName({ resourceName })
134
+ `${composeBindingName({ resource: "kv", resourceName, bindingName })}`,
135
+ composeKvArguments({
136
+ resourceName: composeResourceName({
137
+ project: this.project,
138
+ environment: this.environment,
139
+ resourceName
140
+ })
198
141
  })
199
142
  );
200
143
  }
@@ -204,9 +147,13 @@ class Infrastructure {
204
147
  d1(options) {
205
148
  const { resourceName, bindingName } = options;
206
149
  return new this.sst.cloudflare.D1(
207
- `${this.composeBindingName({ resource: "d1", resourceName, bindingName })}`,
208
- this.composeD1Arguments({
209
- resourceName: this.composeResourceName({ resourceName })
150
+ `${composeBindingName({ resource: "d1", resourceName, bindingName })}`,
151
+ composeD1Arguments({
152
+ resourceName: composeResourceName({
153
+ project: this.project,
154
+ environment: this.environment,
155
+ resourceName
156
+ })
210
157
  })
211
158
  );
212
159
  }
@@ -216,9 +163,13 @@ class Infrastructure {
216
163
  queue(options) {
217
164
  const { resourceName, bindingName, deliveryDelay, messageRetentionPeriod } = options;
218
165
  return new this.sst.cloudflare.Queue(
219
- `${this.composeBindingName({ resource: "queue", resourceName, bindingName })}`,
220
- this.composeQueueArguments({
221
- resourceName: this.composeResourceName({ resourceName }),
166
+ `${composeBindingName({ resource: "queue", resourceName, bindingName })}`,
167
+ composeQueueArguments({
168
+ resourceName: composeResourceName({
169
+ project: this.project,
170
+ environment: this.environment,
171
+ resourceName
172
+ }),
222
173
  deliveryDelay,
223
174
  messageRetentionPeriod
224
175
  })
@@ -230,77 +181,28 @@ class Infrastructure {
230
181
  r2(options) {
231
182
  const { resourceName, bindingName, storageClass } = options;
232
183
  return new this.sst.cloudflare.Bucket(
233
- `${this.composeBindingName({ resource: "r2", resourceName, bindingName })}`,
234
- this.composeR2Arguments({
235
- resourceName: this.composeResourceName({ resourceName }),
184
+ `${composeBindingName({ resource: "r2", resourceName, bindingName })}`,
185
+ composeR2Arguments({
186
+ resourceName: composeResourceName({
187
+ project: this.project,
188
+ environment: this.environment,
189
+ resourceName
190
+ }),
236
191
  storageClass
237
192
  })
238
193
  );
239
194
  }
240
- // TODO: Solve the circular dependency on post infrastructure deploy script
241
- // async worker({
242
- // resourceName,
243
- // bindingName,
244
- // path,
245
- // bindings = [],
246
- // }: {
247
- // resourceName: string
248
- // bindingName: string
249
- // path: string
250
- // bindings?: Input<Kv | D1 | Queue | Worker | Bucket>[]
251
- // }) {
252
- // return new sst.cloudflare.Worker(
253
- // this.composeBindingName({
254
- // resource: 'worker',
255
- // bindingName,
256
- // resourceName,
257
- // }),
258
- // await this.composeWorkerArguments({
259
- // resourceName: this.composeResourceName({ resourceName }),
260
- // path,
261
- // bindings,
262
- // }),
263
- // )
264
- // }
265
- // async service({
266
- // resourceName,
267
- // bindingName,
268
- // path,
269
- // bindings = [],
270
- // }: {
271
- // resourceName: string
272
- // bindingName?: string
273
- // path?: string
274
- // bindings?: Input<Kv | D1 | Queue | Worker | Bucket>[]
275
- // }) {
276
- // return this.worker({
277
- // resourceName: `${this.project}-${resourceName}-service-${this.environment}`,
278
- // bindingName: this.composeBindingName({
279
- // resource: 'service',
280
- // bindingName,
281
- // resourceName,
282
- // }),
283
- // path: `${path ?? `./services/${resourceName}`}`,
284
- // bindings,
285
- // })
286
- // }
287
- // // TODO: Add name
288
- // async orchestrator({
289
- // path,
290
- // bindings = [],
291
- // }: {
292
- // path?: string
293
- // bindings?: Input<Kv | D1 | Queue | Worker | Bucket>[]
294
- // }) {
295
- // return this.worker({
296
- // resourceName: `${this.project}-gateway-${this.environment}`,
297
- // bindingName: 'GATEWAY',
298
- // path: `${path ?? `./apps/gateway`}`,
299
- // bindings,
300
- // })
301
- // }
302
195
  }
303
196
 
197
+ const ENVIRONMENT = ["dev", "test", "staging", "production"];
198
+
199
+ const validateEnvironment = (environment) => {
200
+ if (ENVIRONMENT.includes(environment)) {
201
+ return environment;
202
+ }
203
+ return Number(environment);
204
+ };
205
+
304
206
  const ibanZodSchema = new z.$ZodString({
305
207
  type: "string",
306
208
  checks: [
@@ -928,4 +830,4 @@ function develitWorker(Worker) {
928
830
  return DevelitWorker;
929
831
  }
930
832
 
931
- export { DatabaseTransaction, Infrastructure, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, paginationQuerySchema, paginationSchema, service, swiftZodSchema, useResult, useResultSync, uuidv4 };
833
+ export { DatabaseTransaction, ENVIRONMENT, Infrastructure, RPCResponse, action, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, composeBindingName, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, loadWorkerConfig, paginationQuerySchema, paginationSchema, service, swiftZodSchema, useResult, useResultSync, uuidv4, validateEnvironment };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-io/backend-sdk",
3
- "version": "5.15.0",
3
+ "version": "5.15.2",
4
4
  "description": "Develit Backend SDK",
5
5
  "author": "Develit.io",
6
6
  "license": "ISC",