@develit-io/backend-sdk 5.28.2 → 5.28.3

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.
@@ -74,12 +74,9 @@ class Deployment {
74
74
  project;
75
75
  environment;
76
76
  alchemy;
77
- constructor({
78
- project,
79
- environment
80
- }) {
77
+ constructor({ project }) {
81
78
  this.project = project;
82
- this.environment = environment;
79
+ this.environment = Bun.env.ENVIRONMENT || "unknown";
83
80
  this.alchemy = alchemy__default(project, {
84
81
  stateStore: (scope) => {
85
82
  return new state.CloudflareStateStore(scope, {
@@ -190,6 +187,8 @@ class Deployment {
190
187
  assets,
191
188
  crons,
192
189
  bindings,
190
+ variables,
191
+ secrets,
193
192
  eventSources
194
193
  } = options;
195
194
  const identifierName = composeIdentifierName({
@@ -213,7 +212,11 @@ class Deployment {
213
212
  workerConfig,
214
213
  environment: this.environment
215
214
  }),
216
- bindings,
215
+ bindings: {
216
+ ...bindings,
217
+ ...variables,
218
+ ...secrets
219
+ },
217
220
  eventSources
218
221
  })
219
222
  );
@@ -222,13 +225,15 @@ class Deployment {
222
225
  * Creates an instance of Cloudflare Worker as a service.
223
226
  */
224
227
  async service(options) {
225
- const { resourceName, bindings, eventSources } = options;
228
+ const { resourceName, bindings, variables, secrets, eventSources } = options;
226
229
  return await this.worker({
227
230
  resourceName,
228
231
  resource: "service",
229
232
  // TODO: Convert to util
230
233
  path: `./services/${resourceName}`,
231
234
  bindings,
235
+ variables,
236
+ secrets,
232
237
  eventSources
233
238
  });
234
239
  }
@@ -236,7 +241,14 @@ class Deployment {
236
241
  * Creates an instance of Cloudflare Worker as an orchestrator.
237
242
  */
238
243
  async orchestrator(options) {
239
- const { resourceName, domains, bindings, eventSources } = options;
244
+ const {
245
+ resourceName,
246
+ domains,
247
+ bindings,
248
+ variables,
249
+ secrets,
250
+ eventSources
251
+ } = options;
240
252
  return await this.worker({
241
253
  resourceName,
242
254
  resource: "orchestrator",
@@ -244,6 +256,8 @@ class Deployment {
244
256
  path: `./apps/${resourceName}`,
245
257
  domains,
246
258
  bindings,
259
+ variables,
260
+ secrets,
247
261
  eventSources
248
262
  });
249
263
  }
@@ -251,7 +265,7 @@ class Deployment {
251
265
  * Creates an instance of Cloudflare Worker as a client.
252
266
  */
253
267
  async client(options) {
254
- const { resourceName, domains, bindings } = options;
268
+ const { resourceName, domains, bindings, variables, secrets } = options;
255
269
  return await cloudflare.Nuxt(
256
270
  composeIdentifierName({
257
271
  resourceName,
@@ -270,7 +284,11 @@ class Deployment {
270
284
  },
271
285
  url: false,
272
286
  domains,
273
- bindings,
287
+ bindings: {
288
+ ...bindings,
289
+ ...variables,
290
+ ...secrets
291
+ },
274
292
  // TODO: Convert to util
275
293
  cwd: `./apps/${resourceName}`
276
294
  }
@@ -10,9 +10,8 @@ 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
  }
@@ -10,9 +10,8 @@ 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
  }
@@ -10,9 +10,8 @@ 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
  }
@@ -68,12 +68,9 @@ class Deployment {
68
68
  project;
69
69
  environment;
70
70
  alchemy;
71
- constructor({
72
- project,
73
- environment
74
- }) {
71
+ constructor({ project }) {
75
72
  this.project = project;
76
- this.environment = environment;
73
+ this.environment = Bun.env.ENVIRONMENT || "unknown";
77
74
  this.alchemy = alchemy(project, {
78
75
  stateStore: (scope) => {
79
76
  return new CloudflareStateStore(scope, {
@@ -184,6 +181,8 @@ class Deployment {
184
181
  assets,
185
182
  crons,
186
183
  bindings,
184
+ variables,
185
+ secrets,
187
186
  eventSources
188
187
  } = options;
189
188
  const identifierName = composeIdentifierName({
@@ -207,7 +206,11 @@ class Deployment {
207
206
  workerConfig,
208
207
  environment: this.environment
209
208
  }),
210
- bindings,
209
+ bindings: {
210
+ ...bindings,
211
+ ...variables,
212
+ ...secrets
213
+ },
211
214
  eventSources
212
215
  })
213
216
  );
@@ -216,13 +219,15 @@ class Deployment {
216
219
  * Creates an instance of Cloudflare Worker as a service.
217
220
  */
218
221
  async service(options) {
219
- const { resourceName, bindings, eventSources } = options;
222
+ const { resourceName, bindings, variables, secrets, eventSources } = options;
220
223
  return await this.worker({
221
224
  resourceName,
222
225
  resource: "service",
223
226
  // TODO: Convert to util
224
227
  path: `./services/${resourceName}`,
225
228
  bindings,
229
+ variables,
230
+ secrets,
226
231
  eventSources
227
232
  });
228
233
  }
@@ -230,7 +235,14 @@ class Deployment {
230
235
  * Creates an instance of Cloudflare Worker as an orchestrator.
231
236
  */
232
237
  async orchestrator(options) {
233
- const { resourceName, domains, bindings, eventSources } = options;
238
+ const {
239
+ resourceName,
240
+ domains,
241
+ bindings,
242
+ variables,
243
+ secrets,
244
+ eventSources
245
+ } = options;
234
246
  return await this.worker({
235
247
  resourceName,
236
248
  resource: "orchestrator",
@@ -238,6 +250,8 @@ class Deployment {
238
250
  path: `./apps/${resourceName}`,
239
251
  domains,
240
252
  bindings,
253
+ variables,
254
+ secrets,
241
255
  eventSources
242
256
  });
243
257
  }
@@ -245,7 +259,7 @@ class Deployment {
245
259
  * Creates an instance of Cloudflare Worker as a client.
246
260
  */
247
261
  async client(options) {
248
- const { resourceName, domains, bindings } = options;
262
+ const { resourceName, domains, bindings, variables, secrets } = options;
249
263
  return await Nuxt(
250
264
  composeIdentifierName({
251
265
  resourceName,
@@ -264,7 +278,11 @@ class Deployment {
264
278
  },
265
279
  url: false,
266
280
  domains,
267
- bindings,
281
+ bindings: {
282
+ ...bindings,
283
+ ...variables,
284
+ ...secrets
285
+ },
268
286
  // TODO: Convert to util
269
287
  cwd: `./apps/${resourceName}`
270
288
  }
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.28.3",
4
4
  "description": "Develit Backend SDK",
5
5
  "author": "Develit.io",
6
6
  "license": "ISC",