@develit-io/backend-sdk 5.28.2 → 5.29.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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const worker = require('../shared/backend-sdk.BNEcLkji.cjs');
3
+ const worker = require('../shared/backend-sdk.n8SfX_xu.cjs');
4
4
  const text = require('@std/text');
5
5
  const cloudflare = require('alchemy/cloudflare');
6
6
  const environment_consts = require('../shared/backend-sdk.ClVQ4AzB.cjs');
@@ -33,14 +33,16 @@ const composeKvArguments = ({
33
33
  const composeQueueArguments = ({
34
34
  resourceName,
35
35
  deliveryDelay = worker.QUEUE_DELIVERY_DELAY,
36
- messageRetentionPeriod = worker.QUEUE_MESSAGE_RETENTION_PERIOD
36
+ messageRetentionPeriod = worker.QUEUE_MESSAGE_RETENTION_PERIOD,
37
+ dlq
37
38
  }) => {
38
39
  return {
39
40
  name: resourceName,
40
41
  settings: {
41
42
  deliveryDelay,
42
43
  messageRetentionPeriod
43
- }
44
+ },
45
+ dlq
44
46
  };
45
47
  };
46
48
 
@@ -74,18 +76,16 @@ class Deployment {
74
76
  project;
75
77
  environment;
76
78
  alchemy;
77
- constructor({
78
- project,
79
- environment
80
- }) {
79
+ constructor({ project }) {
81
80
  this.project = project;
82
- this.environment = environment;
81
+ this.environment = Bun.env.ENVIRONMENT || "unknown";
83
82
  this.alchemy = alchemy__default(project, {
84
83
  stateStore: (scope) => {
85
84
  return new state.CloudflareStateStore(scope, {
86
85
  scriptName: environment_consts.ALCHEMY_STATE_STORE
87
86
  });
88
- }
87
+ },
88
+ stage: Bun.env.ENVIRONMENT || "unknown"
89
89
  });
90
90
  }
91
91
  /**
@@ -131,6 +131,17 @@ class Deployment {
131
131
  */
132
132
  async queue(options) {
133
133
  const { resourceName, deliveryDelay, messageRetentionPeriod } = options;
134
+ const dlq = await cloudflare.Queue(
135
+ composeIdentifierName({ resourceName, resource: "dlq" }),
136
+ {
137
+ name: composeResourceName({
138
+ project: this.project,
139
+ environment: this.environment,
140
+ // TODO: Convert to a util
141
+ resourceName: `${resourceName}-dlq`
142
+ })
143
+ }
144
+ );
134
145
  return await cloudflare.Queue(
135
146
  composeIdentifierName({ resourceName, resource: "queue" }),
136
147
  composeQueueArguments({
@@ -140,7 +151,8 @@ class Deployment {
140
151
  resourceName
141
152
  }),
142
153
  deliveryDelay,
143
- messageRetentionPeriod
154
+ messageRetentionPeriod,
155
+ dlq
144
156
  })
145
157
  );
146
158
  }
@@ -190,6 +202,8 @@ class Deployment {
190
202
  assets,
191
203
  crons,
192
204
  bindings,
205
+ variables,
206
+ secrets,
193
207
  eventSources
194
208
  } = options;
195
209
  const identifierName = composeIdentifierName({
@@ -197,6 +211,16 @@ class Deployment {
197
211
  resource: resource || "worker"
198
212
  });
199
213
  const workerConfig = await worker.loadWorkerConfig({ path });
214
+ const consumers = eventSources?.map((queue) => {
215
+ return {
216
+ queue,
217
+ settings: {
218
+ deadLetterQueue: queue.dlq,
219
+ batchSize: worker.QUEUE_MAX_BATCH_SIZE,
220
+ maxWaitTimeMs: worker.QUEUE_MAX_BATCH_TIMEOUT
221
+ }
222
+ };
223
+ });
200
224
  return await cloudflare.Worker(
201
225
  identifierName,
202
226
  worker.composeWorkerArguments({
@@ -213,8 +237,12 @@ class Deployment {
213
237
  workerConfig,
214
238
  environment: this.environment
215
239
  }),
216
- bindings,
217
- eventSources
240
+ bindings: {
241
+ ...bindings,
242
+ ...variables,
243
+ ...secrets
244
+ },
245
+ eventSources: consumers
218
246
  })
219
247
  );
220
248
  }
@@ -222,13 +250,15 @@ class Deployment {
222
250
  * Creates an instance of Cloudflare Worker as a service.
223
251
  */
224
252
  async service(options) {
225
- const { resourceName, bindings, eventSources } = options;
253
+ const { resourceName, bindings, variables, secrets, eventSources } = options;
226
254
  return await this.worker({
227
255
  resourceName,
228
256
  resource: "service",
229
257
  // TODO: Convert to util
230
258
  path: `./services/${resourceName}`,
231
259
  bindings,
260
+ variables,
261
+ secrets,
232
262
  eventSources
233
263
  });
234
264
  }
@@ -236,7 +266,14 @@ class Deployment {
236
266
  * Creates an instance of Cloudflare Worker as an orchestrator.
237
267
  */
238
268
  async orchestrator(options) {
239
- const { resourceName, domains, bindings, eventSources } = options;
269
+ const {
270
+ resourceName,
271
+ domains,
272
+ bindings,
273
+ variables,
274
+ secrets,
275
+ eventSources
276
+ } = options;
240
277
  return await this.worker({
241
278
  resourceName,
242
279
  resource: "orchestrator",
@@ -244,6 +281,8 @@ class Deployment {
244
281
  path: `./apps/${resourceName}`,
245
282
  domains,
246
283
  bindings,
284
+ variables,
285
+ secrets,
247
286
  eventSources
248
287
  });
249
288
  }
@@ -251,7 +290,7 @@ class Deployment {
251
290
  * Creates an instance of Cloudflare Worker as a client.
252
291
  */
253
292
  async client(options) {
254
- const { resourceName, domains, bindings } = options;
293
+ const { resourceName, domains, bindings, variables, secrets } = options;
255
294
  return await cloudflare.Nuxt(
256
295
  composeIdentifierName({
257
296
  resourceName,
@@ -270,7 +309,11 @@ class Deployment {
270
309
  },
271
310
  url: false,
272
311
  domains,
273
- bindings,
312
+ bindings: {
313
+ ...bindings,
314
+ ...variables,
315
+ ...secrets
316
+ },
274
317
  // TODO: Convert to util
275
318
  cwd: `./apps/${resourceName}`
276
319
  }
@@ -2,17 +2,16 @@ import * as alchemy_cloudflare from 'alchemy/cloudflare';
2
2
  import { KVNamespace, D1Database, Queue, R2Bucket, DurableObjectNamespace, Bindings, Worker } from 'alchemy/cloudflare';
3
3
  import { P as Project } from '../shared/backend-sdk.CP78x0gl.cjs';
4
4
  import { E as Environment } from '../shared/backend-sdk.CYcpgphg.cjs';
5
- import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.B7BfiqA5.cjs';
6
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.B7BfiqA5.cjs';
5
+ import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.D8N5si7y.cjs';
6
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.D8N5si7y.cjs';
7
7
  import alchemy from 'alchemy';
8
8
 
9
9
  declare class Deployment {
10
10
  project: Project;
11
11
  environment: Environment;
12
12
  alchemy: Promise<Awaited<ReturnType<typeof alchemy>>>;
13
- constructor({ project, environment, }: {
13
+ constructor({ project }: {
14
14
  project: Project;
15
- environment: Environment;
16
15
  });
17
16
  /**
18
17
  * Finalizes the deployment and correctly quits the Alchemy process.
@@ -107,6 +106,14 @@ declare class Deployment {
107
106
  * Bindings of the Worker.
108
107
  */
109
108
  bindings?: Bindings;
109
+ /**
110
+ * Environment variables of the Worker.
111
+ */
112
+ variables?: Bindings;
113
+ /**
114
+ * Secrets of the Worker.
115
+ */
116
+ secrets?: Bindings;
110
117
  /**
111
118
  * Event sources for the service to consume.
112
119
  */
@@ -124,6 +131,14 @@ declare class Deployment {
124
131
  * Bindings of the Worker.
125
132
  */
126
133
  bindings?: Bindings;
134
+ /**
135
+ * Environment variables of the Worker.
136
+ */
137
+ variables?: Bindings;
138
+ /**
139
+ * Secrets of the Worker.
140
+ */
141
+ secrets?: Bindings;
127
142
  /**
128
143
  * Event sources for the service to consume.
129
144
  */
@@ -145,6 +160,14 @@ declare class Deployment {
145
160
  * Bindings of the Worker.
146
161
  */
147
162
  bindings?: Bindings;
163
+ /**
164
+ * Environment variables of the Worker.
165
+ */
166
+ variables?: Bindings;
167
+ /**
168
+ * Secrets of the Worker.
169
+ */
170
+ secrets?: Bindings;
148
171
  /**
149
172
  * Event sources for the orchestrator to consume.
150
173
  */
@@ -166,7 +189,17 @@ declare class Deployment {
166
189
  * Bindings of the Worker.
167
190
  */
168
191
  bindings?: Bindings;
169
- }): Promise<Worker<Bindings & {
192
+ /**
193
+ * Environment variables of the Worker.
194
+ */
195
+ variables?: Bindings;
196
+ /**
197
+ * Secrets of the Worker.
198
+ */
199
+ secrets?: Bindings;
200
+ }): Promise<Worker<{
201
+ [x: string]: alchemy_cloudflare.Binding;
202
+ } & {
170
203
  ASSETS: alchemy_cloudflare.Assets;
171
204
  }>>;
172
205
  }
@@ -184,16 +217,18 @@ declare const composeKvArguments: ({ resourceName, }: {
184
217
  title: string;
185
218
  };
186
219
 
187
- declare const composeQueueArguments: ({ resourceName, deliveryDelay, messageRetentionPeriod, }: {
220
+ declare const composeQueueArguments: ({ resourceName, deliveryDelay, messageRetentionPeriod, dlq, }: {
188
221
  resourceName: string;
189
222
  deliveryDelay?: number;
190
223
  messageRetentionPeriod?: number;
224
+ dlq: Queue;
191
225
  }) => {
192
226
  name: string;
193
227
  settings: {
194
228
  deliveryDelay: number;
195
229
  messageRetentionPeriod: number;
196
230
  };
231
+ dlq: Queue;
197
232
  };
198
233
 
199
234
  declare const composeR2Arguments: ({ resourceName, storageClass, }: {
@@ -2,17 +2,16 @@ import * as alchemy_cloudflare from 'alchemy/cloudflare';
2
2
  import { KVNamespace, D1Database, Queue, R2Bucket, DurableObjectNamespace, Bindings, Worker } from 'alchemy/cloudflare';
3
3
  import { P as Project } from '../shared/backend-sdk.CP78x0gl.mjs';
4
4
  import { E as Environment } from '../shared/backend-sdk.CYcpgphg.mjs';
5
- import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.BEt22BOM.mjs';
6
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.BEt22BOM.mjs';
5
+ import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.OvCBQJUw.mjs';
6
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.OvCBQJUw.mjs';
7
7
  import alchemy from 'alchemy';
8
8
 
9
9
  declare class Deployment {
10
10
  project: Project;
11
11
  environment: Environment;
12
12
  alchemy: Promise<Awaited<ReturnType<typeof alchemy>>>;
13
- constructor({ project, environment, }: {
13
+ constructor({ project }: {
14
14
  project: Project;
15
- environment: Environment;
16
15
  });
17
16
  /**
18
17
  * Finalizes the deployment and correctly quits the Alchemy process.
@@ -107,6 +106,14 @@ declare class Deployment {
107
106
  * Bindings of the Worker.
108
107
  */
109
108
  bindings?: Bindings;
109
+ /**
110
+ * Environment variables of the Worker.
111
+ */
112
+ variables?: Bindings;
113
+ /**
114
+ * Secrets of the Worker.
115
+ */
116
+ secrets?: Bindings;
110
117
  /**
111
118
  * Event sources for the service to consume.
112
119
  */
@@ -124,6 +131,14 @@ declare class Deployment {
124
131
  * Bindings of the Worker.
125
132
  */
126
133
  bindings?: Bindings;
134
+ /**
135
+ * Environment variables of the Worker.
136
+ */
137
+ variables?: Bindings;
138
+ /**
139
+ * Secrets of the Worker.
140
+ */
141
+ secrets?: Bindings;
127
142
  /**
128
143
  * Event sources for the service to consume.
129
144
  */
@@ -145,6 +160,14 @@ declare class Deployment {
145
160
  * Bindings of the Worker.
146
161
  */
147
162
  bindings?: Bindings;
163
+ /**
164
+ * Environment variables of the Worker.
165
+ */
166
+ variables?: Bindings;
167
+ /**
168
+ * Secrets of the Worker.
169
+ */
170
+ secrets?: Bindings;
148
171
  /**
149
172
  * Event sources for the orchestrator to consume.
150
173
  */
@@ -166,7 +189,17 @@ declare class Deployment {
166
189
  * Bindings of the Worker.
167
190
  */
168
191
  bindings?: Bindings;
169
- }): Promise<Worker<Bindings & {
192
+ /**
193
+ * Environment variables of the Worker.
194
+ */
195
+ variables?: Bindings;
196
+ /**
197
+ * Secrets of the Worker.
198
+ */
199
+ secrets?: Bindings;
200
+ }): Promise<Worker<{
201
+ [x: string]: alchemy_cloudflare.Binding;
202
+ } & {
170
203
  ASSETS: alchemy_cloudflare.Assets;
171
204
  }>>;
172
205
  }
@@ -184,16 +217,18 @@ declare const composeKvArguments: ({ resourceName, }: {
184
217
  title: string;
185
218
  };
186
219
 
187
- declare const composeQueueArguments: ({ resourceName, deliveryDelay, messageRetentionPeriod, }: {
220
+ declare const composeQueueArguments: ({ resourceName, deliveryDelay, messageRetentionPeriod, dlq, }: {
188
221
  resourceName: string;
189
222
  deliveryDelay?: number;
190
223
  messageRetentionPeriod?: number;
224
+ dlq: Queue;
191
225
  }) => {
192
226
  name: string;
193
227
  settings: {
194
228
  deliveryDelay: number;
195
229
  messageRetentionPeriod: number;
196
230
  };
231
+ dlq: Queue;
197
232
  };
198
233
 
199
234
  declare const composeR2Arguments: ({ resourceName, storageClass, }: {
@@ -2,17 +2,16 @@ import * as alchemy_cloudflare from 'alchemy/cloudflare';
2
2
  import { KVNamespace, D1Database, Queue, R2Bucket, DurableObjectNamespace, Bindings, Worker } from 'alchemy/cloudflare';
3
3
  import { P as Project } from '../shared/backend-sdk.CP78x0gl.js';
4
4
  import { E as Environment } from '../shared/backend-sdk.CYcpgphg.js';
5
- import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.CCDScozq.js';
6
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.CCDScozq.js';
5
+ import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.DSK5flKM.js';
6
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.DSK5flKM.js';
7
7
  import alchemy from 'alchemy';
8
8
 
9
9
  declare class Deployment {
10
10
  project: Project;
11
11
  environment: Environment;
12
12
  alchemy: Promise<Awaited<ReturnType<typeof alchemy>>>;
13
- constructor({ project, environment, }: {
13
+ constructor({ project }: {
14
14
  project: Project;
15
- environment: Environment;
16
15
  });
17
16
  /**
18
17
  * Finalizes the deployment and correctly quits the Alchemy process.
@@ -107,6 +106,14 @@ declare class Deployment {
107
106
  * Bindings of the Worker.
108
107
  */
109
108
  bindings?: Bindings;
109
+ /**
110
+ * Environment variables of the Worker.
111
+ */
112
+ variables?: Bindings;
113
+ /**
114
+ * Secrets of the Worker.
115
+ */
116
+ secrets?: Bindings;
110
117
  /**
111
118
  * Event sources for the service to consume.
112
119
  */
@@ -124,6 +131,14 @@ declare class Deployment {
124
131
  * Bindings of the Worker.
125
132
  */
126
133
  bindings?: Bindings;
134
+ /**
135
+ * Environment variables of the Worker.
136
+ */
137
+ variables?: Bindings;
138
+ /**
139
+ * Secrets of the Worker.
140
+ */
141
+ secrets?: Bindings;
127
142
  /**
128
143
  * Event sources for the service to consume.
129
144
  */
@@ -145,6 +160,14 @@ declare class Deployment {
145
160
  * Bindings of the Worker.
146
161
  */
147
162
  bindings?: Bindings;
163
+ /**
164
+ * Environment variables of the Worker.
165
+ */
166
+ variables?: Bindings;
167
+ /**
168
+ * Secrets of the Worker.
169
+ */
170
+ secrets?: Bindings;
148
171
  /**
149
172
  * Event sources for the orchestrator to consume.
150
173
  */
@@ -166,7 +189,17 @@ declare class Deployment {
166
189
  * Bindings of the Worker.
167
190
  */
168
191
  bindings?: Bindings;
169
- }): Promise<Worker<Bindings & {
192
+ /**
193
+ * Environment variables of the Worker.
194
+ */
195
+ variables?: Bindings;
196
+ /**
197
+ * Secrets of the Worker.
198
+ */
199
+ secrets?: Bindings;
200
+ }): Promise<Worker<{
201
+ [x: string]: alchemy_cloudflare.Binding;
202
+ } & {
170
203
  ASSETS: alchemy_cloudflare.Assets;
171
204
  }>>;
172
205
  }
@@ -184,16 +217,18 @@ declare const composeKvArguments: ({ resourceName, }: {
184
217
  title: string;
185
218
  };
186
219
 
187
- declare const composeQueueArguments: ({ resourceName, deliveryDelay, messageRetentionPeriod, }: {
220
+ declare const composeQueueArguments: ({ resourceName, deliveryDelay, messageRetentionPeriod, dlq, }: {
188
221
  resourceName: string;
189
222
  deliveryDelay?: number;
190
223
  messageRetentionPeriod?: number;
224
+ dlq: Queue;
191
225
  }) => {
192
226
  name: string;
193
227
  settings: {
194
228
  deliveryDelay: number;
195
229
  messageRetentionPeriod: number;
196
230
  };
231
+ dlq: Queue;
197
232
  };
198
233
 
199
234
  declare const composeR2Arguments: ({ resourceName, storageClass, }: {
@@ -1,4 +1,4 @@
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 extractWorkerCrons, C as COMPATIBILITY_FLAGS, f as COMPATIBILITY_DATE } from '../shared/backend-sdk.CLtx2lZQ.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, f as QUEUE_MAX_BATCH_TIMEOUT, g as QUEUE_MAX_BATCH_SIZE, c as composeWorkerArguments, e as extractWorkerCrons, C as COMPATIBILITY_FLAGS, h as COMPATIBILITY_DATE } from '../shared/backend-sdk.Cyo7INro.mjs';
2
2
  import { toKebabCase } from '@std/text';
3
3
  import { KVNamespace, D1Database, Queue, R2Bucket, DurableObjectNamespace, Worker, Nuxt } from 'alchemy/cloudflare';
4
4
  import { A as ALCHEMY_STATE_STORE } from '../shared/backend-sdk.BIVnu5aA.mjs';
@@ -27,14 +27,16 @@ const composeKvArguments = ({
27
27
  const composeQueueArguments = ({
28
28
  resourceName,
29
29
  deliveryDelay = QUEUE_DELIVERY_DELAY,
30
- messageRetentionPeriod = QUEUE_MESSAGE_RETENTION_PERIOD
30
+ messageRetentionPeriod = QUEUE_MESSAGE_RETENTION_PERIOD,
31
+ dlq
31
32
  }) => {
32
33
  return {
33
34
  name: resourceName,
34
35
  settings: {
35
36
  deliveryDelay,
36
37
  messageRetentionPeriod
37
- }
38
+ },
39
+ dlq
38
40
  };
39
41
  };
40
42
 
@@ -68,18 +70,16 @@ class Deployment {
68
70
  project;
69
71
  environment;
70
72
  alchemy;
71
- constructor({
72
- project,
73
- environment
74
- }) {
73
+ constructor({ project }) {
75
74
  this.project = project;
76
- this.environment = environment;
75
+ this.environment = Bun.env.ENVIRONMENT || "unknown";
77
76
  this.alchemy = alchemy(project, {
78
77
  stateStore: (scope) => {
79
78
  return new CloudflareStateStore(scope, {
80
79
  scriptName: ALCHEMY_STATE_STORE
81
80
  });
82
- }
81
+ },
82
+ stage: Bun.env.ENVIRONMENT || "unknown"
83
83
  });
84
84
  }
85
85
  /**
@@ -125,6 +125,17 @@ class Deployment {
125
125
  */
126
126
  async queue(options) {
127
127
  const { resourceName, deliveryDelay, messageRetentionPeriod } = options;
128
+ const dlq = await Queue(
129
+ composeIdentifierName({ resourceName, resource: "dlq" }),
130
+ {
131
+ name: composeResourceName({
132
+ project: this.project,
133
+ environment: this.environment,
134
+ // TODO: Convert to a util
135
+ resourceName: `${resourceName}-dlq`
136
+ })
137
+ }
138
+ );
128
139
  return await Queue(
129
140
  composeIdentifierName({ resourceName, resource: "queue" }),
130
141
  composeQueueArguments({
@@ -134,7 +145,8 @@ class Deployment {
134
145
  resourceName
135
146
  }),
136
147
  deliveryDelay,
137
- messageRetentionPeriod
148
+ messageRetentionPeriod,
149
+ dlq
138
150
  })
139
151
  );
140
152
  }
@@ -184,6 +196,8 @@ class Deployment {
184
196
  assets,
185
197
  crons,
186
198
  bindings,
199
+ variables,
200
+ secrets,
187
201
  eventSources
188
202
  } = options;
189
203
  const identifierName = composeIdentifierName({
@@ -191,6 +205,16 @@ class Deployment {
191
205
  resource: resource || "worker"
192
206
  });
193
207
  const workerConfig = await loadWorkerConfig({ path });
208
+ const consumers = eventSources?.map((queue) => {
209
+ return {
210
+ queue,
211
+ settings: {
212
+ deadLetterQueue: queue.dlq,
213
+ batchSize: QUEUE_MAX_BATCH_SIZE,
214
+ maxWaitTimeMs: QUEUE_MAX_BATCH_TIMEOUT
215
+ }
216
+ };
217
+ });
194
218
  return await Worker(
195
219
  identifierName,
196
220
  composeWorkerArguments({
@@ -207,8 +231,12 @@ class Deployment {
207
231
  workerConfig,
208
232
  environment: this.environment
209
233
  }),
210
- bindings,
211
- eventSources
234
+ bindings: {
235
+ ...bindings,
236
+ ...variables,
237
+ ...secrets
238
+ },
239
+ eventSources: consumers
212
240
  })
213
241
  );
214
242
  }
@@ -216,13 +244,15 @@ class Deployment {
216
244
  * Creates an instance of Cloudflare Worker as a service.
217
245
  */
218
246
  async service(options) {
219
- const { resourceName, bindings, eventSources } = options;
247
+ const { resourceName, bindings, variables, secrets, eventSources } = options;
220
248
  return await this.worker({
221
249
  resourceName,
222
250
  resource: "service",
223
251
  // TODO: Convert to util
224
252
  path: `./services/${resourceName}`,
225
253
  bindings,
254
+ variables,
255
+ secrets,
226
256
  eventSources
227
257
  });
228
258
  }
@@ -230,7 +260,14 @@ class Deployment {
230
260
  * Creates an instance of Cloudflare Worker as an orchestrator.
231
261
  */
232
262
  async orchestrator(options) {
233
- const { resourceName, domains, bindings, eventSources } = options;
263
+ const {
264
+ resourceName,
265
+ domains,
266
+ bindings,
267
+ variables,
268
+ secrets,
269
+ eventSources
270
+ } = options;
234
271
  return await this.worker({
235
272
  resourceName,
236
273
  resource: "orchestrator",
@@ -238,6 +275,8 @@ class Deployment {
238
275
  path: `./apps/${resourceName}`,
239
276
  domains,
240
277
  bindings,
278
+ variables,
279
+ secrets,
241
280
  eventSources
242
281
  });
243
282
  }
@@ -245,7 +284,7 @@ class Deployment {
245
284
  * Creates an instance of Cloudflare Worker as a client.
246
285
  */
247
286
  async client(options) {
248
- const { resourceName, domains, bindings } = options;
287
+ const { resourceName, domains, bindings, variables, secrets } = options;
249
288
  return await Nuxt(
250
289
  composeIdentifierName({
251
290
  resourceName,
@@ -264,7 +303,11 @@ class Deployment {
264
303
  },
265
304
  url: false,
266
305
  domains,
267
- bindings,
306
+ bindings: {
307
+ ...bindings,
308
+ ...variables,
309
+ ...secrets
310
+ },
268
311
  // TODO: Convert to util
269
312
  cwd: `./apps/${resourceName}`
270
313
  }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const worker = require('../shared/backend-sdk.BNEcLkji.cjs');
3
+ const worker = require('../shared/backend-sdk.n8SfX_xu.cjs');
4
4
  require('../shared/backend-sdk.ClVQ4AzB.cjs');
5
5
  require('@std/path');
6
6
  require('comment-json');
@@ -1,3 +1,3 @@
1
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.B7BfiqA5.cjs';
1
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.D8N5si7y.cjs';
2
2
  import 'alchemy/cloudflare';
3
3
  import '../shared/backend-sdk.CYcpgphg.cjs';
@@ -1,3 +1,3 @@
1
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.BEt22BOM.mjs';
1
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.OvCBQJUw.mjs';
2
2
  import 'alchemy/cloudflare';
3
3
  import '../shared/backend-sdk.CYcpgphg.mjs';
@@ -1,3 +1,3 @@
1
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.CCDScozq.js';
1
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.DSK5flKM.js';
2
2
  import 'alchemy/cloudflare';
3
3
  import '../shared/backend-sdk.CYcpgphg.js';
@@ -1,4 +1,4 @@
1
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.CLtx2lZQ.mjs';
1
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.Cyo7INro.mjs';
2
2
  import '../shared/backend-sdk.BIVnu5aA.mjs';
3
3
  import '@std/path';
4
4
  import 'comment-json';
@@ -6,6 +6,8 @@ const COMPATIBILITY_DATE = "2025-06-04";
6
6
  const COMPATIBILITY_FLAGS = ["nodejs_compat"];
7
7
  const QUEUE_DELIVERY_DELAY = 5;
8
8
  const QUEUE_MESSAGE_RETENTION_PERIOD = 259200;
9
+ const QUEUE_MAX_BATCH_SIZE = 1;
10
+ const QUEUE_MAX_BATCH_TIMEOUT = 5;
9
11
  const D1_LOCATION_HINT = "weur";
10
12
  const R2_STORAGE_CLASS = "Standard";
11
13
  const R2_JURISDICTION = "eu";
@@ -55,4 +57,4 @@ const composeWorkerArguments = ({
55
57
  };
56
58
  };
57
59
 
58
- export { COMPATIBILITY_FLAGS as C, 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, extractWorkerCrons as e, COMPATIBILITY_DATE as f, loadWorkerConfig as l };
60
+ export { COMPATIBILITY_FLAGS as C, 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, extractWorkerCrons as e, QUEUE_MAX_BATCH_TIMEOUT as f, QUEUE_MAX_BATCH_SIZE as g, COMPATIBILITY_DATE as h, loadWorkerConfig as l };
@@ -1,7 +1,7 @@
1
- import { Bindings, Queue } from 'alchemy/cloudflare';
1
+ import { Bindings, Queue, QueueConsumerSettings } from 'alchemy/cloudflare';
2
2
  import { E as Environment } from './backend-sdk.CYcpgphg.cjs';
3
3
 
4
- type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'durable-object' | 'worker' | 'service' | 'orchestrator' | 'client';
4
+ type Resource = 'kv' | 'd1' | 'queue' | 'dlq' | 'r2' | 'durable-object' | 'worker' | 'service' | 'orchestrator' | 'client';
5
5
  type WorkerType = 'service' | 'orchestrator' | 'client';
6
6
  interface WorkerConfig {
7
7
  triggers: {
@@ -30,7 +30,10 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, domai
30
30
  domains?: string[];
31
31
  crons?: string[];
32
32
  bindings?: Bindings;
33
- eventSources?: Queue[];
33
+ eventSources?: {
34
+ queue: Queue;
35
+ settings: QueueConsumerSettings;
36
+ }[];
34
37
  }) => {
35
38
  name: string;
36
39
  entrypoint: string;
@@ -42,7 +45,10 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, domai
42
45
  url: false;
43
46
  assets: Bindings | undefined;
44
47
  domains: string[];
45
- eventSources: Queue[];
48
+ eventSources: {
49
+ queue: Queue;
50
+ settings: QueueConsumerSettings;
51
+ }[];
46
52
  crons: string[];
47
53
  bindings: Bindings | undefined;
48
54
  };
@@ -1,7 +1,7 @@
1
- import { Bindings, Queue } from 'alchemy/cloudflare';
1
+ import { Bindings, Queue, QueueConsumerSettings } from 'alchemy/cloudflare';
2
2
  import { E as Environment } from './backend-sdk.CYcpgphg.js';
3
3
 
4
- type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'durable-object' | 'worker' | 'service' | 'orchestrator' | 'client';
4
+ type Resource = 'kv' | 'd1' | 'queue' | 'dlq' | 'r2' | 'durable-object' | 'worker' | 'service' | 'orchestrator' | 'client';
5
5
  type WorkerType = 'service' | 'orchestrator' | 'client';
6
6
  interface WorkerConfig {
7
7
  triggers: {
@@ -30,7 +30,10 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, domai
30
30
  domains?: string[];
31
31
  crons?: string[];
32
32
  bindings?: Bindings;
33
- eventSources?: Queue[];
33
+ eventSources?: {
34
+ queue: Queue;
35
+ settings: QueueConsumerSettings;
36
+ }[];
34
37
  }) => {
35
38
  name: string;
36
39
  entrypoint: string;
@@ -42,7 +45,10 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, domai
42
45
  url: false;
43
46
  assets: Bindings | undefined;
44
47
  domains: string[];
45
- eventSources: Queue[];
48
+ eventSources: {
49
+ queue: Queue;
50
+ settings: QueueConsumerSettings;
51
+ }[];
46
52
  crons: string[];
47
53
  bindings: Bindings | undefined;
48
54
  };
@@ -1,7 +1,7 @@
1
- import { Bindings, Queue } from 'alchemy/cloudflare';
1
+ import { Bindings, Queue, QueueConsumerSettings } from 'alchemy/cloudflare';
2
2
  import { E as Environment } from './backend-sdk.CYcpgphg.mjs';
3
3
 
4
- type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'durable-object' | 'worker' | 'service' | 'orchestrator' | 'client';
4
+ type Resource = 'kv' | 'd1' | 'queue' | 'dlq' | 'r2' | 'durable-object' | 'worker' | 'service' | 'orchestrator' | 'client';
5
5
  type WorkerType = 'service' | 'orchestrator' | 'client';
6
6
  interface WorkerConfig {
7
7
  triggers: {
@@ -30,7 +30,10 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, domai
30
30
  domains?: string[];
31
31
  crons?: string[];
32
32
  bindings?: Bindings;
33
- eventSources?: Queue[];
33
+ eventSources?: {
34
+ queue: Queue;
35
+ settings: QueueConsumerSettings;
36
+ }[];
34
37
  }) => {
35
38
  name: string;
36
39
  entrypoint: string;
@@ -42,7 +45,10 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, domai
42
45
  url: false;
43
46
  assets: Bindings | undefined;
44
47
  domains: string[];
45
- eventSources: Queue[];
48
+ eventSources: {
49
+ queue: Queue;
50
+ settings: QueueConsumerSettings;
51
+ }[];
46
52
  crons: string[];
47
53
  bindings: Bindings | undefined;
48
54
  };
@@ -8,6 +8,8 @@ const COMPATIBILITY_DATE = "2025-06-04";
8
8
  const COMPATIBILITY_FLAGS = ["nodejs_compat"];
9
9
  const QUEUE_DELIVERY_DELAY = 5;
10
10
  const QUEUE_MESSAGE_RETENTION_PERIOD = 259200;
11
+ const QUEUE_MAX_BATCH_SIZE = 1;
12
+ const QUEUE_MAX_BATCH_TIMEOUT = 5;
11
13
  const D1_LOCATION_HINT = "weur";
12
14
  const R2_STORAGE_CLASS = "Standard";
13
15
  const R2_JURISDICTION = "eu";
@@ -61,6 +63,8 @@ exports.COMPATIBILITY_DATE = COMPATIBILITY_DATE;
61
63
  exports.COMPATIBILITY_FLAGS = COMPATIBILITY_FLAGS;
62
64
  exports.D1_LOCATION_HINT = D1_LOCATION_HINT;
63
65
  exports.QUEUE_DELIVERY_DELAY = QUEUE_DELIVERY_DELAY;
66
+ exports.QUEUE_MAX_BATCH_SIZE = QUEUE_MAX_BATCH_SIZE;
67
+ exports.QUEUE_MAX_BATCH_TIMEOUT = QUEUE_MAX_BATCH_TIMEOUT;
64
68
  exports.QUEUE_MESSAGE_RETENTION_PERIOD = QUEUE_MESSAGE_RETENTION_PERIOD;
65
69
  exports.R2_JURISDICTION = R2_JURISDICTION;
66
70
  exports.R2_LOCATION_HINT = R2_LOCATION_HINT;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-io/backend-sdk",
3
- "version": "5.28.2",
3
+ "version": "5.29.0",
4
4
  "description": "Develit Backend SDK",
5
5
  "author": "Develit.io",
6
6
  "license": "ISC",