@signageos/cli 1.7.1 → 1.9.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 +6 -3
- package/dist/Applet/Start/appletStartCommand.d.ts +20 -0
- package/dist/Applet/Start/appletStartCommand.js +27 -26
- package/dist/Applet/Start/appletStartCommand.js.map +1 -1
- package/dist/Applet/Upload/appletUploadCommand.js +2 -2
- package/dist/Applet/Upload/appletUploadCommand.js.map +1 -1
- package/dist/Applet/Upload/appletUploadFacade.js +5 -5
- package/dist/Applet/Upload/appletUploadFacade.js.map +1 -1
- package/dist/Applet/appletCommand.d.ts +20 -0
- package/dist/Applet/appletServerHelper.d.ts +18 -0
- package/dist/Applet/appletServerHelper.js +20 -1
- package/dist/Applet/appletServerHelper.js.map +1 -1
- package/dist/CustomScript/Upload/customScriptUploadCommand.d.ts +25 -0
- package/dist/CustomScript/Upload/customScriptUploadCommand.js +143 -0
- package/dist/CustomScript/Upload/customScriptUploadCommand.js.map +1 -0
- package/dist/CustomScript/customScriptCommand.d.ts +29 -0
- package/dist/{Stream/helper.js → CustomScript/customScriptCommand.js} +16 -22
- package/dist/CustomScript/customScriptCommand.js.map +1 -0
- package/dist/CustomScript/customScriptFacade.d.ts +112 -0
- package/dist/CustomScript/customScriptFacade.js +390 -0
- package/dist/CustomScript/customScriptFacade.js.map +1 -0
- package/dist/Device/Connect/connectCommand.d.ts +38 -0
- package/dist/Device/Connect/connectCommand.js +51 -21
- package/dist/Device/Connect/connectCommand.js.map +1 -1
- package/dist/Device/deviceCommand.d.ts +38 -0
- package/dist/Emulator/emulatorFactory.js +3 -3
- package/dist/Emulator/emulatorFactory.js.map +1 -1
- package/dist/Firmware/Upload/firmwareUploadFacade.js +3 -4
- package/dist/Firmware/Upload/firmwareUploadFacade.js.map +1 -1
- package/dist/Lib/archive.d.ts +8 -0
- package/dist/Lib/archive.js +85 -0
- package/dist/Lib/archive.js.map +1 -0
- package/dist/{FileSystem/helper.d.ts → Lib/fileSystem.d.ts} +1 -1
- package/dist/{FileSystem/helper.js → Lib/fileSystem.js} +19 -18
- package/dist/Lib/fileSystem.js.map +1 -0
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/parameters.d.ts +1 -0
- package/dist/parameters.js +1 -0
- package/dist/parameters.js.map +1 -1
- package/package.json +9 -5
- package/dist/FileSystem/helper.js.map +0 -1
- package/dist/Stream/helper.d.ts +0 -2
- package/dist/Stream/helper.js.map +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const customScript: {
|
|
2
|
+
name: "custom-script";
|
|
3
|
+
description: string;
|
|
4
|
+
optionList: never[];
|
|
5
|
+
commands: {
|
|
6
|
+
name: "upload";
|
|
7
|
+
description: string;
|
|
8
|
+
optionList: readonly [{
|
|
9
|
+
readonly name: "no-default-organization";
|
|
10
|
+
readonly type: BooleanConstructor;
|
|
11
|
+
readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc which were set using command sos organization set-default";
|
|
12
|
+
}, {
|
|
13
|
+
readonly name: "organization-uid";
|
|
14
|
+
readonly type: StringConstructor;
|
|
15
|
+
readonly description: "Organization UID";
|
|
16
|
+
}];
|
|
17
|
+
commands: never[];
|
|
18
|
+
run(options: import("../Command/commandDefinition").CommandLineOptions<readonly [{
|
|
19
|
+
readonly name: "no-default-organization";
|
|
20
|
+
readonly type: BooleanConstructor;
|
|
21
|
+
readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc which were set using command sos organization set-default";
|
|
22
|
+
}, {
|
|
23
|
+
readonly name: "organization-uid";
|
|
24
|
+
readonly type: StringConstructor;
|
|
25
|
+
readonly description: "Organization UID";
|
|
26
|
+
}]>): Promise<void>;
|
|
27
|
+
}[];
|
|
28
|
+
run(): Promise<never>;
|
|
29
|
+
};
|
|
@@ -36,26 +36,20 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
resolve(hash.digest('base64'));
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
input.on('error', reject);
|
|
56
|
-
})];
|
|
39
|
+
exports.customScript = void 0;
|
|
40
|
+
var commandDefinition_1 = require("../Command/commandDefinition");
|
|
41
|
+
var customScriptUploadCommand_1 = require("./Upload/customScriptUploadCommand");
|
|
42
|
+
exports.customScript = (0, commandDefinition_1.createCommandDefinition)({
|
|
43
|
+
name: 'custom-script',
|
|
44
|
+
description: 'Custom Script management',
|
|
45
|
+
optionList: [],
|
|
46
|
+
commands: [customScriptUploadCommand_1.customScriptUpload],
|
|
47
|
+
run: function () {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
49
|
+
return __generator(this, function (_a) {
|
|
50
|
+
throw new Error('Unknown command');
|
|
51
|
+
});
|
|
57
52
|
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
//# sourceMappingURL=helper.js.map
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=customScriptCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customScriptCommand.js","sourceRoot":"","sources":["../../src/CustomScript/customScriptCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAuE;AACvE,gFAAwE;AAE3D,QAAA,YAAY,GAAG,IAAA,2CAAuB,EAAC;IACnD,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,0BAA0B;IACvC,UAAU,EAAE,EAAE;IACd,QAAQ,EAAE,CAAC,8CAAkB,CAAC;IACxB,GAAG;;;gBACR,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;;;KACnC;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import RestApi from '@signageos/sdk/dist/RestApi/RestApi';
|
|
3
|
+
import { ICustomScriptVersion } from '@signageos/sdk/dist/RestApi/CustomScript/Version/ICustomScriptVersion';
|
|
4
|
+
declare const PlatformSchema: z.ZodObject<{
|
|
5
|
+
/** List of files/directories that are part of the custom script for a particular platform. */
|
|
6
|
+
rootDir: z.ZodString;
|
|
7
|
+
/** Main file of the particular platform script that will be executed. */
|
|
8
|
+
mainFile: z.ZodString;
|
|
9
|
+
/** What type of runtime is the script for the particular platform (i.e. node.js, bash,...). */
|
|
10
|
+
runtime: z.ZodString;
|
|
11
|
+
}, "strict", z.ZodTypeAny, {
|
|
12
|
+
rootDir: string;
|
|
13
|
+
mainFile: string;
|
|
14
|
+
runtime: string;
|
|
15
|
+
}, {
|
|
16
|
+
rootDir: string;
|
|
17
|
+
mainFile: string;
|
|
18
|
+
runtime: string;
|
|
19
|
+
}>;
|
|
20
|
+
export declare type PlatformConfig = z.infer<typeof PlatformSchema>;
|
|
21
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
22
|
+
uid: z.ZodOptional<z.ZodString>;
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
version: z.ZodString;
|
|
25
|
+
description: z.ZodOptional<z.ZodString>;
|
|
26
|
+
dangerLevel: z.ZodString;
|
|
27
|
+
/**
|
|
28
|
+
* Config of individual custom script implementations for each target platform.
|
|
29
|
+
*
|
|
30
|
+
* A Custom Script is only a virtual unit that consists of multiple platform-specific scripts.
|
|
31
|
+
* This record is a mapping of platform names to their respective platform-specific scripts.
|
|
32
|
+
*/
|
|
33
|
+
platforms: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
34
|
+
/** List of files/directories that are part of the custom script for a particular platform. */
|
|
35
|
+
rootDir: z.ZodString;
|
|
36
|
+
/** Main file of the particular platform script that will be executed. */
|
|
37
|
+
mainFile: z.ZodString;
|
|
38
|
+
/** What type of runtime is the script for the particular platform (i.e. node.js, bash,...). */
|
|
39
|
+
runtime: z.ZodString;
|
|
40
|
+
}, "strict", z.ZodTypeAny, {
|
|
41
|
+
rootDir: string;
|
|
42
|
+
mainFile: string;
|
|
43
|
+
runtime: string;
|
|
44
|
+
}, {
|
|
45
|
+
rootDir: string;
|
|
46
|
+
mainFile: string;
|
|
47
|
+
runtime: string;
|
|
48
|
+
}>>;
|
|
49
|
+
configDefinition: z.ZodArray<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
version: string;
|
|
52
|
+
name: string;
|
|
53
|
+
dangerLevel: string;
|
|
54
|
+
platforms: Record<string, {
|
|
55
|
+
rootDir: string;
|
|
56
|
+
mainFile: string;
|
|
57
|
+
runtime: string;
|
|
58
|
+
}>;
|
|
59
|
+
configDefinition: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
|
|
60
|
+
description?: string | undefined;
|
|
61
|
+
uid?: string | undefined;
|
|
62
|
+
}, {
|
|
63
|
+
version: string;
|
|
64
|
+
name: string;
|
|
65
|
+
dangerLevel: string;
|
|
66
|
+
platforms: Record<string, {
|
|
67
|
+
rootDir: string;
|
|
68
|
+
mainFile: string;
|
|
69
|
+
runtime: string;
|
|
70
|
+
}>;
|
|
71
|
+
configDefinition: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
|
|
72
|
+
description?: string | undefined;
|
|
73
|
+
uid?: string | undefined;
|
|
74
|
+
}>;
|
|
75
|
+
export declare type CustomScriptConfig = z.infer<typeof ConfigSchema>;
|
|
76
|
+
/**
|
|
77
|
+
* Represents archive with Custom Script code for a particular platform
|
|
78
|
+
*/
|
|
79
|
+
export interface CodeArchive {
|
|
80
|
+
filePath: string;
|
|
81
|
+
md5Checksum: string;
|
|
82
|
+
delete(): Promise<void>;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Load and validate the config file .sosconfig.json
|
|
86
|
+
*/
|
|
87
|
+
export declare function getConfig(workDir: string): Promise<{
|
|
88
|
+
version: string;
|
|
89
|
+
name: string;
|
|
90
|
+
dangerLevel: string;
|
|
91
|
+
platforms: Record<string, {
|
|
92
|
+
rootDir: string;
|
|
93
|
+
mainFile: string;
|
|
94
|
+
runtime: string;
|
|
95
|
+
}>;
|
|
96
|
+
configDefinition: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
|
|
97
|
+
description?: string | undefined;
|
|
98
|
+
uid?: string | undefined;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* Add data to the config file .sosconfig.json
|
|
102
|
+
*/
|
|
103
|
+
export declare function addToConfigFile(workDir: string, data: Partial<CustomScriptConfig>): Promise<void>;
|
|
104
|
+
export declare function ensureCustomScriptVersion(restApi: RestApi, config: CustomScriptConfig): Promise<ICustomScriptVersion>;
|
|
105
|
+
export declare function uploadCode({ restApi, workDir, platform, config, customScriptVersion, }: {
|
|
106
|
+
restApi: RestApi;
|
|
107
|
+
workDir: string;
|
|
108
|
+
platform: string;
|
|
109
|
+
config: PlatformConfig;
|
|
110
|
+
customScriptVersion: ICustomScriptVersion;
|
|
111
|
+
}): Promise<void>;
|
|
112
|
+
export {};
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.uploadCode = exports.ensureCustomScriptVersion = exports.addToConfigFile = exports.getConfig = void 0;
|
|
40
|
+
var path = require("path");
|
|
41
|
+
var os = require("os");
|
|
42
|
+
var fs = require("fs-extra");
|
|
43
|
+
var z = require("zod");
|
|
44
|
+
var prompts = require("prompts");
|
|
45
|
+
var chalk_1 = require("chalk");
|
|
46
|
+
var log_1 = require("@signageos/sdk/dist/Console/log");
|
|
47
|
+
var archive_1 = require("../Lib/archive");
|
|
48
|
+
var fileSystem_1 = require("../Lib/fileSystem");
|
|
49
|
+
var runtimeFileSystem_1 = require("@signageos/sdk/dist/Development/runtimeFileSystem");
|
|
50
|
+
var CONFIG_FILE_NAME = '.sosconfig.json';
|
|
51
|
+
var CUSTOM_SCRIPTS_BUILDS_DIRNAME = 'custom_scripts_builds';
|
|
52
|
+
var PlatformSchema = z.strictObject({
|
|
53
|
+
/** List of files/directories that are part of the custom script for a particular platform. */
|
|
54
|
+
rootDir: z.string(),
|
|
55
|
+
/** Main file of the particular platform script that will be executed. */
|
|
56
|
+
mainFile: z.string(),
|
|
57
|
+
/** What type of runtime is the script for the particular platform (i.e. node.js, bash,...). */
|
|
58
|
+
runtime: z.string(),
|
|
59
|
+
});
|
|
60
|
+
var ConfigSchema = z.object({
|
|
61
|
+
uid: z.string().optional(),
|
|
62
|
+
name: z.string(),
|
|
63
|
+
version: z.string(),
|
|
64
|
+
description: z.string().optional(),
|
|
65
|
+
dangerLevel: z.string(),
|
|
66
|
+
/**
|
|
67
|
+
* Config of individual custom script implementations for each target platform.
|
|
68
|
+
*
|
|
69
|
+
* A Custom Script is only a virtual unit that consists of multiple platform-specific scripts.
|
|
70
|
+
* This record is a mapping of platform names to their respective platform-specific scripts.
|
|
71
|
+
*/
|
|
72
|
+
platforms: z.record(z.string(), PlatformSchema),
|
|
73
|
+
configDefinition: z.array(z.object({}).passthrough()), // outsource validation to API because it's a bit complex
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* Load and validate the config file .sosconfig.json
|
|
77
|
+
*/
|
|
78
|
+
function getConfig(workDir) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
+
var config;
|
|
81
|
+
return __generator(this, function (_a) {
|
|
82
|
+
switch (_a.label) {
|
|
83
|
+
case 0: return [4 /*yield*/, loadConfigFromFile(workDir)];
|
|
84
|
+
case 1:
|
|
85
|
+
config = _a.sent();
|
|
86
|
+
return [2 /*return*/, ConfigSchema.parse(config)];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
exports.getConfig = getConfig;
|
|
92
|
+
/**
|
|
93
|
+
* Add data to the config file .sosconfig.json
|
|
94
|
+
*/
|
|
95
|
+
function addToConfigFile(workDir, data) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
97
|
+
var previousContent, filePath, newContent;
|
|
98
|
+
return __generator(this, function (_a) {
|
|
99
|
+
switch (_a.label) {
|
|
100
|
+
case 0: return [4 /*yield*/, loadConfigFromFile(workDir)];
|
|
101
|
+
case 1:
|
|
102
|
+
previousContent = _a.sent();
|
|
103
|
+
filePath = getConfigFilePath(workDir);
|
|
104
|
+
newContent = Object.assign({}, previousContent, data);
|
|
105
|
+
return [4 /*yield*/, fs.writeFile(filePath, JSON.stringify(newContent, undefined, '\t') + '\n')];
|
|
106
|
+
case 2:
|
|
107
|
+
_a.sent();
|
|
108
|
+
return [2 /*return*/];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
exports.addToConfigFile = addToConfigFile;
|
|
114
|
+
function loadConfigFromFile(workDir) {
|
|
115
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
116
|
+
var filePath, fileContent;
|
|
117
|
+
return __generator(this, function (_a) {
|
|
118
|
+
switch (_a.label) {
|
|
119
|
+
case 0:
|
|
120
|
+
filePath = getConfigFilePath(workDir);
|
|
121
|
+
return [4 /*yield*/, fs.pathExists(filePath)];
|
|
122
|
+
case 1:
|
|
123
|
+
if (!(_a.sent())) {
|
|
124
|
+
throw new Error("Config file ".concat(CONFIG_FILE_NAME, " not found"));
|
|
125
|
+
}
|
|
126
|
+
fileContent = fs.readFileSync(filePath, 'utf-8');
|
|
127
|
+
return [2 /*return*/, JSON.parse(fileContent)];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function getConfigFilePath(workDir) {
|
|
133
|
+
return path.join(workDir, CONFIG_FILE_NAME);
|
|
134
|
+
}
|
|
135
|
+
function ensureCustomScriptVersion(restApi, config) {
|
|
136
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
+
var customScript, customScriptVersion, response;
|
|
138
|
+
return __generator(this, function (_a) {
|
|
139
|
+
switch (_a.label) {
|
|
140
|
+
case 0: return [4 /*yield*/, ensureCustomScript(restApi, config)];
|
|
141
|
+
case 1:
|
|
142
|
+
customScript = _a.sent();
|
|
143
|
+
return [4 /*yield*/, restApi.customScript.version.get({
|
|
144
|
+
customScriptUid: customScript.uid,
|
|
145
|
+
version: config.version,
|
|
146
|
+
})];
|
|
147
|
+
case 2:
|
|
148
|
+
customScriptVersion = _a.sent();
|
|
149
|
+
if (customScriptVersion) {
|
|
150
|
+
return [2 /*return*/, customScriptVersion];
|
|
151
|
+
}
|
|
152
|
+
return [4 /*yield*/, prompts({
|
|
153
|
+
type: 'confirm',
|
|
154
|
+
name: 'newVersion',
|
|
155
|
+
message: "Do you want to create new custom script version ".concat(config.version, "?"),
|
|
156
|
+
})];
|
|
157
|
+
case 3:
|
|
158
|
+
response = _a.sent();
|
|
159
|
+
if (!response.newVersion) {
|
|
160
|
+
throw new Error('Custom Script version creation was canceled.');
|
|
161
|
+
}
|
|
162
|
+
(0, log_1.log)('info', chalk_1.default.yellow("Creating Custom Script version ".concat(config.version)));
|
|
163
|
+
return [4 /*yield*/, restApi.customScript.version.create({
|
|
164
|
+
customScriptUid: customScript.uid,
|
|
165
|
+
version: config.version,
|
|
166
|
+
configDefinition: config.configDefinition,
|
|
167
|
+
})];
|
|
168
|
+
case 4: return [2 /*return*/, _a.sent()];
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
exports.ensureCustomScriptVersion = ensureCustomScriptVersion;
|
|
174
|
+
function ensureCustomScript(restApi, config) {
|
|
175
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
176
|
+
var customScript, response, createdCustomScript;
|
|
177
|
+
return __generator(this, function (_a) {
|
|
178
|
+
switch (_a.label) {
|
|
179
|
+
case 0:
|
|
180
|
+
if (!config.uid) return [3 /*break*/, 4];
|
|
181
|
+
return [4 /*yield*/, restApi.customScript.get(config.uid)];
|
|
182
|
+
case 1:
|
|
183
|
+
customScript = _a.sent();
|
|
184
|
+
if (!customScript) return [3 /*break*/, 3];
|
|
185
|
+
return [4 /*yield*/, restApi.customScript.update(customScript.uid, {
|
|
186
|
+
name: config.name,
|
|
187
|
+
title: config.name,
|
|
188
|
+
description: config.description,
|
|
189
|
+
dangerLevel: config.dangerLevel,
|
|
190
|
+
})];
|
|
191
|
+
case 2:
|
|
192
|
+
_a.sent();
|
|
193
|
+
return [2 /*return*/, customScript];
|
|
194
|
+
case 3: throw new Error("Custom Script with uid \"".concat(config.uid, "\" not found"));
|
|
195
|
+
case 4: return [4 /*yield*/, prompts({
|
|
196
|
+
type: 'confirm',
|
|
197
|
+
name: 'create',
|
|
198
|
+
message: "Custom Script \"".concat(config.name, "\" does not exist. Do you want to create it?"),
|
|
199
|
+
})];
|
|
200
|
+
case 5:
|
|
201
|
+
response = _a.sent();
|
|
202
|
+
if (!response.create) {
|
|
203
|
+
throw new Error('Custom Script upload was canceled.');
|
|
204
|
+
}
|
|
205
|
+
(0, log_1.log)('info', chalk_1.default.yellow("Creating Custom Script \"".concat(config.name, "\"")));
|
|
206
|
+
return [4 /*yield*/, restApi.customScript.create({
|
|
207
|
+
name: config.name,
|
|
208
|
+
title: config.name,
|
|
209
|
+
description: config.description,
|
|
210
|
+
dangerLevel: config.dangerLevel,
|
|
211
|
+
})];
|
|
212
|
+
case 6:
|
|
213
|
+
createdCustomScript = _a.sent();
|
|
214
|
+
// TODO ask for permission or read from CLI arg
|
|
215
|
+
(0, log_1.log)('info', chalk_1.default.yellow('Adding Custom Script uid to the config file'));
|
|
216
|
+
return [4 /*yield*/, addToConfigFile(process.cwd(), { uid: createdCustomScript.uid })];
|
|
217
|
+
case 7:
|
|
218
|
+
_a.sent();
|
|
219
|
+
return [2 /*return*/, createdCustomScript];
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
function uploadCode(_a) {
|
|
225
|
+
var restApi = _a.restApi, workDir = _a.workDir, platform = _a.platform, config = _a.config, customScriptVersion = _a.customScriptVersion;
|
|
226
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
227
|
+
var mainFile, runtime, codeArchive, customScriptVersionPlatform;
|
|
228
|
+
return __generator(this, function (_b) {
|
|
229
|
+
switch (_b.label) {
|
|
230
|
+
case 0:
|
|
231
|
+
mainFile = config.mainFile, runtime = config.runtime;
|
|
232
|
+
return [4 /*yield*/, generateCustomScriptPlatformCodeArchive(workDir, config, customScriptVersion, platform)];
|
|
233
|
+
case 1:
|
|
234
|
+
codeArchive = _b.sent();
|
|
235
|
+
return [4 /*yield*/, restApi.customScript.version.platform.get({
|
|
236
|
+
customScriptUid: customScriptVersion.customScriptUid,
|
|
237
|
+
version: customScriptVersion.version,
|
|
238
|
+
platform: platform,
|
|
239
|
+
})];
|
|
240
|
+
case 2:
|
|
241
|
+
customScriptVersionPlatform = _b.sent();
|
|
242
|
+
if ((customScriptVersionPlatform === null || customScriptVersionPlatform === void 0 ? void 0 : customScriptVersionPlatform.md5Checksum) === codeArchive.md5Checksum) {
|
|
243
|
+
(0, log_1.log)('info', chalk_1.default.yellow("Skipping upload for ".concat(platform, " - no changes detected")));
|
|
244
|
+
return [2 /*return*/];
|
|
245
|
+
}
|
|
246
|
+
_b.label = 3;
|
|
247
|
+
case 3:
|
|
248
|
+
_b.trys.push([3, , 6, 8]);
|
|
249
|
+
(0, log_1.log)('info', chalk_1.default.yellow("Uploading files for ".concat(platform)));
|
|
250
|
+
return [4 /*yield*/, uploadCodeArchive({
|
|
251
|
+
restApi: restApi,
|
|
252
|
+
customScriptVersion: customScriptVersion,
|
|
253
|
+
platform: platform,
|
|
254
|
+
codeArchive: codeArchive,
|
|
255
|
+
})];
|
|
256
|
+
case 4:
|
|
257
|
+
_b.sent();
|
|
258
|
+
return [4 /*yield*/, restApi.customScript.version.platform.update({
|
|
259
|
+
customScriptUid: customScriptVersion.customScriptUid,
|
|
260
|
+
version: customScriptVersion.version,
|
|
261
|
+
platform: platform,
|
|
262
|
+
mainFile: mainFile,
|
|
263
|
+
runtime: runtime,
|
|
264
|
+
md5Checksum: codeArchive.md5Checksum,
|
|
265
|
+
})];
|
|
266
|
+
case 5:
|
|
267
|
+
_b.sent();
|
|
268
|
+
return [3 /*break*/, 8];
|
|
269
|
+
case 6: return [4 /*yield*/, codeArchive.delete()];
|
|
270
|
+
case 7:
|
|
271
|
+
_b.sent();
|
|
272
|
+
return [7 /*endfinally*/];
|
|
273
|
+
case 8: return [2 /*return*/];
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
exports.uploadCode = uploadCode;
|
|
279
|
+
function uploadCodeArchive(_a) {
|
|
280
|
+
var restApi = _a.restApi, customScriptVersion = _a.customScriptVersion, platform = _a.platform, codeArchive = _a.codeArchive;
|
|
281
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
282
|
+
var filePath, fileSize, fileStream;
|
|
283
|
+
return __generator(this, function (_b) {
|
|
284
|
+
switch (_b.label) {
|
|
285
|
+
case 0:
|
|
286
|
+
filePath = codeArchive.filePath;
|
|
287
|
+
return [4 /*yield*/, fs.stat(filePath)];
|
|
288
|
+
case 1:
|
|
289
|
+
fileSize = (_b.sent()).size;
|
|
290
|
+
fileStream = fs.createReadStream(filePath);
|
|
291
|
+
return [4 /*yield*/, restApi.customScript.version.platform.archive.upload({
|
|
292
|
+
customScriptUid: customScriptVersion.customScriptUid,
|
|
293
|
+
version: customScriptVersion.version,
|
|
294
|
+
platform: platform,
|
|
295
|
+
md5Checksum: codeArchive.md5Checksum,
|
|
296
|
+
size: fileSize,
|
|
297
|
+
stream: fileStream,
|
|
298
|
+
})];
|
|
299
|
+
case 2:
|
|
300
|
+
_b.sent();
|
|
301
|
+
return [2 /*return*/];
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Generates an archive with the code for a particular platform, defined by the provided configuration.
|
|
308
|
+
*
|
|
309
|
+
* Archive is generated and stored in the runtime /tmp/signageos/custom_scripts_builds/:uid/:version/ directory.
|
|
310
|
+
* After archive isn't needed anymore, it should be deleted using the delete method.
|
|
311
|
+
*/
|
|
312
|
+
function generateCustomScriptPlatformCodeArchive(workDir, config, customScriptVersion, platform) {
|
|
313
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
314
|
+
var buildsDir, archiveFileName, archiveFilePath, md5Checksum;
|
|
315
|
+
return __generator(this, function (_a) {
|
|
316
|
+
switch (_a.label) {
|
|
317
|
+
case 0: return [4 /*yield*/, ensureBuildsDirectory(customScriptVersion)];
|
|
318
|
+
case 1:
|
|
319
|
+
buildsDir = _a.sent();
|
|
320
|
+
archiveFileName = "".concat(platform, ".zip");
|
|
321
|
+
archiveFilePath = path.join(buildsDir, archiveFileName);
|
|
322
|
+
return [4 /*yield*/, (0, archive_1.generateZip)(workDir, config.rootDir, archiveFilePath)];
|
|
323
|
+
case 2:
|
|
324
|
+
_a.sent();
|
|
325
|
+
return [4 /*yield*/, (0, fileSystem_1.getFileMD5Checksum)(archiveFilePath)];
|
|
326
|
+
case 3:
|
|
327
|
+
md5Checksum = _a.sent();
|
|
328
|
+
return [2 /*return*/, {
|
|
329
|
+
filePath: archiveFilePath,
|
|
330
|
+
md5Checksum: md5Checksum,
|
|
331
|
+
delete: function () {
|
|
332
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
333
|
+
return __generator(this, function (_a) {
|
|
334
|
+
switch (_a.label) {
|
|
335
|
+
case 0: return [4 /*yield*/, fs.unlink(archiveFilePath)];
|
|
336
|
+
case 1:
|
|
337
|
+
_a.sent();
|
|
338
|
+
return [2 /*return*/];
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
},
|
|
343
|
+
}];
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Ensure that the runtime directory for custom script version exists in the current working directory.
|
|
350
|
+
*
|
|
351
|
+
* This directory is used to store temporary files generated by the CLI.
|
|
352
|
+
*/
|
|
353
|
+
function ensureBuildsDirectory(customScriptVersion) {
|
|
354
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
355
|
+
var runtimeDir, buildsDir;
|
|
356
|
+
return __generator(this, function (_a) {
|
|
357
|
+
switch (_a.label) {
|
|
358
|
+
case 0: return [4 /*yield*/, ensureRuntimeDir()];
|
|
359
|
+
case 1:
|
|
360
|
+
runtimeDir = _a.sent();
|
|
361
|
+
buildsDir = path.join(runtimeDir, customScriptVersion.customScriptUid, customScriptVersion.version);
|
|
362
|
+
return [4 /*yield*/, fs.ensureDir(buildsDir)];
|
|
363
|
+
case 2:
|
|
364
|
+
_a.sent();
|
|
365
|
+
return [2 /*return*/, buildsDir];
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Ensure that the runtime directory exists in the current working directory.
|
|
372
|
+
*
|
|
373
|
+
* This directory is used to store temporary files generated by the CLI.
|
|
374
|
+
*/
|
|
375
|
+
function ensureRuntimeDir() {
|
|
376
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
377
|
+
var runtimeDir;
|
|
378
|
+
return __generator(this, function (_a) {
|
|
379
|
+
switch (_a.label) {
|
|
380
|
+
case 0:
|
|
381
|
+
runtimeDir = path.join(os.tmpdir(), runtimeFileSystem_1.RUNTIME_DIRNAME, CUSTOM_SCRIPTS_BUILDS_DIRNAME);
|
|
382
|
+
return [4 /*yield*/, fs.ensureDir(runtimeDir)];
|
|
383
|
+
case 1:
|
|
384
|
+
_a.sent();
|
|
385
|
+
return [2 /*return*/, runtimeDir];
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
//# sourceMappingURL=customScriptFacade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customScriptFacade.js","sourceRoot":"","sources":["../../src/CustomScript/customScriptFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAA6B;AAC7B,uBAAyB;AACzB,6BAA+B;AAC/B,uBAAyB;AACzB,iCAAmC;AACnC,+BAA0B;AAE1B,uDAAsD;AACtD,0CAA6C;AAC7C,gDAAuD;AAEvD,uFAAoF;AAEpF,IAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAC3C,IAAM,6BAA6B,GAAG,uBAAuB,CAAC;AAE9D,IAAM,cAAc,GAAG,CAAC,CAAC,YAAY,CAAC;IACrC,8FAA8F;IAC9F,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,yEAAyE;IACzE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,+FAA+F;IAC/F,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AAIH,IAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,GAAG,E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E,CAAC,MAAM,EAAE,EAAE,mCAAe,EAAE,6BAA6B,CAAC,CAAC;oBAC1F,qBAAM,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,EAAA;;oBAA9B,SAA8B,CAAC;oBAE/B,sBAAO,UAAU,EAAC;;;;CAClB"}
|
|
@@ -36,6 +36,25 @@ declare const OPTION_LIST: readonly [{
|
|
|
36
36
|
readonly name: "use-forward-server";
|
|
37
37
|
readonly type: BooleanConstructor;
|
|
38
38
|
readonly description: string;
|
|
39
|
+
}, {
|
|
40
|
+
readonly name: "detach";
|
|
41
|
+
readonly type: BooleanConstructor;
|
|
42
|
+
readonly description: "Detach the applet HTTP server process from the terminal. Useful when want to run more commands reusing the same http server for current applet.";
|
|
43
|
+
readonly defaultValue: false;
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "forward-server-url";
|
|
46
|
+
readonly type: StringConstructor;
|
|
47
|
+
readonly description: "Url of forward server to connect to the device instead of the local network (LAN).";
|
|
48
|
+
readonly defaultValue: string | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "hot-reload";
|
|
51
|
+
readonly type: BooleanConstructor;
|
|
52
|
+
readonly description: "Enable hot reload and build of applet";
|
|
53
|
+
readonly defaultValue: false;
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "applet-path";
|
|
56
|
+
readonly type: StringConstructor;
|
|
57
|
+
readonly description: "Path to the applet file or the project folder depending on the entry file. Relative to the command or absolute.";
|
|
39
58
|
}];
|
|
40
59
|
export declare const connect: {
|
|
41
60
|
name: "connect";
|
|
@@ -72,6 +91,25 @@ export declare const connect: {
|
|
|
72
91
|
readonly name: "use-forward-server";
|
|
73
92
|
readonly type: BooleanConstructor;
|
|
74
93
|
readonly description: string;
|
|
94
|
+
}, {
|
|
95
|
+
readonly name: "detach";
|
|
96
|
+
readonly type: BooleanConstructor;
|
|
97
|
+
readonly description: "Detach the applet HTTP server process from the terminal. Useful when want to run more commands reusing the same http server for current applet.";
|
|
98
|
+
readonly defaultValue: false;
|
|
99
|
+
}, {
|
|
100
|
+
readonly name: "forward-server-url";
|
|
101
|
+
readonly type: StringConstructor;
|
|
102
|
+
readonly description: "Url of forward server to connect to the device instead of the local network (LAN).";
|
|
103
|
+
readonly defaultValue: string | undefined;
|
|
104
|
+
}, {
|
|
105
|
+
readonly name: "hot-reload";
|
|
106
|
+
readonly type: BooleanConstructor;
|
|
107
|
+
readonly description: "Enable hot reload and build of applet";
|
|
108
|
+
readonly defaultValue: false;
|
|
109
|
+
}, {
|
|
110
|
+
readonly name: "applet-path";
|
|
111
|
+
readonly type: StringConstructor;
|
|
112
|
+
readonly description: "Path to the applet file or the project folder depending on the entry file. Relative to the command or absolute.";
|
|
75
113
|
}];
|
|
76
114
|
commands: never[];
|
|
77
115
|
run: (options: CommandLineOptions<typeof OPTION_LIST>) => Promise<void>;
|