@develit-io/backend-sdk 5.16.2 → 5.17.1

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
@@ -4,14 +4,16 @@ const drizzleOrm = require('drizzle-orm');
4
4
  const pgCore = require('drizzle-orm/pg-core');
5
5
  const sqliteCore = require('drizzle-orm/sqlite-core');
6
6
  const generalCodes = require('@develit-io/general-codes');
7
+ const commentJson = require('comment-json');
8
+ const node_fs = require('node:fs');
9
+ const path = require('@std/path');
7
10
  const text = require('@std/text');
8
11
  require('http-status-codes');
9
12
  const z = require('zod/v4/core');
10
13
  const h3 = require('h3');
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 = {
@@ -61,14 +63,100 @@ const bankAccount = {
61
63
  currency: sqliteCore.text("currency", { enum: generalCodes.CURRENCY_CODES }).notNull(),
62
64
  countryCode: sqliteCore.text("country_code", { enum: generalCodes.COUNTRY_CODES_2 }).notNull()
63
65
  };
66
+ const bankAccountCurrencyEnum = pgCore.pgEnum("currency", generalCodes.CURRENCY_CODES);
67
+ const bankAccountCountryCodeEnum = pgCore.pgEnum(
68
+ "country_code",
69
+ generalCodes.COUNTRY_CODES_2
70
+ );
71
+ const bankAccountBankCodeEnum = pgCore.pgEnum("bank_code", generalCodes.BANK_CODES);
64
72
  const bankAccountPostgres = {
65
73
  holderName: pgCore.text("holder_name").notNull(),
66
74
  number: pgCore.text("number").notNull(),
67
- bankCode: pgCore.pgEnum("bank_code", generalCodes.BANK_CODES)().notNull(),
75
+ bankCode: bankAccountBankCodeEnum().notNull(),
68
76
  iban: pgCore.text("iban").notNull(),
69
77
  bic: pgCore.text("bic").notNull(),
70
- currency: pgCore.pgEnum("currency", generalCodes.CURRENCY_CODES)().notNull(),
71
- countryCode: pgCore.pgEnum("country_code", generalCodes.COUNTRY_CODES_2)().notNull()
78
+ currency: bankAccountCurrencyEnum().notNull(),
79
+ countryCode: bankAccountCountryCodeEnum().notNull()
80
+ };
81
+
82
+ const composeD1Arguments = ({
83
+ resourceName
84
+ }) => {
85
+ return {
86
+ transform: {
87
+ database: {
88
+ name: resourceName,
89
+ primaryLocationHint: "weur"
90
+ }
91
+ }
92
+ };
93
+ };
94
+
95
+ const composeKvArguments = ({
96
+ resourceName
97
+ }) => {
98
+ return {
99
+ transform: {
100
+ namespace: {
101
+ title: resourceName
102
+ }
103
+ }
104
+ };
105
+ };
106
+
107
+ const composeQueueArguments = ({
108
+ resourceName,
109
+ deliveryDelay = 5,
110
+ messageRetentionPeriod = 259200
111
+ }) => {
112
+ return {
113
+ transform: {
114
+ queue: {
115
+ queueName: resourceName,
116
+ settings: {
117
+ deliveryDelay,
118
+ messageRetentionPeriod
119
+ }
120
+ }
121
+ }
122
+ };
123
+ };
124
+
125
+ const composeR2Arguments = ({
126
+ resourceName,
127
+ storageClass = "Standard"
128
+ }) => {
129
+ return {
130
+ transform: {
131
+ bucket: {
132
+ name: resourceName,
133
+ jurisdiction: "eu",
134
+ location: "weur",
135
+ storageClass
136
+ }
137
+ }
138
+ };
139
+ };
140
+
141
+ async function loadWorkerConfig({ path: path$1 }) {
142
+ const workerConfigFile = node_fs.readFileSync(path.join(path$1, "./wrangler.jsonc"), "utf-8");
143
+ return commentJson.parse(workerConfigFile);
144
+ }
145
+
146
+ const composeBindingName = ({
147
+ resource,
148
+ resourceName,
149
+ bindingName
150
+ }) => {
151
+ const convertedBindingName = bindingName ? text.toSnakeCase(bindingName) : `${text.toSnakeCase(resourceName)}_${resource}`;
152
+ return convertedBindingName.toUpperCase();
153
+ };
154
+ const composeResourceName = ({
155
+ project,
156
+ environment,
157
+ resourceName
158
+ }) => {
159
+ return `${project}-${resourceName}-${environment}`;
72
160
  };
73
161
 
74
162
  class Infrastructure {
@@ -84,158 +172,19 @@ class Infrastructure {
84
172
  this.environment = environment;
85
173
  this.sst = sst;
86
174
  }
87
- // TODO(Pookensivee): Make tests for this util
88
- composeBindingName({
89
- resource,
90
- resourceName,
91
- bindingName
92
- }) {
93
- const convertedBindingName = bindingName ? text.toSnakeCase(bindingName) : `${text.toSnakeCase(resourceName)}_${resource}`;
94
- return convertedBindingName.toUpperCase();
95
- }
96
- // TODO(Pookensivee): Make tests for this util
97
- composeResourceName({ resourceName }) {
98
- return `${this.project}-${resourceName}-${this.environment}`;
99
- }
100
- // TODO(Pookensivee): Make tests for this util
101
- composeKvArguments({ resourceName }) {
102
- return {
103
- transform: {
104
- namespace: {
105
- title: resourceName
106
- }
107
- }
108
- };
109
- }
110
- // TODO(Pookensivee): Make tests for this util
111
- composeD1Arguments({ resourceName }) {
112
- return {
113
- transform: {
114
- database: {
115
- name: resourceName,
116
- primaryLocationHint: "weur"
117
- }
118
- }
119
- };
120
- }
121
- // TODO(Pookensivee): Make tests for this util
122
- composeQueueArguments({
123
- resourceName,
124
- deliveryDelay = 5,
125
- messageRetentionPeriod = 259200
126
- }) {
127
- return {
128
- transform: {
129
- queue: {
130
- queueName: resourceName,
131
- settings: {
132
- deliveryDelay,
133
- messageRetentionPeriod
134
- }
135
- }
136
- }
137
- };
138
- }
139
- // TODO(Pookensivee): Make tests for this util
140
- composeR2Arguments({
141
- resourceName,
142
- storageClass = "Standard"
143
- }) {
144
- return {
145
- transform: {
146
- bucket: {
147
- name: resourceName,
148
- jurisdiction: "eu",
149
- location: "weur",
150
- storageClass
151
- }
152
- }
153
- };
154
- }
155
- // TODO: Solve the circular dependency on post infrastructure deploy script
156
- // TODO: Cannot assign a queue as a producer, work around: https://developers.cloudflare.com/workers/wrangler/commands/#queues-consumer-add-script-name
157
- // async composeWorkerArguments({
158
- // resourceName,
159
- // path,
160
- // bindings = [],
161
- // }: {
162
- // resourceName: string
163
- // path: string
164
- // bindings?: Input<Kv | D1 | Queue | Worker | Bucket>[]
165
- // }) {
166
- // const workerConfig = this.loadWorkerConfig({ path })
167
- // const environmentVariables = this.extractEnvironmentVariables({ workerConfigEnv:
168
- // workerConfig.env as WorkerConfigEnv
169
- // })
170
- // // TODO: Fix this
171
- // if (
172
- // 'SERVICE_CONFIG' in environmentVariables &&
173
- // typeof environmentVariables.SERVICE_CONFIG === 'object'
174
- // ) {
175
- // environmentVariables.SERVICE_CONFIG = JSON.stringify(environmentVariables.SERVICE_CONFIG)
176
- // }
177
- // // TODO: Fix this
178
- // if (
179
- // 'EMAIL_SENDER' in environmentVariables &&
180
- // typeof environmentVariables.EMAIL_SENDER === 'object'
181
- // ) {
182
- // environmentVariables.EMAIL_SENDER = JSON.stringify(environmentVariables.EMAIL_SENDER)
183
- // }
184
- // return {
185
- // handler: join(path, './src/index.ts'),
186
- // environment: Object.entries(environmentVariables).reduce((acc, [key, value]) => ({
187
- // ...acc,
188
- // [key]: String(value)
189
- // }), {} as Record<string, string>),
190
- // link: bindings,
191
- // transform: {
192
- // worker: {
193
- // scriptName: this.composeResourceName({ resourceName }),
194
- // compatibilityDate: '2025-06-04',
195
- // compatibilityFlags: ['nodejs_compat'],
196
- // observability: {
197
- // enabled: true,
198
- // headSamplingRate: 1,
199
- // logs: {
200
- // // Check whether this disables logs completely or just invocation ones
201
- // enabled: false,
202
- // invocationLogs: false,
203
- // },
204
- // },
205
- // },
206
- // }
207
- // } satisfies Partial<WorkerArgs>
208
- // }
209
- // loadWorkerConfig({ path }: { path: string }) {
210
- // const workerConfigFile = readFileSync(
211
- // join(path, './wrangler.jsonc'),
212
- // 'utf-8',
213
- // )
214
- // TODO: Use parse from comment-json
215
- // const jsonString = workerConfigFile
216
- // .replace(/\/\*[\s\S]*?\*\//g, '')
217
- // .replace(/\/\/.*$/gm, '')
218
- // return JSON.parse(jsonString)
219
- // }
220
- // extractEnvironmentVariables({
221
- // workerConfigEnv,
222
- // }: {
223
- // workerConfigEnv: WorkerConfigEnv
224
- // }) {
225
- // if (typeof this.environment === 'number') {
226
- // return { ...workerConfigEnv.dev.vars, ENVIRONMENT: this.environment }
227
- // }
228
- // return { ...workerConfigEnv[this.environment].vars }
229
- // }
230
175
  /**
231
176
  * Creates an instance of Cloudflare KV.
232
177
  */
233
178
  kv(options) {
234
179
  const { resourceName, bindingName } = options;
235
180
  return new this.sst.cloudflare.Kv(
236
- `${this.composeBindingName({ resource: "kv", resourceName, bindingName })}`,
237
- this.composeKvArguments({
238
- resourceName: this.composeResourceName({ resourceName })
181
+ `${composeBindingName({ resource: "kv", resourceName, bindingName })}`,
182
+ composeKvArguments({
183
+ resourceName: composeResourceName({
184
+ project: this.project,
185
+ environment: this.environment,
186
+ resourceName
187
+ })
239
188
  })
240
189
  );
241
190
  }
@@ -245,9 +194,13 @@ class Infrastructure {
245
194
  d1(options) {
246
195
  const { resourceName, bindingName } = options;
247
196
  return new this.sst.cloudflare.D1(
248
- `${this.composeBindingName({ resource: "d1", resourceName, bindingName })}`,
249
- this.composeD1Arguments({
250
- resourceName: this.composeResourceName({ resourceName })
197
+ `${composeBindingName({ resource: "d1", resourceName, bindingName })}`,
198
+ composeD1Arguments({
199
+ resourceName: composeResourceName({
200
+ project: this.project,
201
+ environment: this.environment,
202
+ resourceName
203
+ })
251
204
  })
252
205
  );
253
206
  }
@@ -257,9 +210,13 @@ class Infrastructure {
257
210
  queue(options) {
258
211
  const { resourceName, bindingName, deliveryDelay, messageRetentionPeriod } = options;
259
212
  return new this.sst.cloudflare.Queue(
260
- `${this.composeBindingName({ resource: "queue", resourceName, bindingName })}`,
261
- this.composeQueueArguments({
262
- resourceName: this.composeResourceName({ resourceName }),
213
+ `${composeBindingName({ resource: "queue", resourceName, bindingName })}`,
214
+ composeQueueArguments({
215
+ resourceName: composeResourceName({
216
+ project: this.project,
217
+ environment: this.environment,
218
+ resourceName
219
+ }),
263
220
  deliveryDelay,
264
221
  messageRetentionPeriod
265
222
  })
@@ -271,77 +228,28 @@ class Infrastructure {
271
228
  r2(options) {
272
229
  const { resourceName, bindingName, storageClass } = options;
273
230
  return new this.sst.cloudflare.Bucket(
274
- `${this.composeBindingName({ resource: "r2", resourceName, bindingName })}`,
275
- this.composeR2Arguments({
276
- resourceName: this.composeResourceName({ resourceName }),
231
+ `${composeBindingName({ resource: "r2", resourceName, bindingName })}`,
232
+ composeR2Arguments({
233
+ resourceName: composeResourceName({
234
+ project: this.project,
235
+ environment: this.environment,
236
+ resourceName
237
+ }),
277
238
  storageClass
278
239
  })
279
240
  );
280
241
  }
281
- // TODO: Solve the circular dependency on post infrastructure deploy script
282
- // async worker({
283
- // resourceName,
284
- // bindingName,
285
- // path,
286
- // bindings = [],
287
- // }: {
288
- // resourceName: string
289
- // bindingName: string
290
- // path: string
291
- // bindings?: Input<Kv | D1 | Queue | Worker | Bucket>[]
292
- // }) {
293
- // return new sst.cloudflare.Worker(
294
- // this.composeBindingName({
295
- // resource: 'worker',
296
- // bindingName,
297
- // resourceName,
298
- // }),
299
- // await this.composeWorkerArguments({
300
- // resourceName: this.composeResourceName({ resourceName }),
301
- // path,
302
- // bindings,
303
- // }),
304
- // )
305
- // }
306
- // async service({
307
- // resourceName,
308
- // bindingName,
309
- // path,
310
- // bindings = [],
311
- // }: {
312
- // resourceName: string
313
- // bindingName?: string
314
- // path?: string
315
- // bindings?: Input<Kv | D1 | Queue | Worker | Bucket>[]
316
- // }) {
317
- // return this.worker({
318
- // resourceName: `${this.project}-${resourceName}-service-${this.environment}`,
319
- // bindingName: this.composeBindingName({
320
- // resource: 'service',
321
- // bindingName,
322
- // resourceName,
323
- // }),
324
- // path: `${path ?? `./services/${resourceName}`}`,
325
- // bindings,
326
- // })
327
- // }
328
- // // TODO: Add name
329
- // async orchestrator({
330
- // path,
331
- // bindings = [],
332
- // }: {
333
- // path?: string
334
- // bindings?: Input<Kv | D1 | Queue | Worker | Bucket>[]
335
- // }) {
336
- // return this.worker({
337
- // resourceName: `${this.project}-gateway-${this.environment}`,
338
- // bindingName: 'GATEWAY',
339
- // path: `${path ?? `./apps/gateway`}`,
340
- // bindings,
341
- // })
342
- // }
343
242
  }
344
243
 
244
+ const ENVIRONMENT = ["dev", "test", "staging", "production"];
245
+
246
+ const validateEnvironment = (environment) => {
247
+ if (ENVIRONMENT.includes(environment)) {
248
+ return environment;
249
+ }
250
+ return Number(environment);
251
+ };
252
+
345
253
  const ibanZodSchema = new z__namespace.$ZodString({
346
254
  type: "string",
347
255
  checks: [
@@ -970,15 +878,20 @@ function develitWorker(Worker) {
970
878
  }
971
879
 
972
880
  exports.DatabaseTransaction = DatabaseTransaction;
881
+ exports.ENVIRONMENT = ENVIRONMENT;
973
882
  exports.Infrastructure = Infrastructure;
974
883
  exports.RPCResponse = RPCResponse;
975
884
  exports.action = action;
976
885
  exports.bankAccount = bankAccount;
886
+ exports.bankAccountBankCodeEnum = bankAccountBankCodeEnum;
887
+ exports.bankAccountCountryCodeEnum = bankAccountCountryCodeEnum;
888
+ exports.bankAccountCurrencyEnum = bankAccountCurrencyEnum;
977
889
  exports.bankAccountPostgres = bankAccountPostgres;
978
890
  exports.base = base;
979
891
  exports.basePostgres = basePostgres;
980
892
  exports.calculateExponentialBackoff = calculateExponentialBackoff;
981
893
  exports.cloudflareQueue = cloudflareQueue;
894
+ exports.composeBindingName = composeBindingName;
982
895
  exports.createAuditLogWriter = createAuditLogWriter;
983
896
  exports.createInternalError = createInternalError;
984
897
  exports.defineCommand = defineCommand;
@@ -998,6 +911,7 @@ exports.handleAction = handleAction;
998
911
  exports.handleActionResponse = handleActionResponse;
999
912
  exports.ibanZodSchema = ibanZodSchema;
1000
913
  exports.isInternalError = isInternalError;
914
+ exports.loadWorkerConfig = loadWorkerConfig;
1001
915
  exports.paginationQuerySchema = paginationQuerySchema;
1002
916
  exports.paginationSchema = paginationSchema;
1003
917
  exports.service = service;
@@ -1005,3 +919,4 @@ exports.swiftZodSchema = swiftZodSchema;
1005
919
  exports.useResult = useResult;
1006
920
  exports.useResultSync = useResultSync;
1007
921
  exports.uuidv4 = uuidv4;
922
+ 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';
@@ -33,6 +34,9 @@ declare const bankAccount: {
33
34
  currency: drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"currency", ["CZK" | "EUR" | "USD" | "PLN" | "RON" | "GBP" | "RUB" | "HUF" | "CHF" | "DKK" | "SEK" | "HRK" | "NOK" | "BGN" | "TRY" | "AUD" | "CAD" | "JPY" | "CNY" | "INR" | "BRL" | "MXN" | "ZAR" | "SGD" | "HKD" | "KRW" | "MYR" | "THB" | "IDR" | "PHP" | "AED" | "SAR" | "ILS" | "EGP" | "NGN" | "PKR" | "COP" | "CLP" | "PEN" | "VND" | "KZT" | "UAH" | "BTC" | "ETH" | "ADA" | "DOT" | "ATOM" | "XRP" | "LTC" | "SOL" | "DOGE" | "MATIC" | "AVAX", ...("CZK" | "EUR" | "USD" | "PLN" | "RON" | "GBP" | "RUB" | "HUF" | "CHF" | "DKK" | "SEK" | "HRK" | "NOK" | "BGN" | "TRY" | "AUD" | "CAD" | "JPY" | "CNY" | "INR" | "BRL" | "MXN" | "ZAR" | "SGD" | "HKD" | "KRW" | "MYR" | "THB" | "IDR" | "PHP" | "AED" | "SAR" | "ILS" | "EGP" | "NGN" | "PKR" | "COP" | "CLP" | "PEN" | "VND" | "KZT" | "UAH" | "BTC" | "ETH" | "ADA" | "DOT" | "ATOM" | "XRP" | "LTC" | "SOL" | "DOGE" | "MATIC" | "AVAX")[]], number | undefined>>;
34
35
  countryCode: drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"country_code", ["AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW", ...("AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW")[]], number | undefined>>;
35
36
  };
37
+ declare const bankAccountCurrencyEnum: drizzle_orm_pg_core.PgEnum<["CZK" | "EUR" | "USD" | "PLN" | "RON" | "GBP" | "RUB" | "HUF" | "CHF" | "DKK" | "SEK" | "HRK" | "NOK" | "BGN" | "TRY" | "AUD" | "CAD" | "JPY" | "CNY" | "INR" | "BRL" | "MXN" | "ZAR" | "SGD" | "HKD" | "KRW" | "MYR" | "THB" | "IDR" | "PHP" | "AED" | "SAR" | "ILS" | "EGP" | "NGN" | "PKR" | "COP" | "CLP" | "PEN" | "VND" | "KZT" | "UAH" | "BTC" | "ETH" | "ADA" | "DOT" | "ATOM" | "XRP" | "LTC" | "SOL" | "DOGE" | "MATIC" | "AVAX", ...("CZK" | "EUR" | "USD" | "PLN" | "RON" | "GBP" | "RUB" | "HUF" | "CHF" | "DKK" | "SEK" | "HRK" | "NOK" | "BGN" | "TRY" | "AUD" | "CAD" | "JPY" | "CNY" | "INR" | "BRL" | "MXN" | "ZAR" | "SGD" | "HKD" | "KRW" | "MYR" | "THB" | "IDR" | "PHP" | "AED" | "SAR" | "ILS" | "EGP" | "NGN" | "PKR" | "COP" | "CLP" | "PEN" | "VND" | "KZT" | "UAH" | "BTC" | "ETH" | "ADA" | "DOT" | "ATOM" | "XRP" | "LTC" | "SOL" | "DOGE" | "MATIC" | "AVAX")[]]>;
38
+ declare const bankAccountCountryCodeEnum: drizzle_orm_pg_core.PgEnum<["AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW", ...("AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW")[]]>;
39
+ declare const bankAccountBankCodeEnum: drizzle_orm_pg_core.PgEnum<["0100" | "0300" | "0600" | "0710" | "0800" | "2010" | "2060" | "2070" | "2100" | "2200" | "2220" | "2250" | "2260" | "2600" | "2700" | "3030" | "3060" | "3500" | "4300" | "5500" | "5800" | "6000" | "6200" | "6210" | "6300" | "6363" | "6700" | "6800" | "7910" | "7950" | "7960" | "7970" | "7990" | "8030" | "8040" | "8060" | "8090" | "8150" | "8190" | "8198" | "8220" | "8250" | "8255" | "8265" | "8500", ...("0100" | "0300" | "0600" | "0710" | "0800" | "2010" | "2060" | "2070" | "2100" | "2200" | "2220" | "2250" | "2260" | "2600" | "2700" | "3030" | "3060" | "3500" | "4300" | "5500" | "5800" | "6000" | "6200" | "6210" | "6300" | "6363" | "6700" | "6800" | "7910" | "7950" | "7960" | "7970" | "7990" | "8030" | "8040" | "8060" | "8090" | "8150" | "8190" | "8198" | "8220" | "8250" | "8255" | "8265" | "8500")[]]>;
36
40
  declare const bankAccountPostgres: {
37
41
  holderName: drizzle_orm.NotNull<drizzle_orm_pg_core.PgTextBuilderInitial<"holder_name", [string, ...string[]]>>;
38
42
  number: drizzle_orm.NotNull<drizzle_orm_pg_core.PgTextBuilderInitial<"number", [string, ...string[]]>>;
@@ -45,8 +49,6 @@ declare const bankAccountPostgres: {
45
49
 
46
50
  type Project = 'creditio' | 'fp' | 'mdm' | 'moneio' | 'txs';
47
51
 
48
- type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
49
-
50
52
  type Environment = number | 'dev' | 'test' | 'staging' | 'production';
51
53
 
52
54
  interface SstInstance {
@@ -63,61 +65,6 @@ declare class Infrastructure {
63
65
  environment: Environment;
64
66
  sst: SstInstance;
65
67
  });
66
- composeBindingName({ resource, resourceName, bindingName, }: {
67
- resource: Resource;
68
- resourceName: string;
69
- bindingName?: string;
70
- }): string;
71
- composeResourceName({ resourceName }: {
72
- resourceName: string;
73
- }): string;
74
- composeKvArguments({ resourceName }: {
75
- resourceName: string;
76
- }): {
77
- transform: {
78
- namespace: {
79
- title: string;
80
- };
81
- };
82
- };
83
- composeD1Arguments({ resourceName }: {
84
- resourceName: string;
85
- }): {
86
- transform: {
87
- database: {
88
- name: string;
89
- primaryLocationHint: string;
90
- };
91
- };
92
- };
93
- composeQueueArguments({ resourceName, deliveryDelay, messageRetentionPeriod, }: {
94
- resourceName: string;
95
- deliveryDelay?: number;
96
- messageRetentionPeriod?: number;
97
- }): {
98
- transform: {
99
- queue: {
100
- queueName: string;
101
- settings: {
102
- deliveryDelay: number;
103
- messageRetentionPeriod: number;
104
- };
105
- };
106
- };
107
- };
108
- composeR2Arguments({ resourceName, storageClass, }: {
109
- resourceName: string;
110
- storageClass?: 'Standard' | 'InfrequentAccess';
111
- }): {
112
- transform: {
113
- bucket: {
114
- name: string;
115
- jurisdiction: string;
116
- location: string;
117
- storageClass: "Standard" | "InfrequentAccess";
118
- };
119
- };
120
- };
121
68
  /**
122
69
  * Creates an instance of Cloudflare KV.
123
70
  */
@@ -184,6 +131,12 @@ declare class Infrastructure {
184
131
  }): any;
185
132
  }
186
133
 
134
+ declare function loadWorkerConfig({ path }: {
135
+ path: string;
136
+ }): Promise<comment_json.CommentJSONValue>;
137
+
138
+ type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
139
+
187
140
  type InternalErrorResponseStatus = Exclude<StatusCodes, 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207>;
188
141
  interface InternalError {
189
142
  status: InternalErrorResponseStatus;
@@ -246,6 +199,16 @@ declare const paginationSchema: z.$ZodObject<Readonly<Readonly<{
246
199
  [k: string]: z.$ZodType<unknown, unknown, z.$ZodTypeInternals<unknown, unknown>>;
247
200
  }>>, z.$ZodObjectConfig>;
248
201
 
202
+ declare const composeBindingName: ({ resource, resourceName, bindingName, }: {
203
+ resource: Resource;
204
+ resourceName: string;
205
+ bindingName?: string;
206
+ }) => string;
207
+
208
+ declare const validateEnvironment: (environment: string) => Environment;
209
+
210
+ declare const ENVIRONMENT: string[];
211
+
249
212
  declare const handleActionResponse: <T>({ error, status, message, data, }: {
250
213
  error: boolean;
251
214
  status: number;
@@ -566,5 +529,5 @@ interface WithRetryCounterOptions {
566
529
  type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
567
530
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
568
531
 
569
- export { DatabaseTransaction, Infrastructure, RPCResponse, action, bankAccount, bankAccountPostgres, 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 };
532
+ export { DatabaseTransaction, ENVIRONMENT, Infrastructure, RPCResponse, action, bankAccount, bankAccountBankCodeEnum, bankAccountCountryCodeEnum, bankAccountCurrencyEnum, bankAccountPostgres, 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 };
570
533
  export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, ValidatedInput };