directus-template-cli 0.5.0-beta.13 → 0.5.0-beta.15
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/apply.js +5 -1
- package/dist/lib/sdk.js +7 -6
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/dist/commands/apply.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
5
|
const inquirer = tslib_1.__importStar(require("inquirer"));
|
|
6
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
6
7
|
const customFlags = tslib_1.__importStar(require("../flags/common"));
|
|
7
8
|
const constants_1 = require("../lib/constants");
|
|
8
9
|
const apply_flags_1 = require("../lib/load/apply-flags");
|
|
@@ -167,7 +168,10 @@ class ApplyCommand extends core_1.Command {
|
|
|
167
168
|
}
|
|
168
169
|
const { selectedTemplate } = await inquirer.prompt([
|
|
169
170
|
{
|
|
170
|
-
choices: templates.map(t => ({
|
|
171
|
+
choices: templates.map(t => ({
|
|
172
|
+
name: `${t.templateName} (${path.basename(t.directoryPath)})`,
|
|
173
|
+
value: t,
|
|
174
|
+
})),
|
|
171
175
|
message: 'Multiple templates found. Please select one:',
|
|
172
176
|
name: 'selectedTemplate',
|
|
173
177
|
type: 'list',
|
package/dist/lib/sdk.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.api = exports.DirectusError = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const sdk_1 = require("@directus/sdk");
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
6
7
|
const bottleneck_1 = tslib_1.__importDefault(require("bottleneck"));
|
|
7
8
|
class DirectusError extends Error {
|
|
8
9
|
constructor(response) {
|
|
@@ -57,12 +58,12 @@ class Api {
|
|
|
57
58
|
const statusCode = error.status;
|
|
58
59
|
if (statusCode === 429) {
|
|
59
60
|
const delay = retryAfter ? Number.parseInt(retryAfter, 10) * 1000 : 60000;
|
|
60
|
-
|
|
61
|
+
core_1.ux.log(`${core_1.ux.colorize('dim', '--')} Rate limited. Retrying after ${delay}ms`);
|
|
61
62
|
return delay;
|
|
62
63
|
}
|
|
63
64
|
if (statusCode === 503) {
|
|
64
65
|
const delay = retryAfter ? Number.parseInt(retryAfter, 10) * 1000 : 5000;
|
|
65
|
-
|
|
66
|
+
core_1.ux.log(`${core_1.ux.colorize('dim', '--')} Server under pressure. Retrying after ${delay}ms`);
|
|
66
67
|
return delay;
|
|
67
68
|
}
|
|
68
69
|
if (statusCode === 400) {
|
|
@@ -72,17 +73,17 @@ class Api {
|
|
|
72
73
|
// For other errors, use exponential backoff, but only if we haven't exceeded retryCount
|
|
73
74
|
if (jobInfo.retryCount < 3) {
|
|
74
75
|
const delay = Math.min(1000 * 2 ** jobInfo.retryCount, 30000);
|
|
75
|
-
|
|
76
|
+
core_1.ux.log(`${core_1.ux.colorize('dim', '--')} Request failed. Retrying after ${delay}ms`);
|
|
76
77
|
return delay;
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
+
core_1.ux.log(`${core_1.ux.colorize('dim', '--')} Max retries reached, not retrying further`);
|
|
79
80
|
});
|
|
80
81
|
this.limiter.on('retry', (error, jobInfo) => {
|
|
81
|
-
|
|
82
|
+
core_1.ux.log(`${core_1.ux.colorize('dim', '--')} Retrying job (attempt ${jobInfo.retryCount + 1})`);
|
|
82
83
|
});
|
|
83
84
|
this.limiter.on('depleted', empty => {
|
|
84
85
|
if (empty) {
|
|
85
|
-
|
|
86
|
+
core_1.ux.log(`${core_1.ux.colorize('dim', '--')} Rate limit quota depleted. Requests will be queued.`);
|
|
86
87
|
}
|
|
87
88
|
});
|
|
88
89
|
}
|
package/oclif.manifest.json
CHANGED