@develit-io/backend-sdk 5.29.1 → 5.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deployment/index.cjs +48 -64
- package/dist/deployment/index.d.cts +50 -69
- package/dist/deployment/index.d.mts +50 -69
- package/dist/deployment/index.d.ts +50 -69
- package/dist/deployment/index.mjs +47 -61
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/node/index.cjs +3 -2
- package/dist/node/index.d.cts +1 -1
- package/dist/node/index.d.mts +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.mjs +2 -2
- package/dist/shared/{backend-sdk.ClVQ4AzB.cjs → backend-sdk.BdcrYpFD.cjs} +0 -2
- package/dist/shared/{backend-sdk.OvCBQJUw.d.mts → backend-sdk.C-0xIdM4.d.mts} +13 -1
- package/dist/shared/{backend-sdk.D8N5si7y.d.cts → backend-sdk.CdngrAa0.d.cts} +13 -1
- package/dist/shared/backend-sdk.DXRpnctc.mjs +3 -0
- package/dist/shared/{backend-sdk.Cyo7INro.mjs → backend-sdk.Fdiq3Ek5.mjs} +12 -2
- package/dist/shared/{backend-sdk.n8SfX_xu.cjs → backend-sdk.Vru_rcK6.cjs} +12 -1
- package/dist/shared/{backend-sdk.DSK5flKM.d.ts → backend-sdk.qPzlx18G.d.ts} +13 -1
- package/package.json +6 -6
- package/dist/shared/backend-sdk.BIVnu5aA.mjs +0 -4
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { D as D1_LOCATION_HINT, Q as QUEUE_MESSAGE_RETENTION_PERIOD,
|
|
1
|
+
import { D as D1_LOCATION_HINT, Q as QUEUE_MESSAGE_RETENTION_PERIOD, b as QUEUE_DELIVERY_DELAY, R as R2_LOCATION_HINT, d as R2_JURISDICTION, f as R2_STORAGE_CLASS, l as loadWorkerConfig, g as QUEUE_MAX_BATCH_TIMEOUT, h as QUEUE_MAX_BATCH_SIZE, c as composeWorkerArguments, a as extractWorkerVars, e as extractWorkerCrons, C as COMPATIBILITY_FLAGS, i as COMPATIBILITY_DATE } from '../shared/backend-sdk.Fdiq3Ek5.mjs';
|
|
2
2
|
import { toKebabCase } from '@std/text';
|
|
3
3
|
import { KVNamespace, D1Database, Queue, R2Bucket, DurableObjectNamespace, Worker, Nuxt } from 'alchemy/cloudflare';
|
|
4
|
-
import
|
|
5
|
-
import alchemy from 'alchemy';
|
|
6
|
-
import { CloudflareStateStore } from 'alchemy/state';
|
|
4
|
+
import '../shared/backend-sdk.DXRpnctc.mjs';
|
|
7
5
|
import '@std/path';
|
|
8
6
|
import 'comment-json';
|
|
9
7
|
|
|
@@ -16,6 +14,20 @@ const composeD1Arguments = ({
|
|
|
16
14
|
};
|
|
17
15
|
};
|
|
18
16
|
|
|
17
|
+
const composeDlqArguments = ({
|
|
18
|
+
resourceName,
|
|
19
|
+
deliveryDelay = QUEUE_DELIVERY_DELAY,
|
|
20
|
+
messageRetentionPeriod = QUEUE_MESSAGE_RETENTION_PERIOD
|
|
21
|
+
}) => {
|
|
22
|
+
return {
|
|
23
|
+
name: resourceName,
|
|
24
|
+
settings: {
|
|
25
|
+
deliveryDelay,
|
|
26
|
+
messageRetentionPeriod
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
19
31
|
const composeKvArguments = ({
|
|
20
32
|
resourceName
|
|
21
33
|
}) => {
|
|
@@ -26,17 +38,17 @@ const composeKvArguments = ({
|
|
|
26
38
|
|
|
27
39
|
const composeQueueArguments = ({
|
|
28
40
|
resourceName,
|
|
41
|
+
dlq,
|
|
29
42
|
deliveryDelay = QUEUE_DELIVERY_DELAY,
|
|
30
|
-
messageRetentionPeriod = QUEUE_MESSAGE_RETENTION_PERIOD
|
|
31
|
-
dlq
|
|
43
|
+
messageRetentionPeriod = QUEUE_MESSAGE_RETENTION_PERIOD
|
|
32
44
|
}) => {
|
|
33
45
|
return {
|
|
34
46
|
name: resourceName,
|
|
47
|
+
dlq,
|
|
35
48
|
settings: {
|
|
36
49
|
deliveryDelay,
|
|
37
50
|
messageRetentionPeriod
|
|
38
|
-
}
|
|
39
|
-
dlq
|
|
51
|
+
}
|
|
40
52
|
};
|
|
41
53
|
};
|
|
42
54
|
|
|
@@ -46,9 +58,9 @@ const composeR2Arguments = ({
|
|
|
46
58
|
}) => {
|
|
47
59
|
return {
|
|
48
60
|
name: resourceName,
|
|
61
|
+
storageClass,
|
|
49
62
|
jurisdiction: R2_JURISDICTION,
|
|
50
|
-
locationHint: R2_LOCATION_HINT
|
|
51
|
-
storageClass
|
|
63
|
+
locationHint: R2_LOCATION_HINT
|
|
52
64
|
};
|
|
53
65
|
};
|
|
54
66
|
|
|
@@ -66,42 +78,23 @@ const composeResourceName = ({
|
|
|
66
78
|
return `${project}-${toKebabCase(resourceName).toLowerCase()}-${environment}`;
|
|
67
79
|
};
|
|
68
80
|
|
|
69
|
-
const composeDlqArguments = ({
|
|
70
|
-
resourceName,
|
|
71
|
-
deliveryDelay = QUEUE_DELIVERY_DELAY,
|
|
72
|
-
messageRetentionPeriod = QUEUE_MESSAGE_RETENTION_PERIOD
|
|
73
|
-
}) => {
|
|
74
|
-
return {
|
|
75
|
-
name: resourceName,
|
|
76
|
-
settings: {
|
|
77
|
-
deliveryDelay,
|
|
78
|
-
messageRetentionPeriod
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
|
|
83
81
|
class Deployment {
|
|
84
82
|
project;
|
|
85
83
|
environment;
|
|
86
|
-
|
|
84
|
+
// TODO: Check if the type is most correct
|
|
85
|
+
// TODO: Keeping this in class creates issues with destroy
|
|
86
|
+
// public alchemy: Promise<Awaited<ReturnType<typeof alchemy>>>
|
|
87
87
|
constructor({ project }) {
|
|
88
88
|
this.project = project;
|
|
89
89
|
this.environment = Bun.env.ENVIRONMENT || "unknown";
|
|
90
|
-
this.alchemy = alchemy(project, {
|
|
91
|
-
stateStore: (scope) => {
|
|
92
|
-
return new CloudflareStateStore(scope, {
|
|
93
|
-
scriptName: ALCHEMY_STATE_STORE
|
|
94
|
-
});
|
|
95
|
-
},
|
|
96
|
-
stage: Bun.env.ENVIRONMENT || "unknown"
|
|
97
|
-
});
|
|
98
90
|
}
|
|
91
|
+
// TODO: Keeping this in class creates issues with destroy
|
|
99
92
|
/**
|
|
100
93
|
* Finalizes the deployment and correctly quits the Alchemy process.
|
|
101
94
|
*/
|
|
102
|
-
async finalize() {
|
|
103
|
-
|
|
104
|
-
}
|
|
95
|
+
// async finalize() {
|
|
96
|
+
// return (await this.alchemy).finalize()
|
|
97
|
+
// }
|
|
105
98
|
/**
|
|
106
99
|
* Creates an instance of Cloudflare KV.
|
|
107
100
|
*/
|
|
@@ -135,11 +128,11 @@ class Deployment {
|
|
|
135
128
|
);
|
|
136
129
|
}
|
|
137
130
|
/**
|
|
138
|
-
* Creates an instance of Cloudflare Queue.
|
|
131
|
+
* Creates an instance of Cloudflare Queue. A DLQ is created automatically.
|
|
139
132
|
*/
|
|
140
133
|
async queue(options) {
|
|
141
134
|
const { resourceName, deliveryDelay, messageRetentionPeriod } = options;
|
|
142
|
-
const
|
|
135
|
+
const deadLetterQueue = await this.dlq({
|
|
143
136
|
resourceName
|
|
144
137
|
});
|
|
145
138
|
return await Queue(
|
|
@@ -150,9 +143,9 @@ class Deployment {
|
|
|
150
143
|
environment: this.environment,
|
|
151
144
|
resourceName
|
|
152
145
|
}),
|
|
146
|
+
dlq: deadLetterQueue,
|
|
153
147
|
deliveryDelay,
|
|
154
|
-
messageRetentionPeriod
|
|
155
|
-
dlq
|
|
148
|
+
messageRetentionPeriod
|
|
156
149
|
})
|
|
157
150
|
);
|
|
158
151
|
}
|
|
@@ -202,6 +195,7 @@ class Deployment {
|
|
|
202
195
|
resourceName: className,
|
|
203
196
|
resource: "durable-object"
|
|
204
197
|
}),
|
|
198
|
+
// TODO: Create util
|
|
205
199
|
{
|
|
206
200
|
// TODO: Create util
|
|
207
201
|
className: `${className}DurableObject`,
|
|
@@ -221,12 +215,11 @@ class Deployment {
|
|
|
221
215
|
assets,
|
|
222
216
|
crons,
|
|
223
217
|
bindings,
|
|
224
|
-
variables,
|
|
225
|
-
secrets,
|
|
226
218
|
eventSources
|
|
227
219
|
} = options;
|
|
228
220
|
const identifierName = composeIdentifierName({
|
|
229
221
|
resourceName,
|
|
222
|
+
// TODO: Convert to a util
|
|
230
223
|
resource: resource || "worker"
|
|
231
224
|
});
|
|
232
225
|
const workerConfig = await loadWorkerConfig({ path });
|
|
@@ -237,10 +230,12 @@ class Deployment {
|
|
|
237
230
|
deadLetterQueue: queue.dlq,
|
|
238
231
|
batchSize: QUEUE_MAX_BATCH_SIZE,
|
|
239
232
|
maxWaitTimeMs: QUEUE_MAX_BATCH_TIMEOUT
|
|
233
|
+
// TODO: Watch out for the type
|
|
240
234
|
}
|
|
241
235
|
};
|
|
242
236
|
});
|
|
243
237
|
return await Worker(
|
|
238
|
+
// TODO: Make it to use composeIdentifierName similary to other resources
|
|
244
239
|
identifierName,
|
|
245
240
|
composeWorkerArguments({
|
|
246
241
|
resourceName: composeResourceName({
|
|
@@ -252,14 +247,17 @@ class Deployment {
|
|
|
252
247
|
entrypoint: `${path}/src/index.ts`,
|
|
253
248
|
domains,
|
|
254
249
|
assets,
|
|
250
|
+
// TODO: Convert to a util
|
|
255
251
|
crons: crons || extractWorkerCrons({
|
|
256
252
|
workerConfig,
|
|
257
253
|
environment: this.environment
|
|
258
254
|
}),
|
|
259
255
|
bindings: {
|
|
260
256
|
...bindings,
|
|
261
|
-
...
|
|
262
|
-
|
|
257
|
+
...extractWorkerVars({
|
|
258
|
+
workerConfig,
|
|
259
|
+
environment: this.environment
|
|
260
|
+
})
|
|
263
261
|
},
|
|
264
262
|
eventSources: consumers
|
|
265
263
|
})
|
|
@@ -269,15 +267,13 @@ class Deployment {
|
|
|
269
267
|
* Creates an instance of Cloudflare Worker as a service.
|
|
270
268
|
*/
|
|
271
269
|
async service(options) {
|
|
272
|
-
const { resourceName, bindings,
|
|
270
|
+
const { resourceName, bindings, eventSources } = options;
|
|
273
271
|
return await this.worker({
|
|
274
272
|
resourceName,
|
|
275
273
|
resource: "service",
|
|
276
274
|
// TODO: Convert to util
|
|
277
275
|
path: `./services/${resourceName}`,
|
|
278
276
|
bindings,
|
|
279
|
-
variables,
|
|
280
|
-
secrets,
|
|
281
277
|
eventSources
|
|
282
278
|
});
|
|
283
279
|
}
|
|
@@ -285,14 +281,7 @@ class Deployment {
|
|
|
285
281
|
* Creates an instance of Cloudflare Worker as an orchestrator.
|
|
286
282
|
*/
|
|
287
283
|
async orchestrator(options) {
|
|
288
|
-
const {
|
|
289
|
-
resourceName,
|
|
290
|
-
domains,
|
|
291
|
-
bindings,
|
|
292
|
-
variables,
|
|
293
|
-
secrets,
|
|
294
|
-
eventSources
|
|
295
|
-
} = options;
|
|
284
|
+
const { resourceName, domains, bindings, eventSources } = options;
|
|
296
285
|
return await this.worker({
|
|
297
286
|
resourceName,
|
|
298
287
|
resource: "orchestrator",
|
|
@@ -300,8 +289,6 @@ class Deployment {
|
|
|
300
289
|
path: `./apps/${resourceName}`,
|
|
301
290
|
domains,
|
|
302
291
|
bindings,
|
|
303
|
-
variables,
|
|
304
|
-
secrets,
|
|
305
292
|
eventSources
|
|
306
293
|
});
|
|
307
294
|
}
|
|
@@ -309,7 +296,7 @@ class Deployment {
|
|
|
309
296
|
* Creates an instance of Cloudflare Worker as a client.
|
|
310
297
|
*/
|
|
311
298
|
async client(options) {
|
|
312
|
-
const { resourceName, domains, bindings, variables
|
|
299
|
+
const { resourceName, domains, bindings, variables } = options;
|
|
313
300
|
return await Nuxt(
|
|
314
301
|
composeIdentifierName({
|
|
315
302
|
resourceName,
|
|
@@ -330,8 +317,7 @@ class Deployment {
|
|
|
330
317
|
domains,
|
|
331
318
|
bindings: {
|
|
332
319
|
...bindings,
|
|
333
|
-
...variables
|
|
334
|
-
...secrets
|
|
320
|
+
...variables
|
|
335
321
|
},
|
|
336
322
|
// TODO: Convert to util
|
|
337
323
|
cwd: `./apps/${resourceName}`
|
|
@@ -340,4 +326,4 @@ class Deployment {
|
|
|
340
326
|
}
|
|
341
327
|
}
|
|
342
328
|
|
|
343
|
-
export { Deployment, composeD1Arguments, composeIdentifierName, composeKvArguments, composeQueueArguments, composeR2Arguments, composeResourceName, composeWorkerArguments, extractWorkerCrons, loadWorkerConfig };
|
|
329
|
+
export { Deployment, composeD1Arguments, composeDlqArguments, composeIdentifierName, composeKvArguments, composeQueueArguments, composeR2Arguments, composeResourceName, composeWorkerArguments, extractWorkerCrons, extractWorkerVars, loadWorkerConfig };
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ const drizzleOrm = require('drizzle-orm');
|
|
|
4
4
|
const pgCore = require('drizzle-orm/pg-core');
|
|
5
5
|
const sqliteCore = require('drizzle-orm/sqlite-core');
|
|
6
6
|
const generalCodes = require('@develit-io/general-codes');
|
|
7
|
-
const environment_consts = require('./shared/backend-sdk.
|
|
7
|
+
const environment_consts = require('./shared/backend-sdk.BdcrYpFD.cjs');
|
|
8
8
|
const z = require('zod/v4/core');
|
|
9
9
|
require('http-status-codes');
|
|
10
10
|
const h3 = require('h3');
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { sql } from 'drizzle-orm';
|
|
|
2
2
|
import { timestamp, uuid, pgEnum, text as text$1 } from 'drizzle-orm/pg-core';
|
|
3
3
|
import { integer, text } from 'drizzle-orm/sqlite-core';
|
|
4
4
|
import { COUNTRY_CODES_2, CURRENCY_CODES, BANK_CODES } from '@develit-io/general-codes';
|
|
5
|
-
export { E as ENVIRONMENT } from './shared/backend-sdk.
|
|
5
|
+
export { E as ENVIRONMENT } from './shared/backend-sdk.DXRpnctc.mjs';
|
|
6
6
|
import * as z from 'zod/v4/core';
|
|
7
7
|
import 'http-status-codes';
|
|
8
8
|
import { createError } from 'h3';
|
package/dist/node/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const worker = require('../shared/backend-sdk.
|
|
4
|
-
require('../shared/backend-sdk.
|
|
3
|
+
const worker = require('../shared/backend-sdk.Vru_rcK6.cjs');
|
|
4
|
+
require('../shared/backend-sdk.BdcrYpFD.cjs');
|
|
5
5
|
require('@std/path');
|
|
6
6
|
require('comment-json');
|
|
7
7
|
|
|
@@ -9,4 +9,5 @@ require('comment-json');
|
|
|
9
9
|
|
|
10
10
|
exports.composeWorkerArguments = worker.composeWorkerArguments;
|
|
11
11
|
exports.extractWorkerCrons = worker.extractWorkerCrons;
|
|
12
|
+
exports.extractWorkerVars = worker.extractWorkerVars;
|
|
12
13
|
exports.loadWorkerConfig = worker.loadWorkerConfig;
|
package/dist/node/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.
|
|
1
|
+
export { c as composeWorkerArguments, e as extractWorkerCrons, a as extractWorkerVars, l as loadWorkerConfig } from '../shared/backend-sdk.CdngrAa0.cjs';
|
|
2
2
|
import 'alchemy/cloudflare';
|
|
3
3
|
import '../shared/backend-sdk.CYcpgphg.cjs';
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.
|
|
1
|
+
export { c as composeWorkerArguments, e as extractWorkerCrons, a as extractWorkerVars, l as loadWorkerConfig } from '../shared/backend-sdk.C-0xIdM4.mjs';
|
|
2
2
|
import 'alchemy/cloudflare';
|
|
3
3
|
import '../shared/backend-sdk.CYcpgphg.mjs';
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.
|
|
1
|
+
export { c as composeWorkerArguments, e as extractWorkerCrons, a as extractWorkerVars, l as loadWorkerConfig } from '../shared/backend-sdk.qPzlx18G.js';
|
|
2
2
|
import 'alchemy/cloudflare';
|
|
3
3
|
import '../shared/backend-sdk.CYcpgphg.js';
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.
|
|
2
|
-
import '../shared/backend-sdk.
|
|
1
|
+
export { c as composeWorkerArguments, e as extractWorkerCrons, a as extractWorkerVars, l as loadWorkerConfig } from '../shared/backend-sdk.Fdiq3Ek5.mjs';
|
|
2
|
+
import '../shared/backend-sdk.DXRpnctc.mjs';
|
|
3
3
|
import '@std/path';
|
|
4
4
|
import 'comment-json';
|
|
@@ -4,11 +4,17 @@ import { E as Environment } from './backend-sdk.CYcpgphg.mjs';
|
|
|
4
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
|
+
vars: {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
};
|
|
7
10
|
triggers: {
|
|
8
11
|
crons: string[];
|
|
9
12
|
};
|
|
10
13
|
env: {
|
|
11
14
|
[key: string]: {
|
|
15
|
+
vars: {
|
|
16
|
+
[key: string]: string;
|
|
17
|
+
};
|
|
12
18
|
triggers: {
|
|
13
19
|
crons: string[];
|
|
14
20
|
};
|
|
@@ -23,6 +29,12 @@ declare const extractWorkerCrons: ({ workerConfig, environment, }: {
|
|
|
23
29
|
workerConfig: WorkerConfig;
|
|
24
30
|
environment: Environment;
|
|
25
31
|
}) => string[];
|
|
32
|
+
declare const extractWorkerVars: ({ workerConfig, environment, }: {
|
|
33
|
+
workerConfig: WorkerConfig;
|
|
34
|
+
environment: Environment;
|
|
35
|
+
}) => {
|
|
36
|
+
[key: string]: string;
|
|
37
|
+
};
|
|
26
38
|
declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, domains, crons, bindings, eventSources, }: {
|
|
27
39
|
resourceName: string;
|
|
28
40
|
entrypoint: string;
|
|
@@ -53,5 +65,5 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, domai
|
|
|
53
65
|
bindings: Bindings | undefined;
|
|
54
66
|
};
|
|
55
67
|
|
|
56
|
-
export { composeWorkerArguments as c, extractWorkerCrons as e, loadWorkerConfig as l };
|
|
68
|
+
export { extractWorkerVars as a, composeWorkerArguments as c, extractWorkerCrons as e, loadWorkerConfig as l };
|
|
57
69
|
export type { Resource as R, WorkerType as W };
|
|
@@ -4,11 +4,17 @@ import { E as Environment } from './backend-sdk.CYcpgphg.cjs';
|
|
|
4
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
|
+
vars: {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
};
|
|
7
10
|
triggers: {
|
|
8
11
|
crons: string[];
|
|
9
12
|
};
|
|
10
13
|
env: {
|
|
11
14
|
[key: string]: {
|
|
15
|
+
vars: {
|
|
16
|
+
[key: string]: string;
|
|
17
|
+
};
|
|
12
18
|
triggers: {
|
|
13
19
|
crons: string[];
|
|
14
20
|
};
|
|
@@ -23,6 +29,12 @@ declare const extractWorkerCrons: ({ workerConfig, environment, }: {
|
|
|
23
29
|
workerConfig: WorkerConfig;
|
|
24
30
|
environment: Environment;
|
|
25
31
|
}) => string[];
|
|
32
|
+
declare const extractWorkerVars: ({ workerConfig, environment, }: {
|
|
33
|
+
workerConfig: WorkerConfig;
|
|
34
|
+
environment: Environment;
|
|
35
|
+
}) => {
|
|
36
|
+
[key: string]: string;
|
|
37
|
+
};
|
|
26
38
|
declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, domains, crons, bindings, eventSources, }: {
|
|
27
39
|
resourceName: string;
|
|
28
40
|
entrypoint: string;
|
|
@@ -53,5 +65,5 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, domai
|
|
|
53
65
|
bindings: Bindings | undefined;
|
|
54
66
|
};
|
|
55
67
|
|
|
56
|
-
export { composeWorkerArguments as c, extractWorkerCrons as e, loadWorkerConfig as l };
|
|
68
|
+
export { extractWorkerVars as a, composeWorkerArguments as c, extractWorkerCrons as e, loadWorkerConfig as l };
|
|
57
69
|
export type { Resource as R, WorkerType as W };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as ENVIRONMENT } from './backend-sdk.
|
|
1
|
+
import { E as ENVIRONMENT } from './backend-sdk.DXRpnctc.mjs';
|
|
2
2
|
import { join } from '@std/path';
|
|
3
3
|
import { parse } from 'comment-json';
|
|
4
4
|
|
|
@@ -31,6 +31,15 @@ const extractWorkerCrons = ({
|
|
|
31
31
|
}
|
|
32
32
|
return workerConfig.env[environment]?.triggers?.crons || [];
|
|
33
33
|
};
|
|
34
|
+
const extractWorkerVars = ({
|
|
35
|
+
workerConfig,
|
|
36
|
+
environment
|
|
37
|
+
}) => {
|
|
38
|
+
if (!ENVIRONMENT.includes(String(environment))) {
|
|
39
|
+
return workerConfig.vars || [];
|
|
40
|
+
}
|
|
41
|
+
return workerConfig.env[environment]?.vars || [];
|
|
42
|
+
};
|
|
34
43
|
const composeWorkerArguments = ({
|
|
35
44
|
resourceName,
|
|
36
45
|
entrypoint,
|
|
@@ -45,6 +54,7 @@ const composeWorkerArguments = ({
|
|
|
45
54
|
entrypoint,
|
|
46
55
|
compatibilityFlags: COMPATIBILITY_FLAGS,
|
|
47
56
|
compatibilityDate: COMPATIBILITY_DATE,
|
|
57
|
+
// TODO: Disable default logs and enable ours
|
|
48
58
|
observability: {
|
|
49
59
|
enabled: true
|
|
50
60
|
},
|
|
@@ -57,4 +67,4 @@ const composeWorkerArguments = ({
|
|
|
57
67
|
};
|
|
58
68
|
};
|
|
59
69
|
|
|
60
|
-
export { COMPATIBILITY_FLAGS as C, D1_LOCATION_HINT as D, QUEUE_MESSAGE_RETENTION_PERIOD as Q,
|
|
70
|
+
export { COMPATIBILITY_FLAGS as C, D1_LOCATION_HINT as D, QUEUE_MESSAGE_RETENTION_PERIOD as Q, R2_LOCATION_HINT as R, extractWorkerVars as a, QUEUE_DELIVERY_DELAY as b, composeWorkerArguments as c, R2_JURISDICTION as d, extractWorkerCrons as e, R2_STORAGE_CLASS as f, QUEUE_MAX_BATCH_TIMEOUT as g, QUEUE_MAX_BATCH_SIZE as h, COMPATIBILITY_DATE as i, loadWorkerConfig as l };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const environment_consts = require('./backend-sdk.
|
|
3
|
+
const environment_consts = require('./backend-sdk.BdcrYpFD.cjs');
|
|
4
4
|
const path = require('@std/path');
|
|
5
5
|
const commentJson = require('comment-json');
|
|
6
6
|
|
|
@@ -33,6 +33,15 @@ const extractWorkerCrons = ({
|
|
|
33
33
|
}
|
|
34
34
|
return workerConfig.env[environment]?.triggers?.crons || [];
|
|
35
35
|
};
|
|
36
|
+
const extractWorkerVars = ({
|
|
37
|
+
workerConfig,
|
|
38
|
+
environment
|
|
39
|
+
}) => {
|
|
40
|
+
if (!environment_consts.ENVIRONMENT.includes(String(environment))) {
|
|
41
|
+
return workerConfig.vars || [];
|
|
42
|
+
}
|
|
43
|
+
return workerConfig.env[environment]?.vars || [];
|
|
44
|
+
};
|
|
36
45
|
const composeWorkerArguments = ({
|
|
37
46
|
resourceName,
|
|
38
47
|
entrypoint,
|
|
@@ -47,6 +56,7 @@ const composeWorkerArguments = ({
|
|
|
47
56
|
entrypoint,
|
|
48
57
|
compatibilityFlags: COMPATIBILITY_FLAGS,
|
|
49
58
|
compatibilityDate: COMPATIBILITY_DATE,
|
|
59
|
+
// TODO: Disable default logs and enable ours
|
|
50
60
|
observability: {
|
|
51
61
|
enabled: true
|
|
52
62
|
},
|
|
@@ -71,4 +81,5 @@ exports.R2_LOCATION_HINT = R2_LOCATION_HINT;
|
|
|
71
81
|
exports.R2_STORAGE_CLASS = R2_STORAGE_CLASS;
|
|
72
82
|
exports.composeWorkerArguments = composeWorkerArguments;
|
|
73
83
|
exports.extractWorkerCrons = extractWorkerCrons;
|
|
84
|
+
exports.extractWorkerVars = extractWorkerVars;
|
|
74
85
|
exports.loadWorkerConfig = loadWorkerConfig;
|
|
@@ -4,11 +4,17 @@ import { E as Environment } from './backend-sdk.CYcpgphg.js';
|
|
|
4
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
|
+
vars: {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
};
|
|
7
10
|
triggers: {
|
|
8
11
|
crons: string[];
|
|
9
12
|
};
|
|
10
13
|
env: {
|
|
11
14
|
[key: string]: {
|
|
15
|
+
vars: {
|
|
16
|
+
[key: string]: string;
|
|
17
|
+
};
|
|
12
18
|
triggers: {
|
|
13
19
|
crons: string[];
|
|
14
20
|
};
|
|
@@ -23,6 +29,12 @@ declare const extractWorkerCrons: ({ workerConfig, environment, }: {
|
|
|
23
29
|
workerConfig: WorkerConfig;
|
|
24
30
|
environment: Environment;
|
|
25
31
|
}) => string[];
|
|
32
|
+
declare const extractWorkerVars: ({ workerConfig, environment, }: {
|
|
33
|
+
workerConfig: WorkerConfig;
|
|
34
|
+
environment: Environment;
|
|
35
|
+
}) => {
|
|
36
|
+
[key: string]: string;
|
|
37
|
+
};
|
|
26
38
|
declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, domains, crons, bindings, eventSources, }: {
|
|
27
39
|
resourceName: string;
|
|
28
40
|
entrypoint: string;
|
|
@@ -53,5 +65,5 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, domai
|
|
|
53
65
|
bindings: Bindings | undefined;
|
|
54
66
|
};
|
|
55
67
|
|
|
56
|
-
export { composeWorkerArguments as c, extractWorkerCrons as e, loadWorkerConfig as l };
|
|
68
|
+
export { extractWorkerVars as a, composeWorkerArguments as c, extractWorkerCrons as e, loadWorkerConfig as l };
|
|
57
69
|
export type { Resource as R, WorkerType as W };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@develit-io/backend-sdk",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.30.1",
|
|
4
4
|
"description": "Develit Backend SDK",
|
|
5
5
|
"author": "Develit.io",
|
|
6
6
|
"license": "ISC",
|
|
@@ -38,19 +38,19 @@
|
|
|
38
38
|
"dist"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@cloudflare/workers-types": "4.
|
|
41
|
+
"@cloudflare/workers-types": "4.20251001.0",
|
|
42
42
|
"@std/path": "npm:@jsr/std__path",
|
|
43
43
|
"@std/text": "npm:@jsr/std__text",
|
|
44
|
-
"comment-json": "^4.
|
|
45
|
-
"drizzle-kit": "^0.31.
|
|
44
|
+
"comment-json": "^4.3.0",
|
|
45
|
+
"drizzle-kit": "^0.31.5",
|
|
46
46
|
"drizzle-orm": "^0.44.5",
|
|
47
47
|
"h3": "^1.15.4",
|
|
48
48
|
"http-status-codes": "2.3.0",
|
|
49
49
|
"superjson": "^2.2.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@develit-io/general-codes": "^1.
|
|
53
|
-
"alchemy": "^0.69.
|
|
52
|
+
"@develit-io/general-codes": "^1.14.0",
|
|
53
|
+
"alchemy": "^0.69.1",
|
|
54
54
|
"zod": "^4.1.8"
|
|
55
55
|
}
|
|
56
56
|
}
|