@develit-io/backend-sdk 5.29.0 → 5.29.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.
- package/dist/deployment/index.cjs +36 -11
- package/dist/deployment/index.d.cts +17 -0
- package/dist/deployment/index.d.mts +17 -0
- package/dist/deployment/index.d.ts +17 -0
- package/dist/deployment/index.mjs +36 -11
- package/package.json +1 -1
|
@@ -72,6 +72,20 @@ const composeResourceName = ({
|
|
|
72
72
|
return `${project}-${text.toKebabCase(resourceName).toLowerCase()}-${environment}`;
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
+
const composeDlqArguments = ({
|
|
76
|
+
resourceName,
|
|
77
|
+
deliveryDelay = worker.QUEUE_DELIVERY_DELAY,
|
|
78
|
+
messageRetentionPeriod = worker.QUEUE_MESSAGE_RETENTION_PERIOD
|
|
79
|
+
}) => {
|
|
80
|
+
return {
|
|
81
|
+
name: resourceName,
|
|
82
|
+
settings: {
|
|
83
|
+
deliveryDelay,
|
|
84
|
+
messageRetentionPeriod
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
75
89
|
class Deployment {
|
|
76
90
|
project;
|
|
77
91
|
environment;
|
|
@@ -131,17 +145,9 @@ class Deployment {
|
|
|
131
145
|
*/
|
|
132
146
|
async queue(options) {
|
|
133
147
|
const { resourceName, deliveryDelay, messageRetentionPeriod } = options;
|
|
134
|
-
const dlq = await
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
name: composeResourceName({
|
|
138
|
-
project: this.project,
|
|
139
|
-
environment: this.environment,
|
|
140
|
-
// TODO: Convert to a util
|
|
141
|
-
resourceName: `${resourceName}-dlq`
|
|
142
|
-
})
|
|
143
|
-
}
|
|
144
|
-
);
|
|
148
|
+
const dlq = await this.dlq({
|
|
149
|
+
resourceName
|
|
150
|
+
});
|
|
145
151
|
return await cloudflare.Queue(
|
|
146
152
|
composeIdentifierName({ resourceName, resource: "queue" }),
|
|
147
153
|
composeQueueArguments({
|
|
@@ -156,6 +162,25 @@ class Deployment {
|
|
|
156
162
|
})
|
|
157
163
|
);
|
|
158
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Creates an instance of Cloudflare Queue as a DLQ.
|
|
167
|
+
*/
|
|
168
|
+
async dlq(options) {
|
|
169
|
+
const { resourceName, deliveryDelay, messageRetentionPeriod } = options;
|
|
170
|
+
return await cloudflare.Queue(
|
|
171
|
+
composeIdentifierName({ resourceName, resource: "dlq" }),
|
|
172
|
+
composeDlqArguments({
|
|
173
|
+
resourceName: composeResourceName({
|
|
174
|
+
project: this.project,
|
|
175
|
+
environment: this.environment,
|
|
176
|
+
// TODO: Convert to a util
|
|
177
|
+
resourceName: `${resourceName}-dlq`
|
|
178
|
+
}),
|
|
179
|
+
deliveryDelay,
|
|
180
|
+
messageRetentionPeriod
|
|
181
|
+
})
|
|
182
|
+
);
|
|
183
|
+
}
|
|
159
184
|
/**
|
|
160
185
|
* Creates an instance of Cloudflare R2.
|
|
161
186
|
*/
|
|
@@ -52,6 +52,23 @@ declare class Deployment {
|
|
|
52
52
|
*/
|
|
53
53
|
messageRetentionPeriod?: number;
|
|
54
54
|
}): Promise<Queue<unknown>>;
|
|
55
|
+
/**
|
|
56
|
+
* Creates an instance of Cloudflare Queue as a DLQ.
|
|
57
|
+
*/
|
|
58
|
+
dlq(options: {
|
|
59
|
+
/**
|
|
60
|
+
* Name of the DLQ. Do not include the 'dlq' or 'queue' prefix.
|
|
61
|
+
*/
|
|
62
|
+
resourceName: string;
|
|
63
|
+
/**
|
|
64
|
+
* The number of seconds to delay delivery of messages to the queue.
|
|
65
|
+
*/
|
|
66
|
+
deliveryDelay?: number;
|
|
67
|
+
/**
|
|
68
|
+
* The number of seconds a message will remain in the queue before being deleted.
|
|
69
|
+
*/
|
|
70
|
+
messageRetentionPeriod?: number;
|
|
71
|
+
}): Promise<Queue<unknown>>;
|
|
55
72
|
/**
|
|
56
73
|
* Creates an instance of Cloudflare R2.
|
|
57
74
|
*/
|
|
@@ -52,6 +52,23 @@ declare class Deployment {
|
|
|
52
52
|
*/
|
|
53
53
|
messageRetentionPeriod?: number;
|
|
54
54
|
}): Promise<Queue<unknown>>;
|
|
55
|
+
/**
|
|
56
|
+
* Creates an instance of Cloudflare Queue as a DLQ.
|
|
57
|
+
*/
|
|
58
|
+
dlq(options: {
|
|
59
|
+
/**
|
|
60
|
+
* Name of the DLQ. Do not include the 'dlq' or 'queue' prefix.
|
|
61
|
+
*/
|
|
62
|
+
resourceName: string;
|
|
63
|
+
/**
|
|
64
|
+
* The number of seconds to delay delivery of messages to the queue.
|
|
65
|
+
*/
|
|
66
|
+
deliveryDelay?: number;
|
|
67
|
+
/**
|
|
68
|
+
* The number of seconds a message will remain in the queue before being deleted.
|
|
69
|
+
*/
|
|
70
|
+
messageRetentionPeriod?: number;
|
|
71
|
+
}): Promise<Queue<unknown>>;
|
|
55
72
|
/**
|
|
56
73
|
* Creates an instance of Cloudflare R2.
|
|
57
74
|
*/
|
|
@@ -52,6 +52,23 @@ declare class Deployment {
|
|
|
52
52
|
*/
|
|
53
53
|
messageRetentionPeriod?: number;
|
|
54
54
|
}): Promise<Queue<unknown>>;
|
|
55
|
+
/**
|
|
56
|
+
* Creates an instance of Cloudflare Queue as a DLQ.
|
|
57
|
+
*/
|
|
58
|
+
dlq(options: {
|
|
59
|
+
/**
|
|
60
|
+
* Name of the DLQ. Do not include the 'dlq' or 'queue' prefix.
|
|
61
|
+
*/
|
|
62
|
+
resourceName: string;
|
|
63
|
+
/**
|
|
64
|
+
* The number of seconds to delay delivery of messages to the queue.
|
|
65
|
+
*/
|
|
66
|
+
deliveryDelay?: number;
|
|
67
|
+
/**
|
|
68
|
+
* The number of seconds a message will remain in the queue before being deleted.
|
|
69
|
+
*/
|
|
70
|
+
messageRetentionPeriod?: number;
|
|
71
|
+
}): Promise<Queue<unknown>>;
|
|
55
72
|
/**
|
|
56
73
|
* Creates an instance of Cloudflare R2.
|
|
57
74
|
*/
|
|
@@ -66,6 +66,20 @@ const composeResourceName = ({
|
|
|
66
66
|
return `${project}-${toKebabCase(resourceName).toLowerCase()}-${environment}`;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
+
const composeDlqArguments = ({
|
|
70
|
+
resourceName,
|
|
71
|
+
deliveryDelay = QUEUE_DELIVERY_DELAY,
|
|
72
|
+
messageRetentionPeriod = QUEUE_MESSAGE_RETENTION_PERIOD
|
|
73
|
+
}) => {
|
|
74
|
+
return {
|
|
75
|
+
name: resourceName,
|
|
76
|
+
settings: {
|
|
77
|
+
deliveryDelay,
|
|
78
|
+
messageRetentionPeriod
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
|
|
69
83
|
class Deployment {
|
|
70
84
|
project;
|
|
71
85
|
environment;
|
|
@@ -125,17 +139,9 @@ class Deployment {
|
|
|
125
139
|
*/
|
|
126
140
|
async queue(options) {
|
|
127
141
|
const { resourceName, deliveryDelay, messageRetentionPeriod } = options;
|
|
128
|
-
const dlq = await
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
name: composeResourceName({
|
|
132
|
-
project: this.project,
|
|
133
|
-
environment: this.environment,
|
|
134
|
-
// TODO: Convert to a util
|
|
135
|
-
resourceName: `${resourceName}-dlq`
|
|
136
|
-
})
|
|
137
|
-
}
|
|
138
|
-
);
|
|
142
|
+
const dlq = await this.dlq({
|
|
143
|
+
resourceName
|
|
144
|
+
});
|
|
139
145
|
return await Queue(
|
|
140
146
|
composeIdentifierName({ resourceName, resource: "queue" }),
|
|
141
147
|
composeQueueArguments({
|
|
@@ -150,6 +156,25 @@ class Deployment {
|
|
|
150
156
|
})
|
|
151
157
|
);
|
|
152
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Creates an instance of Cloudflare Queue as a DLQ.
|
|
161
|
+
*/
|
|
162
|
+
async dlq(options) {
|
|
163
|
+
const { resourceName, deliveryDelay, messageRetentionPeriod } = options;
|
|
164
|
+
return await Queue(
|
|
165
|
+
composeIdentifierName({ resourceName, resource: "dlq" }),
|
|
166
|
+
composeDlqArguments({
|
|
167
|
+
resourceName: composeResourceName({
|
|
168
|
+
project: this.project,
|
|
169
|
+
environment: this.environment,
|
|
170
|
+
// TODO: Convert to a util
|
|
171
|
+
resourceName: `${resourceName}-dlq`
|
|
172
|
+
}),
|
|
173
|
+
deliveryDelay,
|
|
174
|
+
messageRetentionPeriod
|
|
175
|
+
})
|
|
176
|
+
);
|
|
177
|
+
}
|
|
153
178
|
/**
|
|
154
179
|
* Creates an instance of Cloudflare R2.
|
|
155
180
|
*/
|