@develit-io/backend-sdk 5.15.1 → 5.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -24,11 +24,285 @@ declare const basePostgres: {
24
24
  deletedAt: drizzle_orm.HasDefault<drizzle_orm_pg_core.PgTimestampBuilderInitial<"deleted_at">>;
25
25
  };
26
26
 
27
+ declare const bankAccount: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
28
+ name: "bank_account";
29
+ schema: undefined;
30
+ columns: {
31
+ holderName: drizzle_orm_sqlite_core.SQLiteColumn<{
32
+ name: "holder_name";
33
+ tableName: "bank_account";
34
+ dataType: "string";
35
+ columnType: "SQLiteText";
36
+ data: string;
37
+ driverParam: string;
38
+ notNull: true;
39
+ hasDefault: false;
40
+ isPrimaryKey: false;
41
+ isAutoincrement: false;
42
+ hasRuntimeDefault: false;
43
+ enumValues: [string, ...string[]];
44
+ baseColumn: never;
45
+ identity: undefined;
46
+ generated: undefined;
47
+ }, {}, {
48
+ length: number | undefined;
49
+ }>;
50
+ number: drizzle_orm_sqlite_core.SQLiteColumn<{
51
+ name: "number";
52
+ tableName: "bank_account";
53
+ dataType: "string";
54
+ columnType: "SQLiteText";
55
+ data: string;
56
+ driverParam: string;
57
+ notNull: true;
58
+ hasDefault: false;
59
+ isPrimaryKey: false;
60
+ isAutoincrement: false;
61
+ hasRuntimeDefault: false;
62
+ enumValues: [string, ...string[]];
63
+ baseColumn: never;
64
+ identity: undefined;
65
+ generated: undefined;
66
+ }, {}, {
67
+ length: number | undefined;
68
+ }>;
69
+ bankCode: drizzle_orm_sqlite_core.SQLiteColumn<{
70
+ name: "bank_code";
71
+ tableName: "bank_account";
72
+ dataType: "string";
73
+ columnType: "SQLiteText";
74
+ data: "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";
75
+ driverParam: string;
76
+ notNull: true;
77
+ hasDefault: false;
78
+ isPrimaryKey: false;
79
+ isAutoincrement: false;
80
+ hasRuntimeDefault: false;
81
+ enumValues: [string, ...string[]];
82
+ baseColumn: never;
83
+ identity: undefined;
84
+ generated: undefined;
85
+ }, {}, {
86
+ length: number | undefined;
87
+ $type: "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";
88
+ }>;
89
+ iban: drizzle_orm_sqlite_core.SQLiteColumn<{
90
+ name: "iban";
91
+ tableName: "bank_account";
92
+ dataType: "string";
93
+ columnType: "SQLiteText";
94
+ data: string;
95
+ driverParam: string;
96
+ notNull: true;
97
+ hasDefault: false;
98
+ isPrimaryKey: false;
99
+ isAutoincrement: false;
100
+ hasRuntimeDefault: false;
101
+ enumValues: [string, ...string[]];
102
+ baseColumn: never;
103
+ identity: undefined;
104
+ generated: undefined;
105
+ }, {}, {
106
+ length: number | undefined;
107
+ }>;
108
+ bic: drizzle_orm_sqlite_core.SQLiteColumn<{
109
+ name: "bic";
110
+ tableName: "bank_account";
111
+ dataType: "string";
112
+ columnType: "SQLiteText";
113
+ data: string;
114
+ driverParam: string;
115
+ notNull: true;
116
+ hasDefault: false;
117
+ isPrimaryKey: false;
118
+ isAutoincrement: false;
119
+ hasRuntimeDefault: false;
120
+ enumValues: [string, ...string[]];
121
+ baseColumn: never;
122
+ identity: undefined;
123
+ generated: undefined;
124
+ }, {}, {
125
+ length: number | undefined;
126
+ }>;
127
+ currency: drizzle_orm_sqlite_core.SQLiteColumn<{
128
+ name: "currency";
129
+ tableName: "bank_account";
130
+ dataType: "string";
131
+ columnType: "SQLiteText";
132
+ data: "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";
133
+ driverParam: string;
134
+ notNull: false;
135
+ hasDefault: false;
136
+ isPrimaryKey: false;
137
+ isAutoincrement: false;
138
+ hasRuntimeDefault: false;
139
+ enumValues: [string, ...string[]];
140
+ baseColumn: never;
141
+ identity: undefined;
142
+ generated: undefined;
143
+ }, {}, {
144
+ length: number | undefined;
145
+ $type: "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";
146
+ }>;
147
+ countryCode: drizzle_orm_sqlite_core.SQLiteColumn<{
148
+ name: "country_code";
149
+ tableName: "bank_account";
150
+ dataType: "string";
151
+ columnType: "SQLiteText";
152
+ data: string;
153
+ driverParam: string;
154
+ notNull: true;
155
+ hasDefault: false;
156
+ isPrimaryKey: false;
157
+ isAutoincrement: false;
158
+ hasRuntimeDefault: false;
159
+ enumValues: [string, ...string[]];
160
+ baseColumn: never;
161
+ identity: undefined;
162
+ generated: undefined;
163
+ }, {}, {
164
+ length: number | undefined;
165
+ }>;
166
+ };
167
+ dialect: "sqlite";
168
+ }>;
169
+ declare const bankAccountPostgres: drizzle_orm_pg_core.PgTableWithColumns<{
170
+ name: "bank_account";
171
+ schema: undefined;
172
+ columns: {
173
+ holderName: drizzle_orm_pg_core.PgColumn<{
174
+ name: "holder_name";
175
+ tableName: "bank_account";
176
+ dataType: "string";
177
+ columnType: "PgText";
178
+ data: string;
179
+ driverParam: string;
180
+ notNull: true;
181
+ hasDefault: false;
182
+ isPrimaryKey: false;
183
+ isAutoincrement: false;
184
+ hasRuntimeDefault: false;
185
+ enumValues: [string, ...string[]];
186
+ baseColumn: never;
187
+ identity: undefined;
188
+ generated: undefined;
189
+ }, {}, {}>;
190
+ number: drizzle_orm_pg_core.PgColumn<{
191
+ name: "number";
192
+ tableName: "bank_account";
193
+ dataType: "string";
194
+ columnType: "PgText";
195
+ data: string;
196
+ driverParam: string;
197
+ notNull: true;
198
+ hasDefault: false;
199
+ isPrimaryKey: false;
200
+ isAutoincrement: false;
201
+ hasRuntimeDefault: false;
202
+ enumValues: [string, ...string[]];
203
+ baseColumn: never;
204
+ identity: undefined;
205
+ generated: undefined;
206
+ }, {}, {}>;
207
+ bankCode: drizzle_orm_pg_core.PgColumn<{
208
+ name: "bank_code";
209
+ tableName: "bank_account";
210
+ dataType: "string";
211
+ columnType: "PgText";
212
+ data: "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";
213
+ driverParam: string;
214
+ notNull: true;
215
+ hasDefault: false;
216
+ isPrimaryKey: false;
217
+ isAutoincrement: false;
218
+ hasRuntimeDefault: false;
219
+ enumValues: [string, ...string[]];
220
+ baseColumn: never;
221
+ identity: undefined;
222
+ generated: undefined;
223
+ }, {}, {
224
+ $type: "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";
225
+ }>;
226
+ iban: drizzle_orm_pg_core.PgColumn<{
227
+ name: "iban";
228
+ tableName: "bank_account";
229
+ dataType: "string";
230
+ columnType: "PgText";
231
+ data: string;
232
+ driverParam: string;
233
+ notNull: true;
234
+ hasDefault: false;
235
+ isPrimaryKey: false;
236
+ isAutoincrement: false;
237
+ hasRuntimeDefault: false;
238
+ enumValues: [string, ...string[]];
239
+ baseColumn: never;
240
+ identity: undefined;
241
+ generated: undefined;
242
+ }, {}, {}>;
243
+ bic: drizzle_orm_pg_core.PgColumn<{
244
+ name: "bic";
245
+ tableName: "bank_account";
246
+ dataType: "string";
247
+ columnType: "PgText";
248
+ data: string;
249
+ driverParam: string;
250
+ notNull: true;
251
+ hasDefault: false;
252
+ isPrimaryKey: false;
253
+ isAutoincrement: false;
254
+ hasRuntimeDefault: false;
255
+ enumValues: [string, ...string[]];
256
+ baseColumn: never;
257
+ identity: undefined;
258
+ generated: undefined;
259
+ }, {}, {}>;
260
+ currency: drizzle_orm_pg_core.PgColumn<{
261
+ name: "currency";
262
+ tableName: "bank_account";
263
+ dataType: "string";
264
+ columnType: "PgText";
265
+ data: "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";
266
+ driverParam: string;
267
+ notNull: false;
268
+ hasDefault: false;
269
+ isPrimaryKey: false;
270
+ isAutoincrement: false;
271
+ hasRuntimeDefault: false;
272
+ enumValues: [string, ...string[]];
273
+ baseColumn: never;
274
+ identity: undefined;
275
+ generated: undefined;
276
+ }, {}, {
277
+ $type: "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";
278
+ }>;
279
+ countryCode: drizzle_orm_pg_core.PgColumn<{
280
+ name: "country_code";
281
+ tableName: "bank_account";
282
+ dataType: "string";
283
+ columnType: "PgText";
284
+ data: string;
285
+ driverParam: string;
286
+ notNull: true;
287
+ hasDefault: false;
288
+ isPrimaryKey: false;
289
+ isAutoincrement: false;
290
+ hasRuntimeDefault: false;
291
+ enumValues: [string, ...string[]];
292
+ baseColumn: never;
293
+ identity: undefined;
294
+ generated: undefined;
295
+ }, {}, {}>;
296
+ };
297
+ dialect: "pg";
298
+ }>;
299
+
27
300
  type Project = 'creditio' | 'fp' | 'mdm' | 'moneio' | 'txs';
28
301
 
302
+ type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
303
+
29
304
  type Environment = number | 'dev' | 'test' | 'staging' | 'production';
30
305
 
31
- declare const validateEnvironment: (environment: string) => Environment;
32
306
  interface SstInstance {
33
307
  cloudflare: {
34
308
  [key: string]: any;
@@ -43,9 +317,61 @@ declare class Infrastructure {
43
317
  environment: Environment;
44
318
  sst: SstInstance;
45
319
  });
320
+ composeBindingName({ resource, resourceName, bindingName, }: {
321
+ resource: Resource;
322
+ resourceName: string;
323
+ bindingName?: string;
324
+ }): string;
46
325
  composeResourceName({ resourceName }: {
47
326
  resourceName: string;
48
327
  }): string;
328
+ composeKvArguments({ resourceName }: {
329
+ resourceName: string;
330
+ }): {
331
+ transform: {
332
+ namespace: {
333
+ title: string;
334
+ };
335
+ };
336
+ };
337
+ composeD1Arguments({ resourceName }: {
338
+ resourceName: string;
339
+ }): {
340
+ transform: {
341
+ database: {
342
+ name: string;
343
+ primaryLocationHint: string;
344
+ };
345
+ };
346
+ };
347
+ composeQueueArguments({ resourceName, deliveryDelay, messageRetentionPeriod, }: {
348
+ resourceName: string;
349
+ deliveryDelay?: number;
350
+ messageRetentionPeriod?: number;
351
+ }): {
352
+ transform: {
353
+ queue: {
354
+ queueName: string;
355
+ settings: {
356
+ deliveryDelay: number;
357
+ messageRetentionPeriod: number;
358
+ };
359
+ };
360
+ };
361
+ };
362
+ composeR2Arguments({ resourceName, storageClass, }: {
363
+ resourceName: string;
364
+ storageClass?: 'Standard' | 'InfrequentAccess';
365
+ }): {
366
+ transform: {
367
+ bucket: {
368
+ name: string;
369
+ jurisdiction: string;
370
+ location: string;
371
+ storageClass: "Standard" | "InfrequentAccess";
372
+ };
373
+ };
374
+ };
49
375
  /**
50
376
  * Creates an instance of Cloudflare KV.
51
377
  */
@@ -112,16 +438,6 @@ declare class Infrastructure {
112
438
  }): any;
113
439
  }
114
440
 
115
- type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
116
-
117
- declare const composeBindingName: ({ resource, resourceName, bindingName, }: {
118
- resource: Resource;
119
- resourceName: string;
120
- bindingName?: string;
121
- }) => string;
122
-
123
- declare const ENVIRONMENT: string[];
124
-
125
441
  type InternalErrorResponseStatus = Exclude<StatusCodes, 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207>;
126
442
  interface InternalError {
127
443
  status: InternalErrorResponseStatus;
@@ -504,5 +820,5 @@ interface WithRetryCounterOptions {
504
820
  type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
505
821
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
506
822
 
507
- 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, paginationQuerySchema, paginationSchema, service, swiftZodSchema, useResult, useResultSync, uuidv4, validateEnvironment };
823
+ 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 };
508
824
  export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, ValidatedInput };
package/dist/index.mjs CHANGED
@@ -1,11 +1,10 @@
1
1
  import { sql } from 'drizzle-orm';
2
- import { timestamp, uuid } from 'drizzle-orm/pg-core';
3
- import { integer, text } from 'drizzle-orm/sqlite-core';
2
+ import { timestamp, uuid, pgTable, text as text$1 } from 'drizzle-orm/pg-core';
3
+ import { integer, text, sqliteTable } from 'drizzle-orm/sqlite-core';
4
4
  import { toSnakeCase } from '@std/text';
5
5
  import 'http-status-codes';
6
6
  import * as z from 'zod/v4/core';
7
7
  import { createError } from 'h3';
8
- import { consola } from 'consola';
9
8
  import fs from 'fs';
10
9
  import crypto$1 from 'node:crypto';
11
10
  import path from 'path';
@@ -30,82 +29,25 @@ const basePostgres = {
30
29
  }).default(sql`null`)
31
30
  };
32
31
 
33
- const ENVIRONMENT = ["dev", "test", "staging", "production"];
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
- const composeBindingName = ({
95
- resource,
96
- resourceName,
97
- bindingName
98
- }) => {
99
- const convertedBindingName = bindingName ? toSnakeCase(bindingName) : `${toSnakeCase(resourceName)}_${resource}`;
100
- return convertedBindingName.toUpperCase();
101
- };
32
+ const bankAccount = sqliteTable("bank_account", {
33
+ holderName: text("holder_name").notNull(),
34
+ number: text("number").notNull(),
35
+ bankCode: text("bank_code").$type().notNull(),
36
+ iban: text("iban").notNull(),
37
+ bic: text("bic").notNull(),
38
+ currency: text("currency").$type(),
39
+ countryCode: text("country_code").notNull()
40
+ });
41
+ const bankAccountPostgres = pgTable("bank_account", {
42
+ holderName: text$1("holder_name").notNull(),
43
+ number: text$1("number").notNull(),
44
+ bankCode: text$1("bank_code").$type().notNull(),
45
+ iban: text$1("iban").notNull(),
46
+ bic: text$1("bic").notNull(),
47
+ currency: text$1("currency").$type(),
48
+ countryCode: text$1("country_code").notNull()
49
+ });
102
50
 
103
- const validateEnvironment = (environment) => {
104
- if (ENVIRONMENT.includes(environment)) {
105
- return environment;
106
- }
107
- return Number(environment);
108
- };
109
51
  class Infrastructure {
110
52
  project;
111
53
  environment;
@@ -120,9 +62,73 @@ class Infrastructure {
120
62
  this.sst = sst;
121
63
  }
122
64
  // TODO(Pookensivee): Make tests for this util
65
+ composeBindingName({
66
+ resource,
67
+ resourceName,
68
+ bindingName
69
+ }) {
70
+ const convertedBindingName = bindingName ? toSnakeCase(bindingName) : `${toSnakeCase(resourceName)}_${resource}`;
71
+ return convertedBindingName.toUpperCase();
72
+ }
73
+ // TODO(Pookensivee): Make tests for this util
123
74
  composeResourceName({ resourceName }) {
124
75
  return `${this.project}-${resourceName}-${this.environment}`;
125
76
  }
77
+ // TODO(Pookensivee): Make tests for this util
78
+ composeKvArguments({ resourceName }) {
79
+ return {
80
+ transform: {
81
+ namespace: {
82
+ title: resourceName
83
+ }
84
+ }
85
+ };
86
+ }
87
+ // TODO(Pookensivee): Make tests for this util
88
+ composeD1Arguments({ resourceName }) {
89
+ return {
90
+ transform: {
91
+ database: {
92
+ name: resourceName,
93
+ primaryLocationHint: "weur"
94
+ }
95
+ }
96
+ };
97
+ }
98
+ // TODO(Pookensivee): Make tests for this util
99
+ composeQueueArguments({
100
+ resourceName,
101
+ deliveryDelay = 5,
102
+ messageRetentionPeriod = 259200
103
+ }) {
104
+ return {
105
+ transform: {
106
+ queue: {
107
+ queueName: resourceName,
108
+ settings: {
109
+ deliveryDelay,
110
+ messageRetentionPeriod
111
+ }
112
+ }
113
+ }
114
+ };
115
+ }
116
+ // TODO(Pookensivee): Make tests for this util
117
+ composeR2Arguments({
118
+ resourceName,
119
+ storageClass = "Standard"
120
+ }) {
121
+ return {
122
+ transform: {
123
+ bucket: {
124
+ name: resourceName,
125
+ jurisdiction: "eu",
126
+ location: "weur",
127
+ storageClass
128
+ }
129
+ }
130
+ };
131
+ }
126
132
  // TODO: Solve the circular dependency on post infrastructure deploy script
127
133
  // TODO: Cannot assign a queue as a producer, work around: https://developers.cloudflare.com/workers/wrangler/commands/#queues-consumer-add-script-name
128
134
  // async composeWorkerArguments({
@@ -204,8 +210,8 @@ class Infrastructure {
204
210
  kv(options) {
205
211
  const { resourceName, bindingName } = options;
206
212
  return new this.sst.cloudflare.Kv(
207
- `${composeBindingName({ resource: "kv", resourceName, bindingName })}`,
208
- composeKvArguments({
213
+ `${this.composeBindingName({ resource: "kv", resourceName, bindingName })}`,
214
+ this.composeKvArguments({
209
215
  resourceName: this.composeResourceName({ resourceName })
210
216
  })
211
217
  );
@@ -216,8 +222,8 @@ class Infrastructure {
216
222
  d1(options) {
217
223
  const { resourceName, bindingName } = options;
218
224
  return new this.sst.cloudflare.D1(
219
- `${composeBindingName({ resource: "d1", resourceName, bindingName })}`,
220
- composeD1Arguments({
225
+ `${this.composeBindingName({ resource: "d1", resourceName, bindingName })}`,
226
+ this.composeD1Arguments({
221
227
  resourceName: this.composeResourceName({ resourceName })
222
228
  })
223
229
  );
@@ -228,8 +234,8 @@ class Infrastructure {
228
234
  queue(options) {
229
235
  const { resourceName, bindingName, deliveryDelay, messageRetentionPeriod } = options;
230
236
  return new this.sst.cloudflare.Queue(
231
- `${composeBindingName({ resource: "queue", resourceName, bindingName })}`,
232
- composeQueueArguments({
237
+ `${this.composeBindingName({ resource: "queue", resourceName, bindingName })}`,
238
+ this.composeQueueArguments({
233
239
  resourceName: this.composeResourceName({ resourceName }),
234
240
  deliveryDelay,
235
241
  messageRetentionPeriod
@@ -242,8 +248,8 @@ class Infrastructure {
242
248
  r2(options) {
243
249
  const { resourceName, bindingName, storageClass } = options;
244
250
  return new this.sst.cloudflare.Bucket(
245
- `${composeBindingName({ resource: "r2", resourceName, bindingName })}`,
246
- composeR2Arguments({
251
+ `${this.composeBindingName({ resource: "r2", resourceName, bindingName })}`,
252
+ this.composeR2Arguments({
247
253
  resourceName: this.composeResourceName({ resourceName }),
248
254
  storageClass
249
255
  })
@@ -486,7 +492,7 @@ const RPCResponse = {
486
492
  * @returns An `IRPCResponse<T>` with `null` data and the provided error.
487
493
  */
488
494
  serviceError(error) {
489
- consola.error(error.message);
495
+ console.error(error.message);
490
496
  return {
491
497
  status: error.status,
492
498
  message: error.message,
@@ -940,4 +946,4 @@ function develitWorker(Worker) {
940
946
  return DevelitWorker;
941
947
  }
942
948
 
943
- 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, paginationQuerySchema, paginationSchema, service, swiftZodSchema, useResult, useResultSync, uuidv4, validateEnvironment };
949
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-io/backend-sdk",
3
- "version": "5.15.1",
3
+ "version": "5.16.0",
4
4
  "description": "Develit Backend SDK",
5
5
  "author": "Develit.io",
6
6
  "license": "ISC",
@@ -35,7 +35,6 @@
35
35
  "@std/path": "npm:@jsr/std__path",
36
36
  "@std/text": "npm:@jsr/std__text",
37
37
  "comment-json": "^4.2.5",
38
- "consola": "^3.4.2",
39
38
  "drizzle-kit": "^0.31.4",
40
39
  "drizzle-orm": "^0.44.5",
41
40
  "h3": "^1.15.4",