@develit-io/backend-sdk 5.30.0 → 5.30.2

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,18 +1,12 @@
1
1
  'use strict';
2
2
 
3
- const worker = require('../shared/backend-sdk.DEE4fXCZ.cjs');
3
+ const worker = require('../shared/backend-sdk.Vru_rcK6.cjs');
4
4
  const text = require('@std/text');
5
5
  const cloudflare = require('alchemy/cloudflare');
6
- const environment_consts = require('../shared/backend-sdk.ClVQ4AzB.cjs');
7
- const alchemy = require('alchemy');
8
- const state = require('alchemy/state');
6
+ require('../shared/backend-sdk.BdcrYpFD.cjs');
9
7
  require('@std/path');
10
8
  require('comment-json');
11
9
 
12
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
13
-
14
- const alchemy__default = /*#__PURE__*/_interopDefaultCompat(alchemy);
15
-
16
10
  const composeD1Arguments = ({
17
11
  resourceName
18
12
  }) => {
@@ -90,26 +84,19 @@ class Deployment {
90
84
  project;
91
85
  environment;
92
86
  // TODO: Check if the type is most correct
93
- alchemy;
87
+ // TODO: Keeping this in class creates issues with destroy
88
+ // public alchemy: Promise<Awaited<ReturnType<typeof alchemy>>>
94
89
  constructor({ project }) {
95
90
  this.project = project;
96
91
  this.environment = Bun.env.ENVIRONMENT || "unknown";
97
- this.alchemy = alchemy__default(project, {
98
- stateStore: (scope) => {
99
- return new state.CloudflareStateStore(scope, {
100
- scriptName: environment_consts.ALCHEMY_STATE_STORE
101
- });
102
- },
103
- // TODO: Convert to a util
104
- stage: Bun.env.ENVIRONMENT || "unknown"
105
- });
106
92
  }
93
+ // TODO: Keeping this in class creates issues with destroy
107
94
  /**
108
95
  * Finalizes the deployment and correctly quits the Alchemy process.
109
96
  */
110
- async finalize() {
111
- return (await this.alchemy).finalize();
112
- }
97
+ // async finalize() {
98
+ // return (await this.alchemy).finalize()
99
+ // }
113
100
  /**
114
101
  * Creates an instance of Cloudflare KV.
115
102
  */
@@ -238,6 +225,18 @@ class Deployment {
238
225
  resource: resource || "worker"
239
226
  });
240
227
  const workerConfig = await worker.loadWorkerConfig({ path });
228
+ const vars = worker.extractWorkerVars({
229
+ workerConfig,
230
+ environment: this.environment
231
+ });
232
+ for (const key in vars) {
233
+ const value = vars[key];
234
+ switch (typeof value) {
235
+ case "object":
236
+ vars[key] = JSON.stringify(value);
237
+ break;
238
+ }
239
+ }
241
240
  const consumers = eventSources?.map((queue) => {
242
241
  return {
243
242
  queue,
@@ -269,10 +268,7 @@ class Deployment {
269
268
  }),
270
269
  bindings: {
271
270
  ...bindings,
272
- ...worker.extractWorkerVars({
273
- workerConfig,
274
- environment: this.environment
275
- })
271
+ ...vars
276
272
  },
277
273
  eventSources: consumers
278
274
  })
@@ -4,19 +4,16 @@ import { P as Project } from '../shared/backend-sdk.CP78x0gl.cjs';
4
4
  import { E as Environment } from '../shared/backend-sdk.CYcpgphg.cjs';
5
5
  import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.CdngrAa0.cjs';
6
6
  export { c as composeWorkerArguments, e as extractWorkerCrons, a as extractWorkerVars, l as loadWorkerConfig } from '../shared/backend-sdk.CdngrAa0.cjs';
7
- import alchemy from 'alchemy';
8
7
 
9
8
  declare class Deployment {
10
9
  project: Project;
11
10
  environment: Environment;
12
- alchemy: Promise<Awaited<ReturnType<typeof alchemy>>>;
13
11
  constructor({ project }: {
14
12
  project: Project;
15
13
  });
16
14
  /**
17
15
  * Finalizes the deployment and correctly quits the Alchemy process.
18
16
  */
19
- finalize(): Promise<void>;
20
17
  /**
21
18
  * Creates an instance of Cloudflare KV.
22
19
  */
@@ -4,19 +4,16 @@ import { P as Project } from '../shared/backend-sdk.CP78x0gl.mjs';
4
4
  import { E as Environment } from '../shared/backend-sdk.CYcpgphg.mjs';
5
5
  import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.C-0xIdM4.mjs';
6
6
  export { c as composeWorkerArguments, e as extractWorkerCrons, a as extractWorkerVars, l as loadWorkerConfig } from '../shared/backend-sdk.C-0xIdM4.mjs';
7
- import alchemy from 'alchemy';
8
7
 
9
8
  declare class Deployment {
10
9
  project: Project;
11
10
  environment: Environment;
12
- alchemy: Promise<Awaited<ReturnType<typeof alchemy>>>;
13
11
  constructor({ project }: {
14
12
  project: Project;
15
13
  });
16
14
  /**
17
15
  * Finalizes the deployment and correctly quits the Alchemy process.
18
16
  */
19
- finalize(): Promise<void>;
20
17
  /**
21
18
  * Creates an instance of Cloudflare KV.
22
19
  */
@@ -4,19 +4,16 @@ import { P as Project } from '../shared/backend-sdk.CP78x0gl.js';
4
4
  import { E as Environment } from '../shared/backend-sdk.CYcpgphg.js';
5
5
  import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.qPzlx18G.js';
6
6
  export { c as composeWorkerArguments, e as extractWorkerCrons, a as extractWorkerVars, l as loadWorkerConfig } from '../shared/backend-sdk.qPzlx18G.js';
7
- import alchemy from 'alchemy';
8
7
 
9
8
  declare class Deployment {
10
9
  project: Project;
11
10
  environment: Environment;
12
- alchemy: Promise<Awaited<ReturnType<typeof alchemy>>>;
13
11
  constructor({ project }: {
14
12
  project: Project;
15
13
  });
16
14
  /**
17
15
  * Finalizes the deployment and correctly quits the Alchemy process.
18
16
  */
19
- finalize(): Promise<void>;
20
17
  /**
21
18
  * Creates an instance of Cloudflare KV.
22
19
  */
@@ -1,9 +1,7 @@
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.c1cEUEGX.mjs';
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, a as extractWorkerVars, g as QUEUE_MAX_BATCH_TIMEOUT, h as QUEUE_MAX_BATCH_SIZE, c as composeWorkerArguments, 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 { A as ALCHEMY_STATE_STORE } from '../shared/backend-sdk.BIVnu5aA.mjs';
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
 
@@ -84,26 +82,19 @@ class Deployment {
84
82
  project;
85
83
  environment;
86
84
  // TODO: Check if the type is most correct
87
- alchemy;
85
+ // TODO: Keeping this in class creates issues with destroy
86
+ // public alchemy: Promise<Awaited<ReturnType<typeof alchemy>>>
88
87
  constructor({ project }) {
89
88
  this.project = project;
90
89
  this.environment = Bun.env.ENVIRONMENT || "unknown";
91
- this.alchemy = alchemy(project, {
92
- stateStore: (scope) => {
93
- return new CloudflareStateStore(scope, {
94
- scriptName: ALCHEMY_STATE_STORE
95
- });
96
- },
97
- // TODO: Convert to a util
98
- stage: Bun.env.ENVIRONMENT || "unknown"
99
- });
100
90
  }
91
+ // TODO: Keeping this in class creates issues with destroy
101
92
  /**
102
93
  * Finalizes the deployment and correctly quits the Alchemy process.
103
94
  */
104
- async finalize() {
105
- return (await this.alchemy).finalize();
106
- }
95
+ // async finalize() {
96
+ // return (await this.alchemy).finalize()
97
+ // }
107
98
  /**
108
99
  * Creates an instance of Cloudflare KV.
109
100
  */
@@ -232,6 +223,18 @@ class Deployment {
232
223
  resource: resource || "worker"
233
224
  });
234
225
  const workerConfig = await loadWorkerConfig({ path });
226
+ const vars = extractWorkerVars({
227
+ workerConfig,
228
+ environment: this.environment
229
+ });
230
+ for (const key in vars) {
231
+ const value = vars[key];
232
+ switch (typeof value) {
233
+ case "object":
234
+ vars[key] = JSON.stringify(value);
235
+ break;
236
+ }
237
+ }
235
238
  const consumers = eventSources?.map((queue) => {
236
239
  return {
237
240
  queue,
@@ -263,10 +266,7 @@ class Deployment {
263
266
  }),
264
267
  bindings: {
265
268
  ...bindings,
266
- ...extractWorkerVars({
267
- workerConfig,
268
- environment: this.environment
269
- })
269
+ ...vars
270
270
  },
271
271
  eventSources: consumers
272
272
  })
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.ClVQ4AzB.cjs');
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.BIVnu5aA.mjs';
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';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const worker = require('../shared/backend-sdk.DEE4fXCZ.cjs');
4
- require('../shared/backend-sdk.ClVQ4AzB.cjs');
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
 
@@ -1,4 +1,4 @@
1
- export { c as composeWorkerArguments, e as extractWorkerCrons, a as extractWorkerVars, l as loadWorkerConfig } from '../shared/backend-sdk.c1cEUEGX.mjs';
2
- import '../shared/backend-sdk.BIVnu5aA.mjs';
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';
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
3
  const ENVIRONMENT = ["dev", "test", "staging", "production"];
4
- const ALCHEMY_STATE_STORE = "develit-alchemy-state";
5
4
 
6
- exports.ALCHEMY_STATE_STORE = ALCHEMY_STATE_STORE;
7
5
  exports.ENVIRONMENT = ENVIRONMENT;
@@ -0,0 +1,3 @@
1
+ const ENVIRONMENT = ["dev", "test", "staging", "production"];
2
+
3
+ export { ENVIRONMENT as E };
@@ -1,4 +1,4 @@
1
- import { E as ENVIRONMENT } from './backend-sdk.BIVnu5aA.mjs';
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
 
@@ -54,6 +54,7 @@ const composeWorkerArguments = ({
54
54
  entrypoint,
55
55
  compatibilityFlags: COMPATIBILITY_FLAGS,
56
56
  compatibilityDate: COMPATIBILITY_DATE,
57
+ // TODO: Disable default logs and enable ours
57
58
  observability: {
58
59
  enabled: true
59
60
  },
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const environment_consts = require('./backend-sdk.ClVQ4AzB.cjs');
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
 
@@ -56,6 +56,7 @@ const composeWorkerArguments = ({
56
56
  entrypoint,
57
57
  compatibilityFlags: COMPATIBILITY_FLAGS,
58
58
  compatibilityDate: COMPATIBILITY_DATE,
59
+ // TODO: Disable default logs and enable ours
59
60
  observability: {
60
61
  enabled: true
61
62
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-io/backend-sdk",
3
- "version": "5.30.0",
3
+ "version": "5.30.2",
4
4
  "description": "Develit Backend SDK",
5
5
  "author": "Develit.io",
6
6
  "license": "ISC",
@@ -1,4 +0,0 @@
1
- const ENVIRONMENT = ["dev", "test", "staging", "production"];
2
- const ALCHEMY_STATE_STORE = "develit-alchemy-state";
3
-
4
- export { ALCHEMY_STATE_STORE as A, ENVIRONMENT as E };