@nmakarov/cli-toolkit 0.18.0 → 0.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/README.md +9 -0
- package/dist/args.cjs +1 -4
- package/dist/args.cjs.map +1 -1
- package/dist/args.js +1 -1
- package/dist/args.js.map +1 -1
- package/dist/cli-runner.cjs +1493 -516
- package/dist/cli-runner.cjs.map +1 -1
- package/dist/cli-runner.js +1509 -531
- package/dist/cli-runner.js.map +1 -1
- package/dist/db.cjs +85 -157
- package/dist/db.cjs.map +1 -1
- package/dist/db.js +84 -150
- package/dist/db.js.map +1 -1
- package/dist/errors.cjs +2 -2
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.js +2 -1
- package/dist/errors.js.map +1 -1
- package/dist/filedatabase.cjs +19 -19
- package/dist/filedatabase.cjs.map +1 -1
- package/dist/filedatabase.js +19 -16
- package/dist/filedatabase.js.map +1 -1
- package/dist/http-client.cjs +9 -11
- package/dist/http-client.cjs.map +1 -1
- package/dist/http-client.js +10 -9
- package/dist/http-client.js.map +1 -1
- package/dist/http-client2.cjs +34 -33
- package/dist/http-client2.cjs.map +1 -1
- package/dist/http-client2.js +34 -30
- package/dist/http-client2.js.map +1 -1
- package/dist/index.cjs +2063 -658
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2063 -663
- package/dist/index.js.map +1 -1
- package/dist/init.cjs +97 -69
- package/dist/init.cjs.map +1 -1
- package/dist/init.js +112 -83
- package/dist/init.js.map +1 -1
- package/dist/logger.cjs +5 -5
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.js +5 -4
- package/dist/logger.js.map +1 -1
- package/dist/mock-server.cjs +21 -33
- package/dist/mock-server.cjs.map +1 -1
- package/dist/mock-server.js +21 -28
- package/dist/mock-server.js.map +1 -1
- package/dist/params.cjs +22 -10
- package/dist/params.cjs.map +1 -1
- package/dist/params.js +22 -7
- package/dist/params.js.map +1 -1
- package/dist/s3.cjs +286 -0
- package/dist/s3.cjs.map +1 -0
- package/dist/s3.js +273 -0
- package/dist/s3.js.map +1 -0
- package/dist/screen.cjs +34 -39
- package/dist/screen.cjs.map +1 -1
- package/dist/screen.js +48 -46
- package/dist/screen.js.map +1 -1
- package/dist/tasks.cjs +1640 -416
- package/dist/tasks.cjs.map +1 -1
- package/dist/tasks.js +1614 -412
- package/dist/tasks.js.map +1 -1
- package/dist/utils.cjs +7 -8
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +6 -6
- package/dist/utils.js.map +1 -1
- package/package.json +36 -44
- package/scripts/ssm/parse-cli.js +35 -0
- package/scripts/ssm/ssm-admin.js +151 -0
- package/scripts/ssm/ssm-pull.js +147 -0
package/dist/mock-server.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
// src/mock-server/index.
|
|
1
|
+
// src/mock-server/index.js
|
|
2
2
|
import express from "express";
|
|
3
3
|
import http from "http";
|
|
4
4
|
import morgan from "morgan";
|
|
5
5
|
|
|
6
|
-
// src/
|
|
7
|
-
import { createHash } from "crypto";
|
|
8
|
-
|
|
9
|
-
// src/filedatabase/index.ts
|
|
6
|
+
// src/filedatabase/index.js
|
|
10
7
|
import fs3 from "fs";
|
|
11
8
|
import path3 from "path";
|
|
12
9
|
|
|
13
|
-
// src/utils/os-utils.
|
|
10
|
+
// src/utils/os-utils.js
|
|
14
11
|
import fs from "fs";
|
|
15
12
|
import path from "path";
|
|
16
13
|
import { execSync } from "child_process";
|
|
@@ -39,7 +36,7 @@ function getFreeDiskSpace(targetPath) {
|
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
38
|
|
|
42
|
-
// src/utils/fs-utils.
|
|
39
|
+
// src/utils/fs-utils.js
|
|
43
40
|
import fs2 from "fs";
|
|
44
41
|
import path2 from "path";
|
|
45
42
|
async function ensurePath(...pathParts) {
|
|
@@ -63,7 +60,7 @@ function getFileExtension(dataType) {
|
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
62
|
|
|
66
|
-
// src/utils/format-utils.
|
|
63
|
+
// src/utils/format-utils.js
|
|
67
64
|
function bytesToHumanReadable(bytes) {
|
|
68
65
|
if (bytes === 0) return "0 B";
|
|
69
66
|
const k = 1024;
|
|
@@ -72,7 +69,7 @@ function bytesToHumanReadable(bytes) {
|
|
|
72
69
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
73
70
|
}
|
|
74
71
|
|
|
75
|
-
// src/utils/date-utils.
|
|
72
|
+
// src/utils/date-utils.js
|
|
76
73
|
function isTimestampFolder(folderName) {
|
|
77
74
|
const isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|\.\d{3}Z)$/;
|
|
78
75
|
if (!isoRegex.test(folderName)) {
|
|
@@ -82,7 +79,7 @@ function isTimestampFolder(folderName) {
|
|
|
82
79
|
return !isNaN(date.getTime()) && date.getTime() > 0;
|
|
83
80
|
}
|
|
84
81
|
|
|
85
|
-
// src/filedatabase/serializers.
|
|
82
|
+
// src/filedatabase/serializers.js
|
|
86
83
|
function detectDataType(data) {
|
|
87
84
|
if (Array.isArray(data)) {
|
|
88
85
|
return "json-array";
|
|
@@ -114,7 +111,7 @@ function deserializeData(rawData, dataType) {
|
|
|
114
111
|
}
|
|
115
112
|
}
|
|
116
113
|
|
|
117
|
-
// src/errors.
|
|
114
|
+
// src/errors.js
|
|
118
115
|
var FrameworkError = class extends Error {
|
|
119
116
|
constructor(message) {
|
|
120
117
|
super(message);
|
|
@@ -134,7 +131,7 @@ var FileDatabaseError = class extends FrameworkError {
|
|
|
134
131
|
}
|
|
135
132
|
};
|
|
136
133
|
|
|
137
|
-
// src/filedatabase/index.
|
|
134
|
+
// src/filedatabase/index.js
|
|
138
135
|
var FileDatabase = class _FileDatabase {
|
|
139
136
|
basePath;
|
|
140
137
|
namespace;
|
|
@@ -220,7 +217,7 @@ var FileDatabase = class _FileDatabase {
|
|
|
220
217
|
if (errors.length) {
|
|
221
218
|
throw new FileDatabaseError(`[FileDatabase] ${errors.join("; ")}`);
|
|
222
219
|
}
|
|
223
|
-
|
|
220
|
+
const parts = [this.basePath, this.namespace];
|
|
224
221
|
if (this.tableName) {
|
|
225
222
|
parts.push(...this.tableName.split("/"));
|
|
226
223
|
}
|
|
@@ -713,14 +710,17 @@ var FileDatabase = class _FileDatabase {
|
|
|
713
710
|
* Prepare the instance for read or write operations
|
|
714
711
|
* This discovers state and sets up internal members based on mode and current data
|
|
715
712
|
*/
|
|
716
|
-
async prepare(
|
|
713
|
+
async prepare(options) {
|
|
714
|
+
const { write, read, version, deferInitialVersion } = options;
|
|
717
715
|
if (write) {
|
|
718
716
|
if (this.versioned) {
|
|
719
717
|
if (this.currentVersion === null) {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
718
|
+
if (!deferInitialVersion) {
|
|
719
|
+
await this.makeNewVersion();
|
|
720
|
+
this.metadata = this.getDefaultMetadata();
|
|
721
|
+
this.metadata.version = this.currentVersion;
|
|
722
|
+
this.makeNewFile();
|
|
723
|
+
}
|
|
724
724
|
} else {
|
|
725
725
|
if (!this.metadata.files.length) {
|
|
726
726
|
this.metadata = await this.figureMetadata(this.currentVersion);
|
|
@@ -830,7 +830,7 @@ var FileDatabase = class _FileDatabase {
|
|
|
830
830
|
if (options.forceNewVersion && !this.versioned) {
|
|
831
831
|
throw new FileDatabaseError("Cannot use forceNewVersion in non-versioned mode");
|
|
832
832
|
}
|
|
833
|
-
await this.prepare({ write: true });
|
|
833
|
+
await this.prepare({ write: true, deferInitialVersion: !!(options.forceNewVersion && this.versioned) });
|
|
834
834
|
const incomingDataType = detectDataType(data);
|
|
835
835
|
this.metadata.dataType = incomingDataType;
|
|
836
836
|
if (options.forceNewVersion) {
|
|
@@ -1124,7 +1124,7 @@ var FileDatabase = class _FileDatabase {
|
|
|
1124
1124
|
}
|
|
1125
1125
|
};
|
|
1126
1126
|
|
|
1127
|
-
// src/mock-server/mock-storage.
|
|
1127
|
+
// src/mock-server/mock-storage.js
|
|
1128
1128
|
function stableStringify(obj) {
|
|
1129
1129
|
if (obj === null) return "null";
|
|
1130
1130
|
if (obj === void 0) return "undefined";
|
|
@@ -1148,11 +1148,6 @@ function buildCriteria(method, host, pathname, query, requestData) {
|
|
|
1148
1148
|
requestBody: requestData != null ? stableStringify(requestData) : ""
|
|
1149
1149
|
};
|
|
1150
1150
|
}
|
|
1151
|
-
function computeMockKey(method, host, pathname, query, requestData) {
|
|
1152
|
-
const criteria = buildCriteria(method, host, pathname, query, requestData);
|
|
1153
|
-
const str = JSON.stringify(criteria);
|
|
1154
|
-
return createHash("sha256").update(str).digest("hex").slice(0, 32);
|
|
1155
|
-
}
|
|
1156
1151
|
var MockStorage = class {
|
|
1157
1152
|
fileDb;
|
|
1158
1153
|
logger;
|
|
@@ -1226,7 +1221,7 @@ var MockStorage = class {
|
|
|
1226
1221
|
}
|
|
1227
1222
|
};
|
|
1228
1223
|
|
|
1229
|
-
// src/mock-server/index.
|
|
1224
|
+
// src/mock-server/index.js
|
|
1230
1225
|
var DEFAULT_SENSITIVE_KEYS = [
|
|
1231
1226
|
"client_id",
|
|
1232
1227
|
"client_secret",
|
|
@@ -1488,8 +1483,6 @@ async function createMockServer(config) {
|
|
|
1488
1483
|
}
|
|
1489
1484
|
export {
|
|
1490
1485
|
MockServer,
|
|
1491
|
-
MockStorage,
|
|
1492
|
-
computeMockKey,
|
|
1493
1486
|
createMockServer
|
|
1494
1487
|
};
|
|
1495
1488
|
//# sourceMappingURL=mock-server.js.map
|