@platforma-sdk/bootstrap 5.2.51 → 5.2.53
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/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/block.cjs +106 -146
- package/dist/block.cjs.map +1 -1
- package/dist/block.js +100 -125
- package/dist/block.js.map +1 -1
- package/dist/cmd-opts.cjs +87 -177
- package/dist/cmd-opts.cjs.map +1 -1
- package/dist/cmd-opts.js +87 -172
- package/dist/cmd-opts.js.map +1 -1
- package/dist/commands/create-block.cjs +19 -20
- package/dist/commands/create-block.cjs.map +1 -1
- package/dist/commands/create-block.d.ts +12 -7
- package/dist/commands/create-block.js +17 -17
- package/dist/commands/create-block.js.map +1 -1
- package/dist/commands/reset.cjs +18 -21
- package/dist/commands/reset.cjs.map +1 -1
- package/dist/commands/reset.d.ts +12 -7
- package/dist/commands/reset.js +16 -18
- package/dist/commands/reset.js.map +1 -1
- package/dist/commands/start/docker/s3.cjs +64 -67
- package/dist/commands/start/docker/s3.cjs.map +1 -1
- package/dist/commands/start/docker/s3.d.ts +32 -27
- package/dist/commands/start/docker/s3.js +61 -64
- package/dist/commands/start/docker/s3.js.map +1 -1
- package/dist/commands/start/docker.cjs +64 -67
- package/dist/commands/start/docker.cjs.map +1 -1
- package/dist/commands/start/docker.d.ts +32 -27
- package/dist/commands/start/docker.js +61 -64
- package/dist/commands/start/docker.js.map +1 -1
- package/dist/commands/start/local/s3.cjs +101 -135
- package/dist/commands/start/local/s3.cjs.map +1 -1
- package/dist/commands/start/local/s3.d.ts +36 -31
- package/dist/commands/start/local/s3.js +97 -113
- package/dist/commands/start/local/s3.js.map +1 -1
- package/dist/commands/start/local.cjs +95 -122
- package/dist/commands/start/local.cjs.map +1 -1
- package/dist/commands/start/local.d.ts +34 -29
- package/dist/commands/start/local.js +91 -100
- package/dist/commands/start/local.js.map +1 -1
- package/dist/commands/start.cjs +18 -21
- package/dist/commands/start.cjs.map +1 -1
- package/dist/commands/start.d.ts +12 -7
- package/dist/commands/start.js +16 -18
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/stop.cjs +22 -27
- package/dist/commands/stop.cjs.map +1 -1
- package/dist/commands/stop.d.ts +12 -7
- package/dist/commands/stop.js +20 -24
- package/dist/commands/stop.js.map +1 -1
- package/dist/commands/svc/create/arg-parser.cjs +102 -172
- package/dist/commands/svc/create/arg-parser.cjs.map +1 -1
- package/dist/commands/svc/create/arg-parser.js +102 -171
- package/dist/commands/svc/create/arg-parser.js.map +1 -1
- package/dist/commands/svc/create/docker/s3.cjs +78 -96
- package/dist/commands/svc/create/docker/s3.cjs.map +1 -1
- package/dist/commands/svc/create/docker/s3.d.ts +35 -30
- package/dist/commands/svc/create/docker/s3.js +75 -93
- package/dist/commands/svc/create/docker/s3.js.map +1 -1
- package/dist/commands/svc/create/docker.cjs +82 -103
- package/dist/commands/svc/create/docker.cjs.map +1 -1
- package/dist/commands/svc/create/docker.d.ts +35 -30
- package/dist/commands/svc/create/docker.js +79 -100
- package/dist/commands/svc/create/docker.js.map +1 -1
- package/dist/commands/svc/create/local/s3.cjs +107 -139
- package/dist/commands/svc/create/local/s3.cjs.map +1 -1
- package/dist/commands/svc/create/local/s3.d.ts +39 -34
- package/dist/commands/svc/create/local/s3.js +103 -117
- package/dist/commands/svc/create/local/s3.js.map +1 -1
- package/dist/commands/svc/create/local.cjs +101 -138
- package/dist/commands/svc/create/local.cjs.map +1 -1
- package/dist/commands/svc/create/local.d.ts +37 -32
- package/dist/commands/svc/create/local.js +97 -116
- package/dist/commands/svc/create/local.js.map +1 -1
- package/dist/commands/svc/delete.cjs +36 -38
- package/dist/commands/svc/delete.cjs.map +1 -1
- package/dist/commands/svc/delete.d.ts +16 -11
- package/dist/commands/svc/delete.js +34 -35
- package/dist/commands/svc/delete.js.map +1 -1
- package/dist/commands/svc/down.cjs +27 -30
- package/dist/commands/svc/down.cjs.map +1 -1
- package/dist/commands/svc/down.d.ts +15 -10
- package/dist/commands/svc/down.js +25 -27
- package/dist/commands/svc/down.js.map +1 -1
- package/dist/commands/svc/list.cjs +25 -29
- package/dist/commands/svc/list.cjs.map +1 -1
- package/dist/commands/svc/list.d.ts +9 -5
- package/dist/commands/svc/list.js +23 -26
- package/dist/commands/svc/list.js.map +1 -1
- package/dist/commands/svc/up.cjs +33 -49
- package/dist/commands/svc/up.cjs.map +1 -1
- package/dist/commands/svc/up.d.ts +15 -10
- package/dist/commands/svc/up.js +31 -46
- package/dist/commands/svc/up.js.map +1 -1
- package/dist/core.cjs +712 -881
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +709 -877
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +36 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +37 -33
- package/dist/index.js +35 -34
- package/dist/index.js.map +1 -1
- package/dist/package.cjs +15 -36
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +14 -14
- package/dist/package.js.map +1 -1
- package/dist/platforma.cjs +119 -148
- package/dist/platforma.cjs.map +1 -1
- package/dist/platforma.js +114 -122
- package/dist/platforma.js.map +1 -1
- package/dist/run.cjs +55 -58
- package/dist/run.cjs.map +1 -1
- package/dist/run.js +56 -56
- package/dist/run.js.map +1 -1
- package/dist/state.cjs +114 -141
- package/dist/state.cjs.map +1 -1
- package/dist/state.js +110 -139
- package/dist/state.js.map +1 -1
- package/dist/templates/compose.cjs +38 -65
- package/dist/templates/compose.cjs.map +1 -1
- package/dist/templates/compose.js +35 -63
- package/dist/templates/compose.js.map +1 -1
- package/dist/templates/pl-config.cjs +163 -165
- package/dist/templates/pl-config.cjs.map +1 -1
- package/dist/templates/pl-config.js +161 -163
- package/dist/templates/pl-config.js.map +1 -1
- package/dist/templates/types.cjs +24 -23
- package/dist/templates/types.cjs.map +1 -1
- package/dist/templates/types.js +24 -22
- package/dist/templates/types.js.map +1 -1
- package/dist/util.cjs +57 -74
- package/dist/util.cjs.map +1 -1
- package/dist/util.js +51 -72
- package/dist/util.js.map +1 -1
- package/package.json +7 -7
- package/dist/block.d.ts +0 -25
- package/dist/block.d.ts.map +0 -1
- package/dist/cmd-opts.d.ts +0 -89
- package/dist/cmd-opts.d.ts.map +0 -1
- package/dist/commands/create-block.d.ts.map +0 -1
- package/dist/commands/reset.d.ts.map +0 -1
- package/dist/commands/start/docker/s3.d.ts.map +0 -1
- package/dist/commands/start/docker.d.ts.map +0 -1
- package/dist/commands/start/local/s3.d.ts.map +0 -1
- package/dist/commands/start/local.d.ts.map +0 -1
- package/dist/commands/start.d.ts.map +0 -1
- package/dist/commands/stop.d.ts.map +0 -1
- package/dist/commands/svc/create/arg-parser.d.ts +0 -43
- package/dist/commands/svc/create/arg-parser.d.ts.map +0 -1
- package/dist/commands/svc/create/docker/s3.d.ts.map +0 -1
- package/dist/commands/svc/create/docker.d.ts.map +0 -1
- package/dist/commands/svc/create/local/s3.d.ts.map +0 -1
- package/dist/commands/svc/create/local.d.ts.map +0 -1
- package/dist/commands/svc/delete.d.ts.map +0 -1
- package/dist/commands/svc/down.d.ts.map +0 -1
- package/dist/commands/svc/list.d.ts.map +0 -1
- package/dist/commands/svc/up.d.ts.map +0 -1
- package/dist/core.d.ts +0 -105
- package/dist/core.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/package.d.ts +0 -7
- package/dist/package.d.ts.map +0 -1
- package/dist/platforma.d.ts +0 -24
- package/dist/platforma.d.ts.map +0 -1
- package/dist/run.d.ts +0 -13
- package/dist/run.d.ts.map +0 -1
- package/dist/state.d.ts +0 -63
- package/dist/state.d.ts.map +0 -1
- package/dist/templates/compose.d.ts +0 -14
- package/dist/templates/compose.d.ts.map +0 -1
- package/dist/templates/pl-config.d.ts +0 -6
- package/dist/templates/pl-config.d.ts.map +0 -1
- package/dist/templates/types.d.ts +0 -138
- package/dist/templates/types.d.ts.map +0 -1
- package/dist/util.d.ts +0 -18
- package/dist/util.d.ts.map +0 -1
package/dist/templates/types.js
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
|
+
//#region src/templates/types.ts
|
|
1
2
|
function emptyS3Settings(id) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
return {
|
|
4
|
+
id,
|
|
5
|
+
type: "S3",
|
|
6
|
+
indexCachePeriod: "0s",
|
|
7
|
+
endpoint: "",
|
|
8
|
+
region: "",
|
|
9
|
+
bucketName: "",
|
|
10
|
+
createBucket: false,
|
|
11
|
+
forcePathStyle: false,
|
|
12
|
+
key: "",
|
|
13
|
+
secret: "",
|
|
14
|
+
keyPrefix: "",
|
|
15
|
+
accessPrefixes: [],
|
|
16
|
+
uploadKeyPrefix: ""
|
|
17
|
+
};
|
|
17
18
|
}
|
|
18
19
|
function emptyFSSettings(id) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
return {
|
|
21
|
+
id,
|
|
22
|
+
type: "FS",
|
|
23
|
+
indexCachePeriod: "0s",
|
|
24
|
+
rootPath: ""
|
|
25
|
+
};
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
//#endregion
|
|
27
29
|
export { emptyFSSettings, emptyS3Settings };
|
|
28
|
-
//# sourceMappingURL=types.js.map
|
|
30
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../src/templates/types.ts"],"sourcesContent":["export type plSettings = {\n localRoot: string;\n\n license: licenseSettings;\n log: logSettings;\n grpc: grpcSettings;\n core: coreSettings;\n storages: storagesSettings;\n\n monitoring: monitoringSettings;\n debug: debugSettings;\n\n numCpu?: number;\n\n hacks: {\n libraryDownloadable: boolean;\n };\n};\nexport type plOptions = {\n localRoot?: string;\n\n license?: licenseOptions;\n log?: logOptions;\n grpc?: grpcOptions;\n core?: coreOptions;\n storages?: storagesOptions;\n\n numCpu?: number;\n\n monitoring?: monitoringOptions;\n debug?: debugOptions;\n};\n\nexport type licenseSettings = {\n value: string;\n file: string;\n};\nexport type licenseOptions = DeepPartial<licenseSettings>;\n\nexport type logSettings = {\n level: string;\n path: string;\n};\nexport type logOptions = DeepPartial<logSettings>;\n\nexport type coreSettings = {\n auth: authSettings;\n db: dbSettings;\n};\nexport type coreOptions = {\n auth?: authOptions;\n db?: dbOptions;\n};\n\nexport type authSettings = {\n enabled: boolean;\n drivers: authDriver[];\n};\nexport type authOptions = Partial<authSettings>;\n\nexport type dbSettings = {\n path: string;\n};\nexport type dbOptions = Partial<dbSettings>;\n\nexport type authDriver =\n | {\n driver: \"ldap\";\n serverUrl: string; // 'ldaps://ldap.example.com:1111'\n defaultDN: string; // 'cn=%u,ou=users,ou=users,dc=example,dc=com'\n }\n | {\n driver: \"jwt\";\n key: string;\n }\n | {\n driver: \"htpasswd\";\n path: string;\n };\n\nexport type grpcSettings = {\n listen: string;\n tls: tlsSettings;\n};\nexport type grpcOptions = Partial<grpcSettings>;\n\nexport type tlsSettings = {\n enable: boolean;\n clientAuthMode: tlsAuthMode;\n certFile: string;\n keyFile: string;\n};\nexport type tlsOptions = Partial<tlsSettings>;\n\nexport type tlsAuthMode =\n | \"NoAuth\"\n | \"RequestAnyCert\"\n | \"RequireAnyCert\"\n | \"RequestValidCert\"\n | \"RequireValidCert\";\n\nexport type storagesSettings = {\n primary: storageSettings;\n work: fsStorageSettings;\n library: storageSettings;\n};\nexport type storagesOptions = {\n primary?: storageOptions;\n work?: storageOptions;\n library?: storageOptions;\n};\n\nexport type storageSettings = s3StorageSettings | fsStorageSettings;\nexport type storageOptions = s3StorageOptions | fsStorageOptions;\n\ntype storageID = { id: string };\ntype commonStorageSettings = {\n indexCachePeriod: string;\n};\n\nexport type s3StorageSettings = storageID &\n s3StorageType &\n commonStorageSettings &\n s3StorageTypeSettings;\nexport type s3StorageOptions = s3StorageType &\n Partial<commonStorageSettings> &\n Partial<s3StorageTypeSettings>;\nexport function emptyS3Settings(id: string): s3StorageSettings {\n return {\n id: id,\n type: \"S3\",\n indexCachePeriod: \"0s\",\n endpoint: \"\",\n region: \"\",\n bucketName: \"\",\n createBucket: false,\n forcePathStyle: false,\n key: \"\",\n secret: \"\",\n keyPrefix: \"\",\n accessPrefixes: [],\n uploadKeyPrefix: \"\",\n };\n}\n\ntype s3StorageType = { type: \"S3\" };\ntype s3StorageTypeSettings = {\n endpoint?: string;\n presignEndpoint?: string;\n region?: string;\n bucketName: string;\n createBucket: boolean;\n forcePathStyle: boolean;\n key: string;\n secret: string;\n keyPrefix: string;\n accessPrefixes: string[];\n uploadKeyPrefix: string;\n};\n\nexport type fsStorageSettings = storageID &\n fsStorageType &\n commonStorageSettings &\n fsStorageTypeSettings;\nexport type fsStorageOptions = fsStorageType &\n Partial<commonStorageSettings> &\n Partial<fsStorageTypeSettings>;\nexport function emptyFSSettings(id: string): fsStorageSettings {\n return {\n id: id,\n type: \"FS\",\n indexCachePeriod: \"0s\",\n rootPath: \"\",\n };\n}\n\ntype fsStorageType = { type: \"FS\" };\ntype fsStorageTypeSettings = {\n rootPath: string;\n};\n\nexport type monitoringSettings = {\n enabled: boolean;\n listen: string;\n};\nexport type monitoringOptions = Partial<monitoringSettings>;\n\nexport type debugSettings = {\n enabled: boolean;\n listen: string;\n};\nexport type debugOptions = Partial<debugSettings>;\n\n/** Makes all keys and keys in sub-objects optional. */\ntype DeepPartial<T> = {\n [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];\n};\n"],"
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/templates/types.ts"],"sourcesContent":["export type plSettings = {\n localRoot: string;\n\n license: licenseSettings;\n log: logSettings;\n grpc: grpcSettings;\n core: coreSettings;\n storages: storagesSettings;\n\n monitoring: monitoringSettings;\n debug: debugSettings;\n\n numCpu?: number;\n\n hacks: {\n libraryDownloadable: boolean;\n };\n};\nexport type plOptions = {\n localRoot?: string;\n\n license?: licenseOptions;\n log?: logOptions;\n grpc?: grpcOptions;\n core?: coreOptions;\n storages?: storagesOptions;\n\n numCpu?: number;\n\n monitoring?: monitoringOptions;\n debug?: debugOptions;\n};\n\nexport type licenseSettings = {\n value: string;\n file: string;\n};\nexport type licenseOptions = DeepPartial<licenseSettings>;\n\nexport type logSettings = {\n level: string;\n path: string;\n};\nexport type logOptions = DeepPartial<logSettings>;\n\nexport type coreSettings = {\n auth: authSettings;\n db: dbSettings;\n};\nexport type coreOptions = {\n auth?: authOptions;\n db?: dbOptions;\n};\n\nexport type authSettings = {\n enabled: boolean;\n drivers: authDriver[];\n};\nexport type authOptions = Partial<authSettings>;\n\nexport type dbSettings = {\n path: string;\n};\nexport type dbOptions = Partial<dbSettings>;\n\nexport type authDriver =\n | {\n driver: \"ldap\";\n serverUrl: string; // 'ldaps://ldap.example.com:1111'\n defaultDN: string; // 'cn=%u,ou=users,ou=users,dc=example,dc=com'\n }\n | {\n driver: \"jwt\";\n key: string;\n }\n | {\n driver: \"htpasswd\";\n path: string;\n };\n\nexport type grpcSettings = {\n listen: string;\n tls: tlsSettings;\n};\nexport type grpcOptions = Partial<grpcSettings>;\n\nexport type tlsSettings = {\n enable: boolean;\n clientAuthMode: tlsAuthMode;\n certFile: string;\n keyFile: string;\n};\nexport type tlsOptions = Partial<tlsSettings>;\n\nexport type tlsAuthMode =\n | \"NoAuth\"\n | \"RequestAnyCert\"\n | \"RequireAnyCert\"\n | \"RequestValidCert\"\n | \"RequireValidCert\";\n\nexport type storagesSettings = {\n primary: storageSettings;\n work: fsStorageSettings;\n library: storageSettings;\n};\nexport type storagesOptions = {\n primary?: storageOptions;\n work?: storageOptions;\n library?: storageOptions;\n};\n\nexport type storageSettings = s3StorageSettings | fsStorageSettings;\nexport type storageOptions = s3StorageOptions | fsStorageOptions;\n\ntype storageID = { id: string };\ntype commonStorageSettings = {\n indexCachePeriod: string;\n};\n\nexport type s3StorageSettings = storageID &\n s3StorageType &\n commonStorageSettings &\n s3StorageTypeSettings;\nexport type s3StorageOptions = s3StorageType &\n Partial<commonStorageSettings> &\n Partial<s3StorageTypeSettings>;\nexport function emptyS3Settings(id: string): s3StorageSettings {\n return {\n id: id,\n type: \"S3\",\n indexCachePeriod: \"0s\",\n endpoint: \"\",\n region: \"\",\n bucketName: \"\",\n createBucket: false,\n forcePathStyle: false,\n key: \"\",\n secret: \"\",\n keyPrefix: \"\",\n accessPrefixes: [],\n uploadKeyPrefix: \"\",\n };\n}\n\ntype s3StorageType = { type: \"S3\" };\ntype s3StorageTypeSettings = {\n endpoint?: string;\n presignEndpoint?: string;\n region?: string;\n bucketName: string;\n createBucket: boolean;\n forcePathStyle: boolean;\n key: string;\n secret: string;\n keyPrefix: string;\n accessPrefixes: string[];\n uploadKeyPrefix: string;\n};\n\nexport type fsStorageSettings = storageID &\n fsStorageType &\n commonStorageSettings &\n fsStorageTypeSettings;\nexport type fsStorageOptions = fsStorageType &\n Partial<commonStorageSettings> &\n Partial<fsStorageTypeSettings>;\nexport function emptyFSSettings(id: string): fsStorageSettings {\n return {\n id: id,\n type: \"FS\",\n indexCachePeriod: \"0s\",\n rootPath: \"\",\n };\n}\n\ntype fsStorageType = { type: \"FS\" };\ntype fsStorageTypeSettings = {\n rootPath: string;\n};\n\nexport type monitoringSettings = {\n enabled: boolean;\n listen: string;\n};\nexport type monitoringOptions = Partial<monitoringSettings>;\n\nexport type debugSettings = {\n enabled: boolean;\n listen: string;\n};\nexport type debugOptions = Partial<debugSettings>;\n\n/** Makes all keys and keys in sub-objects optional. */\ntype DeepPartial<T> = {\n [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];\n};\n"],"mappings":";AA+HA,SAAgB,gBAAgB,IAA+B;AAC7D,QAAO;EACD;EACJ,MAAM;EACN,kBAAkB;EAClB,UAAU;EACV,QAAQ;EACR,YAAY;EACZ,cAAc;EACd,gBAAgB;EAChB,KAAK;EACL,QAAQ;EACR,WAAW;EACX,gBAAgB,EAAE;EAClB,iBAAiB;EAClB;;AAyBH,SAAgB,gBAAgB,IAA+B;AAC7D,QAAO;EACD;EACJ,MAAM;EACN,kBAAkB;EAClB,UAAU;EACX"}
|
package/dist/util.cjs
CHANGED
|
@@ -1,94 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let node_os = require("node:os");
|
|
3
|
+
node_os = require_runtime.__toESM(node_os);
|
|
4
|
+
let node_fs = require("node:fs");
|
|
5
|
+
node_fs = require_runtime.__toESM(node_fs);
|
|
6
|
+
let node_path = require("node:path");
|
|
7
|
+
node_path = require_runtime.__toESM(node_path);
|
|
8
|
+
let node_child_process = require("node:child_process");
|
|
9
|
+
let winston = require("winston");
|
|
10
|
+
winston = require_runtime.__toESM(winston);
|
|
11
|
+
let node_crypto = require("node:crypto");
|
|
12
|
+
let readline_sync = require("readline-sync");
|
|
13
|
+
readline_sync = require_runtime.__toESM(readline_sync);
|
|
10
14
|
|
|
15
|
+
//#region src/util.ts
|
|
11
16
|
function askYN(prompt) {
|
|
12
|
-
|
|
13
|
-
return answer.toLowerCase() === "y";
|
|
17
|
+
return readline_sync.default.question(`${prompt} [y/N] `).toLowerCase() === "y";
|
|
14
18
|
}
|
|
15
19
|
function assertNever(_n) {
|
|
16
|
-
|
|
20
|
+
throw new Error("this should never happen");
|
|
17
21
|
}
|
|
18
22
|
function createLogger(level = "debug") {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
23
|
+
return winston.default.createLogger({
|
|
24
|
+
level,
|
|
25
|
+
format: winston.default.format.printf(({ level, message }) => {
|
|
26
|
+
const indent = " ".repeat(level.length + 2);
|
|
27
|
+
if (typeof message !== "string") {
|
|
28
|
+
const messageJson = JSON.stringify(message);
|
|
29
|
+
throw Error(`logger message ${messageJson} is not a string`);
|
|
30
|
+
}
|
|
31
|
+
const indentedMessage = message.split("\n").map((line, index) => index === 0 ? line : indent + line).join("\n");
|
|
32
|
+
const colorize = (l) => winston.default.format.colorize().colorize(l, l);
|
|
33
|
+
return `${colorize(level)}: ${indentedMessage}`;
|
|
34
|
+
}),
|
|
35
|
+
transports: [new winston.default.transports.Console({
|
|
36
|
+
stderrLevels: [
|
|
37
|
+
"error",
|
|
38
|
+
"warn",
|
|
39
|
+
"info",
|
|
40
|
+
"debug"
|
|
41
|
+
],
|
|
42
|
+
handleExceptions: true
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
41
45
|
}
|
|
42
46
|
function randomStr(len) {
|
|
43
|
-
|
|
44
|
-
.toString("hex")
|
|
45
|
-
.slice(0, len);
|
|
47
|
+
return (0, node_crypto.randomBytes)(Math.ceil(len / 2)).toString("hex").slice(0, len);
|
|
46
48
|
}
|
|
47
49
|
function resolveTilde(p) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
return p;
|
|
50
|
+
if (p.startsWith("~")) return node_path.default.join(node_os.default.homedir(), p.slice(1));
|
|
51
|
+
return p;
|
|
52
52
|
}
|
|
53
53
|
function ensureDir(p, options) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
fs.mkdirSync(p, { recursive: true });
|
|
58
|
-
if (options?.mode) {
|
|
59
|
-
fs.chmodSync(p, options.mode);
|
|
60
|
-
}
|
|
54
|
+
if (node_fs.default.existsSync(p)) return;
|
|
55
|
+
node_fs.default.mkdirSync(p, { recursive: true });
|
|
56
|
+
if (options?.mode) node_fs.default.chmodSync(p, options.mode);
|
|
61
57
|
}
|
|
62
58
|
function getProcessName(pid) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return "";
|
|
72
|
-
}
|
|
73
|
-
return lines[1].trim();
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
return "";
|
|
77
|
-
}
|
|
59
|
+
try {
|
|
60
|
+
if (node_os.default.platform() !== "win32") return (0, node_child_process.execSync)(`ps -p ${pid} -o comm=`, { encoding: "utf8" }).trim();
|
|
61
|
+
const lines = (0, node_child_process.execSync)(`wmic process where processid=${pid} get Caption`, { encoding: "utf8" }).split("\n");
|
|
62
|
+
if (lines.length <= 1) return "";
|
|
63
|
+
return lines[1].trim();
|
|
64
|
+
} catch {
|
|
65
|
+
return "";
|
|
66
|
+
}
|
|
78
67
|
}
|
|
79
68
|
function getDockerComposeInfo(serviceName) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const report = JSON.parse(result);
|
|
84
|
-
for (const st of report) {
|
|
85
|
-
if (st.Name === serviceName) {
|
|
86
|
-
return st;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return undefined;
|
|
69
|
+
const result = (0, node_child_process.execSync)(`docker compose ls --filter name=${serviceName} --format json`, { encoding: "utf8" }).trim();
|
|
70
|
+
const report = JSON.parse(result);
|
|
71
|
+
for (const st of report) if (st.Name === serviceName) return st;
|
|
90
72
|
}
|
|
91
73
|
|
|
74
|
+
//#endregion
|
|
92
75
|
exports.askYN = askYN;
|
|
93
76
|
exports.assertNever = assertNever;
|
|
94
77
|
exports.createLogger = createLogger;
|
|
@@ -97,4 +80,4 @@ exports.getDockerComposeInfo = getDockerComposeInfo;
|
|
|
97
80
|
exports.getProcessName = getProcessName;
|
|
98
81
|
exports.randomStr = randomStr;
|
|
99
82
|
exports.resolveTilde = resolveTilde;
|
|
100
|
-
//# sourceMappingURL=util.cjs.map
|
|
83
|
+
//# sourceMappingURL=util.cjs.map
|
package/dist/util.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.cjs","sources":["../src/util.ts"],"sourcesContent":["import os from \"node:os\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { execSync } from \"node:child_process\";\n\nimport winston from \"winston\";\nimport { randomBytes } from \"node:crypto\";\nimport readlineSync from \"readline-sync\";\n\nexport function askYN(prompt: string): boolean {\n const answer = readlineSync.question(`${prompt} [y/N] `);\n return answer.toLowerCase() === \"y\";\n}\n\nexport function assertNever(_n: never) {\n throw new Error(\"this should never happen\");\n}\n\nexport function createLogger(level: string = \"debug\"): winston.Logger {\n return winston.createLogger({\n level: level,\n\n format: winston.format.printf(({ level, message }) => {\n const indent = \" \".repeat(level.length + 2); // For ': ' after the level\n if (typeof message !== \"string\") {\n const messageJson = JSON.stringify(message);\n throw Error(`logger message ${messageJson} is not a string`);\n }\n const indentedMessage = message\n .split(\"\\n\")\n .map((line: string, index: number) => (index === 0 ? line : indent + line))\n .join(\"\\n\");\n\n const colorize = (l: string) => winston.format.colorize().colorize(l, l);\n\n return `${colorize(level)}: ${indentedMessage}`;\n }),\n\n transports: [\n new winston.transports.Console({\n stderrLevels: [\"error\", \"warn\", \"info\", \"debug\"],\n handleExceptions: true,\n }),\n ],\n });\n}\n\nexport function randomStr(len: number): string {\n return randomBytes(Math.ceil(len / 2))\n .toString(\"hex\")\n .slice(0, len);\n}\n\nexport function resolveTilde(p: string): string {\n if (p.startsWith(\"~\")) {\n return path.join(os.homedir(), p.slice(1));\n }\n return p;\n}\n\nexport function ensureDir(\n p: string,\n options?: {\n mode?: fs.Mode;\n },\n) {\n if (fs.existsSync(p)) {\n return;\n }\n\n fs.mkdirSync(p, { recursive: true });\n if (options?.mode) {\n fs.chmodSync(p, options.mode);\n }\n}\n\nexport function getProcessName(pid: number): string {\n try {\n if (os.platform() !== \"win32\") {\n return execSync(`ps -p ${pid} -o comm=`, { encoding: \"utf8\" }).trim();\n }\n\n const command = `wmic process where processid=${pid} get Caption`;\n const lines = execSync(command, { encoding: \"utf8\" }).split(\"\\n\");\n\n // lines = [\"Caption:\", \"<process name>\"]\n if (lines.length <= 1) {\n return \"\";\n }\n\n return lines[1].trim();\n } catch {\n return \"\";\n }\n}\n\nexport type dockerComposeStatus = {\n Name: string;\n Status: string;\n ConfigFiles: string;\n};\n\nexport function getDockerComposeInfo(serviceName: string): dockerComposeStatus | undefined {\n const result = execSync(`docker compose ls --filter name=${serviceName} --format json`, {\n encoding: \"utf8\",\n }).trim();\n\n const report = JSON.parse(result) as dockerComposeStatus[];\n\n for (const st of report) {\n if (st.Name === serviceName) {\n return st;\n }\n }\n\n return undefined;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"util.cjs","names":["readlineSync","path","os","fs"],"sources":["../src/util.ts"],"sourcesContent":["import os from \"node:os\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { execSync } from \"node:child_process\";\n\nimport winston from \"winston\";\nimport { randomBytes } from \"node:crypto\";\nimport readlineSync from \"readline-sync\";\n\nexport function askYN(prompt: string): boolean {\n const answer = readlineSync.question(`${prompt} [y/N] `);\n return answer.toLowerCase() === \"y\";\n}\n\nexport function assertNever(_n: never) {\n throw new Error(\"this should never happen\");\n}\n\nexport function createLogger(level: string = \"debug\"): winston.Logger {\n return winston.createLogger({\n level: level,\n\n format: winston.format.printf(({ level, message }) => {\n const indent = \" \".repeat(level.length + 2); // For ': ' after the level\n if (typeof message !== \"string\") {\n const messageJson = JSON.stringify(message);\n throw Error(`logger message ${messageJson} is not a string`);\n }\n const indentedMessage = message\n .split(\"\\n\")\n .map((line: string, index: number) => (index === 0 ? line : indent + line))\n .join(\"\\n\");\n\n const colorize = (l: string) => winston.format.colorize().colorize(l, l);\n\n return `${colorize(level)}: ${indentedMessage}`;\n }),\n\n transports: [\n new winston.transports.Console({\n stderrLevels: [\"error\", \"warn\", \"info\", \"debug\"],\n handleExceptions: true,\n }),\n ],\n });\n}\n\nexport function randomStr(len: number): string {\n return randomBytes(Math.ceil(len / 2))\n .toString(\"hex\")\n .slice(0, len);\n}\n\nexport function resolveTilde(p: string): string {\n if (p.startsWith(\"~\")) {\n return path.join(os.homedir(), p.slice(1));\n }\n return p;\n}\n\nexport function ensureDir(\n p: string,\n options?: {\n mode?: fs.Mode;\n },\n) {\n if (fs.existsSync(p)) {\n return;\n }\n\n fs.mkdirSync(p, { recursive: true });\n if (options?.mode) {\n fs.chmodSync(p, options.mode);\n }\n}\n\nexport function getProcessName(pid: number): string {\n try {\n if (os.platform() !== \"win32\") {\n return execSync(`ps -p ${pid} -o comm=`, { encoding: \"utf8\" }).trim();\n }\n\n const command = `wmic process where processid=${pid} get Caption`;\n const lines = execSync(command, { encoding: \"utf8\" }).split(\"\\n\");\n\n // lines = [\"Caption:\", \"<process name>\"]\n if (lines.length <= 1) {\n return \"\";\n }\n\n return lines[1].trim();\n } catch {\n return \"\";\n }\n}\n\nexport type dockerComposeStatus = {\n Name: string;\n Status: string;\n ConfigFiles: string;\n};\n\nexport function getDockerComposeInfo(serviceName: string): dockerComposeStatus | undefined {\n const result = execSync(`docker compose ls --filter name=${serviceName} --format json`, {\n encoding: \"utf8\",\n }).trim();\n\n const report = JSON.parse(result) as dockerComposeStatus[];\n\n for (const st of report) {\n if (st.Name === serviceName) {\n return st;\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;AASA,SAAgB,MAAM,QAAyB;AAE7C,QADeA,sBAAa,SAAS,GAAG,OAAO,SAAS,CAC1C,aAAa,KAAK;;AAGlC,SAAgB,YAAY,IAAW;AACrC,OAAM,IAAI,MAAM,2BAA2B;;AAG7C,SAAgB,aAAa,QAAgB,SAAyB;AACpE,QAAO,gBAAQ,aAAa;EACnB;EAEP,QAAQ,gBAAQ,OAAO,QAAQ,EAAE,OAAO,cAAc;GACpD,MAAM,SAAS,IAAI,OAAO,MAAM,SAAS,EAAE;AAC3C,OAAI,OAAO,YAAY,UAAU;IAC/B,MAAM,cAAc,KAAK,UAAU,QAAQ;AAC3C,UAAM,MAAM,kBAAkB,YAAY,kBAAkB;;GAE9D,MAAM,kBAAkB,QACrB,MAAM,KAAK,CACX,KAAK,MAAc,UAAmB,UAAU,IAAI,OAAO,SAAS,KAAM,CAC1E,KAAK,KAAK;GAEb,MAAM,YAAY,MAAc,gBAAQ,OAAO,UAAU,CAAC,SAAS,GAAG,EAAE;AAExE,UAAO,GAAG,SAAS,MAAM,CAAC,IAAI;IAC9B;EAEF,YAAY,CACV,IAAI,gBAAQ,WAAW,QAAQ;GAC7B,cAAc;IAAC;IAAS;IAAQ;IAAQ;IAAQ;GAChD,kBAAkB;GACnB,CAAC,CACH;EACF,CAAC;;AAGJ,SAAgB,UAAU,KAAqB;AAC7C,qCAAmB,KAAK,KAAK,MAAM,EAAE,CAAC,CACnC,SAAS,MAAM,CACf,MAAM,GAAG,IAAI;;AAGlB,SAAgB,aAAa,GAAmB;AAC9C,KAAI,EAAE,WAAW,IAAI,CACnB,QAAOC,kBAAK,KAAKC,gBAAG,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC;AAE5C,QAAO;;AAGT,SAAgB,UACd,GACA,SAGA;AACA,KAAIC,gBAAG,WAAW,EAAE,CAClB;AAGF,iBAAG,UAAU,GAAG,EAAE,WAAW,MAAM,CAAC;AACpC,KAAI,SAAS,KACX,iBAAG,UAAU,GAAG,QAAQ,KAAK;;AAIjC,SAAgB,eAAe,KAAqB;AAClD,KAAI;AACF,MAAID,gBAAG,UAAU,KAAK,QACpB,yCAAgB,SAAS,IAAI,YAAY,EAAE,UAAU,QAAQ,CAAC,CAAC,MAAM;EAIvE,MAAM,yCADU,gCAAgC,IAAI,eACpB,EAAE,UAAU,QAAQ,CAAC,CAAC,MAAM,KAAK;AAGjE,MAAI,MAAM,UAAU,EAClB,QAAO;AAGT,SAAO,MAAM,GAAG,MAAM;SAChB;AACN,SAAO;;;AAUX,SAAgB,qBAAqB,aAAsD;CACzF,MAAM,0CAAkB,mCAAmC,YAAY,iBAAiB,EACtF,UAAU,QACX,CAAC,CAAC,MAAM;CAET,MAAM,SAAS,KAAK,MAAM,OAAO;AAEjC,MAAK,MAAM,MAAM,OACf,KAAI,GAAG,SAAS,YACd,QAAO"}
|
package/dist/util.js
CHANGED
|
@@ -1,91 +1,70 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import path from
|
|
4
|
-
import { execSync } from
|
|
5
|
-
import winston from
|
|
6
|
-
import { randomBytes } from
|
|
7
|
-
import readlineSync from
|
|
1
|
+
import os from "node:os";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { execSync } from "node:child_process";
|
|
5
|
+
import winston from "winston";
|
|
6
|
+
import { randomBytes } from "node:crypto";
|
|
7
|
+
import readlineSync from "readline-sync";
|
|
8
8
|
|
|
9
|
+
//#region src/util.ts
|
|
9
10
|
function askYN(prompt) {
|
|
10
|
-
|
|
11
|
-
return answer.toLowerCase() === "y";
|
|
11
|
+
return readlineSync.question(`${prompt} [y/N] `).toLowerCase() === "y";
|
|
12
12
|
}
|
|
13
13
|
function assertNever(_n) {
|
|
14
|
-
|
|
14
|
+
throw new Error("this should never happen");
|
|
15
15
|
}
|
|
16
16
|
function createLogger(level = "debug") {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
17
|
+
return winston.createLogger({
|
|
18
|
+
level,
|
|
19
|
+
format: winston.format.printf(({ level, message }) => {
|
|
20
|
+
const indent = " ".repeat(level.length + 2);
|
|
21
|
+
if (typeof message !== "string") {
|
|
22
|
+
const messageJson = JSON.stringify(message);
|
|
23
|
+
throw Error(`logger message ${messageJson} is not a string`);
|
|
24
|
+
}
|
|
25
|
+
const indentedMessage = message.split("\n").map((line, index) => index === 0 ? line : indent + line).join("\n");
|
|
26
|
+
const colorize = (l) => winston.format.colorize().colorize(l, l);
|
|
27
|
+
return `${colorize(level)}: ${indentedMessage}`;
|
|
28
|
+
}),
|
|
29
|
+
transports: [new winston.transports.Console({
|
|
30
|
+
stderrLevels: [
|
|
31
|
+
"error",
|
|
32
|
+
"warn",
|
|
33
|
+
"info",
|
|
34
|
+
"debug"
|
|
35
|
+
],
|
|
36
|
+
handleExceptions: true
|
|
37
|
+
})]
|
|
38
|
+
});
|
|
39
39
|
}
|
|
40
40
|
function randomStr(len) {
|
|
41
|
-
|
|
42
|
-
.toString("hex")
|
|
43
|
-
.slice(0, len);
|
|
41
|
+
return randomBytes(Math.ceil(len / 2)).toString("hex").slice(0, len);
|
|
44
42
|
}
|
|
45
43
|
function resolveTilde(p) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
return p;
|
|
44
|
+
if (p.startsWith("~")) return path.join(os.homedir(), p.slice(1));
|
|
45
|
+
return p;
|
|
50
46
|
}
|
|
51
47
|
function ensureDir(p, options) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
fs__default.mkdirSync(p, { recursive: true });
|
|
56
|
-
if (options?.mode) {
|
|
57
|
-
fs__default.chmodSync(p, options.mode);
|
|
58
|
-
}
|
|
48
|
+
if (fs.existsSync(p)) return;
|
|
49
|
+
fs.mkdirSync(p, { recursive: true });
|
|
50
|
+
if (options?.mode) fs.chmodSync(p, options.mode);
|
|
59
51
|
}
|
|
60
52
|
function getProcessName(pid) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return "";
|
|
70
|
-
}
|
|
71
|
-
return lines[1].trim();
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
return "";
|
|
75
|
-
}
|
|
53
|
+
try {
|
|
54
|
+
if (os.platform() !== "win32") return execSync(`ps -p ${pid} -o comm=`, { encoding: "utf8" }).trim();
|
|
55
|
+
const lines = execSync(`wmic process where processid=${pid} get Caption`, { encoding: "utf8" }).split("\n");
|
|
56
|
+
if (lines.length <= 1) return "";
|
|
57
|
+
return lines[1].trim();
|
|
58
|
+
} catch {
|
|
59
|
+
return "";
|
|
60
|
+
}
|
|
76
61
|
}
|
|
77
62
|
function getDockerComposeInfo(serviceName) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const report = JSON.parse(result);
|
|
82
|
-
for (const st of report) {
|
|
83
|
-
if (st.Name === serviceName) {
|
|
84
|
-
return st;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return undefined;
|
|
63
|
+
const result = execSync(`docker compose ls --filter name=${serviceName} --format json`, { encoding: "utf8" }).trim();
|
|
64
|
+
const report = JSON.parse(result);
|
|
65
|
+
for (const st of report) if (st.Name === serviceName) return st;
|
|
88
66
|
}
|
|
89
67
|
|
|
68
|
+
//#endregion
|
|
90
69
|
export { askYN, assertNever, createLogger, ensureDir, getDockerComposeInfo, getProcessName, randomStr, resolveTilde };
|
|
91
|
-
//# sourceMappingURL=util.js.map
|
|
70
|
+
//# sourceMappingURL=util.js.map
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../src/util.ts"],"sourcesContent":["import os from \"node:os\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { execSync } from \"node:child_process\";\n\nimport winston from \"winston\";\nimport { randomBytes } from \"node:crypto\";\nimport readlineSync from \"readline-sync\";\n\nexport function askYN(prompt: string): boolean {\n const answer = readlineSync.question(`${prompt} [y/N] `);\n return answer.toLowerCase() === \"y\";\n}\n\nexport function assertNever(_n: never) {\n throw new Error(\"this should never happen\");\n}\n\nexport function createLogger(level: string = \"debug\"): winston.Logger {\n return winston.createLogger({\n level: level,\n\n format: winston.format.printf(({ level, message }) => {\n const indent = \" \".repeat(level.length + 2); // For ': ' after the level\n if (typeof message !== \"string\") {\n const messageJson = JSON.stringify(message);\n throw Error(`logger message ${messageJson} is not a string`);\n }\n const indentedMessage = message\n .split(\"\\n\")\n .map((line: string, index: number) => (index === 0 ? line : indent + line))\n .join(\"\\n\");\n\n const colorize = (l: string) => winston.format.colorize().colorize(l, l);\n\n return `${colorize(level)}: ${indentedMessage}`;\n }),\n\n transports: [\n new winston.transports.Console({\n stderrLevels: [\"error\", \"warn\", \"info\", \"debug\"],\n handleExceptions: true,\n }),\n ],\n });\n}\n\nexport function randomStr(len: number): string {\n return randomBytes(Math.ceil(len / 2))\n .toString(\"hex\")\n .slice(0, len);\n}\n\nexport function resolveTilde(p: string): string {\n if (p.startsWith(\"~\")) {\n return path.join(os.homedir(), p.slice(1));\n }\n return p;\n}\n\nexport function ensureDir(\n p: string,\n options?: {\n mode?: fs.Mode;\n },\n) {\n if (fs.existsSync(p)) {\n return;\n }\n\n fs.mkdirSync(p, { recursive: true });\n if (options?.mode) {\n fs.chmodSync(p, options.mode);\n }\n}\n\nexport function getProcessName(pid: number): string {\n try {\n if (os.platform() !== \"win32\") {\n return execSync(`ps -p ${pid} -o comm=`, { encoding: \"utf8\" }).trim();\n }\n\n const command = `wmic process where processid=${pid} get Caption`;\n const lines = execSync(command, { encoding: \"utf8\" }).split(\"\\n\");\n\n // lines = [\"Caption:\", \"<process name>\"]\n if (lines.length <= 1) {\n return \"\";\n }\n\n return lines[1].trim();\n } catch {\n return \"\";\n }\n}\n\nexport type dockerComposeStatus = {\n Name: string;\n Status: string;\n ConfigFiles: string;\n};\n\nexport function getDockerComposeInfo(serviceName: string): dockerComposeStatus | undefined {\n const result = execSync(`docker compose ls --filter name=${serviceName} --format json`, {\n encoding: \"utf8\",\n }).trim();\n\n const report = JSON.parse(result) as dockerComposeStatus[];\n\n for (const st of report) {\n if (st.Name === serviceName) {\n return st;\n }\n }\n\n return undefined;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"util.js","names":[],"sources":["../src/util.ts"],"sourcesContent":["import os from \"node:os\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { execSync } from \"node:child_process\";\n\nimport winston from \"winston\";\nimport { randomBytes } from \"node:crypto\";\nimport readlineSync from \"readline-sync\";\n\nexport function askYN(prompt: string): boolean {\n const answer = readlineSync.question(`${prompt} [y/N] `);\n return answer.toLowerCase() === \"y\";\n}\n\nexport function assertNever(_n: never) {\n throw new Error(\"this should never happen\");\n}\n\nexport function createLogger(level: string = \"debug\"): winston.Logger {\n return winston.createLogger({\n level: level,\n\n format: winston.format.printf(({ level, message }) => {\n const indent = \" \".repeat(level.length + 2); // For ': ' after the level\n if (typeof message !== \"string\") {\n const messageJson = JSON.stringify(message);\n throw Error(`logger message ${messageJson} is not a string`);\n }\n const indentedMessage = message\n .split(\"\\n\")\n .map((line: string, index: number) => (index === 0 ? line : indent + line))\n .join(\"\\n\");\n\n const colorize = (l: string) => winston.format.colorize().colorize(l, l);\n\n return `${colorize(level)}: ${indentedMessage}`;\n }),\n\n transports: [\n new winston.transports.Console({\n stderrLevels: [\"error\", \"warn\", \"info\", \"debug\"],\n handleExceptions: true,\n }),\n ],\n });\n}\n\nexport function randomStr(len: number): string {\n return randomBytes(Math.ceil(len / 2))\n .toString(\"hex\")\n .slice(0, len);\n}\n\nexport function resolveTilde(p: string): string {\n if (p.startsWith(\"~\")) {\n return path.join(os.homedir(), p.slice(1));\n }\n return p;\n}\n\nexport function ensureDir(\n p: string,\n options?: {\n mode?: fs.Mode;\n },\n) {\n if (fs.existsSync(p)) {\n return;\n }\n\n fs.mkdirSync(p, { recursive: true });\n if (options?.mode) {\n fs.chmodSync(p, options.mode);\n }\n}\n\nexport function getProcessName(pid: number): string {\n try {\n if (os.platform() !== \"win32\") {\n return execSync(`ps -p ${pid} -o comm=`, { encoding: \"utf8\" }).trim();\n }\n\n const command = `wmic process where processid=${pid} get Caption`;\n const lines = execSync(command, { encoding: \"utf8\" }).split(\"\\n\");\n\n // lines = [\"Caption:\", \"<process name>\"]\n if (lines.length <= 1) {\n return \"\";\n }\n\n return lines[1].trim();\n } catch {\n return \"\";\n }\n}\n\nexport type dockerComposeStatus = {\n Name: string;\n Status: string;\n ConfigFiles: string;\n};\n\nexport function getDockerComposeInfo(serviceName: string): dockerComposeStatus | undefined {\n const result = execSync(`docker compose ls --filter name=${serviceName} --format json`, {\n encoding: \"utf8\",\n }).trim();\n\n const report = JSON.parse(result) as dockerComposeStatus[];\n\n for (const st of report) {\n if (st.Name === serviceName) {\n return st;\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,MAAM,QAAyB;AAE7C,QADe,aAAa,SAAS,GAAG,OAAO,SAAS,CAC1C,aAAa,KAAK;;AAGlC,SAAgB,YAAY,IAAW;AACrC,OAAM,IAAI,MAAM,2BAA2B;;AAG7C,SAAgB,aAAa,QAAgB,SAAyB;AACpE,QAAO,QAAQ,aAAa;EACnB;EAEP,QAAQ,QAAQ,OAAO,QAAQ,EAAE,OAAO,cAAc;GACpD,MAAM,SAAS,IAAI,OAAO,MAAM,SAAS,EAAE;AAC3C,OAAI,OAAO,YAAY,UAAU;IAC/B,MAAM,cAAc,KAAK,UAAU,QAAQ;AAC3C,UAAM,MAAM,kBAAkB,YAAY,kBAAkB;;GAE9D,MAAM,kBAAkB,QACrB,MAAM,KAAK,CACX,KAAK,MAAc,UAAmB,UAAU,IAAI,OAAO,SAAS,KAAM,CAC1E,KAAK,KAAK;GAEb,MAAM,YAAY,MAAc,QAAQ,OAAO,UAAU,CAAC,SAAS,GAAG,EAAE;AAExE,UAAO,GAAG,SAAS,MAAM,CAAC,IAAI;IAC9B;EAEF,YAAY,CACV,IAAI,QAAQ,WAAW,QAAQ;GAC7B,cAAc;IAAC;IAAS;IAAQ;IAAQ;IAAQ;GAChD,kBAAkB;GACnB,CAAC,CACH;EACF,CAAC;;AAGJ,SAAgB,UAAU,KAAqB;AAC7C,QAAO,YAAY,KAAK,KAAK,MAAM,EAAE,CAAC,CACnC,SAAS,MAAM,CACf,MAAM,GAAG,IAAI;;AAGlB,SAAgB,aAAa,GAAmB;AAC9C,KAAI,EAAE,WAAW,IAAI,CACnB,QAAO,KAAK,KAAK,GAAG,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC;AAE5C,QAAO;;AAGT,SAAgB,UACd,GACA,SAGA;AACA,KAAI,GAAG,WAAW,EAAE,CAClB;AAGF,IAAG,UAAU,GAAG,EAAE,WAAW,MAAM,CAAC;AACpC,KAAI,SAAS,KACX,IAAG,UAAU,GAAG,QAAQ,KAAK;;AAIjC,SAAgB,eAAe,KAAqB;AAClD,KAAI;AACF,MAAI,GAAG,UAAU,KAAK,QACpB,QAAO,SAAS,SAAS,IAAI,YAAY,EAAE,UAAU,QAAQ,CAAC,CAAC,MAAM;EAIvE,MAAM,QAAQ,SADE,gCAAgC,IAAI,eACpB,EAAE,UAAU,QAAQ,CAAC,CAAC,MAAM,KAAK;AAGjE,MAAI,MAAM,UAAU,EAClB,QAAO;AAGT,SAAO,MAAM,GAAG,MAAM;SAChB;AACN,SAAO;;;AAUX,SAAgB,qBAAqB,aAAsD;CACzF,MAAM,SAAS,SAAS,mCAAmC,YAAY,iBAAiB,EACtF,UAAU,QACX,CAAC,CAAC,MAAM;CAET,MAAM,SAAS,KAAK,MAAM,OAAO;AAEjC,MAAK,MAAM,MAAM,OACf,KAAI,GAAG,SAAS,YACd,QAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/bootstrap",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.53",
|
|
4
4
|
"description": "MiLaboratories Platforma Backend bootstrap code: configuration generators, service run wrappers and so on",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
"winston": "^3.17.0",
|
|
24
24
|
"yaml": "^2.8.0",
|
|
25
25
|
"zod": "~3.23.8",
|
|
26
|
-
"@milaboratories/pl-deployments": "2.15.
|
|
26
|
+
"@milaboratories/pl-deployments": "2.15.19"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/decompress": "^4.2.7",
|
|
30
30
|
"@types/node": "~24.5.2",
|
|
31
31
|
"@types/readline-sync": "^1.4.8",
|
|
32
32
|
"ts-node": "^10.9.2",
|
|
33
|
-
"typescript": "~5.
|
|
34
|
-
"@milaboratories/
|
|
35
|
-
"@milaboratories/ts-builder": "1.2.
|
|
36
|
-
"@milaboratories/ts-configs": "1.2.
|
|
37
|
-
"@milaboratories/
|
|
33
|
+
"typescript": "~5.9.3",
|
|
34
|
+
"@milaboratories/oclif-index": "1.1.1",
|
|
35
|
+
"@milaboratories/ts-builder": "1.2.13",
|
|
36
|
+
"@milaboratories/ts-configs": "1.2.2",
|
|
37
|
+
"@milaboratories/build-configs": "1.5.1"
|
|
38
38
|
},
|
|
39
39
|
"oclif": {
|
|
40
40
|
"bin": "pl-dev",
|
package/dist/block.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type winston from "winston";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
declare const CreateBlockPlatforms: z.ZodUnion<[z.ZodLiteral<"Tengo">, z.ZodLiteral<"Python">]>;
|
|
4
|
-
export type CreateBlockPlatform = z.infer<typeof CreateBlockPlatforms>;
|
|
5
|
-
declare const CreateBlockOptions: z.ZodObject<{
|
|
6
|
-
npmOrgName: z.ZodString;
|
|
7
|
-
orgName: z.ZodString;
|
|
8
|
-
blockName: z.ZodString;
|
|
9
|
-
softwarePlatforms: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"Tengo">, z.ZodLiteral<"Python">]>, "many">, ("Python" | "Tengo")[], ("Python" | "Tengo")[]>;
|
|
10
|
-
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
npmOrgName: string;
|
|
12
|
-
orgName: string;
|
|
13
|
-
blockName: string;
|
|
14
|
-
softwarePlatforms: ("Python" | "Tengo")[];
|
|
15
|
-
}, {
|
|
16
|
-
npmOrgName: string;
|
|
17
|
-
orgName: string;
|
|
18
|
-
blockName: string;
|
|
19
|
-
softwarePlatforms: ("Python" | "Tengo")[];
|
|
20
|
-
}>;
|
|
21
|
-
export type CreateBlockOptions = z.infer<typeof CreateBlockOptions>;
|
|
22
|
-
/** Creates a block by cloning block-boilerplate repository. */
|
|
23
|
-
export declare function createBlock(logger: winston.Logger): Promise<void>;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=block.d.ts.map
|
package/dist/block.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../src/block.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAInC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,QAAA,MAAM,oBAAoB,6DAAqD,CAAC;AAChF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEvE,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;EAOtB,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,+DAA+D;AAC/D,wBAAsB,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,iBAoCvD"}
|
package/dist/cmd-opts.d.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
export declare const GlobalFlags: {
|
|
2
|
-
"log-level": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
3
|
-
};
|
|
4
|
-
export declare const InstanceName: {
|
|
5
|
-
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
|
-
};
|
|
7
|
-
export declare const ImageFlag: {
|
|
8
|
-
image: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
-
};
|
|
10
|
-
export declare const VersionFlag: {
|
|
11
|
-
version: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
-
};
|
|
13
|
-
export declare const ArchFlag: {
|
|
14
|
-
arch: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
-
};
|
|
16
|
-
export declare const LicenseFlags: {
|
|
17
|
-
license: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
-
"license-file": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
|
-
};
|
|
20
|
-
export declare const AddressesFlags: {
|
|
21
|
-
"grpc-port": import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
22
|
-
"grpc-listen": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
23
|
-
"monitoring-port": import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
24
|
-
"monitoring-listen": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
25
|
-
"debug-port": import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
26
|
-
"debug-listen": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
27
|
-
};
|
|
28
|
-
export declare const S3AddressesFlags: {
|
|
29
|
-
"s3-port": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
30
|
-
"s3-console-port": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
31
|
-
};
|
|
32
|
-
export declare const StorageFlag: {
|
|
33
|
-
storage: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
34
|
-
};
|
|
35
|
-
export declare const MinioPresignHostFlag: {
|
|
36
|
-
"minio-presign-host": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
37
|
-
};
|
|
38
|
-
export declare const MountFlag: {
|
|
39
|
-
mount: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
40
|
-
};
|
|
41
|
-
export declare const PlLogFileFlag: {
|
|
42
|
-
"pl-log-file": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
43
|
-
};
|
|
44
|
-
export declare const PlWorkdirFlag: {
|
|
45
|
-
"pl-workdir": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
46
|
-
};
|
|
47
|
-
export declare const PlBinaryFlag: {
|
|
48
|
-
"pl-binary": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
49
|
-
};
|
|
50
|
-
export declare const PlSourcesFlag: {
|
|
51
|
-
"pl-sources": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
52
|
-
};
|
|
53
|
-
export declare const ConfigFlag: {
|
|
54
|
-
config: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
55
|
-
};
|
|
56
|
-
export declare const StoragePrimaryPathFlag: {
|
|
57
|
-
"storage-primary": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
58
|
-
};
|
|
59
|
-
export declare const StorageWorkPathFlag: {
|
|
60
|
-
"storage-work": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
61
|
-
};
|
|
62
|
-
export declare const StorageLibraryPathFlag: {
|
|
63
|
-
"storage-primary": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
64
|
-
};
|
|
65
|
-
export declare const StoragePrimaryURLFlag: {
|
|
66
|
-
"storage-primary": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
67
|
-
};
|
|
68
|
-
export declare const StorageLibraryURLFlag: {
|
|
69
|
-
"storage-library": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
70
|
-
};
|
|
71
|
-
export declare const AuthEnabledFlag: {
|
|
72
|
-
"auth-enabled": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
73
|
-
};
|
|
74
|
-
export declare const HTPasswdFileFlag: {
|
|
75
|
-
"auth-htpasswd-file": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
76
|
-
};
|
|
77
|
-
export declare const LDAPAddressFlag: {
|
|
78
|
-
"auth-ldap-server": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
79
|
-
};
|
|
80
|
-
export declare const LDAPDefaultDNFlag: {
|
|
81
|
-
"auth-ldap-default-dn": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
82
|
-
};
|
|
83
|
-
export declare const AuthFlags: {
|
|
84
|
-
"auth-ldap-default-dn": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
85
|
-
"auth-ldap-server": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
86
|
-
"auth-htpasswd-file": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
87
|
-
"auth-enabled": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
88
|
-
};
|
|
89
|
-
//# sourceMappingURL=cmd-opts.d.ts.map
|
package/dist/cmd-opts.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cmd-opts.d.ts","sourceRoot":"","sources":["../src/cmd-opts.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;;CAOvB,CAAC;AAEF,eAAO,MAAM,YAAY;;CAKxB,CAAC;AAEF,eAAO,MAAM,SAAS;;CAIrB,CAAC;AAEF,eAAO,MAAM,WAAW;;CAIvB,CAAC;AAEF,eAAO,MAAM,QAAQ;;CAKpB,CAAC;AAEF,eAAO,MAAM,YAAY;;;CAUxB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;CA8B1B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;CAY5B,CAAC;AAEF,eAAO,MAAM,WAAW;;CAIvB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;CAIhC,CAAC;AAEF,eAAO,MAAM,SAAS;;CAMrB,CAAC;AAEF,eAAO,MAAM,aAAa;;CAIzB,CAAC;AAEF,eAAO,MAAM,aAAa;;CAIzB,CAAC;AAEF,eAAO,MAAM,YAAY;;CAIxB,CAAC;AAEF,eAAO,MAAM,aAAa;;CAKzB,CAAC;AAEF,eAAO,MAAM,UAAU;;CAItB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;CAIlC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;CAI/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;CAIlC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;CASjC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;CASjC,CAAC;AAEF,eAAO,MAAM,eAAe;;CAI3B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;CAI5B,CAAC;AAEF,eAAO,MAAM,eAAe;;CAI3B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;CAK7B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;CAMrB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-block.d.ts","sourceRoot":"","sources":["../../src/commands/create-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKtC,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;IAC9C,OAAgB,WAAW,SAAoE;IAE/F,OAAgB,QAAQ,WAAmB;IAE3C,OAAgB,KAAK;;MAEnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAMlC"}
|