@develit-io/backend-sdk 5.23.0 → 5.24.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.cts CHANGED
@@ -5,7 +5,8 @@ import { ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult } from 'dri
5
5
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
6
6
  import { AnySQLiteTable } from 'drizzle-orm/sqlite-core';
7
7
  import * as z from 'zod/v4/core';
8
- export { E as Environment, P as Project } from './shared/backend-sdk._l2mbzzF.cjs';
8
+ export { E as Environment } from './shared/backend-sdk.D5vSybcI.cjs';
9
+ export { P as Project } from './shared/backend-sdk.B5vcbB2_.cjs';
9
10
  import { StatusCodes, ReasonPhrases } from 'http-status-codes';
10
11
  export { ReasonPhrases as InternalResponsePhrase, StatusCodes as InternalResponseStatus } from 'http-status-codes';
11
12
  import { Queue } from '@cloudflare/workers-types';
@@ -236,7 +237,7 @@ type AuditLogWriter<TAuditAction = string> = (logs: AuditLogPayload<TAuditAction
236
237
  */
237
238
  declare function createAuditLogWriter<TAuditAction = string>(table: AuditLogTable): AuditLogWriter<TAuditAction>;
238
239
 
239
- declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string): any;
240
+ declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string): string;
240
241
  declare const getD1DatabaseIdFromWrangler: () => string | undefined;
241
242
  declare const getD1Credentials: () => {
242
243
  driver?: undefined;
@@ -244,14 +245,14 @@ declare const getD1Credentials: () => {
244
245
  } | {
245
246
  driver: string;
246
247
  dbCredentials: {
247
- accountId: any;
248
+ accountId: string | undefined;
248
249
  databaseId: string;
249
- token: any;
250
+ token: string | undefined;
250
251
  url?: undefined;
251
252
  };
252
253
  } | {
253
254
  dbCredentials: {
254
- url: any;
255
+ url: string | undefined;
255
256
  accountId?: undefined;
256
257
  databaseId?: undefined;
257
258
  token?: undefined;
@@ -267,9 +268,9 @@ declare const getDrizzleD1Config: () => {
267
268
  } | {
268
269
  driver: string;
269
270
  dbCredentials: {
270
- accountId: any;
271
+ accountId: string | undefined;
271
272
  databaseId: string;
272
- token: any;
273
+ token: string | undefined;
273
274
  url?: undefined;
274
275
  };
275
276
  schema: string;
@@ -277,7 +278,7 @@ declare const getDrizzleD1Config: () => {
277
278
  dialect: "sqlite";
278
279
  } | {
279
280
  dbCredentials: {
280
- url: any;
281
+ url: string | undefined;
281
282
  accountId?: undefined;
282
283
  databaseId?: undefined;
283
284
  token?: undefined;
@@ -335,7 +336,7 @@ declare const getPgLocalConnectionString: (id: string) => string;
335
336
  declare const getPgDatabaseIdFromWrangler: () => string | undefined;
336
337
  declare const getPgCredentials: (serviceName?: string) => {
337
338
  dbCredentials: {
338
- url: any;
339
+ url: string;
339
340
  };
340
341
  };
341
342
  declare const getDrizzlePgConfig: () => {
@@ -344,7 +345,7 @@ declare const getDrizzlePgConfig: () => {
344
345
  schema: string;
345
346
  };
346
347
  dbCredentials: {
347
- url: any;
348
+ url: string;
348
349
  };
349
350
  schema: string;
350
351
  out: string;
package/dist/index.d.mts CHANGED
@@ -5,7 +5,8 @@ import { ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult } from 'dri
5
5
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
6
6
  import { AnySQLiteTable } from 'drizzle-orm/sqlite-core';
7
7
  import * as z from 'zod/v4/core';
8
- export { E as Environment, P as Project } from './shared/backend-sdk._l2mbzzF.mjs';
8
+ export { E as Environment } from './shared/backend-sdk.D5vSybcI.mjs';
9
+ export { P as Project } from './shared/backend-sdk.B5vcbB2_.mjs';
9
10
  import { StatusCodes, ReasonPhrases } from 'http-status-codes';
10
11
  export { ReasonPhrases as InternalResponsePhrase, StatusCodes as InternalResponseStatus } from 'http-status-codes';
11
12
  import { Queue } from '@cloudflare/workers-types';
@@ -236,7 +237,7 @@ type AuditLogWriter<TAuditAction = string> = (logs: AuditLogPayload<TAuditAction
236
237
  */
237
238
  declare function createAuditLogWriter<TAuditAction = string>(table: AuditLogTable): AuditLogWriter<TAuditAction>;
238
239
 
239
- declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string): any;
240
+ declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string): string;
240
241
  declare const getD1DatabaseIdFromWrangler: () => string | undefined;
241
242
  declare const getD1Credentials: () => {
242
243
  driver?: undefined;
@@ -244,14 +245,14 @@ declare const getD1Credentials: () => {
244
245
  } | {
245
246
  driver: string;
246
247
  dbCredentials: {
247
- accountId: any;
248
+ accountId: string | undefined;
248
249
  databaseId: string;
249
- token: any;
250
+ token: string | undefined;
250
251
  url?: undefined;
251
252
  };
252
253
  } | {
253
254
  dbCredentials: {
254
- url: any;
255
+ url: string | undefined;
255
256
  accountId?: undefined;
256
257
  databaseId?: undefined;
257
258
  token?: undefined;
@@ -267,9 +268,9 @@ declare const getDrizzleD1Config: () => {
267
268
  } | {
268
269
  driver: string;
269
270
  dbCredentials: {
270
- accountId: any;
271
+ accountId: string | undefined;
271
272
  databaseId: string;
272
- token: any;
273
+ token: string | undefined;
273
274
  url?: undefined;
274
275
  };
275
276
  schema: string;
@@ -277,7 +278,7 @@ declare const getDrizzleD1Config: () => {
277
278
  dialect: "sqlite";
278
279
  } | {
279
280
  dbCredentials: {
280
- url: any;
281
+ url: string | undefined;
281
282
  accountId?: undefined;
282
283
  databaseId?: undefined;
283
284
  token?: undefined;
@@ -335,7 +336,7 @@ declare const getPgLocalConnectionString: (id: string) => string;
335
336
  declare const getPgDatabaseIdFromWrangler: () => string | undefined;
336
337
  declare const getPgCredentials: (serviceName?: string) => {
337
338
  dbCredentials: {
338
- url: any;
339
+ url: string;
339
340
  };
340
341
  };
341
342
  declare const getDrizzlePgConfig: () => {
@@ -344,7 +345,7 @@ declare const getDrizzlePgConfig: () => {
344
345
  schema: string;
345
346
  };
346
347
  dbCredentials: {
347
- url: any;
348
+ url: string;
348
349
  };
349
350
  schema: string;
350
351
  out: string;
package/dist/index.d.ts CHANGED
@@ -5,7 +5,8 @@ import { ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult } from 'dri
5
5
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
6
6
  import { AnySQLiteTable } from 'drizzle-orm/sqlite-core';
7
7
  import * as z from 'zod/v4/core';
8
- export { E as Environment, P as Project } from './shared/backend-sdk._l2mbzzF.js';
8
+ export { E as Environment } from './shared/backend-sdk.D5vSybcI.js';
9
+ export { P as Project } from './shared/backend-sdk.B5vcbB2_.js';
9
10
  import { StatusCodes, ReasonPhrases } from 'http-status-codes';
10
11
  export { ReasonPhrases as InternalResponsePhrase, StatusCodes as InternalResponseStatus } from 'http-status-codes';
11
12
  import { Queue } from '@cloudflare/workers-types';
@@ -236,7 +237,7 @@ type AuditLogWriter<TAuditAction = string> = (logs: AuditLogPayload<TAuditAction
236
237
  */
237
238
  declare function createAuditLogWriter<TAuditAction = string>(table: AuditLogTable): AuditLogWriter<TAuditAction>;
238
239
 
239
- declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string): any;
240
+ declare function durableObjectNamespaceIdFromName(uniqueKey: string, name: string): string;
240
241
  declare const getD1DatabaseIdFromWrangler: () => string | undefined;
241
242
  declare const getD1Credentials: () => {
242
243
  driver?: undefined;
@@ -244,14 +245,14 @@ declare const getD1Credentials: () => {
244
245
  } | {
245
246
  driver: string;
246
247
  dbCredentials: {
247
- accountId: any;
248
+ accountId: string | undefined;
248
249
  databaseId: string;
249
- token: any;
250
+ token: string | undefined;
250
251
  url?: undefined;
251
252
  };
252
253
  } | {
253
254
  dbCredentials: {
254
- url: any;
255
+ url: string | undefined;
255
256
  accountId?: undefined;
256
257
  databaseId?: undefined;
257
258
  token?: undefined;
@@ -267,9 +268,9 @@ declare const getDrizzleD1Config: () => {
267
268
  } | {
268
269
  driver: string;
269
270
  dbCredentials: {
270
- accountId: any;
271
+ accountId: string | undefined;
271
272
  databaseId: string;
272
- token: any;
273
+ token: string | undefined;
273
274
  url?: undefined;
274
275
  };
275
276
  schema: string;
@@ -277,7 +278,7 @@ declare const getDrizzleD1Config: () => {
277
278
  dialect: "sqlite";
278
279
  } | {
279
280
  dbCredentials: {
280
- url: any;
281
+ url: string | undefined;
281
282
  accountId?: undefined;
282
283
  databaseId?: undefined;
283
284
  token?: undefined;
@@ -335,7 +336,7 @@ declare const getPgLocalConnectionString: (id: string) => string;
335
336
  declare const getPgDatabaseIdFromWrangler: () => string | undefined;
336
337
  declare const getPgCredentials: (serviceName?: string) => {
337
338
  dbCredentials: {
338
- url: any;
339
+ url: string;
339
340
  };
340
341
  };
341
342
  declare const getDrizzlePgConfig: () => {
@@ -344,7 +345,7 @@ declare const getDrizzlePgConfig: () => {
344
345
  schema: string;
345
346
  };
346
347
  dbCredentials: {
347
- url: any;
348
+ url: string;
348
349
  };
349
350
  schema: string;
350
351
  out: string;
@@ -1,15 +1,16 @@
1
1
  'use strict';
2
2
 
3
- const node_index = require('../shared/backend-sdk.CwYK8F7O.cjs');
3
+ const worker = require('../shared/backend-sdk.wIHFRZjD.cjs');
4
4
  const cloudflare = require('alchemy/cloudflare');
5
5
  const environment_consts = require('../shared/backend-sdk.BdcrYpFD.cjs');
6
+ require('@std/path');
6
7
 
7
8
  const composeD1Arguments = ({
8
9
  resourceName
9
10
  }) => {
10
11
  return {
11
12
  name: resourceName,
12
- primaryLocationHint: node_index.D1_LOCATION_HINT
13
+ primaryLocationHint: worker.D1_LOCATION_HINT
13
14
  };
14
15
  };
15
16
 
@@ -23,8 +24,8 @@ const composeKvArguments = ({
23
24
 
24
25
  const composeQueueArguments = ({
25
26
  resourceName,
26
- deliveryDelay = node_index.QUEUE_DELIVERY_DELAY,
27
- messageRetentionPeriod = node_index.QUEUE_MESSAGE_RETENTION_PERIOD
27
+ deliveryDelay = worker.QUEUE_DELIVERY_DELAY,
28
+ messageRetentionPeriod = worker.QUEUE_MESSAGE_RETENTION_PERIOD
28
29
  }) => {
29
30
  return {
30
31
  name: resourceName,
@@ -37,12 +38,12 @@ const composeQueueArguments = ({
37
38
 
38
39
  const composeR2Arguments = ({
39
40
  resourceName,
40
- storageClass = node_index.R2_STORAGE_CLASS
41
+ storageClass = worker.R2_STORAGE_CLASS
41
42
  }) => {
42
43
  return {
43
44
  name: resourceName,
44
- jurisdiction: node_index.R2_JURISDICTION,
45
- locationHint: node_index.R2_LOCATION_HINT,
45
+ jurisdiction: worker.R2_JURISDICTION,
46
+ locationHint: worker.R2_LOCATION_HINT,
46
47
  storageClass
47
48
  };
48
49
  };
@@ -142,28 +143,26 @@ class Infrastructure {
142
143
  * Creates an instance of Cloudflare Worker.
143
144
  */
144
145
  async worker(options) {
145
- const {
146
- resourceName,
147
- resource,
148
- entrypoint,
149
- crons,
150
- bindings,
151
- eventSources
152
- } = options;
146
+ const { resourceName, resource, path, crons, bindings, eventSources } = options;
153
147
  const identifierName = composeIdentifierName({
154
148
  resourceName,
155
149
  resource: resource || "worker"
156
150
  });
151
+ const workerConfig = await worker.loadWorkerConfig({ path });
157
152
  return await cloudflare.Worker(
158
153
  identifierName,
159
- node_index.composeWorkerArguments({
154
+ worker.composeWorkerArguments({
160
155
  resourceName: composeResourceName({
161
156
  project: this.project,
162
157
  environment: this.environment,
163
158
  resourceName: identifierName
164
159
  }),
165
- entrypoint,
166
- crons,
160
+ // TODO: Convert to util
161
+ entrypoint: `${path}/src/index.ts`,
162
+ crons: crons || worker.extractWorkerTriggers({
163
+ workerConfig,
164
+ environment: this.environment
165
+ }),
167
166
  bindings,
168
167
  eventSources
169
168
  })
@@ -173,13 +172,12 @@ class Infrastructure {
173
172
  * Creates an instance of Cloudflare Worker as a service.
174
173
  */
175
174
  async service(options) {
176
- const { resourceName, crons, bindings, eventSources } = options;
175
+ const { resourceName, bindings, eventSources } = options;
177
176
  return await this.worker({
178
177
  resourceName,
179
178
  resource: "service",
180
179
  // TODO: Convert to util
181
- entrypoint: `./services/${resourceName}/src/index.ts`,
182
- crons,
180
+ path: `./services/${resourceName}`,
183
181
  bindings,
184
182
  eventSources
185
183
  });
@@ -1,8 +1,7 @@
1
- import { P as Project, E as Environment } from '../shared/backend-sdk._l2mbzzF.cjs';
1
+ import { P as Project } from '../shared/backend-sdk.B5vcbB2_.cjs';
2
+ import { E as Environment } from '../shared/backend-sdk.D5vSybcI.cjs';
2
3
  import { KVNamespace, D1Database, Queue, R2Bucket, Bindings, Worker } from 'alchemy/cloudflare';
3
-
4
- type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
5
- type WorkerType$1 = 'service' | 'orchestrator';
4
+ import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.Ntg58c34.cjs';
6
5
 
7
6
  declare class Infrastructure {
8
7
  private project;
@@ -72,9 +71,9 @@ declare class Infrastructure {
72
71
  */
73
72
  resource?: WorkerType$1;
74
73
  /**
75
- * Entrypoint file of the Worker.
74
+ * Path to the root of the Worker.
76
75
  */
77
- entrypoint: string;
76
+ path: string;
78
77
  /**
79
78
  * Cron expressions for the trigger of the Worker.
80
79
  */
@@ -96,10 +95,6 @@ declare class Infrastructure {
96
95
  * Name of the service. Do not include the 'service' prefix.
97
96
  */
98
97
  resourceName: string;
99
- /**
100
- * Cron expressions for the trigger of the Worker.
101
- */
102
- crons?: string[];
103
98
  /**
104
99
  * Bindings of the Worker.
105
100
  */
@@ -1,8 +1,7 @@
1
- import { P as Project, E as Environment } from '../shared/backend-sdk._l2mbzzF.mjs';
1
+ import { P as Project } from '../shared/backend-sdk.B5vcbB2_.mjs';
2
+ import { E as Environment } from '../shared/backend-sdk.D5vSybcI.mjs';
2
3
  import { KVNamespace, D1Database, Queue, R2Bucket, Bindings, Worker } from 'alchemy/cloudflare';
3
-
4
- type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
5
- type WorkerType$1 = 'service' | 'orchestrator';
4
+ import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.Ntg58c34.mjs';
6
5
 
7
6
  declare class Infrastructure {
8
7
  private project;
@@ -72,9 +71,9 @@ declare class Infrastructure {
72
71
  */
73
72
  resource?: WorkerType$1;
74
73
  /**
75
- * Entrypoint file of the Worker.
74
+ * Path to the root of the Worker.
76
75
  */
77
- entrypoint: string;
76
+ path: string;
78
77
  /**
79
78
  * Cron expressions for the trigger of the Worker.
80
79
  */
@@ -96,10 +95,6 @@ declare class Infrastructure {
96
95
  * Name of the service. Do not include the 'service' prefix.
97
96
  */
98
97
  resourceName: string;
99
- /**
100
- * Cron expressions for the trigger of the Worker.
101
- */
102
- crons?: string[];
103
98
  /**
104
99
  * Bindings of the Worker.
105
100
  */
@@ -1,8 +1,7 @@
1
- import { P as Project, E as Environment } from '../shared/backend-sdk._l2mbzzF.js';
1
+ import { P as Project } from '../shared/backend-sdk.B5vcbB2_.js';
2
+ import { E as Environment } from '../shared/backend-sdk.D5vSybcI.js';
2
3
  import { KVNamespace, D1Database, Queue, R2Bucket, Bindings, Worker } from 'alchemy/cloudflare';
3
-
4
- type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
5
- type WorkerType$1 = 'service' | 'orchestrator';
4
+ import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.Ntg58c34.js';
6
5
 
7
6
  declare class Infrastructure {
8
7
  private project;
@@ -72,9 +71,9 @@ declare class Infrastructure {
72
71
  */
73
72
  resource?: WorkerType$1;
74
73
  /**
75
- * Entrypoint file of the Worker.
74
+ * Path to the root of the Worker.
76
75
  */
77
- entrypoint: string;
76
+ path: string;
78
77
  /**
79
78
  * Cron expressions for the trigger of the Worker.
80
79
  */
@@ -96,10 +95,6 @@ declare class Infrastructure {
96
95
  * Name of the service. Do not include the 'service' prefix.
97
96
  */
98
97
  resourceName: string;
99
- /**
100
- * Cron expressions for the trigger of the Worker.
101
- */
102
- crons?: string[];
103
98
  /**
104
99
  * Bindings of the Worker.
105
100
  */
@@ -1,6 +1,7 @@
1
- import { D as D1_LOCATION_HINT, Q as QUEUE_MESSAGE_RETENTION_PERIOD, a as QUEUE_DELIVERY_DELAY, R as R2_STORAGE_CLASS, b as R2_LOCATION_HINT, c as R2_JURISDICTION, d as composeWorkerArguments } from '../shared/backend-sdk.BsaVoxCw.mjs';
1
+ import { D as D1_LOCATION_HINT, Q as QUEUE_MESSAGE_RETENTION_PERIOD, a as QUEUE_DELIVERY_DELAY, R as R2_STORAGE_CLASS, b as R2_LOCATION_HINT, d as R2_JURISDICTION, l as loadWorkerConfig, c as composeWorkerArguments, e as extractWorkerTriggers } from '../shared/backend-sdk.G6WixINe.mjs';
2
2
  import { KVNamespace, D1Database, Queue, R2Bucket, Worker } from 'alchemy/cloudflare';
3
3
  import { E as ENVIRONMENT } from '../shared/backend-sdk.DXRpnctc.mjs';
4
+ import '@std/path';
4
5
 
5
6
  const composeD1Arguments = ({
6
7
  resourceName
@@ -140,18 +141,12 @@ class Infrastructure {
140
141
  * Creates an instance of Cloudflare Worker.
141
142
  */
142
143
  async worker(options) {
143
- const {
144
- resourceName,
145
- resource,
146
- entrypoint,
147
- crons,
148
- bindings,
149
- eventSources
150
- } = options;
144
+ const { resourceName, resource, path, crons, bindings, eventSources } = options;
151
145
  const identifierName = composeIdentifierName({
152
146
  resourceName,
153
147
  resource: resource || "worker"
154
148
  });
149
+ const workerConfig = await loadWorkerConfig({ path });
155
150
  return await Worker(
156
151
  identifierName,
157
152
  composeWorkerArguments({
@@ -160,8 +155,12 @@ class Infrastructure {
160
155
  environment: this.environment,
161
156
  resourceName: identifierName
162
157
  }),
163
- entrypoint,
164
- crons,
158
+ // TODO: Convert to util
159
+ entrypoint: `${path}/src/index.ts`,
160
+ crons: crons || extractWorkerTriggers({
161
+ workerConfig,
162
+ environment: this.environment
163
+ }),
165
164
  bindings,
166
165
  eventSources
167
166
  })
@@ -171,13 +170,12 @@ class Infrastructure {
171
170
  * Creates an instance of Cloudflare Worker as a service.
172
171
  */
173
172
  async service(options) {
174
- const { resourceName, crons, bindings, eventSources } = options;
173
+ const { resourceName, bindings, eventSources } = options;
175
174
  return await this.worker({
176
175
  resourceName,
177
176
  resource: "service",
178
177
  // TODO: Convert to util
179
- entrypoint: `./services/${resourceName}/src/index.ts`,
180
- crons,
178
+ path: `./services/${resourceName}`,
181
179
  bindings,
182
180
  eventSources
183
181
  });
@@ -1,7 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const node_index = require('../shared/backend-sdk.CwYK8F7O.cjs');
3
+ const worker = require('../shared/backend-sdk.wIHFRZjD.cjs');
4
+ require('../shared/backend-sdk.BdcrYpFD.cjs');
5
+ require('@std/path');
4
6
 
5
7
 
6
8
 
7
- exports.composeWorkerArguments = node_index.composeWorkerArguments;
9
+ exports.composeWorkerArguments = worker.composeWorkerArguments;
10
+ exports.extractWorkerTriggers = worker.extractWorkerTriggers;
11
+ exports.loadWorkerConfig = worker.loadWorkerConfig;
@@ -1,5 +1,14 @@
1
1
  import { Bindings, Queue } from 'alchemy/cloudflare';
2
+ import { E as Environment } from '../shared/backend-sdk.D5vSybcI.cjs';
3
+ import { a as WorkerConfig } from '../shared/backend-sdk.Ntg58c34.cjs';
2
4
 
5
+ declare const loadWorkerConfig: ({ path }: {
6
+ path: string;
7
+ }) => Promise<WorkerConfig>;
8
+ declare const extractWorkerTriggers: ({ workerConfig, environment, }: {
9
+ workerConfig: WorkerConfig;
10
+ environment: Environment;
11
+ }) => string[];
3
12
  declare const composeWorkerArguments: ({ resourceName, entrypoint, crons, bindings, eventSources, }: {
4
13
  resourceName: string;
5
14
  entrypoint: string;
@@ -20,4 +29,4 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, crons, bindin
20
29
  crons: string[];
21
30
  };
22
31
 
23
- export { composeWorkerArguments };
32
+ export { composeWorkerArguments, extractWorkerTriggers, loadWorkerConfig };
@@ -1,5 +1,14 @@
1
1
  import { Bindings, Queue } from 'alchemy/cloudflare';
2
+ import { E as Environment } from '../shared/backend-sdk.D5vSybcI.mjs';
3
+ import { a as WorkerConfig } from '../shared/backend-sdk.Ntg58c34.mjs';
2
4
 
5
+ declare const loadWorkerConfig: ({ path }: {
6
+ path: string;
7
+ }) => Promise<WorkerConfig>;
8
+ declare const extractWorkerTriggers: ({ workerConfig, environment, }: {
9
+ workerConfig: WorkerConfig;
10
+ environment: Environment;
11
+ }) => string[];
3
12
  declare const composeWorkerArguments: ({ resourceName, entrypoint, crons, bindings, eventSources, }: {
4
13
  resourceName: string;
5
14
  entrypoint: string;
@@ -20,4 +29,4 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, crons, bindin
20
29
  crons: string[];
21
30
  };
22
31
 
23
- export { composeWorkerArguments };
32
+ export { composeWorkerArguments, extractWorkerTriggers, loadWorkerConfig };
@@ -1,5 +1,14 @@
1
1
  import { Bindings, Queue } from 'alchemy/cloudflare';
2
+ import { E as Environment } from '../shared/backend-sdk.D5vSybcI.js';
3
+ import { a as WorkerConfig } from '../shared/backend-sdk.Ntg58c34.js';
2
4
 
5
+ declare const loadWorkerConfig: ({ path }: {
6
+ path: string;
7
+ }) => Promise<WorkerConfig>;
8
+ declare const extractWorkerTriggers: ({ workerConfig, environment, }: {
9
+ workerConfig: WorkerConfig;
10
+ environment: Environment;
11
+ }) => string[];
3
12
  declare const composeWorkerArguments: ({ resourceName, entrypoint, crons, bindings, eventSources, }: {
4
13
  resourceName: string;
5
14
  entrypoint: string;
@@ -20,4 +29,4 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, crons, bindin
20
29
  crons: string[];
21
30
  };
22
31
 
23
- export { composeWorkerArguments };
32
+ export { composeWorkerArguments, extractWorkerTriggers, loadWorkerConfig };
@@ -1 +1,3 @@
1
- export { d as composeWorkerArguments } from '../shared/backend-sdk.BsaVoxCw.mjs';
1
+ export { c as composeWorkerArguments, e as extractWorkerTriggers, l as loadWorkerConfig } from '../shared/backend-sdk.G6WixINe.mjs';
2
+ import '../shared/backend-sdk.DXRpnctc.mjs';
3
+ import '@std/path';
@@ -0,0 +1,3 @@
1
+ type Project = 'creditio' | 'fp' | 'mdm' | 'moneio' | 'dbu-txs';
2
+
3
+ export type { Project as P };
@@ -0,0 +1,3 @@
1
+ type Project = 'creditio' | 'fp' | 'mdm' | 'moneio' | 'dbu-txs';
2
+
3
+ export type { Project as P };
@@ -0,0 +1,3 @@
1
+ type Project = 'creditio' | 'fp' | 'mdm' | 'moneio' | 'dbu-txs';
2
+
3
+ export type { Project as P };
@@ -0,0 +1,3 @@
1
+ type Environment = number | 'dev' | 'test' | 'staging' | 'production';
2
+
3
+ export type { Environment as E };
@@ -0,0 +1,3 @@
1
+ type Environment = number | 'dev' | 'test' | 'staging' | 'production';
2
+
3
+ export type { Environment as E };
@@ -0,0 +1,3 @@
1
+ type Environment = number | 'dev' | 'test' | 'staging' | 'production';
2
+
3
+ export type { Environment as E };
@@ -1,3 +1,6 @@
1
+ import { E as ENVIRONMENT } from './backend-sdk.DXRpnctc.mjs';
2
+ import { join } from '@std/path';
3
+
1
4
  const COMPATIBILITY_DATE = "2025-06-04";
2
5
  const COMPATIBILITY_FLAGS = ["nodejs_compat"];
3
6
  const QUEUE_DELIVERY_DELAY = 5;
@@ -7,6 +10,19 @@ const R2_STORAGE_CLASS = "Standard";
7
10
  const R2_JURISDICTION = "eu";
8
11
  const R2_LOCATION_HINT = "weur";
9
12
 
13
+ const loadWorkerConfig = async ({ path }) => {
14
+ const workerConfigFile = Bun.file(join(path, "./wrangler.jsonc"));
15
+ return await workerConfigFile.json();
16
+ };
17
+ const extractWorkerTriggers = ({
18
+ workerConfig,
19
+ environment
20
+ }) => {
21
+ if (!ENVIRONMENT.includes(String(environment))) {
22
+ return workerConfig.triggers;
23
+ }
24
+ return workerConfig.env[environment].triggers;
25
+ };
10
26
  const composeWorkerArguments = ({
11
27
  resourceName,
12
28
  entrypoint,
@@ -29,4 +45,4 @@ const composeWorkerArguments = ({
29
45
  };
30
46
  };
31
47
 
32
- export { D1_LOCATION_HINT as D, QUEUE_MESSAGE_RETENTION_PERIOD as Q, R2_STORAGE_CLASS as R, QUEUE_DELIVERY_DELAY as a, R2_LOCATION_HINT as b, R2_JURISDICTION as c, composeWorkerArguments as d };
48
+ export { D1_LOCATION_HINT as D, QUEUE_MESSAGE_RETENTION_PERIOD as Q, R2_STORAGE_CLASS as R, QUEUE_DELIVERY_DELAY as a, R2_LOCATION_HINT as b, composeWorkerArguments as c, R2_JURISDICTION as d, extractWorkerTriggers as e, loadWorkerConfig as l };
@@ -0,0 +1,12 @@
1
+ type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
2
+ type WorkerType = 'service' | 'orchestrator';
3
+ interface WorkerConfig {
4
+ triggers: string[];
5
+ env: {
6
+ [key: string]: {
7
+ triggers: string[];
8
+ };
9
+ };
10
+ }
11
+
12
+ export type { Resource as R, WorkerType as W, WorkerConfig as a };
@@ -0,0 +1,12 @@
1
+ type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
2
+ type WorkerType = 'service' | 'orchestrator';
3
+ interface WorkerConfig {
4
+ triggers: string[];
5
+ env: {
6
+ [key: string]: {
7
+ triggers: string[];
8
+ };
9
+ };
10
+ }
11
+
12
+ export type { Resource as R, WorkerType as W, WorkerConfig as a };
@@ -0,0 +1,12 @@
1
+ type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
2
+ type WorkerType = 'service' | 'orchestrator';
3
+ interface WorkerConfig {
4
+ triggers: string[];
5
+ env: {
6
+ [key: string]: {
7
+ triggers: string[];
8
+ };
9
+ };
10
+ }
11
+
12
+ export type { Resource as R, WorkerType as W, WorkerConfig as a };
@@ -1,5 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ const environment_consts = require('./backend-sdk.BdcrYpFD.cjs');
4
+ const path = require('@std/path');
5
+
3
6
  const COMPATIBILITY_DATE = "2025-06-04";
4
7
  const COMPATIBILITY_FLAGS = ["nodejs_compat"];
5
8
  const QUEUE_DELIVERY_DELAY = 5;
@@ -9,6 +12,19 @@ const R2_STORAGE_CLASS = "Standard";
9
12
  const R2_JURISDICTION = "eu";
10
13
  const R2_LOCATION_HINT = "weur";
11
14
 
15
+ const loadWorkerConfig = async ({ path: path$1 }) => {
16
+ const workerConfigFile = Bun.file(path.join(path$1, "./wrangler.jsonc"));
17
+ return await workerConfigFile.json();
18
+ };
19
+ const extractWorkerTriggers = ({
20
+ workerConfig,
21
+ environment
22
+ }) => {
23
+ if (!environment_consts.ENVIRONMENT.includes(String(environment))) {
24
+ return workerConfig.triggers;
25
+ }
26
+ return workerConfig.env[environment].triggers;
27
+ };
12
28
  const composeWorkerArguments = ({
13
29
  resourceName,
14
30
  entrypoint,
@@ -38,3 +54,5 @@ exports.R2_JURISDICTION = R2_JURISDICTION;
38
54
  exports.R2_LOCATION_HINT = R2_LOCATION_HINT;
39
55
  exports.R2_STORAGE_CLASS = R2_STORAGE_CLASS;
40
56
  exports.composeWorkerArguments = composeWorkerArguments;
57
+ exports.extractWorkerTriggers = extractWorkerTriggers;
58
+ exports.loadWorkerConfig = loadWorkerConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-io/backend-sdk",
3
- "version": "5.23.0",
3
+ "version": "5.24.0",
4
4
  "description": "Develit Backend SDK",
5
5
  "author": "Develit.io",
6
6
  "license": "ISC",
@@ -1,5 +0,0 @@
1
- type Environment = number | 'dev' | 'test' | 'staging' | 'production';
2
-
3
- type Project = 'creditio' | 'fp' | 'mdm' | 'moneio' | 'dbu-txs';
4
-
5
- export type { Environment as E, Project as P };
@@ -1,5 +0,0 @@
1
- type Environment = number | 'dev' | 'test' | 'staging' | 'production';
2
-
3
- type Project = 'creditio' | 'fp' | 'mdm' | 'moneio' | 'dbu-txs';
4
-
5
- export type { Environment as E, Project as P };
@@ -1,5 +0,0 @@
1
- type Environment = number | 'dev' | 'test' | 'staging' | 'production';
2
-
3
- type Project = 'creditio' | 'fp' | 'mdm' | 'moneio' | 'dbu-txs';
4
-
5
- export type { Environment as E, Project as P };