@develit-io/backend-sdk 5.26.5 → 5.27.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,7 @@
1
1
  'use strict';
2
2
 
3
- const worker = require('../shared/backend-sdk.DmI0NREG.cjs');
3
+ const worker = require('../shared/backend-sdk.Bx_rk73k.cjs');
4
+ const text = require('@std/text');
4
5
  const cloudflare = require('alchemy/cloudflare');
5
6
  const environment_consts = require('../shared/backend-sdk.BdcrYpFD.cjs');
6
7
  require('@std/path');
@@ -53,14 +54,14 @@ const composeIdentifierName = ({
53
54
  resource,
54
55
  resourceName
55
56
  }) => {
56
- return `${resourceName}-${resource}`;
57
+ return text.toKebabCase(`${resourceName}-${resource}`).toLowerCase();
57
58
  };
58
59
  const composeResourceName = ({
59
60
  project,
60
61
  environment,
61
62
  resourceName
62
63
  }) => {
63
- return `${project}-${resourceName}-${environment}`;
64
+ return text.toKebabCase(`${project}-${resourceName}-${environment}`).toLowerCase();
64
65
  };
65
66
 
66
67
  class Infrastructure {
@@ -140,6 +141,23 @@ class Infrastructure {
140
141
  })
141
142
  );
142
143
  }
144
+ /**
145
+ * Creates an instance of Cloudflare Durable Object.
146
+ */
147
+ async durableObject(options) {
148
+ const { className } = options;
149
+ return cloudflare.DurableObjectNamespace(
150
+ composeIdentifierName({
151
+ resourceName: className,
152
+ resource: "durable-object"
153
+ }),
154
+ {
155
+ // TODO: Create util
156
+ className: `${className}DurableObject`,
157
+ sqlite: true
158
+ }
159
+ );
160
+ }
143
161
  /**
144
162
  * Creates an instance of Cloudflare Worker.
145
163
  */
@@ -149,6 +167,7 @@ class Infrastructure {
149
167
  resource,
150
168
  path,
151
169
  domains,
170
+ assets,
152
171
  crons: _crons,
153
172
  bindings,
154
173
  eventSources
@@ -168,6 +187,7 @@ class Infrastructure {
168
187
  // TODO: Convert to util
169
188
  entrypoint: resource === "client" ? `${path}/server/index.mjs` : `${path}/src/index.ts`,
170
189
  domains,
190
+ assets,
171
191
  // crons:
172
192
  // crons ||
173
193
  // extractWorkerCrons({
@@ -213,13 +233,14 @@ class Infrastructure {
213
233
  * Creates an instance of Cloudflare Worker as a client.
214
234
  */
215
235
  async client(options) {
216
- const { resourceName, domains, bindings } = options;
236
+ const { resourceName, domains, assets, bindings } = options;
217
237
  return await this.worker({
218
238
  resourceName,
219
239
  resource: "client",
220
240
  // TODO: Convert to util
221
241
  path: `./apps/${resourceName}/.output`,
222
242
  domains,
243
+ assets,
223
244
  bindings
224
245
  });
225
246
  }
@@ -1,8 +1,8 @@
1
1
  import { P as Project } from '../shared/backend-sdk.B5vcbB2_.cjs';
2
2
  import { E as Environment } from '../shared/backend-sdk.D5vSybcI.cjs';
3
- import { KVNamespace, D1Database, Queue, R2Bucket, Bindings, Worker } from 'alchemy/cloudflare';
4
- import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.COZ8j4F5.cjs';
5
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.COZ8j4F5.cjs';
3
+ import { KVNamespace, D1Database, Queue, R2Bucket, DurableObjectNamespace, Bindings, Worker } from 'alchemy/cloudflare';
4
+ import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.Cd67M26h.cjs';
5
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.Cd67M26h.cjs';
6
6
 
7
7
  declare class Infrastructure {
8
8
  private project;
@@ -59,6 +59,15 @@ declare class Infrastructure {
59
59
  */
60
60
  storageClass?: 'Standard' | 'InfrequentAccess';
61
61
  }): Promise<R2Bucket>;
62
+ /**
63
+ * Creates an instance of Cloudflare Durable Object.
64
+ */
65
+ durableObject(options: {
66
+ /**
67
+ * Name of the Durable Object class. Do not include the 'durable-object' or 'do' prefix.
68
+ */
69
+ className: string;
70
+ }): Promise<DurableObjectNamespace<any>>;
62
71
  /**
63
72
  * Creates an instance of Cloudflare Worker.
64
73
  */
@@ -79,6 +88,10 @@ declare class Infrastructure {
79
88
  * Custom domains to bind to the Worker.
80
89
  */
81
90
  domains?: string[];
91
+ /**
92
+ * Static assets of the Worker.
93
+ */
94
+ assets?: Bindings;
82
95
  /**
83
96
  * Cron expressions for the trigger of the Worker.
84
97
  */
@@ -142,6 +155,10 @@ declare class Infrastructure {
142
155
  * Custom domains to bind to the Worker.
143
156
  */
144
157
  domains?: string[];
158
+ /**
159
+ * Static assets of the Worker.
160
+ */
161
+ assets?: Bindings;
145
162
  /**
146
163
  * Bindings of the Worker.
147
164
  */
@@ -1,8 +1,8 @@
1
1
  import { P as Project } from '../shared/backend-sdk.B5vcbB2_.mjs';
2
2
  import { E as Environment } from '../shared/backend-sdk.D5vSybcI.mjs';
3
- import { KVNamespace, D1Database, Queue, R2Bucket, Bindings, Worker } from 'alchemy/cloudflare';
4
- import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.zF_pNSIO.mjs';
5
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.zF_pNSIO.mjs';
3
+ import { KVNamespace, D1Database, Queue, R2Bucket, DurableObjectNamespace, Bindings, Worker } from 'alchemy/cloudflare';
4
+ import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.DhyrRk3x.mjs';
5
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.DhyrRk3x.mjs';
6
6
 
7
7
  declare class Infrastructure {
8
8
  private project;
@@ -59,6 +59,15 @@ declare class Infrastructure {
59
59
  */
60
60
  storageClass?: 'Standard' | 'InfrequentAccess';
61
61
  }): Promise<R2Bucket>;
62
+ /**
63
+ * Creates an instance of Cloudflare Durable Object.
64
+ */
65
+ durableObject(options: {
66
+ /**
67
+ * Name of the Durable Object class. Do not include the 'durable-object' or 'do' prefix.
68
+ */
69
+ className: string;
70
+ }): Promise<DurableObjectNamespace<any>>;
62
71
  /**
63
72
  * Creates an instance of Cloudflare Worker.
64
73
  */
@@ -79,6 +88,10 @@ declare class Infrastructure {
79
88
  * Custom domains to bind to the Worker.
80
89
  */
81
90
  domains?: string[];
91
+ /**
92
+ * Static assets of the Worker.
93
+ */
94
+ assets?: Bindings;
82
95
  /**
83
96
  * Cron expressions for the trigger of the Worker.
84
97
  */
@@ -142,6 +155,10 @@ declare class Infrastructure {
142
155
  * Custom domains to bind to the Worker.
143
156
  */
144
157
  domains?: string[];
158
+ /**
159
+ * Static assets of the Worker.
160
+ */
161
+ assets?: Bindings;
145
162
  /**
146
163
  * Bindings of the Worker.
147
164
  */
@@ -1,8 +1,8 @@
1
1
  import { P as Project } from '../shared/backend-sdk.B5vcbB2_.js';
2
2
  import { E as Environment } from '../shared/backend-sdk.D5vSybcI.js';
3
- import { KVNamespace, D1Database, Queue, R2Bucket, Bindings, Worker } from 'alchemy/cloudflare';
4
- import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.umOsvljz.js';
5
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.umOsvljz.js';
3
+ import { KVNamespace, D1Database, Queue, R2Bucket, DurableObjectNamespace, Bindings, Worker } from 'alchemy/cloudflare';
4
+ import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.DGKSH7tj.js';
5
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.DGKSH7tj.js';
6
6
 
7
7
  declare class Infrastructure {
8
8
  private project;
@@ -59,6 +59,15 @@ declare class Infrastructure {
59
59
  */
60
60
  storageClass?: 'Standard' | 'InfrequentAccess';
61
61
  }): Promise<R2Bucket>;
62
+ /**
63
+ * Creates an instance of Cloudflare Durable Object.
64
+ */
65
+ durableObject(options: {
66
+ /**
67
+ * Name of the Durable Object class. Do not include the 'durable-object' or 'do' prefix.
68
+ */
69
+ className: string;
70
+ }): Promise<DurableObjectNamespace<any>>;
62
71
  /**
63
72
  * Creates an instance of Cloudflare Worker.
64
73
  */
@@ -79,6 +88,10 @@ declare class Infrastructure {
79
88
  * Custom domains to bind to the Worker.
80
89
  */
81
90
  domains?: string[];
91
+ /**
92
+ * Static assets of the Worker.
93
+ */
94
+ assets?: Bindings;
82
95
  /**
83
96
  * Cron expressions for the trigger of the Worker.
84
97
  */
@@ -142,6 +155,10 @@ declare class Infrastructure {
142
155
  * Custom domains to bind to the Worker.
143
156
  */
144
157
  domains?: string[];
158
+ /**
159
+ * Static assets of the Worker.
160
+ */
161
+ assets?: Bindings;
145
162
  /**
146
163
  * Bindings of the Worker.
147
164
  */
@@ -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, d as R2_JURISDICTION, c as composeWorkerArguments } from '../shared/backend-sdk.UXVziNMz.mjs';
2
- export { e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.UXVziNMz.mjs';
3
- import { KVNamespace, D1Database, Queue, R2Bucket, Worker } from 'alchemy/cloudflare';
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, c as composeWorkerArguments } from '../shared/backend-sdk.DbpLyXGp.mjs';
2
+ export { e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.DbpLyXGp.mjs';
3
+ import { toKebabCase } from '@std/text';
4
+ import { KVNamespace, D1Database, Queue, R2Bucket, DurableObjectNamespace, Worker } from 'alchemy/cloudflare';
4
5
  import { E as ENVIRONMENT } from '../shared/backend-sdk.DXRpnctc.mjs';
5
6
  import '@std/path';
6
7
  import 'comment-json';
@@ -52,14 +53,14 @@ const composeIdentifierName = ({
52
53
  resource,
53
54
  resourceName
54
55
  }) => {
55
- return `${resourceName}-${resource}`;
56
+ return toKebabCase(`${resourceName}-${resource}`).toLowerCase();
56
57
  };
57
58
  const composeResourceName = ({
58
59
  project,
59
60
  environment,
60
61
  resourceName
61
62
  }) => {
62
- return `${project}-${resourceName}-${environment}`;
63
+ return toKebabCase(`${project}-${resourceName}-${environment}`).toLowerCase();
63
64
  };
64
65
 
65
66
  class Infrastructure {
@@ -139,6 +140,23 @@ class Infrastructure {
139
140
  })
140
141
  );
141
142
  }
143
+ /**
144
+ * Creates an instance of Cloudflare Durable Object.
145
+ */
146
+ async durableObject(options) {
147
+ const { className } = options;
148
+ return DurableObjectNamespace(
149
+ composeIdentifierName({
150
+ resourceName: className,
151
+ resource: "durable-object"
152
+ }),
153
+ {
154
+ // TODO: Create util
155
+ className: `${className}DurableObject`,
156
+ sqlite: true
157
+ }
158
+ );
159
+ }
142
160
  /**
143
161
  * Creates an instance of Cloudflare Worker.
144
162
  */
@@ -148,6 +166,7 @@ class Infrastructure {
148
166
  resource,
149
167
  path,
150
168
  domains,
169
+ assets,
151
170
  crons: _crons,
152
171
  bindings,
153
172
  eventSources
@@ -167,6 +186,7 @@ class Infrastructure {
167
186
  // TODO: Convert to util
168
187
  entrypoint: resource === "client" ? `${path}/server/index.mjs` : `${path}/src/index.ts`,
169
188
  domains,
189
+ assets,
170
190
  // crons:
171
191
  // crons ||
172
192
  // extractWorkerCrons({
@@ -212,13 +232,14 @@ class Infrastructure {
212
232
  * Creates an instance of Cloudflare Worker as a client.
213
233
  */
214
234
  async client(options) {
215
- const { resourceName, domains, bindings } = options;
235
+ const { resourceName, domains, assets, bindings } = options;
216
236
  return await this.worker({
217
237
  resourceName,
218
238
  resource: "client",
219
239
  // TODO: Convert to util
220
240
  path: `./apps/${resourceName}/.output`,
221
241
  domains,
242
+ assets,
222
243
  bindings
223
244
  });
224
245
  }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const worker = require('../shared/backend-sdk.DmI0NREG.cjs');
3
+ const worker = require('../shared/backend-sdk.Bx_rk73k.cjs');
4
4
  require('../shared/backend-sdk.BdcrYpFD.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.COZ8j4F5.cjs';
1
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.Cd67M26h.cjs';
2
2
  import 'alchemy/cloudflare';
3
3
  import '../shared/backend-sdk.D5vSybcI.cjs';
@@ -1,3 +1,3 @@
1
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.zF_pNSIO.mjs';
1
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.DhyrRk3x.mjs';
2
2
  import 'alchemy/cloudflare';
3
3
  import '../shared/backend-sdk.D5vSybcI.mjs';
@@ -1,3 +1,3 @@
1
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.umOsvljz.js';
1
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.DGKSH7tj.js';
2
2
  import 'alchemy/cloudflare';
3
3
  import '../shared/backend-sdk.D5vSybcI.js';
@@ -1,4 +1,4 @@
1
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.UXVziNMz.mjs';
1
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.DbpLyXGp.mjs';
2
2
  import '../shared/backend-sdk.DXRpnctc.mjs';
3
3
  import '@std/path';
4
4
  import 'comment-json';
@@ -38,6 +38,7 @@ const extractWorkerCrons = ({
38
38
  const composeWorkerArguments = ({
39
39
  resourceName,
40
40
  entrypoint,
41
+ assets,
41
42
  domains = [],
42
43
  crons = [],
43
44
  bindings,
@@ -52,6 +53,7 @@ const composeWorkerArguments = ({
52
53
  enabled: true
53
54
  },
54
55
  url: false,
56
+ assets,
55
57
  domains,
56
58
  eventSources,
57
59
  crons,
@@ -1,7 +1,7 @@
1
1
  import { Bindings, Queue } from 'alchemy/cloudflare';
2
2
  import { E as Environment } from './backend-sdk.D5vSybcI.cjs';
3
3
 
4
- type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator' | 'client';
4
+ type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'durable-object' | 'worker' | 'service' | 'orchestrator' | 'client';
5
5
  type WorkerType = 'service' | 'orchestrator' | 'client';
6
6
  interface WorkerConfig {
7
7
  triggers: {
@@ -23,9 +23,10 @@ declare const extractWorkerCrons: ({ workerConfig, environment, }: {
23
23
  workerConfig: WorkerConfig;
24
24
  environment: Environment;
25
25
  }) => string[];
26
- declare const composeWorkerArguments: ({ resourceName, entrypoint, domains, crons, bindings, eventSources, }: {
26
+ declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, domains, crons, bindings, eventSources, }: {
27
27
  resourceName: string;
28
28
  entrypoint: string;
29
+ assets?: Bindings;
29
30
  domains?: string[];
30
31
  crons?: string[];
31
32
  bindings?: Bindings;
@@ -39,6 +40,7 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, domains, cron
39
40
  enabled: true;
40
41
  };
41
42
  url: false;
43
+ assets: Bindings | undefined;
42
44
  domains: string[];
43
45
  eventSources: Queue[];
44
46
  crons: string[];
@@ -1,7 +1,7 @@
1
1
  import { Bindings, Queue } from 'alchemy/cloudflare';
2
2
  import { E as Environment } from './backend-sdk.D5vSybcI.js';
3
3
 
4
- type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator' | 'client';
4
+ type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'durable-object' | 'worker' | 'service' | 'orchestrator' | 'client';
5
5
  type WorkerType = 'service' | 'orchestrator' | 'client';
6
6
  interface WorkerConfig {
7
7
  triggers: {
@@ -23,9 +23,10 @@ declare const extractWorkerCrons: ({ workerConfig, environment, }: {
23
23
  workerConfig: WorkerConfig;
24
24
  environment: Environment;
25
25
  }) => string[];
26
- declare const composeWorkerArguments: ({ resourceName, entrypoint, domains, crons, bindings, eventSources, }: {
26
+ declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, domains, crons, bindings, eventSources, }: {
27
27
  resourceName: string;
28
28
  entrypoint: string;
29
+ assets?: Bindings;
29
30
  domains?: string[];
30
31
  crons?: string[];
31
32
  bindings?: Bindings;
@@ -39,6 +40,7 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, domains, cron
39
40
  enabled: true;
40
41
  };
41
42
  url: false;
43
+ assets: Bindings | undefined;
42
44
  domains: string[];
43
45
  eventSources: Queue[];
44
46
  crons: string[];
@@ -36,6 +36,7 @@ const extractWorkerCrons = ({
36
36
  const composeWorkerArguments = ({
37
37
  resourceName,
38
38
  entrypoint,
39
+ assets,
39
40
  domains = [],
40
41
  crons = [],
41
42
  bindings,
@@ -50,6 +51,7 @@ const composeWorkerArguments = ({
50
51
  enabled: true
51
52
  },
52
53
  url: false,
54
+ assets,
53
55
  domains,
54
56
  eventSources,
55
57
  crons,
@@ -1,7 +1,7 @@
1
1
  import { Bindings, Queue } from 'alchemy/cloudflare';
2
2
  import { E as Environment } from './backend-sdk.D5vSybcI.mjs';
3
3
 
4
- type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator' | 'client';
4
+ type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'durable-object' | 'worker' | 'service' | 'orchestrator' | 'client';
5
5
  type WorkerType = 'service' | 'orchestrator' | 'client';
6
6
  interface WorkerConfig {
7
7
  triggers: {
@@ -23,9 +23,10 @@ declare const extractWorkerCrons: ({ workerConfig, environment, }: {
23
23
  workerConfig: WorkerConfig;
24
24
  environment: Environment;
25
25
  }) => string[];
26
- declare const composeWorkerArguments: ({ resourceName, entrypoint, domains, crons, bindings, eventSources, }: {
26
+ declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, domains, crons, bindings, eventSources, }: {
27
27
  resourceName: string;
28
28
  entrypoint: string;
29
+ assets?: Bindings;
29
30
  domains?: string[];
30
31
  crons?: string[];
31
32
  bindings?: Bindings;
@@ -39,6 +40,7 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, domains, cron
39
40
  enabled: true;
40
41
  };
41
42
  url: false;
43
+ assets: Bindings | undefined;
42
44
  domains: string[];
43
45
  eventSources: Queue[];
44
46
  crons: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-io/backend-sdk",
3
- "version": "5.26.5",
3
+ "version": "5.27.0",
4
4
  "description": "Develit Backend SDK",
5
5
  "author": "Develit.io",
6
6
  "license": "ISC",