@develit-io/backend-sdk 5.21.5 → 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.
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/infrastructure/index.cjs +53 -17
- package/dist/infrastructure/index.d.cts +55 -9
- package/dist/infrastructure/index.d.mts +55 -9
- package/dist/infrastructure/index.d.ts +55 -9
- package/dist/infrastructure/index.mjs +55 -18
- package/dist/node/index.cjs +3 -8
- package/dist/node/index.d.cts +21 -5
- package/dist/node/index.d.mts +21 -5
- package/dist/node/index.d.ts +21 -5
- package/dist/node/index.mjs +1 -10
- package/dist/shared/backend-sdk.BsaVoxCw.mjs +32 -0
- package/dist/shared/backend-sdk.CwYK8F7O.cjs +40 -0
- package/dist/shared/{backend-sdk.B4rrbKNu.d.cts → backend-sdk._l2mbzzF.d.cts} +1 -1
- package/dist/shared/{backend-sdk.B4rrbKNu.d.mts → backend-sdk._l2mbzzF.d.mts} +1 -1
- package/dist/shared/{backend-sdk.B4rrbKNu.d.ts → backend-sdk._l2mbzzF.d.ts} +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ import { ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult } from 'dri
|
|
|
5
5
|
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
6
6
|
import { AnySQLiteTable } from 'drizzle-orm/sqlite-core';
|
|
7
7
|
import * as z from 'zod/v4/core';
|
|
8
|
-
export { E as Environment, P as Project } from './shared/backend-sdk.
|
|
8
|
+
export { E as Environment, P as Project } from './shared/backend-sdk._l2mbzzF.cjs';
|
|
9
9
|
import { StatusCodes, ReasonPhrases } from 'http-status-codes';
|
|
10
10
|
export { ReasonPhrases as InternalResponsePhrase, StatusCodes as InternalResponseStatus } from 'http-status-codes';
|
|
11
11
|
import { Queue } from '@cloudflare/workers-types';
|
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import { ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult } from 'dri
|
|
|
5
5
|
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
6
6
|
import { AnySQLiteTable } from 'drizzle-orm/sqlite-core';
|
|
7
7
|
import * as z from 'zod/v4/core';
|
|
8
|
-
export { E as Environment, P as Project } from './shared/backend-sdk.
|
|
8
|
+
export { E as Environment, P as Project } from './shared/backend-sdk._l2mbzzF.mjs';
|
|
9
9
|
import { StatusCodes, ReasonPhrases } from 'http-status-codes';
|
|
10
10
|
export { ReasonPhrases as InternalResponsePhrase, StatusCodes as InternalResponseStatus } from 'http-status-codes';
|
|
11
11
|
import { Queue } from '@cloudflare/workers-types';
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult } from 'dri
|
|
|
5
5
|
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
6
6
|
import { AnySQLiteTable } from 'drizzle-orm/sqlite-core';
|
|
7
7
|
import * as z from 'zod/v4/core';
|
|
8
|
-
export { E as Environment, P as Project } from './shared/backend-sdk.
|
|
8
|
+
export { E as Environment, P as Project } from './shared/backend-sdk._l2mbzzF.js';
|
|
9
9
|
import { StatusCodes, ReasonPhrases } from 'http-status-codes';
|
|
10
10
|
export { ReasonPhrases as InternalResponsePhrase, StatusCodes as InternalResponseStatus } from 'http-status-codes';
|
|
11
11
|
import { Queue } from '@cloudflare/workers-types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
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
|
|
|
@@ -9,8 +9,7 @@ const composeD1Arguments = ({
|
|
|
9
9
|
}) => {
|
|
10
10
|
return {
|
|
11
11
|
name: resourceName,
|
|
12
|
-
primaryLocationHint:
|
|
13
|
-
// TODO: It's possible that it will take care of migrations as well
|
|
12
|
+
primaryLocationHint: node_index.D1_LOCATION_HINT
|
|
14
13
|
};
|
|
15
14
|
};
|
|
16
15
|
|
|
@@ -24,8 +23,8 @@ const composeKvArguments = ({
|
|
|
24
23
|
|
|
25
24
|
const composeQueueArguments = ({
|
|
26
25
|
resourceName,
|
|
27
|
-
deliveryDelay =
|
|
28
|
-
messageRetentionPeriod =
|
|
26
|
+
deliveryDelay = node_index.QUEUE_DELIVERY_DELAY,
|
|
27
|
+
messageRetentionPeriod = node_index.QUEUE_MESSAGE_RETENTION_PERIOD
|
|
29
28
|
}) => {
|
|
30
29
|
return {
|
|
31
30
|
name: resourceName,
|
|
@@ -38,24 +37,16 @@ const composeQueueArguments = ({
|
|
|
38
37
|
|
|
39
38
|
const composeR2Arguments = ({
|
|
40
39
|
resourceName,
|
|
41
|
-
storageClass =
|
|
40
|
+
storageClass = node_index.R2_STORAGE_CLASS
|
|
42
41
|
}) => {
|
|
43
42
|
return {
|
|
44
43
|
name: resourceName,
|
|
45
|
-
jurisdiction:
|
|
46
|
-
locationHint:
|
|
44
|
+
jurisdiction: node_index.R2_JURISDICTION,
|
|
45
|
+
locationHint: node_index.R2_LOCATION_HINT,
|
|
47
46
|
storageClass
|
|
48
47
|
};
|
|
49
48
|
};
|
|
50
49
|
|
|
51
|
-
const composeBindingName = ({
|
|
52
|
-
resource,
|
|
53
|
-
resourceName,
|
|
54
|
-
bindingName
|
|
55
|
-
}) => {
|
|
56
|
-
const convertedBindingName = bindingName ? text.toSnakeCase(bindingName) : `${text.toSnakeCase(resourceName)}_${resource}`;
|
|
57
|
-
return convertedBindingName.toUpperCase();
|
|
58
|
-
};
|
|
59
50
|
const composeIdentifierName = ({
|
|
60
51
|
resource,
|
|
61
52
|
resourceName
|
|
@@ -147,6 +138,52 @@ class Infrastructure {
|
|
|
147
138
|
})
|
|
148
139
|
);
|
|
149
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Creates an instance of Cloudflare Worker.
|
|
143
|
+
*/
|
|
144
|
+
async worker(options) {
|
|
145
|
+
const {
|
|
146
|
+
resourceName,
|
|
147
|
+
resource,
|
|
148
|
+
entrypoint,
|
|
149
|
+
crons,
|
|
150
|
+
bindings,
|
|
151
|
+
eventSources
|
|
152
|
+
} = options;
|
|
153
|
+
const identifierName = composeIdentifierName({
|
|
154
|
+
resourceName,
|
|
155
|
+
resource: resource || "worker"
|
|
156
|
+
});
|
|
157
|
+
return await cloudflare.Worker(
|
|
158
|
+
identifierName,
|
|
159
|
+
node_index.composeWorkerArguments({
|
|
160
|
+
resourceName: composeResourceName({
|
|
161
|
+
project: this.project,
|
|
162
|
+
environment: this.environment,
|
|
163
|
+
resourceName: identifierName
|
|
164
|
+
}),
|
|
165
|
+
entrypoint,
|
|
166
|
+
crons,
|
|
167
|
+
bindings,
|
|
168
|
+
eventSources
|
|
169
|
+
})
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Creates an instance of Cloudflare Worker as a service.
|
|
174
|
+
*/
|
|
175
|
+
async service(options) {
|
|
176
|
+
const { resourceName, crons, bindings, eventSources } = options;
|
|
177
|
+
return await this.worker({
|
|
178
|
+
resourceName,
|
|
179
|
+
resource: "service",
|
|
180
|
+
// TODO: Convert to util
|
|
181
|
+
entrypoint: `./services/${resourceName}/src/index.ts`,
|
|
182
|
+
crons,
|
|
183
|
+
bindings,
|
|
184
|
+
eventSources
|
|
185
|
+
});
|
|
186
|
+
}
|
|
150
187
|
}
|
|
151
188
|
|
|
152
189
|
const validateEnvironment = (environment) => {
|
|
@@ -157,7 +194,6 @@ const validateEnvironment = (environment) => {
|
|
|
157
194
|
};
|
|
158
195
|
|
|
159
196
|
exports.Infrastructure = Infrastructure;
|
|
160
|
-
exports.composeBindingName = composeBindingName;
|
|
161
197
|
exports.composeD1Arguments = composeD1Arguments;
|
|
162
198
|
exports.composeIdentifierName = composeIdentifierName;
|
|
163
199
|
exports.composeKvArguments = composeKvArguments;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { P as Project, E as Environment } from '../shared/backend-sdk.
|
|
2
|
-
import { KVNamespace, D1Database, Queue, R2Bucket } from 'alchemy/cloudflare';
|
|
1
|
+
import { P as Project, E as Environment } from '../shared/backend-sdk._l2mbzzF.cjs';
|
|
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;
|
|
@@ -58,6 +59,56 @@ declare class Infrastructure {
|
|
|
58
59
|
*/
|
|
59
60
|
storageClass?: 'Standard' | 'InfrequentAccess';
|
|
60
61
|
}): Promise<R2Bucket>;
|
|
62
|
+
/**
|
|
63
|
+
* Creates an instance of Cloudflare Worker.
|
|
64
|
+
*/
|
|
65
|
+
worker(options: {
|
|
66
|
+
/**
|
|
67
|
+
* Name of the Worker. Do not include the 'worker' prefix.
|
|
68
|
+
*/
|
|
69
|
+
resourceName: string;
|
|
70
|
+
/**
|
|
71
|
+
* Type of the Worker.
|
|
72
|
+
*/
|
|
73
|
+
resource?: WorkerType$1;
|
|
74
|
+
/**
|
|
75
|
+
* Entrypoint file of the Worker.
|
|
76
|
+
*/
|
|
77
|
+
entrypoint: string;
|
|
78
|
+
/**
|
|
79
|
+
* Cron expressions for the trigger of the Worker.
|
|
80
|
+
*/
|
|
81
|
+
crons?: string[];
|
|
82
|
+
/**
|
|
83
|
+
* Bindings of the Worker.
|
|
84
|
+
*/
|
|
85
|
+
bindings?: Bindings;
|
|
86
|
+
/**
|
|
87
|
+
* Event sources for the service to consume.
|
|
88
|
+
*/
|
|
89
|
+
eventSources?: Queue[];
|
|
90
|
+
}): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
|
|
91
|
+
/**
|
|
92
|
+
* Creates an instance of Cloudflare Worker as a service.
|
|
93
|
+
*/
|
|
94
|
+
service(options: {
|
|
95
|
+
/**
|
|
96
|
+
* Name of the service. Do not include the 'service' prefix.
|
|
97
|
+
*/
|
|
98
|
+
resourceName: string;
|
|
99
|
+
/**
|
|
100
|
+
* Cron expressions for the trigger of the Worker.
|
|
101
|
+
*/
|
|
102
|
+
crons?: string[];
|
|
103
|
+
/**
|
|
104
|
+
* Bindings of the Worker.
|
|
105
|
+
*/
|
|
106
|
+
bindings?: Bindings;
|
|
107
|
+
/**
|
|
108
|
+
* Event sources for the service to consume.
|
|
109
|
+
*/
|
|
110
|
+
eventSources?: Queue[];
|
|
111
|
+
}): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
|
|
61
112
|
}
|
|
62
113
|
|
|
63
114
|
declare const composeD1Arguments: ({ resourceName, }: {
|
|
@@ -95,13 +146,8 @@ declare const composeR2Arguments: ({ resourceName, storageClass, }: {
|
|
|
95
146
|
storageClass: "Standard" | "InfrequentAccess";
|
|
96
147
|
};
|
|
97
148
|
|
|
98
|
-
declare const composeBindingName: ({ resource, resourceName, bindingName, }: {
|
|
99
|
-
resource: Resource;
|
|
100
|
-
resourceName: string;
|
|
101
|
-
bindingName?: string;
|
|
102
|
-
}) => string;
|
|
103
149
|
declare const composeIdentifierName: ({ resource, resourceName, }: {
|
|
104
|
-
resource: Resource;
|
|
150
|
+
resource: Resource | WorkerType;
|
|
105
151
|
resourceName: string;
|
|
106
152
|
}) => string;
|
|
107
153
|
declare const composeResourceName: ({ project, environment, resourceName, }: {
|
|
@@ -112,4 +158,4 @@ declare const composeResourceName: ({ project, environment, resourceName, }: {
|
|
|
112
158
|
|
|
113
159
|
declare const validateEnvironment: (environment: string) => Environment;
|
|
114
160
|
|
|
115
|
-
export { Infrastructure,
|
|
161
|
+
export { Infrastructure, composeD1Arguments, composeIdentifierName, composeKvArguments, composeQueueArguments, composeR2Arguments, composeResourceName, validateEnvironment };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { P as Project, E as Environment } from '../shared/backend-sdk.
|
|
2
|
-
import { KVNamespace, D1Database, Queue, R2Bucket } from 'alchemy/cloudflare';
|
|
1
|
+
import { P as Project, E as Environment } from '../shared/backend-sdk._l2mbzzF.mjs';
|
|
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;
|
|
@@ -58,6 +59,56 @@ declare class Infrastructure {
|
|
|
58
59
|
*/
|
|
59
60
|
storageClass?: 'Standard' | 'InfrequentAccess';
|
|
60
61
|
}): Promise<R2Bucket>;
|
|
62
|
+
/**
|
|
63
|
+
* Creates an instance of Cloudflare Worker.
|
|
64
|
+
*/
|
|
65
|
+
worker(options: {
|
|
66
|
+
/**
|
|
67
|
+
* Name of the Worker. Do not include the 'worker' prefix.
|
|
68
|
+
*/
|
|
69
|
+
resourceName: string;
|
|
70
|
+
/**
|
|
71
|
+
* Type of the Worker.
|
|
72
|
+
*/
|
|
73
|
+
resource?: WorkerType$1;
|
|
74
|
+
/**
|
|
75
|
+
* Entrypoint file of the Worker.
|
|
76
|
+
*/
|
|
77
|
+
entrypoint: string;
|
|
78
|
+
/**
|
|
79
|
+
* Cron expressions for the trigger of the Worker.
|
|
80
|
+
*/
|
|
81
|
+
crons?: string[];
|
|
82
|
+
/**
|
|
83
|
+
* Bindings of the Worker.
|
|
84
|
+
*/
|
|
85
|
+
bindings?: Bindings;
|
|
86
|
+
/**
|
|
87
|
+
* Event sources for the service to consume.
|
|
88
|
+
*/
|
|
89
|
+
eventSources?: Queue[];
|
|
90
|
+
}): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
|
|
91
|
+
/**
|
|
92
|
+
* Creates an instance of Cloudflare Worker as a service.
|
|
93
|
+
*/
|
|
94
|
+
service(options: {
|
|
95
|
+
/**
|
|
96
|
+
* Name of the service. Do not include the 'service' prefix.
|
|
97
|
+
*/
|
|
98
|
+
resourceName: string;
|
|
99
|
+
/**
|
|
100
|
+
* Cron expressions for the trigger of the Worker.
|
|
101
|
+
*/
|
|
102
|
+
crons?: string[];
|
|
103
|
+
/**
|
|
104
|
+
* Bindings of the Worker.
|
|
105
|
+
*/
|
|
106
|
+
bindings?: Bindings;
|
|
107
|
+
/**
|
|
108
|
+
* Event sources for the service to consume.
|
|
109
|
+
*/
|
|
110
|
+
eventSources?: Queue[];
|
|
111
|
+
}): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
|
|
61
112
|
}
|
|
62
113
|
|
|
63
114
|
declare const composeD1Arguments: ({ resourceName, }: {
|
|
@@ -95,13 +146,8 @@ declare const composeR2Arguments: ({ resourceName, storageClass, }: {
|
|
|
95
146
|
storageClass: "Standard" | "InfrequentAccess";
|
|
96
147
|
};
|
|
97
148
|
|
|
98
|
-
declare const composeBindingName: ({ resource, resourceName, bindingName, }: {
|
|
99
|
-
resource: Resource;
|
|
100
|
-
resourceName: string;
|
|
101
|
-
bindingName?: string;
|
|
102
|
-
}) => string;
|
|
103
149
|
declare const composeIdentifierName: ({ resource, resourceName, }: {
|
|
104
|
-
resource: Resource;
|
|
150
|
+
resource: Resource | WorkerType;
|
|
105
151
|
resourceName: string;
|
|
106
152
|
}) => string;
|
|
107
153
|
declare const composeResourceName: ({ project, environment, resourceName, }: {
|
|
@@ -112,4 +158,4 @@ declare const composeResourceName: ({ project, environment, resourceName, }: {
|
|
|
112
158
|
|
|
113
159
|
declare const validateEnvironment: (environment: string) => Environment;
|
|
114
160
|
|
|
115
|
-
export { Infrastructure,
|
|
161
|
+
export { Infrastructure, composeD1Arguments, composeIdentifierName, composeKvArguments, composeQueueArguments, composeR2Arguments, composeResourceName, validateEnvironment };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { P as Project, E as Environment } from '../shared/backend-sdk.
|
|
2
|
-
import { KVNamespace, D1Database, Queue, R2Bucket } from 'alchemy/cloudflare';
|
|
1
|
+
import { P as Project, E as Environment } from '../shared/backend-sdk._l2mbzzF.js';
|
|
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;
|
|
@@ -58,6 +59,56 @@ declare class Infrastructure {
|
|
|
58
59
|
*/
|
|
59
60
|
storageClass?: 'Standard' | 'InfrequentAccess';
|
|
60
61
|
}): Promise<R2Bucket>;
|
|
62
|
+
/**
|
|
63
|
+
* Creates an instance of Cloudflare Worker.
|
|
64
|
+
*/
|
|
65
|
+
worker(options: {
|
|
66
|
+
/**
|
|
67
|
+
* Name of the Worker. Do not include the 'worker' prefix.
|
|
68
|
+
*/
|
|
69
|
+
resourceName: string;
|
|
70
|
+
/**
|
|
71
|
+
* Type of the Worker.
|
|
72
|
+
*/
|
|
73
|
+
resource?: WorkerType$1;
|
|
74
|
+
/**
|
|
75
|
+
* Entrypoint file of the Worker.
|
|
76
|
+
*/
|
|
77
|
+
entrypoint: string;
|
|
78
|
+
/**
|
|
79
|
+
* Cron expressions for the trigger of the Worker.
|
|
80
|
+
*/
|
|
81
|
+
crons?: string[];
|
|
82
|
+
/**
|
|
83
|
+
* Bindings of the Worker.
|
|
84
|
+
*/
|
|
85
|
+
bindings?: Bindings;
|
|
86
|
+
/**
|
|
87
|
+
* Event sources for the service to consume.
|
|
88
|
+
*/
|
|
89
|
+
eventSources?: Queue[];
|
|
90
|
+
}): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
|
|
91
|
+
/**
|
|
92
|
+
* Creates an instance of Cloudflare Worker as a service.
|
|
93
|
+
*/
|
|
94
|
+
service(options: {
|
|
95
|
+
/**
|
|
96
|
+
* Name of the service. Do not include the 'service' prefix.
|
|
97
|
+
*/
|
|
98
|
+
resourceName: string;
|
|
99
|
+
/**
|
|
100
|
+
* Cron expressions for the trigger of the Worker.
|
|
101
|
+
*/
|
|
102
|
+
crons?: string[];
|
|
103
|
+
/**
|
|
104
|
+
* Bindings of the Worker.
|
|
105
|
+
*/
|
|
106
|
+
bindings?: Bindings;
|
|
107
|
+
/**
|
|
108
|
+
* Event sources for the service to consume.
|
|
109
|
+
*/
|
|
110
|
+
eventSources?: Queue[];
|
|
111
|
+
}): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
|
|
61
112
|
}
|
|
62
113
|
|
|
63
114
|
declare const composeD1Arguments: ({ resourceName, }: {
|
|
@@ -95,13 +146,8 @@ declare const composeR2Arguments: ({ resourceName, storageClass, }: {
|
|
|
95
146
|
storageClass: "Standard" | "InfrequentAccess";
|
|
96
147
|
};
|
|
97
148
|
|
|
98
|
-
declare const composeBindingName: ({ resource, resourceName, bindingName, }: {
|
|
99
|
-
resource: Resource;
|
|
100
|
-
resourceName: string;
|
|
101
|
-
bindingName?: string;
|
|
102
|
-
}) => string;
|
|
103
149
|
declare const composeIdentifierName: ({ resource, resourceName, }: {
|
|
104
|
-
resource: Resource;
|
|
150
|
+
resource: Resource | WorkerType;
|
|
105
151
|
resourceName: string;
|
|
106
152
|
}) => string;
|
|
107
153
|
declare const composeResourceName: ({ project, environment, resourceName, }: {
|
|
@@ -112,4 +158,4 @@ declare const composeResourceName: ({ project, environment, resourceName, }: {
|
|
|
112
158
|
|
|
113
159
|
declare const validateEnvironment: (environment: string) => Environment;
|
|
114
160
|
|
|
115
|
-
export { Infrastructure,
|
|
161
|
+
export { Infrastructure, composeD1Arguments, composeIdentifierName, composeKvArguments, composeQueueArguments, composeR2Arguments, composeResourceName, validateEnvironment };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { KVNamespace, D1Database, Queue, R2Bucket } 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, c as R2_JURISDICTION, d as composeWorkerArguments } from '../shared/backend-sdk.BsaVoxCw.mjs';
|
|
2
|
+
import { KVNamespace, D1Database, Queue, R2Bucket, Worker } from 'alchemy/cloudflare';
|
|
3
3
|
import { E as ENVIRONMENT } from '../shared/backend-sdk.DXRpnctc.mjs';
|
|
4
4
|
|
|
5
5
|
const composeD1Arguments = ({
|
|
@@ -7,8 +7,7 @@ const composeD1Arguments = ({
|
|
|
7
7
|
}) => {
|
|
8
8
|
return {
|
|
9
9
|
name: resourceName,
|
|
10
|
-
primaryLocationHint:
|
|
11
|
-
// TODO: It's possible that it will take care of migrations as well
|
|
10
|
+
primaryLocationHint: D1_LOCATION_HINT
|
|
12
11
|
};
|
|
13
12
|
};
|
|
14
13
|
|
|
@@ -22,8 +21,8 @@ const composeKvArguments = ({
|
|
|
22
21
|
|
|
23
22
|
const composeQueueArguments = ({
|
|
24
23
|
resourceName,
|
|
25
|
-
deliveryDelay =
|
|
26
|
-
messageRetentionPeriod =
|
|
24
|
+
deliveryDelay = QUEUE_DELIVERY_DELAY,
|
|
25
|
+
messageRetentionPeriod = QUEUE_MESSAGE_RETENTION_PERIOD
|
|
27
26
|
}) => {
|
|
28
27
|
return {
|
|
29
28
|
name: resourceName,
|
|
@@ -36,24 +35,16 @@ const composeQueueArguments = ({
|
|
|
36
35
|
|
|
37
36
|
const composeR2Arguments = ({
|
|
38
37
|
resourceName,
|
|
39
|
-
storageClass =
|
|
38
|
+
storageClass = R2_STORAGE_CLASS
|
|
40
39
|
}) => {
|
|
41
40
|
return {
|
|
42
41
|
name: resourceName,
|
|
43
|
-
jurisdiction:
|
|
44
|
-
locationHint:
|
|
42
|
+
jurisdiction: R2_JURISDICTION,
|
|
43
|
+
locationHint: R2_LOCATION_HINT,
|
|
45
44
|
storageClass
|
|
46
45
|
};
|
|
47
46
|
};
|
|
48
47
|
|
|
49
|
-
const composeBindingName = ({
|
|
50
|
-
resource,
|
|
51
|
-
resourceName,
|
|
52
|
-
bindingName
|
|
53
|
-
}) => {
|
|
54
|
-
const convertedBindingName = bindingName ? toSnakeCase(bindingName) : `${toSnakeCase(resourceName)}_${resource}`;
|
|
55
|
-
return convertedBindingName.toUpperCase();
|
|
56
|
-
};
|
|
57
48
|
const composeIdentifierName = ({
|
|
58
49
|
resource,
|
|
59
50
|
resourceName
|
|
@@ -145,6 +136,52 @@ class Infrastructure {
|
|
|
145
136
|
})
|
|
146
137
|
);
|
|
147
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Creates an instance of Cloudflare Worker.
|
|
141
|
+
*/
|
|
142
|
+
async worker(options) {
|
|
143
|
+
const {
|
|
144
|
+
resourceName,
|
|
145
|
+
resource,
|
|
146
|
+
entrypoint,
|
|
147
|
+
crons,
|
|
148
|
+
bindings,
|
|
149
|
+
eventSources
|
|
150
|
+
} = options;
|
|
151
|
+
const identifierName = composeIdentifierName({
|
|
152
|
+
resourceName,
|
|
153
|
+
resource: resource || "worker"
|
|
154
|
+
});
|
|
155
|
+
return await Worker(
|
|
156
|
+
identifierName,
|
|
157
|
+
composeWorkerArguments({
|
|
158
|
+
resourceName: composeResourceName({
|
|
159
|
+
project: this.project,
|
|
160
|
+
environment: this.environment,
|
|
161
|
+
resourceName: identifierName
|
|
162
|
+
}),
|
|
163
|
+
entrypoint,
|
|
164
|
+
crons,
|
|
165
|
+
bindings,
|
|
166
|
+
eventSources
|
|
167
|
+
})
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Creates an instance of Cloudflare Worker as a service.
|
|
172
|
+
*/
|
|
173
|
+
async service(options) {
|
|
174
|
+
const { resourceName, crons, bindings, eventSources } = options;
|
|
175
|
+
return await this.worker({
|
|
176
|
+
resourceName,
|
|
177
|
+
resource: "service",
|
|
178
|
+
// TODO: Convert to util
|
|
179
|
+
entrypoint: `./services/${resourceName}/src/index.ts`,
|
|
180
|
+
crons,
|
|
181
|
+
bindings,
|
|
182
|
+
eventSources
|
|
183
|
+
});
|
|
184
|
+
}
|
|
148
185
|
}
|
|
149
186
|
|
|
150
187
|
const validateEnvironment = (environment) => {
|
|
@@ -154,4 +191,4 @@ const validateEnvironment = (environment) => {
|
|
|
154
191
|
return Number(environment);
|
|
155
192
|
};
|
|
156
193
|
|
|
157
|
-
export { Infrastructure,
|
|
194
|
+
export { Infrastructure, composeD1Arguments, composeIdentifierName, composeKvArguments, composeQueueArguments, composeR2Arguments, composeResourceName, validateEnvironment };
|
package/dist/node/index.cjs
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const fs = require('node:fs');
|
|
5
|
-
const path = require('@std/path');
|
|
3
|
+
const node_index = require('../shared/backend-sdk.CwYK8F7O.cjs');
|
|
6
4
|
|
|
7
|
-
async function loadWorkerConfig({ path: path$1 }) {
|
|
8
|
-
const workerConfigFile = fs.readFileSync(path.join(path$1, "./wrangler.jsonc"), "utf-8");
|
|
9
|
-
return commentJson.parse(workerConfigFile);
|
|
10
|
-
}
|
|
11
5
|
|
|
12
|
-
|
|
6
|
+
|
|
7
|
+
exports.composeWorkerArguments = node_index.composeWorkerArguments;
|
package/dist/node/index.d.cts
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Bindings, Queue } from 'alchemy/cloudflare';
|
|
2
2
|
|
|
3
|
-
declare
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
declare const composeWorkerArguments: ({ resourceName, entrypoint, crons, bindings, eventSources, }: {
|
|
4
|
+
resourceName: string;
|
|
5
|
+
entrypoint: string;
|
|
6
|
+
crons?: string[];
|
|
7
|
+
bindings?: Bindings;
|
|
8
|
+
eventSources?: Queue[];
|
|
9
|
+
}) => {
|
|
10
|
+
name: string;
|
|
11
|
+
entrypoint: string;
|
|
12
|
+
compatibilityFlags: string[];
|
|
13
|
+
compatibilityDate: string;
|
|
14
|
+
observability: {
|
|
15
|
+
enabled: true;
|
|
16
|
+
};
|
|
17
|
+
url: false;
|
|
18
|
+
eventSources: Queue[];
|
|
19
|
+
bindings: Bindings | undefined;
|
|
20
|
+
crons: string[];
|
|
21
|
+
};
|
|
6
22
|
|
|
7
|
-
export {
|
|
23
|
+
export { composeWorkerArguments };
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Bindings, Queue } from 'alchemy/cloudflare';
|
|
2
2
|
|
|
3
|
-
declare
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
declare const composeWorkerArguments: ({ resourceName, entrypoint, crons, bindings, eventSources, }: {
|
|
4
|
+
resourceName: string;
|
|
5
|
+
entrypoint: string;
|
|
6
|
+
crons?: string[];
|
|
7
|
+
bindings?: Bindings;
|
|
8
|
+
eventSources?: Queue[];
|
|
9
|
+
}) => {
|
|
10
|
+
name: string;
|
|
11
|
+
entrypoint: string;
|
|
12
|
+
compatibilityFlags: string[];
|
|
13
|
+
compatibilityDate: string;
|
|
14
|
+
observability: {
|
|
15
|
+
enabled: true;
|
|
16
|
+
};
|
|
17
|
+
url: false;
|
|
18
|
+
eventSources: Queue[];
|
|
19
|
+
bindings: Bindings | undefined;
|
|
20
|
+
crons: string[];
|
|
21
|
+
};
|
|
6
22
|
|
|
7
|
-
export {
|
|
23
|
+
export { composeWorkerArguments };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Bindings, Queue } from 'alchemy/cloudflare';
|
|
2
2
|
|
|
3
|
-
declare
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
declare const composeWorkerArguments: ({ resourceName, entrypoint, crons, bindings, eventSources, }: {
|
|
4
|
+
resourceName: string;
|
|
5
|
+
entrypoint: string;
|
|
6
|
+
crons?: string[];
|
|
7
|
+
bindings?: Bindings;
|
|
8
|
+
eventSources?: Queue[];
|
|
9
|
+
}) => {
|
|
10
|
+
name: string;
|
|
11
|
+
entrypoint: string;
|
|
12
|
+
compatibilityFlags: string[];
|
|
13
|
+
compatibilityDate: string;
|
|
14
|
+
observability: {
|
|
15
|
+
enabled: true;
|
|
16
|
+
};
|
|
17
|
+
url: false;
|
|
18
|
+
eventSources: Queue[];
|
|
19
|
+
bindings: Bindings | undefined;
|
|
20
|
+
crons: string[];
|
|
21
|
+
};
|
|
6
22
|
|
|
7
|
-
export {
|
|
23
|
+
export { composeWorkerArguments };
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { readFileSync } from 'node:fs';
|
|
3
|
-
import { join } from '@std/path';
|
|
4
|
-
|
|
5
|
-
async function loadWorkerConfig({ path }) {
|
|
6
|
-
const workerConfigFile = readFileSync(join(path, "./wrangler.jsonc"), "utf-8");
|
|
7
|
-
return parse(workerConfigFile);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { loadWorkerConfig };
|
|
1
|
+
export { d as composeWorkerArguments } from '../shared/backend-sdk.BsaVoxCw.mjs';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const COMPATIBILITY_DATE = "2025-06-04";
|
|
2
|
+
const COMPATIBILITY_FLAGS = ["nodejs_compat"];
|
|
3
|
+
const QUEUE_DELIVERY_DELAY = 5;
|
|
4
|
+
const QUEUE_MESSAGE_RETENTION_PERIOD = 259200;
|
|
5
|
+
const D1_LOCATION_HINT = "weur";
|
|
6
|
+
const R2_STORAGE_CLASS = "Standard";
|
|
7
|
+
const R2_JURISDICTION = "eu";
|
|
8
|
+
const R2_LOCATION_HINT = "weur";
|
|
9
|
+
|
|
10
|
+
const composeWorkerArguments = ({
|
|
11
|
+
resourceName,
|
|
12
|
+
entrypoint,
|
|
13
|
+
crons = [],
|
|
14
|
+
bindings,
|
|
15
|
+
eventSources = []
|
|
16
|
+
}) => {
|
|
17
|
+
return {
|
|
18
|
+
name: resourceName,
|
|
19
|
+
entrypoint,
|
|
20
|
+
compatibilityFlags: COMPATIBILITY_FLAGS,
|
|
21
|
+
compatibilityDate: COMPATIBILITY_DATE,
|
|
22
|
+
observability: {
|
|
23
|
+
enabled: true
|
|
24
|
+
},
|
|
25
|
+
url: false,
|
|
26
|
+
eventSources,
|
|
27
|
+
bindings,
|
|
28
|
+
crons
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { D1_LOCATION_HINT as D, QUEUE_MESSAGE_RETENTION_PERIOD as Q, R2_STORAGE_CLASS as R, QUEUE_DELIVERY_DELAY as a, R2_LOCATION_HINT as b, R2_JURISDICTION as c, composeWorkerArguments as d };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const COMPATIBILITY_DATE = "2025-06-04";
|
|
4
|
+
const COMPATIBILITY_FLAGS = ["nodejs_compat"];
|
|
5
|
+
const QUEUE_DELIVERY_DELAY = 5;
|
|
6
|
+
const QUEUE_MESSAGE_RETENTION_PERIOD = 259200;
|
|
7
|
+
const D1_LOCATION_HINT = "weur";
|
|
8
|
+
const R2_STORAGE_CLASS = "Standard";
|
|
9
|
+
const R2_JURISDICTION = "eu";
|
|
10
|
+
const R2_LOCATION_HINT = "weur";
|
|
11
|
+
|
|
12
|
+
const composeWorkerArguments = ({
|
|
13
|
+
resourceName,
|
|
14
|
+
entrypoint,
|
|
15
|
+
crons = [],
|
|
16
|
+
bindings,
|
|
17
|
+
eventSources = []
|
|
18
|
+
}) => {
|
|
19
|
+
return {
|
|
20
|
+
name: resourceName,
|
|
21
|
+
entrypoint,
|
|
22
|
+
compatibilityFlags: COMPATIBILITY_FLAGS,
|
|
23
|
+
compatibilityDate: COMPATIBILITY_DATE,
|
|
24
|
+
observability: {
|
|
25
|
+
enabled: true
|
|
26
|
+
},
|
|
27
|
+
url: false,
|
|
28
|
+
eventSources,
|
|
29
|
+
bindings,
|
|
30
|
+
crons
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.D1_LOCATION_HINT = D1_LOCATION_HINT;
|
|
35
|
+
exports.QUEUE_DELIVERY_DELAY = QUEUE_DELIVERY_DELAY;
|
|
36
|
+
exports.QUEUE_MESSAGE_RETENTION_PERIOD = QUEUE_MESSAGE_RETENTION_PERIOD;
|
|
37
|
+
exports.R2_JURISDICTION = R2_JURISDICTION;
|
|
38
|
+
exports.R2_LOCATION_HINT = R2_LOCATION_HINT;
|
|
39
|
+
exports.R2_STORAGE_CLASS = R2_STORAGE_CLASS;
|
|
40
|
+
exports.composeWorkerArguments = composeWorkerArguments;
|