@ductape/cli 0.3.4 → 0.3.6
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/commands/products.js +18 -1
- package/package.json +1 -1
|
@@ -85,6 +85,13 @@ const COMPONENT_KEYS = {
|
|
|
85
85
|
sessions: ['sessions'],
|
|
86
86
|
features: ['features'],
|
|
87
87
|
jobs: ['jobs'],
|
|
88
|
+
healthchecks: ['healthchecks'],
|
|
89
|
+
health: ['healthchecks'],
|
|
90
|
+
quotas: ['quota', 'quotas'],
|
|
91
|
+
fallbacks: ['fallback', 'fallbacks'],
|
|
92
|
+
functions: ['functions'],
|
|
93
|
+
agents: ['agents'],
|
|
94
|
+
models: ['models'],
|
|
88
95
|
};
|
|
89
96
|
function unwrapProduct(value) {
|
|
90
97
|
if (!value || typeof value !== 'object')
|
|
@@ -166,7 +173,7 @@ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
166
173
|
*/
|
|
167
174
|
async function fetchEnvironmentWithRetry(proxy, productTag, slug, attempts = 3, delayMs = 400) {
|
|
168
175
|
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
169
|
-
const found = await proxy.execute('product', 'environments.fetch', [productTag, slug]);
|
|
176
|
+
const found = await proxy.execute('product', 'environments.fetch', [productTag, slug, true]);
|
|
170
177
|
if (found)
|
|
171
178
|
return found;
|
|
172
179
|
if (attempt < attempts)
|
|
@@ -222,6 +229,16 @@ export async function runProductEnvironments(verb, opts, extraArgs) {
|
|
|
222
229
|
const verified = await fetchEnvironmentWithRetry(proxy, productTag, body.slug ?? updateSlug);
|
|
223
230
|
if (!verified)
|
|
224
231
|
throw new Error(`Environment "${updateSlug}" was not found after update.`);
|
|
232
|
+
if (verified === null || typeof verified !== 'object') {
|
|
233
|
+
throw new Error(`Environment "${updateSlug}" returned an invalid response after update.`);
|
|
234
|
+
}
|
|
235
|
+
const mismatches = Object.entries(body)
|
|
236
|
+
.filter(([key, expected]) => !Object.is(verified[key], expected))
|
|
237
|
+
.map(([key]) => key);
|
|
238
|
+
if (mismatches.length > 0) {
|
|
239
|
+
throw new Error(`Environment "${updateSlug}" update could not be verified; ` +
|
|
240
|
+
`the persisted value did not match field(s): ${mismatches.join(', ')}.`);
|
|
241
|
+
}
|
|
225
242
|
printJson({ product: productTag, slug: body.slug ?? updateSlug, updated: true, environment: verified }, Boolean(opts.json));
|
|
226
243
|
return;
|
|
227
244
|
}
|
package/package.json
CHANGED