@develit-io/backend-sdk 5.25.0 → 5.26.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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const worker = require('../shared/backend-sdk.DY2PE5z-.cjs');
3
+ const worker = require('../shared/backend-sdk.DRtTRYdh.cjs');
4
4
  const cloudflare = require('alchemy/cloudflare');
5
5
  const environment_consts = require('../shared/backend-sdk.BdcrYpFD.cjs');
6
6
  require('@std/path');
@@ -144,7 +144,15 @@ class Infrastructure {
144
144
  * Creates an instance of Cloudflare Worker.
145
145
  */
146
146
  async worker(options) {
147
- const { resourceName, resource, path, crons, bindings, eventSources } = options;
147
+ const {
148
+ resourceName,
149
+ resource,
150
+ path,
151
+ assets,
152
+ crons,
153
+ bindings,
154
+ eventSources
155
+ } = options;
148
156
  const identifierName = composeIdentifierName({
149
157
  resourceName,
150
158
  resource: resource || "worker"
@@ -160,6 +168,7 @@ class Infrastructure {
160
168
  }),
161
169
  // TODO: Convert to util
162
170
  entrypoint: `${path}/src/index.ts`,
171
+ assets,
163
172
  crons: crons || worker.extractWorkerCrons({
164
173
  workerConfig,
165
174
  environment: this.environment
@@ -197,6 +206,20 @@ class Infrastructure {
197
206
  eventSources
198
207
  });
199
208
  }
209
+ /**
210
+ * Creates an instance of Cloudflare Worker as a client.
211
+ */
212
+ async client(options) {
213
+ const { resourceName, assets, bindings } = options;
214
+ return await this.worker({
215
+ resourceName,
216
+ resource: "client",
217
+ // TODO: Convert to util
218
+ path: `./apps/${resourceName}/.output`,
219
+ assets,
220
+ bindings
221
+ });
222
+ }
200
223
  }
201
224
 
202
225
  const validateEnvironment = (environment) => {
@@ -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
3
  import { KVNamespace, D1Database, Queue, R2Bucket, Bindings, Worker } from 'alchemy/cloudflare';
4
- import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.B3VLuILe.cjs';
5
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.B3VLuILe.cjs';
4
+ import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.DCTuTktG.cjs';
5
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.DCTuTktG.cjs';
6
6
 
7
7
  declare class Infrastructure {
8
8
  private project;
@@ -75,6 +75,10 @@ declare class Infrastructure {
75
75
  * Path to the root of the Worker.
76
76
  */
77
77
  path: string;
78
+ /**
79
+ * Static assets of the Worker.
80
+ */
81
+ assets?: Bindings;
78
82
  /**
79
83
  * Cron expressions for the trigger of the Worker.
80
84
  */
@@ -122,6 +126,23 @@ declare class Infrastructure {
122
126
  */
123
127
  eventSources?: Queue[];
124
128
  }): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
129
+ /**
130
+ * Creates an instance of Cloudflare Worker as a client.
131
+ */
132
+ client(options: {
133
+ /**
134
+ * Name of the client. Do not include the 'client' prefix.
135
+ */
136
+ resourceName: string;
137
+ /**
138
+ * Static assets of the Worker.
139
+ */
140
+ assets?: Bindings;
141
+ /**
142
+ * Bindings of the Worker.
143
+ */
144
+ bindings?: Bindings;
145
+ }): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
125
146
  }
126
147
 
127
148
  declare const composeD1Arguments: ({ resourceName, }: {
@@ -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
3
  import { KVNamespace, D1Database, Queue, R2Bucket, Bindings, Worker } from 'alchemy/cloudflare';
4
- import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.CHNezj3A.mjs';
5
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.CHNezj3A.mjs';
4
+ import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.C-MJGcqQ.mjs';
5
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.C-MJGcqQ.mjs';
6
6
 
7
7
  declare class Infrastructure {
8
8
  private project;
@@ -75,6 +75,10 @@ declare class Infrastructure {
75
75
  * Path to the root of the Worker.
76
76
  */
77
77
  path: string;
78
+ /**
79
+ * Static assets of the Worker.
80
+ */
81
+ assets?: Bindings;
78
82
  /**
79
83
  * Cron expressions for the trigger of the Worker.
80
84
  */
@@ -122,6 +126,23 @@ declare class Infrastructure {
122
126
  */
123
127
  eventSources?: Queue[];
124
128
  }): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
129
+ /**
130
+ * Creates an instance of Cloudflare Worker as a client.
131
+ */
132
+ client(options: {
133
+ /**
134
+ * Name of the client. Do not include the 'client' prefix.
135
+ */
136
+ resourceName: string;
137
+ /**
138
+ * Static assets of the Worker.
139
+ */
140
+ assets?: Bindings;
141
+ /**
142
+ * Bindings of the Worker.
143
+ */
144
+ bindings?: Bindings;
145
+ }): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
125
146
  }
126
147
 
127
148
  declare const composeD1Arguments: ({ resourceName, }: {
@@ -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
3
  import { KVNamespace, D1Database, Queue, R2Bucket, Bindings, Worker } from 'alchemy/cloudflare';
4
- import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.7SCu5aVl.js';
5
- export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.7SCu5aVl.js';
4
+ import { W as WorkerType$1, R as Resource } from '../shared/backend-sdk.CNwKOme4.js';
5
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.CNwKOme4.js';
6
6
 
7
7
  declare class Infrastructure {
8
8
  private project;
@@ -75,6 +75,10 @@ declare class Infrastructure {
75
75
  * Path to the root of the Worker.
76
76
  */
77
77
  path: string;
78
+ /**
79
+ * Static assets of the Worker.
80
+ */
81
+ assets?: Bindings;
78
82
  /**
79
83
  * Cron expressions for the trigger of the Worker.
80
84
  */
@@ -122,6 +126,23 @@ declare class Infrastructure {
122
126
  */
123
127
  eventSources?: Queue[];
124
128
  }): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
129
+ /**
130
+ * Creates an instance of Cloudflare Worker as a client.
131
+ */
132
+ client(options: {
133
+ /**
134
+ * Name of the client. Do not include the 'client' prefix.
135
+ */
136
+ resourceName: string;
137
+ /**
138
+ * Static assets of the Worker.
139
+ */
140
+ assets?: Bindings;
141
+ /**
142
+ * Bindings of the Worker.
143
+ */
144
+ bindings?: Bindings;
145
+ }): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
125
146
  }
126
147
 
127
148
  declare const composeD1Arguments: ({ resourceName, }: {
@@ -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 } from '../shared/backend-sdk.BTl8Iida.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, c as composeWorkerArguments, e as extractWorkerCrons } from '../shared/backend-sdk.670b7XEP.mjs';
2
2
  import { KVNamespace, D1Database, Queue, R2Bucket, Worker } from 'alchemy/cloudflare';
3
3
  import { E as ENVIRONMENT } from '../shared/backend-sdk.DXRpnctc.mjs';
4
4
  import '@std/path';
@@ -142,7 +142,15 @@ class Infrastructure {
142
142
  * Creates an instance of Cloudflare Worker.
143
143
  */
144
144
  async worker(options) {
145
- const { resourceName, resource, path, crons, bindings, eventSources } = options;
145
+ const {
146
+ resourceName,
147
+ resource,
148
+ path,
149
+ assets,
150
+ crons,
151
+ bindings,
152
+ eventSources
153
+ } = options;
146
154
  const identifierName = composeIdentifierName({
147
155
  resourceName,
148
156
  resource: resource || "worker"
@@ -158,6 +166,7 @@ class Infrastructure {
158
166
  }),
159
167
  // TODO: Convert to util
160
168
  entrypoint: `${path}/src/index.ts`,
169
+ assets,
161
170
  crons: crons || extractWorkerCrons({
162
171
  workerConfig,
163
172
  environment: this.environment
@@ -195,6 +204,20 @@ class Infrastructure {
195
204
  eventSources
196
205
  });
197
206
  }
207
+ /**
208
+ * Creates an instance of Cloudflare Worker as a client.
209
+ */
210
+ async client(options) {
211
+ const { resourceName, assets, bindings } = options;
212
+ return await this.worker({
213
+ resourceName,
214
+ resource: "client",
215
+ // TODO: Convert to util
216
+ path: `./apps/${resourceName}/.output`,
217
+ assets,
218
+ bindings
219
+ });
220
+ }
198
221
  }
199
222
 
200
223
  const validateEnvironment = (environment) => {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const worker = require('../shared/backend-sdk.DY2PE5z-.cjs');
3
+ const worker = require('../shared/backend-sdk.DRtTRYdh.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.B3VLuILe.cjs';
1
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.DCTuTktG.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.CHNezj3A.mjs';
1
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.C-MJGcqQ.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.7SCu5aVl.js';
1
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.CNwKOme4.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.BTl8Iida.mjs';
1
+ export { c as composeWorkerArguments, e as extractWorkerCrons, l as loadWorkerConfig } from '../shared/backend-sdk.670b7XEP.mjs';
2
2
  import '../shared/backend-sdk.DXRpnctc.mjs';
3
3
  import '@std/path';
4
4
  import 'comment-json';
@@ -31,6 +31,7 @@ const extractWorkerCrons = ({
31
31
  const composeWorkerArguments = ({
32
32
  resourceName,
33
33
  entrypoint,
34
+ assets,
34
35
  crons = [],
35
36
  bindings,
36
37
  eventSources = []
@@ -45,8 +46,9 @@ const composeWorkerArguments = ({
45
46
  },
46
47
  url: false,
47
48
  eventSources,
48
- bindings,
49
- crons
49
+ assets,
50
+ crons,
51
+ bindings
50
52
  };
51
53
  };
52
54
 
@@ -1,8 +1,8 @@
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';
5
- type WorkerType = 'service' | 'orchestrator';
4
+ type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator' | 'client';
5
+ type WorkerType = 'service' | 'orchestrator' | 'client';
6
6
  interface WorkerConfig {
7
7
  triggers: {
8
8
  crons: string[];
@@ -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, crons, bindings, eventSources, }: {
26
+ declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, crons, bindings, eventSources, }: {
27
27
  resourceName: string;
28
28
  entrypoint: string;
29
+ assets?: Bindings;
29
30
  crons?: string[];
30
31
  bindings?: Bindings;
31
32
  eventSources?: Queue[];
@@ -39,8 +40,9 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, crons, bindin
39
40
  };
40
41
  url: false;
41
42
  eventSources: Queue[];
42
- bindings: Bindings | undefined;
43
+ assets: Bindings | undefined;
43
44
  crons: string[];
45
+ bindings: Bindings | undefined;
44
46
  };
45
47
 
46
48
  export { composeWorkerArguments as c, extractWorkerCrons as e, loadWorkerConfig as l };
@@ -1,8 +1,8 @@
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';
5
- type WorkerType = 'service' | 'orchestrator';
4
+ type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator' | 'client';
5
+ type WorkerType = 'service' | 'orchestrator' | 'client';
6
6
  interface WorkerConfig {
7
7
  triggers: {
8
8
  crons: string[];
@@ -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, crons, bindings, eventSources, }: {
26
+ declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, crons, bindings, eventSources, }: {
27
27
  resourceName: string;
28
28
  entrypoint: string;
29
+ assets?: Bindings;
29
30
  crons?: string[];
30
31
  bindings?: Bindings;
31
32
  eventSources?: Queue[];
@@ -39,8 +40,9 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, crons, bindin
39
40
  };
40
41
  url: false;
41
42
  eventSources: Queue[];
42
- bindings: Bindings | undefined;
43
+ assets: Bindings | undefined;
43
44
  crons: string[];
45
+ bindings: Bindings | undefined;
44
46
  };
45
47
 
46
48
  export { composeWorkerArguments as c, extractWorkerCrons as e, loadWorkerConfig as l };
@@ -1,8 +1,8 @@
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';
5
- type WorkerType = 'service' | 'orchestrator';
4
+ type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator' | 'client';
5
+ type WorkerType = 'service' | 'orchestrator' | 'client';
6
6
  interface WorkerConfig {
7
7
  triggers: {
8
8
  crons: string[];
@@ -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, crons, bindings, eventSources, }: {
26
+ declare const composeWorkerArguments: ({ resourceName, entrypoint, assets, crons, bindings, eventSources, }: {
27
27
  resourceName: string;
28
28
  entrypoint: string;
29
+ assets?: Bindings;
29
30
  crons?: string[];
30
31
  bindings?: Bindings;
31
32
  eventSources?: Queue[];
@@ -39,8 +40,9 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, crons, bindin
39
40
  };
40
41
  url: false;
41
42
  eventSources: Queue[];
42
- bindings: Bindings | undefined;
43
+ assets: Bindings | undefined;
43
44
  crons: string[];
45
+ bindings: Bindings | undefined;
44
46
  };
45
47
 
46
48
  export { composeWorkerArguments as c, extractWorkerCrons as e, loadWorkerConfig as l };
@@ -33,6 +33,7 @@ const extractWorkerCrons = ({
33
33
  const composeWorkerArguments = ({
34
34
  resourceName,
35
35
  entrypoint,
36
+ assets,
36
37
  crons = [],
37
38
  bindings,
38
39
  eventSources = []
@@ -47,8 +48,9 @@ const composeWorkerArguments = ({
47
48
  },
48
49
  url: false,
49
50
  eventSources,
50
- bindings,
51
- crons
51
+ assets,
52
+ crons,
53
+ bindings
52
54
  };
53
55
  };
54
56
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-io/backend-sdk",
3
- "version": "5.25.0",
3
+ "version": "5.26.1",
4
4
  "description": "Develit Backend SDK",
5
5
  "author": "Develit.io",
6
6
  "license": "ISC",