@develit-io/backend-sdk 5.22.0 → 5.23.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,6 @@
1
1
  'use strict';
2
2
 
3
- const node_index = require('../shared/backend-sdk.CpwGFVDb.cjs');
3
+ const node_index = require('../shared/backend-sdk.CwYK8F7O.cjs');
4
4
  const cloudflare = require('alchemy/cloudflare');
5
5
  const environment_consts = require('../shared/backend-sdk.BdcrYpFD.cjs');
6
6
 
@@ -142,10 +142,17 @@ class Infrastructure {
142
142
  * Creates an instance of Cloudflare Worker.
143
143
  */
144
144
  async worker(options) {
145
- const { resourceName, entrypoint, bindings, eventSources } = options;
145
+ const {
146
+ resourceName,
147
+ resource,
148
+ entrypoint,
149
+ crons,
150
+ bindings,
151
+ eventSources
152
+ } = options;
146
153
  const identifierName = composeIdentifierName({
147
154
  resourceName,
148
- resource: "worker"
155
+ resource: resource || "worker"
149
156
  });
150
157
  return await cloudflare.Worker(
151
158
  identifierName,
@@ -156,6 +163,7 @@ class Infrastructure {
156
163
  resourceName: identifierName
157
164
  }),
158
165
  entrypoint,
166
+ crons,
159
167
  bindings,
160
168
  eventSources
161
169
  })
@@ -165,11 +173,13 @@ class Infrastructure {
165
173
  * Creates an instance of Cloudflare Worker as a service.
166
174
  */
167
175
  async service(options) {
168
- const { resourceName, bindings, eventSources } = options;
176
+ const { resourceName, crons, bindings, eventSources } = options;
169
177
  return await this.worker({
170
178
  resourceName,
179
+ resource: "service",
171
180
  // TODO: Convert to util
172
181
  entrypoint: `./services/${resourceName}/src/index.ts`,
182
+ crons,
173
183
  bindings,
174
184
  eventSources
175
185
  });
@@ -2,6 +2,7 @@ import { P as Project, E as Environment } from '../shared/backend-sdk._l2mbzzF.c
2
2
  import { KVNamespace, D1Database, Queue, R2Bucket, Bindings, Worker } from 'alchemy/cloudflare';
3
3
 
4
4
  type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
5
+ type WorkerType$1 = 'service' | 'orchestrator';
5
6
 
6
7
  declare class Infrastructure {
7
8
  private project;
@@ -66,14 +67,22 @@ declare class Infrastructure {
66
67
  * Name of the Worker. Do not include the 'worker' prefix.
67
68
  */
68
69
  resourceName: string;
70
+ /**
71
+ * Type of the Worker.
72
+ */
73
+ resource?: WorkerType$1;
69
74
  /**
70
75
  * Entrypoint file of the Worker.
71
76
  */
72
77
  entrypoint: string;
78
+ /**
79
+ * Cron expressions for the trigger of the Worker.
80
+ */
81
+ crons?: string[];
73
82
  /**
74
83
  * Bindings of the Worker.
75
84
  */
76
- bindings: Bindings;
85
+ bindings?: Bindings;
77
86
  /**
78
87
  * Event sources for the service to consume.
79
88
  */
@@ -87,10 +96,14 @@ declare class Infrastructure {
87
96
  * Name of the service. Do not include the 'service' prefix.
88
97
  */
89
98
  resourceName: string;
99
+ /**
100
+ * Cron expressions for the trigger of the Worker.
101
+ */
102
+ crons?: string[];
90
103
  /**
91
104
  * Bindings of the Worker.
92
105
  */
93
- bindings: Bindings;
106
+ bindings?: Bindings;
94
107
  /**
95
108
  * Event sources for the service to consume.
96
109
  */
@@ -134,7 +147,7 @@ declare const composeR2Arguments: ({ resourceName, storageClass, }: {
134
147
  };
135
148
 
136
149
  declare const composeIdentifierName: ({ resource, resourceName, }: {
137
- resource: Resource;
150
+ resource: Resource | WorkerType;
138
151
  resourceName: string;
139
152
  }) => string;
140
153
  declare const composeResourceName: ({ project, environment, resourceName, }: {
@@ -2,6 +2,7 @@ import { P as Project, E as Environment } from '../shared/backend-sdk._l2mbzzF.m
2
2
  import { KVNamespace, D1Database, Queue, R2Bucket, Bindings, Worker } from 'alchemy/cloudflare';
3
3
 
4
4
  type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
5
+ type WorkerType$1 = 'service' | 'orchestrator';
5
6
 
6
7
  declare class Infrastructure {
7
8
  private project;
@@ -66,14 +67,22 @@ declare class Infrastructure {
66
67
  * Name of the Worker. Do not include the 'worker' prefix.
67
68
  */
68
69
  resourceName: string;
70
+ /**
71
+ * Type of the Worker.
72
+ */
73
+ resource?: WorkerType$1;
69
74
  /**
70
75
  * Entrypoint file of the Worker.
71
76
  */
72
77
  entrypoint: string;
78
+ /**
79
+ * Cron expressions for the trigger of the Worker.
80
+ */
81
+ crons?: string[];
73
82
  /**
74
83
  * Bindings of the Worker.
75
84
  */
76
- bindings: Bindings;
85
+ bindings?: Bindings;
77
86
  /**
78
87
  * Event sources for the service to consume.
79
88
  */
@@ -87,10 +96,14 @@ declare class Infrastructure {
87
96
  * Name of the service. Do not include the 'service' prefix.
88
97
  */
89
98
  resourceName: string;
99
+ /**
100
+ * Cron expressions for the trigger of the Worker.
101
+ */
102
+ crons?: string[];
90
103
  /**
91
104
  * Bindings of the Worker.
92
105
  */
93
- bindings: Bindings;
106
+ bindings?: Bindings;
94
107
  /**
95
108
  * Event sources for the service to consume.
96
109
  */
@@ -134,7 +147,7 @@ declare const composeR2Arguments: ({ resourceName, storageClass, }: {
134
147
  };
135
148
 
136
149
  declare const composeIdentifierName: ({ resource, resourceName, }: {
137
- resource: Resource;
150
+ resource: Resource | WorkerType;
138
151
  resourceName: string;
139
152
  }) => string;
140
153
  declare const composeResourceName: ({ project, environment, resourceName, }: {
@@ -2,6 +2,7 @@ import { P as Project, E as Environment } from '../shared/backend-sdk._l2mbzzF.j
2
2
  import { KVNamespace, D1Database, Queue, R2Bucket, Bindings, Worker } from 'alchemy/cloudflare';
3
3
 
4
4
  type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
5
+ type WorkerType$1 = 'service' | 'orchestrator';
5
6
 
6
7
  declare class Infrastructure {
7
8
  private project;
@@ -66,14 +67,22 @@ declare class Infrastructure {
66
67
  * Name of the Worker. Do not include the 'worker' prefix.
67
68
  */
68
69
  resourceName: string;
70
+ /**
71
+ * Type of the Worker.
72
+ */
73
+ resource?: WorkerType$1;
69
74
  /**
70
75
  * Entrypoint file of the Worker.
71
76
  */
72
77
  entrypoint: string;
78
+ /**
79
+ * Cron expressions for the trigger of the Worker.
80
+ */
81
+ crons?: string[];
73
82
  /**
74
83
  * Bindings of the Worker.
75
84
  */
76
- bindings: Bindings;
85
+ bindings?: Bindings;
77
86
  /**
78
87
  * Event sources for the service to consume.
79
88
  */
@@ -87,10 +96,14 @@ declare class Infrastructure {
87
96
  * Name of the service. Do not include the 'service' prefix.
88
97
  */
89
98
  resourceName: string;
99
+ /**
100
+ * Cron expressions for the trigger of the Worker.
101
+ */
102
+ crons?: string[];
90
103
  /**
91
104
  * Bindings of the Worker.
92
105
  */
93
- bindings: Bindings;
106
+ bindings?: Bindings;
94
107
  /**
95
108
  * Event sources for the service to consume.
96
109
  */
@@ -134,7 +147,7 @@ declare const composeR2Arguments: ({ resourceName, storageClass, }: {
134
147
  };
135
148
 
136
149
  declare const composeIdentifierName: ({ resource, resourceName, }: {
137
- resource: Resource;
150
+ resource: Resource | WorkerType;
138
151
  resourceName: string;
139
152
  }) => string;
140
153
  declare const composeResourceName: ({ project, environment, 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, c as R2_JURISDICTION, d as composeWorkerArguments } from '../shared/backend-sdk.CxCzOVpU.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, c as R2_JURISDICTION, d as composeWorkerArguments } from '../shared/backend-sdk.BsaVoxCw.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
 
@@ -140,10 +140,17 @@ class Infrastructure {
140
140
  * Creates an instance of Cloudflare Worker.
141
141
  */
142
142
  async worker(options) {
143
- const { resourceName, entrypoint, bindings, eventSources } = options;
143
+ const {
144
+ resourceName,
145
+ resource,
146
+ entrypoint,
147
+ crons,
148
+ bindings,
149
+ eventSources
150
+ } = options;
144
151
  const identifierName = composeIdentifierName({
145
152
  resourceName,
146
- resource: "worker"
153
+ resource: resource || "worker"
147
154
  });
148
155
  return await Worker(
149
156
  identifierName,
@@ -154,6 +161,7 @@ class Infrastructure {
154
161
  resourceName: identifierName
155
162
  }),
156
163
  entrypoint,
164
+ crons,
157
165
  bindings,
158
166
  eventSources
159
167
  })
@@ -163,11 +171,13 @@ class Infrastructure {
163
171
  * Creates an instance of Cloudflare Worker as a service.
164
172
  */
165
173
  async service(options) {
166
- const { resourceName, bindings, eventSources } = options;
174
+ const { resourceName, crons, bindings, eventSources } = options;
167
175
  return await this.worker({
168
176
  resourceName,
177
+ resource: "service",
169
178
  // TODO: Convert to util
170
179
  entrypoint: `./services/${resourceName}/src/index.ts`,
180
+ crons,
171
181
  bindings,
172
182
  eventSources
173
183
  });
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const node_index = require('../shared/backend-sdk.CpwGFVDb.cjs');
3
+ const node_index = require('../shared/backend-sdk.CwYK8F7O.cjs');
4
4
 
5
5
 
6
6
 
@@ -1,9 +1,10 @@
1
1
  import { Bindings, Queue } from 'alchemy/cloudflare';
2
2
 
3
- declare const composeWorkerArguments: ({ resourceName, entrypoint, bindings, eventSources, }: {
3
+ declare const composeWorkerArguments: ({ resourceName, entrypoint, crons, bindings, eventSources, }: {
4
4
  resourceName: string;
5
5
  entrypoint: string;
6
- bindings: Bindings;
6
+ crons?: string[];
7
+ bindings?: Bindings;
7
8
  eventSources?: Queue[];
8
9
  }) => {
9
10
  name: string;
@@ -15,7 +16,8 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, bindings, eve
15
16
  };
16
17
  url: false;
17
18
  eventSources: Queue[];
18
- bindings: Bindings;
19
+ bindings: Bindings | undefined;
20
+ crons: string[];
19
21
  };
20
22
 
21
23
  export { composeWorkerArguments };
@@ -1,9 +1,10 @@
1
1
  import { Bindings, Queue } from 'alchemy/cloudflare';
2
2
 
3
- declare const composeWorkerArguments: ({ resourceName, entrypoint, bindings, eventSources, }: {
3
+ declare const composeWorkerArguments: ({ resourceName, entrypoint, crons, bindings, eventSources, }: {
4
4
  resourceName: string;
5
5
  entrypoint: string;
6
- bindings: Bindings;
6
+ crons?: string[];
7
+ bindings?: Bindings;
7
8
  eventSources?: Queue[];
8
9
  }) => {
9
10
  name: string;
@@ -15,7 +16,8 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, bindings, eve
15
16
  };
16
17
  url: false;
17
18
  eventSources: Queue[];
18
- bindings: Bindings;
19
+ bindings: Bindings | undefined;
20
+ crons: string[];
19
21
  };
20
22
 
21
23
  export { composeWorkerArguments };
@@ -1,9 +1,10 @@
1
1
  import { Bindings, Queue } from 'alchemy/cloudflare';
2
2
 
3
- declare const composeWorkerArguments: ({ resourceName, entrypoint, bindings, eventSources, }: {
3
+ declare const composeWorkerArguments: ({ resourceName, entrypoint, crons, bindings, eventSources, }: {
4
4
  resourceName: string;
5
5
  entrypoint: string;
6
- bindings: Bindings;
6
+ crons?: string[];
7
+ bindings?: Bindings;
7
8
  eventSources?: Queue[];
8
9
  }) => {
9
10
  name: string;
@@ -15,7 +16,8 @@ declare const composeWorkerArguments: ({ resourceName, entrypoint, bindings, eve
15
16
  };
16
17
  url: false;
17
18
  eventSources: Queue[];
18
- bindings: Bindings;
19
+ bindings: Bindings | undefined;
20
+ crons: string[];
19
21
  };
20
22
 
21
23
  export { composeWorkerArguments };
@@ -1 +1 @@
1
- export { d as composeWorkerArguments } from '../shared/backend-sdk.CxCzOVpU.mjs';
1
+ export { d as composeWorkerArguments } from '../shared/backend-sdk.BsaVoxCw.mjs';
@@ -10,6 +10,7 @@ const R2_LOCATION_HINT = "weur";
10
10
  const composeWorkerArguments = ({
11
11
  resourceName,
12
12
  entrypoint,
13
+ crons = [],
13
14
  bindings,
14
15
  eventSources = []
15
16
  }) => {
@@ -23,7 +24,8 @@ const composeWorkerArguments = ({
23
24
  },
24
25
  url: false,
25
26
  eventSources,
26
- bindings
27
+ bindings,
28
+ crons
27
29
  };
28
30
  };
29
31
 
@@ -12,6 +12,7 @@ const R2_LOCATION_HINT = "weur";
12
12
  const composeWorkerArguments = ({
13
13
  resourceName,
14
14
  entrypoint,
15
+ crons = [],
15
16
  bindings,
16
17
  eventSources = []
17
18
  }) => {
@@ -25,7 +26,8 @@ const composeWorkerArguments = ({
25
26
  },
26
27
  url: false,
27
28
  eventSources,
28
- bindings
29
+ bindings,
30
+ crons
29
31
  };
30
32
  };
31
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-io/backend-sdk",
3
- "version": "5.22.0",
3
+ "version": "5.23.0",
4
4
  "description": "Develit Backend SDK",
5
5
  "author": "Develit.io",
6
6
  "license": "ISC",