@alwaysai/device-agent 1.5.0 → 2.0.1
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/lib/application-control/config.d.ts.map +1 -1
- package/lib/application-control/config.js +8 -3
- package/lib/application-control/config.js.map +1 -1
- package/lib/application-control/environment-variables.d.ts +5 -5
- package/lib/application-control/environment-variables.d.ts.map +1 -1
- package/lib/application-control/environment-variables.js +25 -38
- package/lib/application-control/environment-variables.js.map +1 -1
- package/lib/application-control/environment-variables.test.js +27 -7
- package/lib/application-control/environment-variables.test.js.map +1 -1
- package/lib/application-control/index.d.ts +4 -4
- package/lib/application-control/index.d.ts.map +1 -1
- package/lib/application-control/index.js +1 -4
- package/lib/application-control/index.js.map +1 -1
- package/lib/application-control/install.d.ts +4 -1
- package/lib/application-control/install.d.ts.map +1 -1
- package/lib/application-control/install.js +24 -8
- package/lib/application-control/install.js.map +1 -1
- package/lib/application-control/models.d.ts +0 -11
- package/lib/application-control/models.d.ts.map +1 -1
- package/lib/application-control/models.js +5 -54
- package/lib/application-control/models.js.map +1 -1
- package/lib/application-control/utils.d.ts +0 -4
- package/lib/application-control/utils.d.ts.map +1 -1
- package/lib/application-control/utils.js +12 -22
- package/lib/application-control/utils.js.map +1 -1
- package/lib/cloud-connection/base-message-handler.d.ts +27 -0
- package/lib/cloud-connection/base-message-handler.d.ts.map +1 -0
- package/lib/cloud-connection/base-message-handler.js +72 -0
- package/lib/cloud-connection/base-message-handler.js.map +1 -0
- package/lib/cloud-connection/bootstrap-provision.js +3 -2
- package/lib/cloud-connection/bootstrap-provision.js.map +1 -1
- package/lib/cloud-connection/connection-manager.d.ts +21 -0
- package/lib/cloud-connection/connection-manager.d.ts.map +1 -0
- package/lib/cloud-connection/connection-manager.js +158 -0
- package/lib/cloud-connection/connection-manager.js.map +1 -0
- package/lib/cloud-connection/device-agent-cloud-connection.d.ts +9 -30
- package/lib/cloud-connection/device-agent-cloud-connection.d.ts.map +1 -1
- package/lib/cloud-connection/device-agent-cloud-connection.js +69 -508
- package/lib/cloud-connection/device-agent-cloud-connection.js.map +1 -1
- package/lib/cloud-connection/device-agent-message-handler.d.ts +22 -0
- package/lib/cloud-connection/device-agent-message-handler.d.ts.map +1 -0
- package/lib/cloud-connection/device-agent-message-handler.js +357 -0
- package/lib/cloud-connection/device-agent-message-handler.js.map +1 -0
- package/lib/cloud-connection/device-agent.d.ts.map +1 -1
- package/lib/cloud-connection/device-agent.js +11 -9
- package/lib/cloud-connection/device-agent.js.map +1 -1
- package/lib/cloud-connection/live-updates-handler.d.ts +19 -28
- package/lib/cloud-connection/live-updates-handler.d.ts.map +1 -1
- package/lib/cloud-connection/live-updates-handler.js +60 -172
- package/lib/cloud-connection/live-updates-handler.js.map +1 -1
- package/lib/cloud-connection/live-updates-handler.test.js +71 -165
- package/lib/cloud-connection/live-updates-handler.test.js.map +1 -1
- package/lib/cloud-connection/message-dispatcher.d.ts +10 -0
- package/lib/cloud-connection/message-dispatcher.d.ts.map +1 -0
- package/lib/cloud-connection/message-dispatcher.js +27 -0
- package/lib/cloud-connection/message-dispatcher.js.map +1 -0
- package/lib/cloud-connection/passthrough-handler.d.ts +4 -1
- package/lib/cloud-connection/passthrough-handler.d.ts.map +1 -1
- package/lib/cloud-connection/passthrough-handler.js +30 -11
- package/lib/cloud-connection/passthrough-handler.js.map +1 -1
- package/lib/cloud-connection/shadow-handler.d.ts +11 -3
- package/lib/cloud-connection/shadow-handler.d.ts.map +1 -1
- package/lib/cloud-connection/shadow-handler.js +133 -28
- package/lib/cloud-connection/shadow-handler.js.map +1 -1
- package/lib/cloud-connection/shadow-handler.test.js +45 -57
- package/lib/cloud-connection/shadow-handler.test.js.map +1 -1
- package/lib/cloud-connection/shadow.d.ts.map +1 -1
- package/lib/cloud-connection/shadow.js +2 -1
- package/lib/cloud-connection/shadow.js.map +1 -1
- package/lib/cloud-connection/transaction-manager.d.ts +12 -3
- package/lib/cloud-connection/transaction-manager.d.ts.map +1 -1
- package/lib/cloud-connection/transaction-manager.js +29 -28
- package/lib/cloud-connection/transaction-manager.js.map +1 -1
- package/lib/cloud-connection/transaction-manager.test.js +46 -5
- package/lib/cloud-connection/transaction-manager.test.js.map +1 -1
- package/lib/device-control/device-control.d.ts +8 -8
- package/lib/device-control/device-control.d.ts.map +1 -1
- package/lib/device-control/device-control.js +95 -71
- package/lib/device-control/device-control.js.map +1 -1
- package/lib/docker/docker-compose.d.ts.map +1 -1
- package/lib/docker/docker-compose.js +2 -1
- package/lib/docker/docker-compose.js.map +1 -1
- package/lib/infrastructure/agent-config.d.ts +2 -1
- package/lib/infrastructure/agent-config.d.ts.map +1 -1
- package/lib/infrastructure/agent-config.js +7 -7
- package/lib/infrastructure/agent-config.js.map +1 -1
- package/lib/infrastructure/agent-config.test.js +3 -1
- package/lib/infrastructure/agent-config.test.js.map +1 -1
- package/lib/infrastructure/config-check-utility.d.ts +6 -0
- package/lib/infrastructure/config-check-utility.d.ts.map +1 -0
- package/lib/infrastructure/config-check-utility.js +67 -0
- package/lib/infrastructure/config-check-utility.js.map +1 -0
- package/lib/infrastructure/config-check-utility.test.d.ts +2 -0
- package/lib/infrastructure/config-check-utility.test.d.ts.map +1 -0
- package/lib/infrastructure/config-check-utility.test.js +109 -0
- package/lib/infrastructure/config-check-utility.test.js.map +1 -0
- package/lib/infrastructure/device-certificate.d.ts +10 -0
- package/lib/infrastructure/device-certificate.d.ts.map +1 -0
- package/lib/infrastructure/device-certificate.js +47 -0
- package/lib/infrastructure/device-certificate.js.map +1 -0
- package/lib/infrastructure/device-certificate.test.d.ts +2 -0
- package/lib/infrastructure/device-certificate.test.d.ts.map +1 -0
- package/lib/infrastructure/device-certificate.test.js +24 -0
- package/lib/infrastructure/device-certificate.test.js.map +1 -0
- package/lib/infrastructure/legacy-migration/legacy-file.test.d.ts +2 -0
- package/lib/infrastructure/legacy-migration/legacy-file.test.d.ts.map +1 -0
- package/lib/infrastructure/legacy-migration/legacy-file.test.js +61 -0
- package/lib/infrastructure/legacy-migration/legacy-file.test.js.map +1 -0
- package/lib/infrastructure/legacy-migration/legacy-files.d.ts +75 -0
- package/lib/infrastructure/legacy-migration/legacy-files.d.ts.map +1 -0
- package/lib/infrastructure/legacy-migration/legacy-files.js +75 -0
- package/lib/infrastructure/legacy-migration/legacy-files.js.map +1 -0
- package/lib/infrastructure/legacy-migration/legacy-migration.d.ts +6 -0
- package/lib/infrastructure/legacy-migration/legacy-migration.d.ts.map +1 -0
- package/lib/infrastructure/legacy-migration/legacy-migration.js +149 -0
- package/lib/infrastructure/legacy-migration/legacy-migration.js.map +1 -0
- package/lib/infrastructure/legacy-migration/legacy-migration.test.d.ts +2 -0
- package/lib/infrastructure/legacy-migration/legacy-migration.test.d.ts.map +1 -0
- package/lib/infrastructure/legacy-migration/legacy-migration.test.js +226 -0
- package/lib/infrastructure/legacy-migration/legacy-migration.test.js.map +1 -0
- package/lib/infrastructure/require-files-present-ready.test.d.ts +2 -0
- package/lib/infrastructure/require-files-present-ready.test.d.ts.map +1 -0
- package/lib/infrastructure/require-files-present-ready.test.js +44 -0
- package/lib/infrastructure/require-files-present-ready.test.js.map +1 -0
- package/lib/infrastructure/required-config-checks.d.ts +2 -0
- package/lib/infrastructure/required-config-checks.d.ts.map +1 -0
- package/lib/infrastructure/required-config-checks.js +30 -0
- package/lib/infrastructure/required-config-checks.js.map +1 -0
- package/lib/infrastructure/tokens-and-device-cfg.d.ts.map +1 -1
- package/lib/infrastructure/tokens-and-device-cfg.js +11 -8
- package/lib/infrastructure/tokens-and-device-cfg.js.map +1 -1
- package/lib/jobs/job-handler.d.ts +23 -0
- package/lib/jobs/job-handler.d.ts.map +1 -0
- package/lib/jobs/job-handler.js +131 -0
- package/lib/jobs/job-handler.js.map +1 -0
- package/lib/local-connection/rabbitmq-connection.d.ts.map +1 -1
- package/lib/local-connection/rabbitmq-connection.js +14 -14
- package/lib/local-connection/rabbitmq-connection.js.map +1 -1
- package/lib/secure-tunneling/secure-tunnel-message-handler.d.ts +8 -0
- package/lib/secure-tunneling/secure-tunnel-message-handler.d.ts.map +1 -0
- package/lib/secure-tunneling/secure-tunnel-message-handler.js +42 -0
- package/lib/secure-tunneling/secure-tunnel-message-handler.js.map +1 -0
- package/lib/secure-tunneling/secure-tunneling.d.ts +9 -9
- package/lib/secure-tunneling/secure-tunneling.d.ts.map +1 -1
- package/lib/secure-tunneling/secure-tunneling.js +21 -16
- package/lib/secure-tunneling/secure-tunneling.js.map +1 -1
- package/lib/secure-tunneling/secure-tunneling.test.js +11 -13
- package/lib/secure-tunneling/secure-tunneling.test.js.map +1 -1
- package/lib/subcommands/app/analytics.d.ts.map +1 -1
- package/lib/subcommands/app/analytics.js +1 -2
- package/lib/subcommands/app/analytics.js.map +1 -1
- package/lib/subcommands/app/env-vars.d.ts +4 -0
- package/lib/subcommands/app/env-vars.d.ts.map +1 -1
- package/lib/subcommands/app/env-vars.js +52 -6
- package/lib/subcommands/app/env-vars.js.map +1 -1
- package/lib/subcommands/app/index.d.ts.map +1 -1
- package/lib/subcommands/app/index.js +1 -3
- package/lib/subcommands/app/index.js.map +1 -1
- package/lib/subcommands/app/models.d.ts +0 -11
- package/lib/subcommands/app/models.d.ts.map +1 -1
- package/lib/subcommands/app/models.js +2 -58
- package/lib/subcommands/app/models.js.map +1 -1
- package/lib/subcommands/app/shadow.d.ts.map +1 -1
- package/lib/subcommands/app/shadow.js +6 -5
- package/lib/subcommands/app/shadow.js.map +1 -1
- package/lib/subcommands/app/version.d.ts +2 -0
- package/lib/subcommands/app/version.d.ts.map +1 -1
- package/lib/subcommands/app/version.js +16 -6
- package/lib/subcommands/app/version.js.map +1 -1
- package/lib/subcommands/config.d.ts +2 -0
- package/lib/subcommands/config.d.ts.map +1 -0
- package/lib/subcommands/config.js +39 -0
- package/lib/subcommands/config.js.map +1 -0
- package/lib/subcommands/device/clean.d.ts +1 -1
- package/lib/subcommands/device/clean.d.ts.map +1 -1
- package/lib/subcommands/device/clean.js +23 -13
- package/lib/subcommands/device/clean.js.map +1 -1
- package/lib/subcommands/device/index.d.ts.map +1 -1
- package/lib/subcommands/device/index.js +3 -1
- package/lib/subcommands/device/index.js.map +1 -1
- package/lib/subcommands/device/init.js +8 -8
- package/lib/subcommands/device/init.js.map +1 -1
- package/lib/subcommands/device/migrate.d.ts +2 -0
- package/lib/subcommands/device/migrate.d.ts.map +1 -0
- package/lib/subcommands/device/migrate.js +24 -0
- package/lib/subcommands/device/migrate.js.map +1 -0
- package/lib/subcommands/device/refresh.d.ts.map +1 -1
- package/lib/subcommands/device/refresh.js +1 -0
- package/lib/subcommands/device/refresh.js.map +1 -1
- package/lib/subcommands/index.d.ts +1 -1
- package/lib/subcommands/index.d.ts.map +1 -1
- package/lib/subcommands/index.js +3 -1
- package/lib/subcommands/index.js.map +1 -1
- package/lib/subcommands/rabbitmq-connection.d.ts +1 -1
- package/lib/subcommands/rabbitmq-connection.d.ts.map +1 -1
- package/lib/util/aai-error.d.ts +12 -0
- package/lib/util/aai-error.d.ts.map +1 -0
- package/lib/util/aai-error.js +11 -0
- package/lib/util/aai-error.js.map +1 -0
- package/lib/util/aws-regions.d.ts +2 -0
- package/lib/util/aws-regions.d.ts.map +1 -0
- package/lib/util/{cloud-mode-ready.js → aws-regions.js} +2 -20
- package/lib/util/aws-regions.js.map +1 -0
- package/lib/util/check-for-updates.d.ts.map +1 -1
- package/lib/util/check-for-updates.js +5 -28
- package/lib/util/check-for-updates.js.map +1 -1
- package/lib/util/clean-certs.d.ts.map +1 -1
- package/lib/util/clean-certs.js +5 -4
- package/lib/util/clean-certs.js.map +1 -1
- package/lib/util/directories.d.ts +4 -18
- package/lib/util/directories.d.ts.map +1 -1
- package/lib/util/directories.js +18 -32
- package/lib/util/directories.js.map +1 -1
- package/lib/util/file.d.ts +4 -0
- package/lib/util/file.d.ts.map +1 -1
- package/lib/util/file.js +65 -4
- package/lib/util/file.js.map +1 -1
- package/lib/util/get-device-id.d.ts.map +1 -1
- package/lib/util/get-device-id.js +7 -1
- package/lib/util/get-device-id.js.map +1 -1
- package/lib/util/http-client.js +3 -3
- package/lib/util/http-client.js.map +1 -1
- package/package.json +19 -17
- package/readme.md +12 -32
- package/src/application-control/config.ts +9 -12
- package/src/application-control/environment-variables.test.ts +28 -7
- package/src/application-control/environment-variables.ts +42 -59
- package/src/application-control/index.ts +3 -16
- package/src/application-control/install.ts +39 -13
- package/src/application-control/models.ts +6 -87
- package/src/application-control/utils.ts +10 -25
- package/src/cloud-connection/base-message-handler.ts +118 -0
- package/src/cloud-connection/bootstrap-provision.ts +7 -7
- package/src/cloud-connection/connection-manager.ts +187 -0
- package/src/cloud-connection/device-agent-cloud-connection.ts +130 -723
- package/src/cloud-connection/device-agent-message-handler.ts +642 -0
- package/src/cloud-connection/device-agent.ts +16 -7
- package/src/cloud-connection/live-updates-handler.test.ts +121 -189
- package/src/cloud-connection/live-updates-handler.ts +105 -232
- package/src/cloud-connection/message-dispatcher.ts +33 -0
- package/src/cloud-connection/passthrough-handler.ts +55 -18
- package/src/cloud-connection/shadow-handler.test.ts +45 -57
- package/src/cloud-connection/shadow-handler.ts +224 -54
- package/src/cloud-connection/shadow.ts +4 -1
- package/src/cloud-connection/transaction-manager.test.ts +68 -6
- package/src/cloud-connection/transaction-manager.ts +69 -41
- package/src/device-control/device-control.ts +102 -70
- package/src/docker/docker-compose.ts +3 -2
- package/src/infrastructure/agent-config.test.ts +6 -2
- package/src/infrastructure/agent-config.ts +8 -7
- package/src/infrastructure/config-check-utility.test.ts +154 -0
- package/src/infrastructure/config-check-utility.ts +77 -0
- package/src/infrastructure/device-certificate.test.ts +40 -0
- package/src/infrastructure/device-certificate.ts +58 -0
- package/src/infrastructure/legacy-migration/legacy-file.test.ts +88 -0
- package/src/infrastructure/legacy-migration/legacy-files.ts +101 -0
- package/src/infrastructure/legacy-migration/legacy-migration.test.ts +396 -0
- package/src/infrastructure/legacy-migration/legacy-migration.ts +229 -0
- package/src/infrastructure/require-files-present-ready.test.ts +53 -0
- package/src/infrastructure/required-config-checks.ts +33 -0
- package/src/infrastructure/tokens-and-device-cfg.ts +12 -10
- package/src/jobs/job-handler.ts +146 -0
- package/src/local-connection/rabbitmq-connection.ts +22 -17
- package/src/secure-tunneling/secure-tunnel-message-handler.ts +56 -0
- package/src/secure-tunneling/secure-tunneling.test.ts +20 -22
- package/src/secure-tunneling/secure-tunneling.ts +41 -29
- package/src/subcommands/app/analytics.ts +2 -4
- package/src/subcommands/app/env-vars.ts +72 -9
- package/src/subcommands/app/index.ts +3 -11
- package/src/subcommands/app/models.ts +5 -81
- package/src/subcommands/app/shadow.ts +6 -5
- package/src/subcommands/app/version.ts +23 -6
- package/src/subcommands/config.ts +42 -0
- package/src/subcommands/device/clean.ts +31 -17
- package/src/subcommands/device/index.ts +3 -1
- package/src/subcommands/device/init.ts +11 -11
- package/src/subcommands/device/migrate.ts +20 -0
- package/src/subcommands/device/refresh.ts +1 -0
- package/src/subcommands/index.ts +3 -1
- package/src/util/aai-error.ts +20 -0
- package/src/util/{cloud-mode-ready.ts → aws-regions.ts} +0 -24
- package/src/util/check-for-updates.ts +14 -30
- package/src/util/clean-certs.ts +8 -4
- package/src/util/directories.ts +23 -67
- package/src/util/file.ts +83 -3
- package/src/util/get-device-id.ts +7 -7
- package/src/util/http-client.ts +2 -2
- package/lib/util/cloud-mode-ready.d.ts +0 -3
- package/lib/util/cloud-mode-ready.d.ts.map +0 -1
- package/lib/util/cloud-mode-ready.js.map +0 -1
- package/lib/util/download-file.d.ts +0 -6
- package/lib/util/download-file.d.ts.map +0 -1
- package/lib/util/download-file.js +0 -25
- package/lib/util/download-file.js.map +0 -1
- package/lib/util/fetch-with-timeout.d.ts +0 -4
- package/lib/util/fetch-with-timeout.d.ts.map +0 -1
- package/lib/util/fetch-with-timeout.js +0 -30
- package/lib/util/fetch-with-timeout.js.map +0 -1
- package/lib/util/parsing.d.ts +0 -2
- package/lib/util/parsing.d.ts.map +0 -1
- package/lib/util/parsing.js +0 -17
- package/lib/util/parsing.js.map +0 -1
- package/src/util/download-file.ts +0 -25
- package/src/util/fetch-with-timeout.ts +0 -35
- package/src/util/parsing.ts +0 -11
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configBranch = void 0;
|
|
4
|
+
const alwayscli_1 = require("@alwaysai/alwayscli");
|
|
5
|
+
const constants_1 = require("alwaysai/lib/constants");
|
|
6
|
+
const environment_1 = require("alwaysai/lib/environment");
|
|
7
|
+
const infrastructure_1 = require("alwaysai/lib/infrastructure");
|
|
8
|
+
const util_1 = require("alwaysai/lib/util");
|
|
9
|
+
const environment_2 = require("../environment");
|
|
10
|
+
const show = (0, alwayscli_1.CliLeaf)({
|
|
11
|
+
name: 'show',
|
|
12
|
+
description: `Show your current configuration`,
|
|
13
|
+
action() {
|
|
14
|
+
if (environment_1.ALWAYSAI_SYSTEM_ID) {
|
|
15
|
+
(0, util_1.echo)('[WARNING] System ID is overridden by environment variable "ALWAYSAI_SYSTEM_ID"');
|
|
16
|
+
}
|
|
17
|
+
return { systemId: (0, infrastructure_1.getSystemId)() };
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const set = (0, alwayscli_1.CliLeaf)({
|
|
21
|
+
name: 'set',
|
|
22
|
+
description: 'Set an configuration value',
|
|
23
|
+
namedInputs: {
|
|
24
|
+
systemId: (0, alwayscli_1.CliOneOfInput)({ values: constants_1.SYSTEM_IDS, required: true })
|
|
25
|
+
},
|
|
26
|
+
action(_, { systemId }) {
|
|
27
|
+
if (environment_1.ALWAYSAI_SYSTEM_ID) {
|
|
28
|
+
(0, util_1.echo)('WARNING] System ID is overridden by environment variable "ALWAYSAI_SYSTEM_ID"');
|
|
29
|
+
}
|
|
30
|
+
return (0, infrastructure_1.setSystemId)(systemId);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
exports.configBranch = (0, alwayscli_1.CliBranch)({
|
|
34
|
+
name: 'config',
|
|
35
|
+
hidden: !environment_2.ALWAYSAI_SHOW_HIDDEN,
|
|
36
|
+
description: `Show or set configuration values`,
|
|
37
|
+
subcommands: [show, set]
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/subcommands/config.ts"],"names":[],"mappings":";;;AAAA,mDAAwE;AACxE,sDAAoD;AACpD,0DAA8D;AAC9D,gEAAuE;AACvE,4CAAyC;AACzC,gDAAsD;AAEtD,MAAM,IAAI,GAAG,IAAA,mBAAO,EAAC;IACnB,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,iCAAiC;IAC9C,MAAM;QACJ,IAAI,gCAAkB,EAAE;YACtB,IAAA,WAAI,EACF,gFAAgF,CACjF,CAAC;SACH;QACD,OAAO,EAAE,QAAQ,EAAE,IAAA,4BAAW,GAAE,EAAE,CAAC;IACrC,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,GAAG,GAAG,IAAA,mBAAO,EAAC;IAClB,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,4BAA4B;IACzC,WAAW,EAAE;QACX,QAAQ,EAAE,IAAA,yBAAa,EAAC,EAAE,MAAM,EAAE,sBAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KAChE;IACD,MAAM,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE;QACpB,IAAI,gCAAkB,EAAE;YACtB,IAAA,WAAI,EACF,+EAA+E,CAChF,CAAC;SACH;QACD,OAAO,IAAA,4BAAW,EAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;CACF,CAAC,CAAC;AAEU,QAAA,YAAY,GAAG,IAAA,qBAAS,EAAC;IACpC,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,CAAC,kCAAoB;IAC7B,WAAW,EAAE,mCAAmC;IAChD,WAAW,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;CACzB,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const cleanCliLeaf: import("@alwaysai/alwayscli/lib/types").CliLeaf<import("@alwaysai/alwayscli").CliInput<undefined, false>,
|
|
1
|
+
export declare const cleanCliLeaf: import("@alwaysai/alwayscli/lib/types").CliLeaf<import("@alwaysai/alwayscli").CliInput<undefined, false>, import("@alwaysai/alwayscli/lib/types").AnyNamedInputs, import("@alwaysai/alwayscli").CliInput<undefined, false>>;
|
|
2
2
|
//# sourceMappingURL=clean.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../src/subcommands/device/clean.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../src/subcommands/device/clean.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,YAAY,6NAgDvB,CAAC"}
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cleanCliLeaf = void 0;
|
|
4
4
|
const alwayscli_1 = require("@alwaysai/alwayscli");
|
|
5
|
-
const logger_1 = require("../../util/logger");
|
|
6
|
-
const agent_config_1 = require("../../infrastructure/agent-config");
|
|
7
5
|
const device_1 = require("alwaysai/lib/core/device");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
6
|
+
const infrastructure_1 = require("alwaysai/lib/infrastructure");
|
|
7
|
+
const util_1 = require("alwaysai/lib/util");
|
|
8
|
+
const promises_1 = require("fs/promises");
|
|
10
9
|
const application_control_1 = require("../../application-control");
|
|
11
|
-
const
|
|
10
|
+
const agent_config_1 = require("../../infrastructure/agent-config");
|
|
11
|
+
const rabbitmq_connection_1 = require("../../local-connection/rabbitmq-connection");
|
|
12
|
+
const directories_1 = require("../../util/directories");
|
|
12
13
|
const file_1 = require("../../util/file");
|
|
14
|
+
const logger_1 = require("../../util/logger");
|
|
13
15
|
exports.cleanCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
14
16
|
name: 'clean',
|
|
15
17
|
description: 'Remove all provisioning files',
|
|
@@ -21,25 +23,33 @@ exports.cleanCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
catch (e) {
|
|
24
|
-
logger_1.logger.error(`You may need to manually stop the container by running docker-compose down in the following directory: ${directories_1.
|
|
25
|
-
logger_1.logger.debug(`Error in checking / stopping RabbitMQ container
|
|
26
|
+
logger_1.logger.error(`You may need to manually stop the container by running docker-compose down in the following directory: ${(0, directories_1.getDeviceAgentDockerComposePath)()}`);
|
|
27
|
+
logger_1.logger.debug(`Error in checking / stopping RabbitMQ container!\n${(0, util_1.stringifyError)(e)}`);
|
|
26
28
|
}
|
|
27
|
-
await (0, file_1.safeRimraf)(directories_1.
|
|
29
|
+
await (0, file_1.safeRimraf)((0, directories_1.getDeviceAgentConfigPath)());
|
|
28
30
|
logger_1.logger.debug('Checking for alwaysAI applications still running');
|
|
29
31
|
const apps = await (0, agent_config_1.AgentConfigFile)().getApps();
|
|
30
|
-
const
|
|
32
|
+
const uninstallAppPromises = [];
|
|
31
33
|
for (const app of apps) {
|
|
32
34
|
const { projectId } = app;
|
|
33
|
-
|
|
35
|
+
uninstallAppPromises.push((0, application_control_1.uninstallApp)({ projectId }));
|
|
34
36
|
}
|
|
35
|
-
await Promise.all(
|
|
36
|
-
await (0, file_1.safeRimraf)(
|
|
37
|
+
await Promise.all(uninstallAppPromises);
|
|
38
|
+
await (0, file_1.safeRimraf)(infrastructure_1.LOCAL_CERT_AND_KEY_DIR);
|
|
39
|
+
const legacyCertificates = new infrastructure_1.LocalLegacyDeviceCertificates();
|
|
40
|
+
await (0, file_1.safeRimraf)(legacyCertificates.getCertificateDirectoryPath());
|
|
37
41
|
logger_1.logger.debug(`Removing ${(0, agent_config_1.AgentConfigFile)().path}`);
|
|
38
42
|
(0, agent_config_1.AgentConfigFile)().remove();
|
|
39
43
|
logger_1.logger.debug(`Removing ${(0, device_1.DeviceConfigFile)().path}`);
|
|
40
44
|
(0, device_1.DeviceConfigFile)().remove();
|
|
41
45
|
await (0, file_1.safeRimraf)(directories_1.CREDENTIALS_FILE_PATH);
|
|
42
|
-
await (0,
|
|
46
|
+
const files = await (0, promises_1.readdir)(directories_1.APP_ROOT);
|
|
47
|
+
logger_1.logger.debug(`${directories_1.APP_ROOT} folder contents ${JSON.stringify(files.length)}`);
|
|
48
|
+
// This won't handle hidden files, but will remove if truly empty, which is safer
|
|
49
|
+
if (files.length === 0) {
|
|
50
|
+
logger_1.logger.debug('Applications directory is empty, removing.');
|
|
51
|
+
await (0, file_1.safeRimraf)(directories_1.APP_ROOT);
|
|
52
|
+
}
|
|
43
53
|
logger_1.logger.info('Device configuration cleaned');
|
|
44
54
|
}
|
|
45
55
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean.js","sourceRoot":"","sources":["../../../src/subcommands/device/clean.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"clean.js","sourceRoot":"","sources":["../../../src/subcommands/device/clean.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAC9C,qDAA4D;AAC5D,gEAGqC;AACrC,4CAAmD;AACnD,0CAAsC;AACtC,mEAAyD;AACzD,oEAAoE;AACpE,oFAGoD;AACpD,wDAKgC;AAChC,0CAA6C;AAC7C,8CAA2C;AAE9B,QAAA,YAAY,GAAG,IAAA,mBAAO,EAAC;IAClC,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,+BAA+B;IAC5C,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI;QAClB,eAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC5C,IAAI;YACF,IAAI,MAAM,IAAA,mDAA6B,GAAE,EAAE;gBACzC,MAAM,IAAA,2CAAqB,GAAE,CAAC;aAC/B;SACF;QAAC,OAAO,CAAC,EAAE;YACV,eAAM,CAAC,KAAK,CACV,0GAA0G,IAAA,6CAA+B,GAAE,EAAE,CAC9I,CAAC;YACF,eAAM,CAAC,KAAK,CACV,qDAAqD,IAAA,qBAAc,EAAC,CAAC,CAAC,EAAE,CACzE,CAAC;SACH;QAED,MAAM,IAAA,iBAAU,EAAC,IAAA,sCAAwB,GAAE,CAAC,CAAC;QAE7C,eAAM,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACjE,MAAM,IAAI,GAAG,MAAM,IAAA,8BAAe,GAAE,CAAC,OAAO,EAAE,CAAC;QAC/C,MAAM,oBAAoB,GAAoB,EAAE,CAAC;QACjD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,MAAM,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC;YAC1B,oBAAoB,CAAC,IAAI,CAAC,IAAA,kCAAY,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;SACxD;QACD,MAAM,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAExC,MAAM,IAAA,iBAAU,EAAC,uCAAsB,CAAC,CAAC;QACzC,MAAM,kBAAkB,GAAG,IAAI,8CAA6B,EAAE,CAAC;QAC/D,MAAM,IAAA,iBAAU,EAAC,kBAAkB,CAAC,2BAA2B,EAAE,CAAC,CAAC;QAEnE,eAAM,CAAC,KAAK,CAAC,YAAY,IAAA,8BAAe,GAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,IAAA,8BAAe,GAAE,CAAC,MAAM,EAAE,CAAC;QAC3B,eAAM,CAAC,KAAK,CAAC,YAAY,IAAA,yBAAgB,GAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QACpD,IAAA,yBAAgB,GAAE,CAAC,MAAM,EAAE,CAAC;QAE5B,MAAM,IAAA,iBAAU,EAAC,mCAAqB,CAAC,CAAC;QACxC,MAAM,KAAK,GAAG,MAAM,IAAA,kBAAO,EAAC,sBAAQ,CAAC,CAAC;QACtC,eAAM,CAAC,KAAK,CAAC,GAAG,sBAAQ,oBAAoB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC5E,iFAAiF;QACjF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACtB,eAAM,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;YAC3D,MAAM,IAAA,iBAAU,EAAC,sBAAQ,CAAC,CAAC;SAC5B;QACD,eAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;IAC9C,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/subcommands/device/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/subcommands/device/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,mDAW1B,CAAC"}
|
|
@@ -7,6 +7,7 @@ const clean_1 = require("./clean");
|
|
|
7
7
|
const init_1 = require("./init");
|
|
8
8
|
const restart_1 = require("./restart");
|
|
9
9
|
const refresh_1 = require("./refresh");
|
|
10
|
+
const migrate_1 = require("./migrate");
|
|
10
11
|
exports.deviceCliBranch = (0, alwayscli_1.CliBranch)({
|
|
11
12
|
name: 'device',
|
|
12
13
|
description: 'Manage current device',
|
|
@@ -15,7 +16,8 @@ exports.deviceCliBranch = (0, alwayscli_1.CliBranch)({
|
|
|
15
16
|
get_info_1.getInfoCliLeaf,
|
|
16
17
|
refresh_1.refreshCliLeaf,
|
|
17
18
|
clean_1.cleanCliLeaf,
|
|
18
|
-
restart_1.restartCliLeaf
|
|
19
|
+
restart_1.restartCliLeaf,
|
|
20
|
+
migrate_1.migrateCliLeaf
|
|
19
21
|
]
|
|
20
22
|
});
|
|
21
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/subcommands/device/index.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAChD,yCAA4C;AAC5C,mCAAuC;AACvC,iCAAqC;AACrC,uCAA2C;AAC3C,uCAA2C;AAE9B,QAAA,eAAe,GAAG,IAAA,qBAAS,EAAC;IACvC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,uBAAuB;IACpC,WAAW,EAAE;QACX,kBAAW;QACX,yBAAc;QACd,wBAAc;QACd,oBAAY;QACZ,wBAAc;KACf;CACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/subcommands/device/index.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAChD,yCAA4C;AAC5C,mCAAuC;AACvC,iCAAqC;AACrC,uCAA2C;AAC3C,uCAA2C;AAC3C,uCAA2C;AAE9B,QAAA,eAAe,GAAG,IAAA,qBAAS,EAAC;IACvC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,uBAAuB;IACpC,WAAW,EAAE;QACX,kBAAW;QACX,yBAAc;QACd,wBAAc;QACd,oBAAY;QACZ,wBAAc;QACd,wBAAc;KACf;CACF,CAAC,CAAC"}
|
|
@@ -3,17 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.initCliLeaf = void 0;
|
|
4
4
|
const alwayscli_1 = require("@alwaysai/alwayscli");
|
|
5
5
|
const app_1 = require("alwaysai/lib/core/app");
|
|
6
|
-
const uuid_1 = require("uuid");
|
|
7
6
|
const infrastructure_1 = require("alwaysai/lib/infrastructure");
|
|
8
7
|
const fs_1 = require("fs");
|
|
9
|
-
const
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
10
9
|
const directories_1 = require("../../util/directories");
|
|
10
|
+
const http_client_1 = require("../../util/http-client");
|
|
11
|
+
const device_1 = require("alwaysai/lib/core/device");
|
|
11
12
|
const util_1 = require("alwaysai/lib/util");
|
|
13
|
+
const device_certificate_1 = require("../../infrastructure/device-certificate");
|
|
12
14
|
const tokens_and_device_cfg_1 = require("../../infrastructure/tokens-and-device-cfg");
|
|
13
15
|
const logger_1 = require("../../util/logger");
|
|
14
|
-
const device_1 = require("alwaysai/lib/core/device");
|
|
15
16
|
const require_logged_in_and_paid_plan_1 = require("../../util/require-logged-in-and-paid-plan");
|
|
16
|
-
const paths_1 = require("alwaysai/lib/paths");
|
|
17
17
|
exports.initCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
18
18
|
name: 'init',
|
|
19
19
|
description: 'Initialize device',
|
|
@@ -31,7 +31,7 @@ exports.initCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
|
31
31
|
let { name } = opts;
|
|
32
32
|
name = name || (0, uuid_1.v4)();
|
|
33
33
|
if ((0, device_1.DeviceConfigFile)().exists() ||
|
|
34
|
-
(0, fs_1.existsSync)(
|
|
34
|
+
(0, fs_1.existsSync)(infrastructure_1.DEVICE_PRIVATE_KEY_FILE_PATH)) {
|
|
35
35
|
throw new Error("Device has been previously provisioned. Run 'aai-agent device clean' to re-provision");
|
|
36
36
|
}
|
|
37
37
|
logger_1.logger.info(`Initializing device ${name}`);
|
|
@@ -55,10 +55,10 @@ exports.initCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
|
55
55
|
await (0, tokens_and_device_cfg_1.writeTokenAndDeviceCfg)({
|
|
56
56
|
deviceUuid: response.deviceUuid
|
|
57
57
|
});
|
|
58
|
-
await (0, util_1.JsSpawner)().mkdirp((0,
|
|
59
|
-
await (0, util_1.JsSpawner)({ path:
|
|
58
|
+
await (0, util_1.JsSpawner)().mkdirp((0, device_certificate_1.getBootstrapCertificateDirectoryPath)());
|
|
59
|
+
await (0, util_1.JsSpawner)({ path: infrastructure_1.LOCAL_CERT_AND_KEY_DIR }).writeFile(directories_1.AWS_ROOT_CERTIFICATE_FILE_NAME, ROOT_CERT_AWS);
|
|
60
60
|
const certSpawner = (0, util_1.JsSpawner)({
|
|
61
|
-
path: (0,
|
|
61
|
+
path: (0, device_certificate_1.getBootstrapCertificateDirectoryPath)()
|
|
62
62
|
});
|
|
63
63
|
const writeCertFilePromises = [];
|
|
64
64
|
for (const key in response.claimCertificate) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/subcommands/device/init.ts"],"names":[],"mappings":";;;AAAA,mDAA8D;AAC9D,+CAA8D;AAC9D,+BAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/subcommands/device/init.ts"],"names":[],"mappings":";;;AAAA,mDAA8D;AAC9D,+CAA8D;AAC9D,gEAIqC;AACrC,2BAAgC;AAChC,+BAAoC;AACpC,wDAAwE;AACxE,wDAA4E;AAE5E,qDAA4D;AAC5D,4CAA8C;AAC9C,gFAA+F;AAC/F,sFAAoF;AACpF,8CAA2C;AAC3C,gGAAwF;AAE3E,QAAA,WAAW,GAAG,IAAA,mBAAO,EAAC;IACjC,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE;QACX,IAAI,EAAE,IAAA,0BAAc,EAAC;YACnB,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,WAAW,EAAE,IAAA,0BAAc,EAAC;YAC1B,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACD,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI;QAClB,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QACpB,IAAI,GAAG,IAAI,IAAI,IAAA,SAAM,GAAE,CAAC;QAExB,IACE,IAAA,yBAAgB,GAAE,CAAC,MAAM,EAAE;YAC3B,IAAA,eAAU,EAAC,6CAA4B,CAAC,EACxC;YACA,MAAM,IAAI,KAAK,CACb,sFAAsF,CACvF,CAAC;SACH;QACD,eAAM,CAAC,IAAI,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;QAC3C,MAAM,IAAA,4DAA0B,GAAE,CAAC;QACnC,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAA,wCAAuB,GAAE,CAAC,OAAO,EAAE,CAAC;QAC/D,MAAM,UAAU,GAAG,MAAM,IAAA,2BAAqB,EAAC,IAAA,gBAAS,GAAE,CAAC,CAAC;QAC5D,MAAM,MAAM,GAAG;YACb,UAAU,EAAE,YAAY;YACxB,UAAU;YACV,IAAI,EAAE,IAAA,SAAM,GAAE;YACd,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,IAAI;SACnB,CAAC;QAEF,2CAA2C;QAC3C,MAAM,QAAQ,GACZ,MAAM,IAAA,oCAAsB,EAC1B,iBAAiB,EACjB,WAAW,EACX,MAAM,EACN,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CACvB,CAAC;QACJ,eAAM,CAAC,KAAK,CAAC,uBAAuB,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAEzE,IAAI,CAAC,CAAC,kBAAkB,IAAI,QAAQ,CAAC,EAAE;YACrC,MAAM,IAAI,KAAK,CACb,uEAAuE,CACxE,CAAC;SACH;QACD,MAAM,aAAa,GAAG,MAAM,IAAA,wBAAU,EACpC,0DAA0D,EAC1D,KAAK,EACL,EAAE,CACH,CAAC;QAEF,MAAM,IAAA,8CAAsB,EAAC;YAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;SAChC,CAAC,CAAC;QAEH,MAAM,IAAA,gBAAS,GAAE,CAAC,MAAM,CAAC,IAAA,yDAAoC,GAAE,CAAC,CAAC;QAEjE,MAAM,IAAA,gBAAS,EAAC,EAAE,IAAI,EAAE,uCAAsB,EAAE,CAAC,CAAC,SAAS,CACzD,4CAA8B,EAC9B,aAAa,CACd,CAAC;QACF,MAAM,WAAW,GAAG,IAAA,gBAAS,EAAC;YAC5B,IAAI,EAAE,IAAA,yDAAoC,GAAE;SAC7C,CAAC,CAAC;QACH,MAAM,qBAAqB,GAAoB,EAAE,CAAC;QAClD,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,gBAAgB,EAAE;YAC3C,qBAAqB,CAAC,IAAI,CACxB,WAAW,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAC3D,CAAC;SACH;QACD,MAAM,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;QAEzC,eAAM,CAAC,IAAI,CAAC,sBAAsB,IAAI,UAAU,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IACzE,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../src/subcommands/device/migrate.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,yKAczB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.migrateCliLeaf = void 0;
|
|
4
|
+
const alwayscli_1 = require("@alwaysai/alwayscli");
|
|
5
|
+
const logger_1 = require("../../util/logger");
|
|
6
|
+
const required_config_checks_1 = require("../../infrastructure/required-config-checks");
|
|
7
|
+
const legacy_migration_1 = require("../../infrastructure/legacy-migration/legacy-migration");
|
|
8
|
+
exports.migrateCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
9
|
+
name: 'migrate',
|
|
10
|
+
description: 'Migrate configuration to the latest',
|
|
11
|
+
namedInputs: {},
|
|
12
|
+
async action(_, opts) {
|
|
13
|
+
const filesAlreadyMigrated = await (0, required_config_checks_1.requiredConfigFilesPresentAndValid)();
|
|
14
|
+
if (filesAlreadyMigrated) {
|
|
15
|
+
logger_1.logger.info('Configuration already migrated');
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
logger_1.logger.info('Attempting configuration file migration');
|
|
19
|
+
await (0, legacy_migration_1.migrateFromLegacyCertsAndTokens)();
|
|
20
|
+
logger_1.logger.info('Migration complete');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../src/subcommands/device/migrate.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAC9C,8CAA2C;AAC3C,wFAAiG;AACjG,6FAAyG;AAE5F,QAAA,cAAc,GAAG,IAAA,mBAAO,EAAC;IACpC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,qCAAqC;IAClD,WAAW,EAAE,EAAE;IACf,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI;QAClB,MAAM,oBAAoB,GAAG,MAAM,IAAA,2DAAkC,GAAE,CAAC;QACxE,IAAI,oBAAoB,EAAE;YACxB,eAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;SAC/C;aAAM;YACL,eAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;YACvD,MAAM,IAAA,kDAA+B,GAAE,CAAC;YACxC,eAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;SACnC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../../src/subcommands/device/refresh.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../../src/subcommands/device/refresh.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,yKAgBzB,CAAC"}
|
|
@@ -5,6 +5,7 @@ const alwayscli_1 = require("@alwaysai/alwayscli");
|
|
|
5
5
|
const tokens_and_device_cfg_1 = require("../../infrastructure/tokens-and-device-cfg");
|
|
6
6
|
const logger_1 = require("../../util/logger");
|
|
7
7
|
const device_1 = require("alwaysai/lib/core/device");
|
|
8
|
+
// FIXME: Do we need this command now that tokens aren't used outside of provisioning step?
|
|
8
9
|
exports.refreshCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
9
10
|
name: 'refresh',
|
|
10
11
|
description: 'Refresh the device tokens',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../../src/subcommands/device/refresh.ts"],"names":[],"mappings":";;;AAAA,mDAA6D;AAC7D,sFAAoF;AACpF,8CAA2C;AAC3C,qDAA4D;
|
|
1
|
+
{"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../../src/subcommands/device/refresh.ts"],"names":[],"mappings":";;;AAAA,mDAA6D;AAC7D,sFAAoF;AACpF,8CAA2C;AAC3C,qDAA4D;AAE5D,2FAA2F;AAC9E,QAAA,cAAc,GAAG,IAAA,mBAAO,EAAC;IACpC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,2BAA2B;IACxC,WAAW,EAAE,EAAE;IACf,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI;QAClB,eAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QACxC,MAAM,GAAG,GAAG,IAAA,yBAAgB,GAAE,CAAC,YAAY,EAAE,CAAC;QAC9C,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,MAAM,IAAI,yBAAa,CAAC,4CAA4C,CAAC,CAAC;SACvE;QACD,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;QAElC,MAAM,IAAA,8CAAsB,EAAC;YAC3B,UAAU;SACX,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const subcommands: (import("@alwaysai/alwayscli/lib/types").CliBranch | import("@alwaysai/alwayscli/lib/types").CliLeaf<import("@alwaysai/alwayscli").CliInput<undefined, false>,
|
|
1
|
+
export declare const subcommands: (import("@alwaysai/alwayscli/lib/types").CliBranch | import("@alwaysai/alwayscli/lib/types").CliLeaf<import("@alwaysai/alwayscli").CliInput<undefined, false>, import("@alwaysai/alwayscli/lib/types").AnyNamedInputs, import("@alwaysai/alwayscli").CliInput<undefined, false>> | import("@alwaysai/alwayscli/lib/types").CliLeaf<import("@alwaysai/alwayscli").CliInput<string, true>, {
|
|
2
2
|
version: import("@alwaysai/alwayscli").CliInput<number | undefined, boolean>;
|
|
3
3
|
path: import("@alwaysai/alwayscli").CliInput<string | undefined, false>;
|
|
4
4
|
}, import("@alwaysai/alwayscli").CliInput<undefined, false>>)[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/subcommands/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/subcommands/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW;;;+DAOvB,CAAC"}
|
package/lib/subcommands/index.js
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.subcommands = void 0;
|
|
4
4
|
const app_1 = require("./app");
|
|
5
|
+
const config_1 = require("./config");
|
|
5
6
|
const device_1 = require("./device");
|
|
6
|
-
const login_1 = require("./login");
|
|
7
7
|
const get_model_package_1 = require("./get-model-package");
|
|
8
|
+
const login_1 = require("./login");
|
|
8
9
|
const rabbitmq_connection_1 = require("./rabbitmq-connection");
|
|
9
10
|
exports.subcommands = [
|
|
10
11
|
login_1.loginCliLeaf,
|
|
12
|
+
config_1.configBranch,
|
|
11
13
|
app_1.appCliBranch,
|
|
12
14
|
device_1.deviceCliBranch,
|
|
13
15
|
get_model_package_1.getModelPackageCliLeaf,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/subcommands/index.ts"],"names":[],"mappings":";;;AAAA,+BAAqC;AACrC,qCAA2C;AAC3C,mCAAuC;AACvC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/subcommands/index.ts"],"names":[],"mappings":";;;AAAA,+BAAqC;AACrC,qCAAwC;AACxC,qCAA2C;AAC3C,2DAA6D;AAC7D,mCAAuC;AACvC,+DAAqE;AAExD,QAAA,WAAW,GAAG;IACzB,oBAAY;IACZ,qBAAY;IACZ,kBAAY;IACZ,wBAAe;IACf,0CAAsB;IACtB,kDAA4B;CAC7B,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const stopRabbitMQContainerCliLeaf: import("@alwaysai/alwayscli/lib/types").CliLeaf<import("@alwaysai/alwayscli").CliInput<undefined, false>,
|
|
1
|
+
export declare const stopRabbitMQContainerCliLeaf: import("@alwaysai/alwayscli/lib/types").CliLeaf<import("@alwaysai/alwayscli").CliInput<undefined, false>, import("@alwaysai/alwayscli/lib/types").AnyNamedInputs, import("@alwaysai/alwayscli").CliInput<undefined, false>>;
|
|
2
2
|
//# sourceMappingURL=rabbitmq-connection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rabbitmq-connection.d.ts","sourceRoot":"","sources":["../../src/subcommands/rabbitmq-connection.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B,
|
|
1
|
+
{"version":3,"file":"rabbitmq-connection.d.ts","sourceRoot":"","sources":["../../src/subcommands/rabbitmq-connection.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B,6NAOvC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ErrorObject } from 'ajv';
|
|
2
|
+
declare type ErrorOption = ErrorObject<string, Record<string, any>, unknown>;
|
|
3
|
+
declare type Details = ErrorOption | ErrorOption[] | Error | null;
|
|
4
|
+
interface Options {
|
|
5
|
+
cause?: Details;
|
|
6
|
+
}
|
|
7
|
+
declare class AaiError extends Error {
|
|
8
|
+
detailed?: Details;
|
|
9
|
+
constructor(message: string, options?: Options);
|
|
10
|
+
}
|
|
11
|
+
export default AaiError;
|
|
12
|
+
//# sourceMappingURL=aai-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aai-error.d.ts","sourceRoot":"","sources":["../../src/util/aai-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAElC,aAAK,WAAW,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AAErE,aAAK,OAAO,GAAG,WAAW,GAAG,WAAW,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC;AAE1D,UAAU,OAAO;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,cAAM,QAAS,SAAQ,KAAK;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;gBACd,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;CAK/C;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class AaiError extends Error {
|
|
4
|
+
constructor(message, options) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = 'AaiError';
|
|
7
|
+
this.detailed = options === null || options === void 0 ? void 0 : options.cause;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.default = AaiError;
|
|
11
|
+
//# sourceMappingURL=aai-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aai-error.js","sourceRoot":"","sources":["../../src/util/aai-error.ts"],"names":[],"mappings":";;AAUA,MAAM,QAAS,SAAQ,KAAK;IAE1B,YAAY,OAAe,EAAE,OAAiB;QAC5C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC;IACjC,CAAC;CACF;AAED,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws-regions.d.ts","sourceRoot":"","sources":["../../src/util/aws-regions.ts"],"names":[],"mappings":"AAgCA,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAExD"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const directories_1 = require("../util/directories");
|
|
3
|
+
exports.isValidAwsRegion = void 0;
|
|
6
4
|
const VALID_AWS_REGIONS = [
|
|
7
5
|
// 'af-south-1', // Africa (Cape Town)
|
|
8
6
|
// 'ap-east-1', // Asia Pacific (Hong Kong)
|
|
@@ -38,20 +36,4 @@ function isValidAwsRegion(region) {
|
|
|
38
36
|
return VALID_AWS_REGIONS.includes(region);
|
|
39
37
|
}
|
|
40
38
|
exports.isValidAwsRegion = isValidAwsRegion;
|
|
41
|
-
|
|
42
|
-
let ready = true;
|
|
43
|
-
const requiredFiles = [
|
|
44
|
-
directories_1.DEVICE_CERTIFICATE_FILE_PATH,
|
|
45
|
-
directories_1.DEVICE_PRIVATE_KEY_FILE_PATH,
|
|
46
|
-
directories_1.AWS_ROOT_CERTIFICATE_FILE_PATH
|
|
47
|
-
];
|
|
48
|
-
for (const path of requiredFiles) {
|
|
49
|
-
if (!(0, fs_1.existsSync)(path)) {
|
|
50
|
-
ready = false;
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return ready;
|
|
55
|
-
}
|
|
56
|
-
exports.cloudModeReady = cloudModeReady;
|
|
57
|
-
//# sourceMappingURL=cloud-mode-ready.js.map
|
|
39
|
+
//# sourceMappingURL=aws-regions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws-regions.js","sourceRoot":"","sources":["../../src/util/aws-regions.ts"],"names":[],"mappings":";;;AAAA,MAAM,iBAAiB,GAAG;IACxB,sCAAsC;IACtC,2CAA2C;IAC3C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,yCAAyC;IACzC,gDAAgD;IAChD,6CAA6C;IAC7C,8CAA8C;IAC9C,gDAAgD;IAChD,sCAAsC;IACtC,wCAAwC;IACxC,kCAAkC;IAClC,iCAAiC;IACjC,wCAAwC;IACxC,qCAAqC;IACrC,sCAAsC;IACtC,kCAAkC;IAClC,kCAAkC;IAClC,mCAAmC;IACnC,uCAAuC;IACvC,yCAAyC;IACzC,uCAAuC;IACvC,2CAA2C;IAC3C,iCAAiC;IACjC,qCAAqC;IACrC,0CAA0C;IAC1C,WAAW,CAAC,mBAAmB;CAChC,CAAC;AAEF,SAAgB,gBAAgB,CAAC,MAAc;IAC7C,OAAO,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC;AAFD,4CAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-for-updates.d.ts","sourceRoot":"","sources":["../../src/util/check-for-updates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"check-for-updates.d.ts","sourceRoot":"","sources":["../../src/util/check-for-updates.ts"],"names":[],"mappings":"AAYA,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC,CAc7D;AAQD,wBAAsB,wBAAwB,kBAkB7C"}
|
|
@@ -4,31 +4,8 @@ exports.checkForUpdatesAndPrompt = exports.getDeviceAgentVersion = void 0;
|
|
|
4
4
|
const logger_1 = require("../util/logger");
|
|
5
5
|
const util_1 = require("alwaysai/lib/util");
|
|
6
6
|
const path = require("path");
|
|
7
|
-
const https_1 = require("https");
|
|
8
7
|
const appPrompt = 'Please restart the Device Agent or reboot the device to update. ';
|
|
9
8
|
const updatePrompt = `A new version of the Device Agent is available! \n\n`;
|
|
10
|
-
function getLatestVersion(packageName) {
|
|
11
|
-
return new Promise((resolve, reject) => {
|
|
12
|
-
const url = `https://registry.npmjs.org/${packageName}/latest`;
|
|
13
|
-
(0, https_1.get)(url, (res) => {
|
|
14
|
-
let data = '';
|
|
15
|
-
res.on('data', (chunk) => {
|
|
16
|
-
data += chunk;
|
|
17
|
-
});
|
|
18
|
-
res.on('end', () => {
|
|
19
|
-
try {
|
|
20
|
-
const latestPackage = JSON.parse(data);
|
|
21
|
-
resolve(latestPackage.version);
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
reject(error);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}).on('error', (error) => {
|
|
28
|
-
reject(error);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
9
|
async function getDeviceAgentVersion() {
|
|
33
10
|
let daVersion = '';
|
|
34
11
|
try {
|
|
@@ -39,7 +16,7 @@ async function getDeviceAgentVersion() {
|
|
|
39
16
|
daVersion = parsed.version;
|
|
40
17
|
}
|
|
41
18
|
catch (e) {
|
|
42
|
-
logger_1.logger.error(`Could not retrieve the Device Agent version
|
|
19
|
+
logger_1.logger.error(`Could not retrieve the Device Agent version!\n${(0, util_1.stringifyError)(e)}`);
|
|
43
20
|
}
|
|
44
21
|
return daVersion;
|
|
45
22
|
}
|
|
@@ -51,8 +28,8 @@ function constructPrompt(props) {
|
|
|
51
28
|
}
|
|
52
29
|
async function checkForUpdatesAndPrompt() {
|
|
53
30
|
try {
|
|
54
|
-
logger_1.logger.debug('Checking for updates...');
|
|
55
|
-
const latestVersion = await
|
|
31
|
+
logger_1.logger.debug('Checking for available Device Agent updates...');
|
|
32
|
+
const latestVersion = await (0, util_1.getLatestVersionFromNpm)('@alwaysai/device-agent');
|
|
56
33
|
const version = await getDeviceAgentVersion();
|
|
57
34
|
if (version !== latestVersion) {
|
|
58
35
|
logger_1.logger.warn(constructPrompt({
|
|
@@ -61,8 +38,8 @@ async function checkForUpdatesAndPrompt() {
|
|
|
61
38
|
}));
|
|
62
39
|
}
|
|
63
40
|
}
|
|
64
|
-
catch (
|
|
65
|
-
logger_1.logger.error(`Could not check for updates
|
|
41
|
+
catch (e) {
|
|
42
|
+
logger_1.logger.error(`Could not check for updates!\n${(0, util_1.stringifyError)(e)}`);
|
|
66
43
|
}
|
|
67
44
|
}
|
|
68
45
|
exports.checkForUpdatesAndPrompt = checkForUpdatesAndPrompt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-for-updates.js","sourceRoot":"","sources":["../../src/util/check-for-updates.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"check-for-updates.js","sourceRoot":"","sources":["../../src/util/check-for-updates.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,4CAI2B;AAC3B,6BAA6B;AAE7B,MAAM,SAAS,GACb,kEAAkE,CAAC;AACrE,MAAM,YAAY,GAAG,sDAAsD,CAAC;AAErE,KAAK,UAAU,qBAAqB;IACzC,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,IAAI;QACF,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACnD,MAAM,OAAO,GAAG,IAAA,gBAAS,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;QACjD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAClC,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC;KAC5B;IAAC,OAAO,CAAC,EAAE;QACV,eAAM,CAAC,KAAK,CACV,iDAAiD,IAAA,qBAAc,EAAC,CAAC,CAAC,EAAE,CACrE,CAAC;KACH;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAdD,sDAcC;AAED,SAAS,eAAe,CAAC,KAAgD;IACvE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACxC,MAAM,MAAM,GAAG,GAAG,YAAY,GAAG,SAAS,mBAAmB,UAAU,qBAAqB,SAAS,EAAE,CAAC;IACxG,OAAO,MAAM,CAAC;AAChB,CAAC;AAEM,KAAK,UAAU,wBAAwB;IAC5C,IAAI;QACF,eAAM,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAC/D,MAAM,aAAa,GAAG,MAAM,IAAA,8BAAuB,EACjD,wBAAwB,CACzB,CAAC;QACF,MAAM,OAAO,GAAG,MAAM,qBAAqB,EAAE,CAAC;QAC9C,IAAI,OAAO,KAAK,aAAa,EAAE;YAC7B,eAAM,CAAC,IAAI,CACT,eAAe,CAAC;gBACd,UAAU,EAAE,OAAO;gBACnB,SAAS,EAAE,aAAa;aACzB,CAAC,CACH,CAAC;SACH;KACF;IAAC,OAAO,CAAC,EAAE;QACV,eAAM,CAAC,KAAK,CAAC,iCAAiC,IAAA,qBAAc,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC;KACpE;AACH,CAAC;AAlBD,4DAkBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean-certs.d.ts","sourceRoot":"","sources":["../../src/util/clean-certs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clean-certs.d.ts","sourceRoot":"","sources":["../../src/util/clean-certs.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,wBAAwB,sBAOpC,CAAC"}
|
package/lib/util/clean-certs.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rmBootstrapCertsAndClose = void 0;
|
|
4
|
+
const infrastructure_1 = require("alwaysai/lib/infrastructure");
|
|
4
5
|
const util_1 = require("alwaysai/lib/util");
|
|
6
|
+
const device_certificate_1 = require("../infrastructure/device-certificate");
|
|
5
7
|
const logger_1 = require("../util/logger");
|
|
6
|
-
const paths_1 = require("alwaysai/lib/paths");
|
|
7
|
-
const directories_1 = require("../util/directories");
|
|
8
8
|
const rmBootstrapCertsAndClose = async () => {
|
|
9
|
+
const deviceCertificates = new infrastructure_1.LocalDeviceCertificates();
|
|
9
10
|
const spawner = (0, util_1.JsSpawner)();
|
|
10
|
-
await spawner.rimraf((0,
|
|
11
|
-
await spawner.rimraf(
|
|
11
|
+
await spawner.rimraf((0, device_certificate_1.getBootstrapCertificateDirectoryPath)());
|
|
12
|
+
await spawner.rimraf(deviceCertificates.getCertificateDirectoryPath());
|
|
12
13
|
logger_1.logger.error('Could not provision device. Try again.');
|
|
13
14
|
process.exit(1);
|
|
14
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean-certs.js","sourceRoot":"","sources":["../../src/util/clean-certs.ts"],"names":[],"mappings":";;;AAAA,4CAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"clean-certs.js","sourceRoot":"","sources":["../../src/util/clean-certs.ts"],"names":[],"mappings":";;;AAAA,gEAGqC;AACrC,4CAA8C;AAC9C,6EAA4F;AAC5F,2CAAwC;AAEjC,MAAM,wBAAwB,GAAG,KAAK,IAAI,EAAE;IACjD,MAAM,kBAAkB,GAAG,IAAI,wCAAuB,EAAE,CAAC;IACzD,MAAM,OAAO,GAAG,IAAA,gBAAS,GAAE,CAAC;IAC5B,MAAM,OAAO,CAAC,MAAM,CAAC,IAAA,yDAAoC,GAAE,CAAC,CAAC;IAC7D,MAAM,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,2BAA2B,EAAE,CAAC,CAAC;IACvE,eAAM,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC;AAPW,QAAA,wBAAwB,4BAOnC"}
|
|
@@ -1,25 +1,11 @@
|
|
|
1
1
|
export declare const APP_ROOT: string;
|
|
2
2
|
export declare const DEVICE_AGENT_CFG_DIR = "device-agent";
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
3
|
+
export declare function getDeviceAgentConfigPath(baseDir?: any): string;
|
|
4
|
+
export declare function getDeviceAgentDockerComposePath(baseDir?: any): string;
|
|
5
5
|
export declare const CREDENTIALS_FILE_PATH: string;
|
|
6
|
-
export declare const AWS_ROOT_CERTIFICATE_FILE_NAME = "AmazonRootCA1.pem";
|
|
7
6
|
export declare const AWS_ROOT_CERTIFICATE_FILE_PATH: string;
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const BOOTSTRAP_PRIVATE_KEY_FILE_NAME: () => string;
|
|
11
|
-
export declare const BOOTSTRAP_CERTIFICATE_FILE_NAME: () => string;
|
|
12
|
-
export declare const BOOTSTRAP_ID_FILE_NAME: () => string;
|
|
13
|
-
export declare const CERTIFICATE_OWNERSHIP_TOKEN_FILE_NAME = "certificate-ownership-token.txt";
|
|
14
|
-
export declare const BOOTSTRAP_CERTIFICATES_DIR_PATH: () => string;
|
|
15
|
-
export declare const BOOTSTRAP_PRIVATE_KEY_FILE_PATH: () => string;
|
|
16
|
-
export declare const BOOTSTRAP_CERTIFICATE_FILE_PATH: () => string;
|
|
17
|
-
export declare const BOOTSTRAP_ID_FILE_PATH: () => string;
|
|
18
|
-
export declare const DEVICE_PRIVATE_KEY_FILE_NAME = "aai-device-private-key.pem.key";
|
|
19
|
-
export declare const DEVICE_CERTIFICATE_FILE_NAME = "aai-device-cert.pem.crt";
|
|
20
|
-
export declare const DEVICE_ID_FILE_NAME = "aai-device-cert-id.txt";
|
|
21
|
-
export declare const DEVICE_PRIVATE_KEY_FILE_PATH: string;
|
|
22
|
-
export declare const DEVICE_CERTIFICATE_FILE_PATH: string;
|
|
7
|
+
export declare const AWS_ROOT_CERTIFICATE_FILE_NAME: string;
|
|
8
|
+
export declare const shortenSystemId: () => "qa" | "dev" | "prod";
|
|
23
9
|
export declare const SECURE_TUNNEL_BIN_NAME = "localproxy";
|
|
24
10
|
export declare const SECURE_TUNNEL_BIN_DIR = "secure-tunnel";
|
|
25
11
|
export declare const SECURE_TUNNEL_BIN_PATH: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directories.d.ts","sourceRoot":"","sources":["../../src/util/directories.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"directories.d.ts","sourceRoot":"","sources":["../../src/util/directories.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,QAAQ,QAAgC,CAAC;AAEtD,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AAEnD,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,KAAA,UAKhD;AAED,wBAAgB,+BAA+B,CAAC,OAAO,CAAC,KAAA,UAEvD;AAED,eAAO,MAAM,qBAAqB,QAGjC,CAAC;AAGF,eAAO,MAAM,8BAA8B,QACW,CAAC;AACvD,eAAO,MAAM,8BAA8B,QACW,CAAC;AAEvD,eAAO,MAAM,eAAe,6BAY3B,CAAC;AAKF,eAAO,MAAM,sBAAsB,eAAe,CAAC;AACnD,eAAO,MAAM,qBAAqB,kBAAkB,CAAC;AACrD,eAAO,MAAM,sBAAsB,QAIlC,CAAC"}
|