@develit-io/backend-sdk 5.21.5 → 5.22.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 +43 -17
- package/dist/infrastructure/index.d.cts +41 -8
- package/dist/infrastructure/index.d.mts +41 -8
- package/dist/infrastructure/index.d.ts +41 -8
- package/dist/infrastructure/index.mjs +45 -18
- package/dist/node/index.cjs +3 -8
- package/dist/node/index.d.cts +19 -5
- package/dist/node/index.d.mts +19 -5
- package/dist/node/index.d.ts +19 -5
- package/dist/node/index.mjs +1 -10
- package/dist/shared/backend-sdk.CpwGFVDb.cjs +38 -0
- package/dist/shared/backend-sdk.CxCzOVpU.mjs +30 -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.CpwGFVDb.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,42 @@ class Infrastructure {
|
|
|
147
138
|
})
|
|
148
139
|
);
|
|
149
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Creates an instance of Cloudflare Worker.
|
|
143
|
+
*/
|
|
144
|
+
async worker(options) {
|
|
145
|
+
const { resourceName, entrypoint, bindings, eventSources } = options;
|
|
146
|
+
const identifierName = composeIdentifierName({
|
|
147
|
+
resourceName,
|
|
148
|
+
resource: "worker"
|
|
149
|
+
});
|
|
150
|
+
return await cloudflare.Worker(
|
|
151
|
+
identifierName,
|
|
152
|
+
node_index.composeWorkerArguments({
|
|
153
|
+
resourceName: composeResourceName({
|
|
154
|
+
project: this.project,
|
|
155
|
+
environment: this.environment,
|
|
156
|
+
resourceName: identifierName
|
|
157
|
+
}),
|
|
158
|
+
entrypoint,
|
|
159
|
+
bindings,
|
|
160
|
+
eventSources
|
|
161
|
+
})
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Creates an instance of Cloudflare Worker as a service.
|
|
166
|
+
*/
|
|
167
|
+
async service(options) {
|
|
168
|
+
const { resourceName, bindings, eventSources } = options;
|
|
169
|
+
return await this.worker({
|
|
170
|
+
resourceName,
|
|
171
|
+
// TODO: Convert to util
|
|
172
|
+
entrypoint: `./services/${resourceName}/src/index.ts`,
|
|
173
|
+
bindings,
|
|
174
|
+
eventSources
|
|
175
|
+
});
|
|
176
|
+
}
|
|
150
177
|
}
|
|
151
178
|
|
|
152
179
|
const validateEnvironment = (environment) => {
|
|
@@ -157,7 +184,6 @@ const validateEnvironment = (environment) => {
|
|
|
157
184
|
};
|
|
158
185
|
|
|
159
186
|
exports.Infrastructure = Infrastructure;
|
|
160
|
-
exports.composeBindingName = composeBindingName;
|
|
161
187
|
exports.composeD1Arguments = composeD1Arguments;
|
|
162
188
|
exports.composeIdentifierName = composeIdentifierName;
|
|
163
189
|
exports.composeKvArguments = composeKvArguments;
|
|
@@ -1,5 +1,5 @@
|
|
|
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
5
|
|
|
@@ -58,6 +58,44 @@ declare class Infrastructure {
|
|
|
58
58
|
*/
|
|
59
59
|
storageClass?: 'Standard' | 'InfrequentAccess';
|
|
60
60
|
}): Promise<R2Bucket>;
|
|
61
|
+
/**
|
|
62
|
+
* Creates an instance of Cloudflare Worker.
|
|
63
|
+
*/
|
|
64
|
+
worker(options: {
|
|
65
|
+
/**
|
|
66
|
+
* Name of the Worker. Do not include the 'worker' prefix.
|
|
67
|
+
*/
|
|
68
|
+
resourceName: string;
|
|
69
|
+
/**
|
|
70
|
+
* Entrypoint file of the Worker.
|
|
71
|
+
*/
|
|
72
|
+
entrypoint: string;
|
|
73
|
+
/**
|
|
74
|
+
* Bindings of the Worker.
|
|
75
|
+
*/
|
|
76
|
+
bindings: Bindings;
|
|
77
|
+
/**
|
|
78
|
+
* Event sources for the service to consume.
|
|
79
|
+
*/
|
|
80
|
+
eventSources?: Queue[];
|
|
81
|
+
}): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
|
|
82
|
+
/**
|
|
83
|
+
* Creates an instance of Cloudflare Worker as a service.
|
|
84
|
+
*/
|
|
85
|
+
service(options: {
|
|
86
|
+
/**
|
|
87
|
+
* Name of the service. Do not include the 'service' prefix.
|
|
88
|
+
*/
|
|
89
|
+
resourceName: string;
|
|
90
|
+
/**
|
|
91
|
+
* Bindings of the Worker.
|
|
92
|
+
*/
|
|
93
|
+
bindings: Bindings;
|
|
94
|
+
/**
|
|
95
|
+
* Event sources for the service to consume.
|
|
96
|
+
*/
|
|
97
|
+
eventSources?: Queue[];
|
|
98
|
+
}): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
|
|
61
99
|
}
|
|
62
100
|
|
|
63
101
|
declare const composeD1Arguments: ({ resourceName, }: {
|
|
@@ -95,11 +133,6 @@ declare const composeR2Arguments: ({ resourceName, storageClass, }: {
|
|
|
95
133
|
storageClass: "Standard" | "InfrequentAccess";
|
|
96
134
|
};
|
|
97
135
|
|
|
98
|
-
declare const composeBindingName: ({ resource, resourceName, bindingName, }: {
|
|
99
|
-
resource: Resource;
|
|
100
|
-
resourceName: string;
|
|
101
|
-
bindingName?: string;
|
|
102
|
-
}) => string;
|
|
103
136
|
declare const composeIdentifierName: ({ resource, resourceName, }: {
|
|
104
137
|
resource: Resource;
|
|
105
138
|
resourceName: string;
|
|
@@ -112,4 +145,4 @@ declare const composeResourceName: ({ project, environment, resourceName, }: {
|
|
|
112
145
|
|
|
113
146
|
declare const validateEnvironment: (environment: string) => Environment;
|
|
114
147
|
|
|
115
|
-
export { Infrastructure,
|
|
148
|
+
export { Infrastructure, composeD1Arguments, composeIdentifierName, composeKvArguments, composeQueueArguments, composeR2Arguments, composeResourceName, validateEnvironment };
|
|
@@ -1,5 +1,5 @@
|
|
|
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
5
|
|
|
@@ -58,6 +58,44 @@ declare class Infrastructure {
|
|
|
58
58
|
*/
|
|
59
59
|
storageClass?: 'Standard' | 'InfrequentAccess';
|
|
60
60
|
}): Promise<R2Bucket>;
|
|
61
|
+
/**
|
|
62
|
+
* Creates an instance of Cloudflare Worker.
|
|
63
|
+
*/
|
|
64
|
+
worker(options: {
|
|
65
|
+
/**
|
|
66
|
+
* Name of the Worker. Do not include the 'worker' prefix.
|
|
67
|
+
*/
|
|
68
|
+
resourceName: string;
|
|
69
|
+
/**
|
|
70
|
+
* Entrypoint file of the Worker.
|
|
71
|
+
*/
|
|
72
|
+
entrypoint: string;
|
|
73
|
+
/**
|
|
74
|
+
* Bindings of the Worker.
|
|
75
|
+
*/
|
|
76
|
+
bindings: Bindings;
|
|
77
|
+
/**
|
|
78
|
+
* Event sources for the service to consume.
|
|
79
|
+
*/
|
|
80
|
+
eventSources?: Queue[];
|
|
81
|
+
}): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
|
|
82
|
+
/**
|
|
83
|
+
* Creates an instance of Cloudflare Worker as a service.
|
|
84
|
+
*/
|
|
85
|
+
service(options: {
|
|
86
|
+
/**
|
|
87
|
+
* Name of the service. Do not include the 'service' prefix.
|
|
88
|
+
*/
|
|
89
|
+
resourceName: string;
|
|
90
|
+
/**
|
|
91
|
+
* Bindings of the Worker.
|
|
92
|
+
*/
|
|
93
|
+
bindings: Bindings;
|
|
94
|
+
/**
|
|
95
|
+
* Event sources for the service to consume.
|
|
96
|
+
*/
|
|
97
|
+
eventSources?: Queue[];
|
|
98
|
+
}): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
|
|
61
99
|
}
|
|
62
100
|
|
|
63
101
|
declare const composeD1Arguments: ({ resourceName, }: {
|
|
@@ -95,11 +133,6 @@ declare const composeR2Arguments: ({ resourceName, storageClass, }: {
|
|
|
95
133
|
storageClass: "Standard" | "InfrequentAccess";
|
|
96
134
|
};
|
|
97
135
|
|
|
98
|
-
declare const composeBindingName: ({ resource, resourceName, bindingName, }: {
|
|
99
|
-
resource: Resource;
|
|
100
|
-
resourceName: string;
|
|
101
|
-
bindingName?: string;
|
|
102
|
-
}) => string;
|
|
103
136
|
declare const composeIdentifierName: ({ resource, resourceName, }: {
|
|
104
137
|
resource: Resource;
|
|
105
138
|
resourceName: string;
|
|
@@ -112,4 +145,4 @@ declare const composeResourceName: ({ project, environment, resourceName, }: {
|
|
|
112
145
|
|
|
113
146
|
declare const validateEnvironment: (environment: string) => Environment;
|
|
114
147
|
|
|
115
|
-
export { Infrastructure,
|
|
148
|
+
export { Infrastructure, composeD1Arguments, composeIdentifierName, composeKvArguments, composeQueueArguments, composeR2Arguments, composeResourceName, validateEnvironment };
|
|
@@ -1,5 +1,5 @@
|
|
|
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
5
|
|
|
@@ -58,6 +58,44 @@ declare class Infrastructure {
|
|
|
58
58
|
*/
|
|
59
59
|
storageClass?: 'Standard' | 'InfrequentAccess';
|
|
60
60
|
}): Promise<R2Bucket>;
|
|
61
|
+
/**
|
|
62
|
+
* Creates an instance of Cloudflare Worker.
|
|
63
|
+
*/
|
|
64
|
+
worker(options: {
|
|
65
|
+
/**
|
|
66
|
+
* Name of the Worker. Do not include the 'worker' prefix.
|
|
67
|
+
*/
|
|
68
|
+
resourceName: string;
|
|
69
|
+
/**
|
|
70
|
+
* Entrypoint file of the Worker.
|
|
71
|
+
*/
|
|
72
|
+
entrypoint: string;
|
|
73
|
+
/**
|
|
74
|
+
* Bindings of the Worker.
|
|
75
|
+
*/
|
|
76
|
+
bindings: Bindings;
|
|
77
|
+
/**
|
|
78
|
+
* Event sources for the service to consume.
|
|
79
|
+
*/
|
|
80
|
+
eventSources?: Queue[];
|
|
81
|
+
}): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
|
|
82
|
+
/**
|
|
83
|
+
* Creates an instance of Cloudflare Worker as a service.
|
|
84
|
+
*/
|
|
85
|
+
service(options: {
|
|
86
|
+
/**
|
|
87
|
+
* Name of the service. Do not include the 'service' prefix.
|
|
88
|
+
*/
|
|
89
|
+
resourceName: string;
|
|
90
|
+
/**
|
|
91
|
+
* Bindings of the Worker.
|
|
92
|
+
*/
|
|
93
|
+
bindings: Bindings;
|
|
94
|
+
/**
|
|
95
|
+
* Event sources for the service to consume.
|
|
96
|
+
*/
|
|
97
|
+
eventSources?: Queue[];
|
|
98
|
+
}): Promise<Worker<Bindings, Rpc.WorkerEntrypointBranded>>;
|
|
61
99
|
}
|
|
62
100
|
|
|
63
101
|
declare const composeD1Arguments: ({ resourceName, }: {
|
|
@@ -95,11 +133,6 @@ declare const composeR2Arguments: ({ resourceName, storageClass, }: {
|
|
|
95
133
|
storageClass: "Standard" | "InfrequentAccess";
|
|
96
134
|
};
|
|
97
135
|
|
|
98
|
-
declare const composeBindingName: ({ resource, resourceName, bindingName, }: {
|
|
99
|
-
resource: Resource;
|
|
100
|
-
resourceName: string;
|
|
101
|
-
bindingName?: string;
|
|
102
|
-
}) => string;
|
|
103
136
|
declare const composeIdentifierName: ({ resource, resourceName, }: {
|
|
104
137
|
resource: Resource;
|
|
105
138
|
resourceName: string;
|
|
@@ -112,4 +145,4 @@ declare const composeResourceName: ({ project, environment, resourceName, }: {
|
|
|
112
145
|
|
|
113
146
|
declare const validateEnvironment: (environment: string) => Environment;
|
|
114
147
|
|
|
115
|
-
export { Infrastructure,
|
|
148
|
+
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.CxCzOVpU.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,42 @@ class Infrastructure {
|
|
|
145
136
|
})
|
|
146
137
|
);
|
|
147
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Creates an instance of Cloudflare Worker.
|
|
141
|
+
*/
|
|
142
|
+
async worker(options) {
|
|
143
|
+
const { resourceName, entrypoint, bindings, eventSources } = options;
|
|
144
|
+
const identifierName = composeIdentifierName({
|
|
145
|
+
resourceName,
|
|
146
|
+
resource: "worker"
|
|
147
|
+
});
|
|
148
|
+
return await Worker(
|
|
149
|
+
identifierName,
|
|
150
|
+
composeWorkerArguments({
|
|
151
|
+
resourceName: composeResourceName({
|
|
152
|
+
project: this.project,
|
|
153
|
+
environment: this.environment,
|
|
154
|
+
resourceName: identifierName
|
|
155
|
+
}),
|
|
156
|
+
entrypoint,
|
|
157
|
+
bindings,
|
|
158
|
+
eventSources
|
|
159
|
+
})
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Creates an instance of Cloudflare Worker as a service.
|
|
164
|
+
*/
|
|
165
|
+
async service(options) {
|
|
166
|
+
const { resourceName, bindings, eventSources } = options;
|
|
167
|
+
return await this.worker({
|
|
168
|
+
resourceName,
|
|
169
|
+
// TODO: Convert to util
|
|
170
|
+
entrypoint: `./services/${resourceName}/src/index.ts`,
|
|
171
|
+
bindings,
|
|
172
|
+
eventSources
|
|
173
|
+
});
|
|
174
|
+
}
|
|
148
175
|
}
|
|
149
176
|
|
|
150
177
|
const validateEnvironment = (environment) => {
|
|
@@ -154,4 +181,4 @@ const validateEnvironment = (environment) => {
|
|
|
154
181
|
return Number(environment);
|
|
155
182
|
};
|
|
156
183
|
|
|
157
|
-
export { Infrastructure,
|
|
184
|
+
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.CpwGFVDb.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,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Bindings, Queue } from 'alchemy/cloudflare';
|
|
2
2
|
|
|
3
|
-
declare
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
declare const composeWorkerArguments: ({ resourceName, entrypoint, bindings, eventSources, }: {
|
|
4
|
+
resourceName: string;
|
|
5
|
+
entrypoint: string;
|
|
6
|
+
bindings: Bindings;
|
|
7
|
+
eventSources?: Queue[];
|
|
8
|
+
}) => {
|
|
9
|
+
name: string;
|
|
10
|
+
entrypoint: string;
|
|
11
|
+
compatibilityFlags: string[];
|
|
12
|
+
compatibilityDate: string;
|
|
13
|
+
observability: {
|
|
14
|
+
enabled: true;
|
|
15
|
+
};
|
|
16
|
+
url: false;
|
|
17
|
+
eventSources: Queue[];
|
|
18
|
+
bindings: Bindings;
|
|
19
|
+
};
|
|
6
20
|
|
|
7
|
-
export {
|
|
21
|
+
export { composeWorkerArguments };
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Bindings, Queue } from 'alchemy/cloudflare';
|
|
2
2
|
|
|
3
|
-
declare
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
declare const composeWorkerArguments: ({ resourceName, entrypoint, bindings, eventSources, }: {
|
|
4
|
+
resourceName: string;
|
|
5
|
+
entrypoint: string;
|
|
6
|
+
bindings: Bindings;
|
|
7
|
+
eventSources?: Queue[];
|
|
8
|
+
}) => {
|
|
9
|
+
name: string;
|
|
10
|
+
entrypoint: string;
|
|
11
|
+
compatibilityFlags: string[];
|
|
12
|
+
compatibilityDate: string;
|
|
13
|
+
observability: {
|
|
14
|
+
enabled: true;
|
|
15
|
+
};
|
|
16
|
+
url: false;
|
|
17
|
+
eventSources: Queue[];
|
|
18
|
+
bindings: Bindings;
|
|
19
|
+
};
|
|
6
20
|
|
|
7
|
-
export {
|
|
21
|
+
export { composeWorkerArguments };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Bindings, Queue } from 'alchemy/cloudflare';
|
|
2
2
|
|
|
3
|
-
declare
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
declare const composeWorkerArguments: ({ resourceName, entrypoint, bindings, eventSources, }: {
|
|
4
|
+
resourceName: string;
|
|
5
|
+
entrypoint: string;
|
|
6
|
+
bindings: Bindings;
|
|
7
|
+
eventSources?: Queue[];
|
|
8
|
+
}) => {
|
|
9
|
+
name: string;
|
|
10
|
+
entrypoint: string;
|
|
11
|
+
compatibilityFlags: string[];
|
|
12
|
+
compatibilityDate: string;
|
|
13
|
+
observability: {
|
|
14
|
+
enabled: true;
|
|
15
|
+
};
|
|
16
|
+
url: false;
|
|
17
|
+
eventSources: Queue[];
|
|
18
|
+
bindings: Bindings;
|
|
19
|
+
};
|
|
6
20
|
|
|
7
|
-
export {
|
|
21
|
+
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.CxCzOVpU.mjs';
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
bindings,
|
|
16
|
+
eventSources = []
|
|
17
|
+
}) => {
|
|
18
|
+
return {
|
|
19
|
+
name: resourceName,
|
|
20
|
+
entrypoint,
|
|
21
|
+
compatibilityFlags: COMPATIBILITY_FLAGS,
|
|
22
|
+
compatibilityDate: COMPATIBILITY_DATE,
|
|
23
|
+
observability: {
|
|
24
|
+
enabled: true
|
|
25
|
+
},
|
|
26
|
+
url: false,
|
|
27
|
+
eventSources,
|
|
28
|
+
bindings
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
exports.D1_LOCATION_HINT = D1_LOCATION_HINT;
|
|
33
|
+
exports.QUEUE_DELIVERY_DELAY = QUEUE_DELIVERY_DELAY;
|
|
34
|
+
exports.QUEUE_MESSAGE_RETENTION_PERIOD = QUEUE_MESSAGE_RETENTION_PERIOD;
|
|
35
|
+
exports.R2_JURISDICTION = R2_JURISDICTION;
|
|
36
|
+
exports.R2_LOCATION_HINT = R2_LOCATION_HINT;
|
|
37
|
+
exports.R2_STORAGE_CLASS = R2_STORAGE_CLASS;
|
|
38
|
+
exports.composeWorkerArguments = composeWorkerArguments;
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
bindings,
|
|
14
|
+
eventSources = []
|
|
15
|
+
}) => {
|
|
16
|
+
return {
|
|
17
|
+
name: resourceName,
|
|
18
|
+
entrypoint,
|
|
19
|
+
compatibilityFlags: COMPATIBILITY_FLAGS,
|
|
20
|
+
compatibilityDate: COMPATIBILITY_DATE,
|
|
21
|
+
observability: {
|
|
22
|
+
enabled: true
|
|
23
|
+
},
|
|
24
|
+
url: false,
|
|
25
|
+
eventSources,
|
|
26
|
+
bindings
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
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 };
|