@alwaysai/device-agent 1.5.0 → 2.0.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/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 +1 -5
- package/lib/application-control/environment-variables.d.ts.map +1 -1
- package/lib/application-control/environment-variables.js +9 -26
- 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.map +1 -1
- package/lib/application-control/install.js +8 -7
- 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 +1 -24
- package/lib/application-control/utils.js.map +1 -1
- package/lib/cloud-connection/bootstrap-provision.js +3 -2
- package/lib/cloud-connection/bootstrap-provision.js.map +1 -1
- package/lib/cloud-connection/device-agent-cloud-connection.d.ts +10 -15
- package/lib/cloud-connection/device-agent-cloud-connection.d.ts.map +1 -1
- package/lib/cloud-connection/device-agent-cloud-connection.js +279 -250
- package/lib/cloud-connection/device-agent-cloud-connection.js.map +1 -1
- 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 +18 -28
- package/lib/cloud-connection/live-updates-handler.d.ts.map +1 -1
- package/lib/cloud-connection/live-updates-handler.js +54 -169
- 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/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 +5 -3
- package/lib/cloud-connection/shadow-handler.d.ts.map +1 -1
- package/lib/cloud-connection/shadow-handler.js +59 -27
- 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 +4 -2
- package/lib/cloud-connection/transaction-manager.d.ts.map +1 -1
- package/lib/cloud-connection/transaction-manager.js +18 -29
- package/lib/cloud-connection/transaction-manager.js.map +1 -1
- package/lib/cloud-connection/transaction-manager.test.js +3 -3
- 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/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-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.map +1 -1
- package/lib/subcommands/app/version.js +2 -4
- 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 +13 -40
- package/src/application-control/index.ts +3 -16
- package/src/application-control/install.ts +15 -10
- package/src/application-control/models.ts +6 -87
- package/src/application-control/utils.ts +0 -28
- package/src/cloud-connection/bootstrap-provision.ts +7 -7
- package/src/cloud-connection/device-agent-cloud-connection.ts +639 -525
- 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 +99 -234
- 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 +103 -57
- package/src/cloud-connection/shadow.ts +4 -1
- package/src/cloud-connection/transaction-manager.test.ts +3 -3
- package/src/cloud-connection/transaction-manager.ts +53 -39
- 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/local-connection/rabbitmq-connection.ts +22 -17
- 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 +3 -4
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../src/subcommands/app/analytics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../src/subcommands/app/analytics.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,sBAAsB;;4DAkBjC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;4DAgEjC,CAAC"}
|
|
@@ -48,7 +48,6 @@ exports.setAnalyticsCfgCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
|
48
48
|
},
|
|
49
49
|
async action(_, { project, 'enable-cloud-publish': enableCLoudPublish, 'enable-file-publish': enableFilePublish, 'file-size-bytes': fileSizeBytes }) {
|
|
50
50
|
const deviceAgent = new device_agent_cloud_connection_1.DeviceAgentCloudConnection();
|
|
51
|
-
await deviceAgent.setupHandlers();
|
|
52
51
|
const newAppCfg = {
|
|
53
52
|
analytics: {
|
|
54
53
|
enable_cloud_publish: enableCLoudPublish,
|
|
@@ -64,7 +63,7 @@ exports.setAnalyticsCfgCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
|
64
63
|
appConfig: JSON.stringify(appCfg) // Pack app config as string as dictated by schema
|
|
65
64
|
}
|
|
66
65
|
};
|
|
67
|
-
deviceAgent.publisher.publish((0, device_agent_schemas_1.getShadowTopic)(deviceAgent.getClientId(), 'projects', 'update'), JSON.stringify((0, device_agent_schemas_1.
|
|
66
|
+
deviceAgent.publisher.publish((0, device_agent_schemas_1.getShadowTopic)(deviceAgent.getClientId(), 'projects', 'update'), JSON.stringify((0, device_agent_schemas_1.buildUpdateShadowMessage)({
|
|
68
67
|
clientId: 'client',
|
|
69
68
|
desired: toDesire
|
|
70
69
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../src/subcommands/app/analytics.ts"],"names":[],"mappings":";;;AAAA,mDAK6B;AAC7B,mEAA2D;AAC3D,wGAAkG;AAClG,4CAAqC;
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../src/subcommands/app/analytics.ts"],"names":[],"mappings":";;;AAAA,mDAK6B;AAC7B,mEAA2D;AAC3D,wGAAkG;AAClG,4CAAqC;AACrC,mCAAuC;AACvC,yEAGwC;AAE3B,QAAA,sBAAsB,GAAG,IAAA,mBAAO,EAAC;IAC5C,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,gDAAgD;IAC7D,WAAW,EAAE;QACX,OAAO,EAAE,IAAA,0BAAc,EAAC;YACtB,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI;QAClB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QACzB,MAAM,MAAM,GAAG,MAAM,IAAA,oCAAc,EAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;QAC5D,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,EAAE;YAClC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;SACxD;aAAM;YACL,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;SACpD;IACH,CAAC;CACF,CAAC,CAAC;AAEU,QAAA,sBAAsB,GAAG,IAAA,mBAAO,EAAC;IAC5C,IAAI,EAAE,mBAAmB;IACzB,WAAW,EACT,qHAAqH;IACvH,WAAW,EAAE;QACX,OAAO,EAAE,IAAA,0BAAc,EAAC;YACtB,WAAW,EAAE,YAAY;YACzB,QAAQ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;QAC1D,MAAM,IAAA,eAAK,EAAC,KAAK,CAAC,CAAC;QAEnB,OAAO,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE;YAC3C,MAAM,IAAA,eAAK,EAAC,IAAI,CAAC,CAAC;SACnB;QACD,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -5,4 +5,8 @@ export declare const setEnvCliLeaf: import("@alwaysai/alwayscli/lib/types").CliL
|
|
|
5
5
|
project: import("@alwaysai/alwayscli").CliInput<string, true>;
|
|
6
6
|
service: import("@alwaysai/alwayscli").CliInput<string, true>;
|
|
7
7
|
}, import("@alwaysai/alwayscli").CliInput<undefined, false>>;
|
|
8
|
+
export declare const rmEnvCliLeaf: import("@alwaysai/alwayscli/lib/types").CliLeaf<import("@alwaysai/alwayscli").CliInput<string, true>, {
|
|
9
|
+
project: import("@alwaysai/alwayscli").CliInput<string, true>;
|
|
10
|
+
service: import("@alwaysai/alwayscli").CliInput<string, true>;
|
|
11
|
+
}, import("@alwaysai/alwayscli").CliInput<undefined, false>>;
|
|
8
12
|
//# sourceMappingURL=env-vars.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-vars.d.ts","sourceRoot":"","sources":["../../../src/subcommands/app/env-vars.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,iBAAiB;;4DAc5B,CAAC;AAEH,eAAO,MAAM,aAAa;;;
|
|
1
|
+
{"version":3,"file":"env-vars.d.ts","sourceRoot":"","sources":["../../../src/subcommands/app/env-vars.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,iBAAiB;;4DAc5B,CAAC;AAEH,eAAO,MAAM,aAAa;;;4DAsDxB,CAAC;AAEH,eAAO,MAAM,YAAY;;;4DA4DvB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setEnvCliLeaf = exports.getAllEnvsCliLeaf = void 0;
|
|
3
|
+
exports.rmEnvCliLeaf = exports.setEnvCliLeaf = exports.getAllEnvsCliLeaf = void 0;
|
|
4
4
|
const alwayscli_1 = require("@alwaysai/alwayscli");
|
|
5
5
|
const application_control_1 = require("../../application-control");
|
|
6
6
|
const device_agent_cloud_connection_1 = require("../../cloud-connection/device-agent-cloud-connection");
|
|
@@ -40,23 +40,69 @@ exports.setEnvCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
|
40
40
|
},
|
|
41
41
|
async action(args, opts) {
|
|
42
42
|
const { project: projectId, service } = opts;
|
|
43
|
-
const
|
|
43
|
+
const currentEnvs = await (0, application_control_1.getAllEnvs)({ projectId });
|
|
44
|
+
const envVars = { [service]: Object.assign({}, currentEnvs[service]) };
|
|
44
45
|
args.forEach((arg) => {
|
|
45
46
|
const nameVal = arg.split('=');
|
|
46
47
|
if (nameVal.length !== 2) {
|
|
47
48
|
throw new alwayscli_1.CliTerseError(`Invalid argument: ${arg}`);
|
|
48
49
|
}
|
|
49
|
-
const value = nameVal[1]
|
|
50
|
+
const value = nameVal[1];
|
|
50
51
|
envVars[service][nameVal[0]] = value;
|
|
51
52
|
});
|
|
52
53
|
const deviceAgent = new device_agent_cloud_connection_1.DeviceAgentCloudConnection();
|
|
53
|
-
await deviceAgent.setupHandlers();
|
|
54
54
|
const toDesire = {
|
|
55
55
|
[projectId]: {
|
|
56
|
-
envVars
|
|
56
|
+
envVars: JSON.stringify(envVars)
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
deviceAgent.publisher.publish((0, device_agent_schemas_1.getShadowTopic)(deviceAgent.getClientId(), 'projects', 'update'), JSON.stringify((0, device_agent_schemas_1.
|
|
59
|
+
deviceAgent.publisher.publish((0, device_agent_schemas_1.getShadowTopic)(deviceAgent.getClientId(), 'projects', 'update'), JSON.stringify((0, device_agent_schemas_1.buildUpdateShadowMessage)({
|
|
60
|
+
clientId: 'client',
|
|
61
|
+
desired: toDesire
|
|
62
|
+
})));
|
|
63
|
+
// Sleep for extra time to ensure time for shadow response
|
|
64
|
+
await (0, sleep_1.default)(10000);
|
|
65
|
+
while (deviceAgent.isCmdInProgress(projectId)) {
|
|
66
|
+
await (0, sleep_1.default)(1000);
|
|
67
|
+
}
|
|
68
|
+
await deviceAgent.stop();
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
exports.rmEnvCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
72
|
+
name: 'rm-env',
|
|
73
|
+
description: 'Remove an environment variable from an application',
|
|
74
|
+
positionalInput: (0, alwayscli_1.CliStringInput)({
|
|
75
|
+
description: 'The key of the environment variable to be removed',
|
|
76
|
+
required: true
|
|
77
|
+
}),
|
|
78
|
+
namedInputs: {
|
|
79
|
+
project: (0, alwayscli_1.CliStringInput)({
|
|
80
|
+
description: 'Project Id',
|
|
81
|
+
required: true
|
|
82
|
+
}),
|
|
83
|
+
service: (0, alwayscli_1.CliStringInput)({
|
|
84
|
+
description: 'Docker compose service to remove an environment variable from',
|
|
85
|
+
required: true
|
|
86
|
+
})
|
|
87
|
+
},
|
|
88
|
+
async action(arg, opts) {
|
|
89
|
+
const { project: projectId, service } = opts;
|
|
90
|
+
const envVar = arg;
|
|
91
|
+
const currentEnvs = await (0, application_control_1.getAllEnvs)({ projectId: projectId });
|
|
92
|
+
const newEnvs = Object.assign({}, currentEnvs);
|
|
93
|
+
if (Object.keys(newEnvs[service]).includes(envVar)) {
|
|
94
|
+
delete newEnvs[service][envVar];
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
throw new alwayscli_1.CliTerseError(`Could not find key "${envVar}" in service ${service}. Current keys are:\n ${JSON.stringify(Object.keys(currentEnvs[service]), null, 2)}.\nPlease check the key and try again.`);
|
|
98
|
+
}
|
|
99
|
+
const deviceAgent = new device_agent_cloud_connection_1.DeviceAgentCloudConnection();
|
|
100
|
+
const toDesire = {
|
|
101
|
+
[projectId]: {
|
|
102
|
+
envVars: JSON.stringify(newEnvs)
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
deviceAgent.publisher.publish((0, device_agent_schemas_1.getShadowTopic)(deviceAgent.getClientId(), 'projects', 'update'), JSON.stringify((0, device_agent_schemas_1.buildUpdateShadowMessage)({
|
|
60
106
|
clientId: 'client',
|
|
61
107
|
desired: toDesire
|
|
62
108
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-vars.js","sourceRoot":"","sources":["../../../src/subcommands/app/env-vars.ts"],"names":[],"mappings":";;;AAAA,mDAK6B;AAC7B,
|
|
1
|
+
{"version":3,"file":"env-vars.js","sourceRoot":"","sources":["../../../src/subcommands/app/env-vars.ts"],"names":[],"mappings":";;;AAAA,mDAK6B;AAC7B,mEAAuD;AACvD,wGAAkG;AAClG,4CAAqC;AACrC,yEAIwC;AAE3B,QAAA,iBAAiB,GAAG,IAAA,mBAAO,EAAC;IACvC,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,8CAA8C;IAC3D,WAAW,EAAE;QACX,OAAO,EAAE,IAAA,0BAAc,EAAC;YACtB,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI;QAClB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QACzB,MAAM,OAAO,GAAG,MAAM,IAAA,gCAAU,EAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC;CACF,CAAC,CAAC;AAEU,QAAA,aAAa,GAAG,IAAA,mBAAO,EAAC;IACnC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,yCAAyC;IACtD,eAAe,EAAE,IAAA,+BAAmB,EAAC;QACnC,WAAW,EAAE,iCAAiC;QAC9C,QAAQ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,CAAC,CAAC;SACjC;aAAM;YACL,MAAM,IAAI,yBAAa,CACrB,uBAAuB,MAAM,gBAAgB,OAAO,yBAAyB,IAAI,CAAC,SAAS,CACzF,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,EACjC,IAAI,EACJ,CAAC,CACF,wCAAwC,CAC1C,CAAC;SACH;QAED,MAAM,WAAW,GAAG,IAAI,0DAA0B,EAAE,CAAC;QAErD,MAAM,QAAQ,GAAG;YACf,CAAC,SAAS,CAAC,EAAE;gBACX,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;aACjC;SACF,CAAC;QACF,WAAW,CAAC,SAAS,CAAC,OAAO,CAC3B,IAAA,qCAAc,EAAC,WAAW,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,QAAQ,CAAC,EAC/D,IAAI,CAAC,SAAS,CACZ,IAAA,+CAAwB,EAAC;YACvB,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,QAAQ;SAClB,CAAC,CACH,CACF,CAAC;QACF,0DAA0D;QAC1D,MAAM,IAAA,eAAK,EAAC,KAAK,CAAC,CAAC;QAEnB,OAAO,WAAW,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE;YAC7C,MAAM,IAAA,eAAK,EAAC,IAAI,CAAC,CAAC;SACnB;QACD,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/subcommands/app/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/subcommands/app/index.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,YAAY,mDAuBvB,CAAC"}
|
|
@@ -23,11 +23,9 @@ exports.appCliBranch = (0, alwayscli_1.CliBranch)({
|
|
|
23
23
|
version_1.rollbackAppCliLeaf,
|
|
24
24
|
models_1.showAppModelsCliLeaf,
|
|
25
25
|
models_1.addModelCliLeaf,
|
|
26
|
-
models_1.removeModelCliLeaf,
|
|
27
|
-
models_1.replaceModelsCliLeaf,
|
|
28
|
-
models_1.updateModelsCliLeaf,
|
|
29
26
|
env_vars_1.getAllEnvsCliLeaf,
|
|
30
27
|
env_vars_1.setEnvCliLeaf,
|
|
28
|
+
env_vars_1.rmEnvCliLeaf,
|
|
31
29
|
analytics_1.getAnalyticsCfgCliLeaf,
|
|
32
30
|
analytics_1.setAnalyticsCfgCliLeaf,
|
|
33
31
|
shadow_1.getShadowCliLeaf,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/subcommands/app/index.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/subcommands/app/index.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAChD,yCAA4E;AAC5E,qCAAiE;AACjE,qCAMkB;AAClB,uCAKmB;AACnB,qCAAiE;AACjE,2CAA6E;AAEhE,QAAA,YAAY,GAAG,IAAA,qBAAS,EAAC;IACpC,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,8BAA8B;IAC3C,WAAW,EAAE;QACX,yBAAe;QACf,2BAAiB;QACjB,4BAAmB;QACnB,wBAAe;QACf,uBAAc;QACd,0BAAiB;QACjB,0BAAiB;QACjB,6BAAmB;QACnB,4BAAkB;QAClB,6BAAoB;QACpB,wBAAe;QACf,4BAAiB;QACjB,wBAAa;QACb,uBAAY;QACZ,kCAAsB;QACtB,kCAAsB;QACtB,yBAAgB;QAChB,4BAAmB;KACpB;CACF,CAAC,CAAC"}
|
|
@@ -6,15 +6,4 @@ export declare const addModelCliLeaf: import("@alwaysai/alwayscli/lib/types").Cl
|
|
|
6
6
|
model: import("@alwaysai/alwayscli").CliInput<string, true>;
|
|
7
7
|
version: import("@alwaysai/alwayscli").CliInput<string, true>;
|
|
8
8
|
}, import("@alwaysai/alwayscli").CliInput<undefined, false>>;
|
|
9
|
-
export declare const removeModelCliLeaf: import("@alwaysai/alwayscli/lib/types").CliLeaf<import("@alwaysai/alwayscli").CliInput<undefined, false>, {
|
|
10
|
-
project: import("@alwaysai/alwayscli").CliInput<string, true>;
|
|
11
|
-
model: import("@alwaysai/alwayscli").CliInput<string, true>;
|
|
12
|
-
}, import("@alwaysai/alwayscli").CliInput<undefined, false>>;
|
|
13
|
-
export declare const replaceModelsCliLeaf: import("@alwaysai/alwayscli/lib/types").CliLeaf<import("@alwaysai/alwayscli").CliInput<undefined, false>, {
|
|
14
|
-
project: import("@alwaysai/alwayscli").CliInput<string, true>;
|
|
15
|
-
models: import("@alwaysai/alwayscli").CliInput<string[], true>;
|
|
16
|
-
}, import("@alwaysai/alwayscli").CliInput<undefined, false>>;
|
|
17
|
-
export declare const updateModelsCliLeaf: import("@alwaysai/alwayscli/lib/types").CliLeaf<import("@alwaysai/alwayscli").CliInput<undefined, false>, {
|
|
18
|
-
project: import("@alwaysai/alwayscli").CliInput<string, true>;
|
|
19
|
-
}, import("@alwaysai/alwayscli").CliInput<undefined, false>>;
|
|
20
9
|
//# sourceMappingURL=models.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/subcommands/app/models.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/subcommands/app/models.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,oBAAoB;;4DAc/B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;4DAgD1B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.addModelCliLeaf = exports.showAppModelsCliLeaf = void 0;
|
|
4
4
|
const alwayscli_1 = require("@alwaysai/alwayscli");
|
|
5
5
|
const application_control_1 = require("../../application-control");
|
|
6
6
|
const device_agent_cloud_connection_1 = require("../../cloud-connection/device-agent-cloud-connection");
|
|
@@ -41,7 +41,6 @@ exports.addModelCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
|
41
41
|
async action(_, opts) {
|
|
42
42
|
const { project: projectId, model, version } = opts;
|
|
43
43
|
const deviceAgent = new device_agent_cloud_connection_1.DeviceAgentCloudConnection();
|
|
44
|
-
await deviceAgent.setupHandlers();
|
|
45
44
|
// Update the shadow as a client
|
|
46
45
|
const newAppCfg = await (0, application_control_1.readAppCfgFile)({ projectId: projectId });
|
|
47
46
|
newAppCfg.models[model] = Number(version);
|
|
@@ -50,7 +49,7 @@ exports.addModelCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
|
50
49
|
appConfig: JSON.stringify(newAppCfg)
|
|
51
50
|
}
|
|
52
51
|
};
|
|
53
|
-
deviceAgent.publisher.publish((0, device_agent_schemas_1.getShadowTopic)(deviceAgent.getClientId(), 'projects', 'update'), JSON.stringify((0, device_agent_schemas_1.
|
|
52
|
+
deviceAgent.publisher.publish((0, device_agent_schemas_1.getShadowTopic)(deviceAgent.getClientId(), 'projects', 'update'), JSON.stringify((0, device_agent_schemas_1.buildUpdateShadowMessage)({
|
|
54
53
|
clientId: 'client',
|
|
55
54
|
desired: toDesire
|
|
56
55
|
})));
|
|
@@ -62,59 +61,4 @@ exports.addModelCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
|
62
61
|
await deviceAgent.stop();
|
|
63
62
|
}
|
|
64
63
|
});
|
|
65
|
-
exports.removeModelCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
66
|
-
name: 'remove-model',
|
|
67
|
-
description: 'Remove a model from an alwaysAI app',
|
|
68
|
-
namedInputs: {
|
|
69
|
-
project: (0, alwayscli_1.CliStringInput)({
|
|
70
|
-
description: 'Project ID',
|
|
71
|
-
required: true
|
|
72
|
-
}),
|
|
73
|
-
model: (0, alwayscli_1.CliStringInput)({
|
|
74
|
-
description: 'Model ID',
|
|
75
|
-
required: true
|
|
76
|
-
})
|
|
77
|
-
},
|
|
78
|
-
async action(_, opts) {
|
|
79
|
-
const { project, model } = opts;
|
|
80
|
-
// TODO: Replace with handleMessage()
|
|
81
|
-
await (0, application_control_1.removeModel)({ projectId: project, modelId: model });
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
exports.replaceModelsCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
85
|
-
name: 'replace-models',
|
|
86
|
-
description: 'Replace all models of an alwaysAI app with new models',
|
|
87
|
-
namedInputs: {
|
|
88
|
-
project: (0, alwayscli_1.CliStringInput)({
|
|
89
|
-
description: 'Project Id',
|
|
90
|
-
required: true
|
|
91
|
-
}),
|
|
92
|
-
models: (0, alwayscli_1.CliStringArrayInput)({
|
|
93
|
-
description: 'One or more model IDs',
|
|
94
|
-
required: true
|
|
95
|
-
})
|
|
96
|
-
},
|
|
97
|
-
hidden: true,
|
|
98
|
-
async action(_, opts) {
|
|
99
|
-
const { project, models } = opts;
|
|
100
|
-
console.log('This command is deprecated and will be removed in a future release');
|
|
101
|
-
await (0, application_control_1.replaceModels)({ projectId: project, modelIds: models });
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
exports.updateModelsCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
105
|
-
name: 'update-models',
|
|
106
|
-
description: 'Update all models for an alwaysAI app',
|
|
107
|
-
namedInputs: {
|
|
108
|
-
project: (0, alwayscli_1.CliStringInput)({
|
|
109
|
-
description: 'Project Id',
|
|
110
|
-
required: true
|
|
111
|
-
})
|
|
112
|
-
},
|
|
113
|
-
hidden: true,
|
|
114
|
-
async action(_, opts) {
|
|
115
|
-
const { project } = opts;
|
|
116
|
-
console.log('This command is deprecated and will be removed in a future release');
|
|
117
|
-
await (0, application_control_1.updateModels)({ projectId: project });
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
64
|
//# sourceMappingURL=models.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/subcommands/app/models.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/subcommands/app/models.ts"],"names":[],"mappings":";;;AAAA,mDAA8D;AAC9D,mEAAyE;AACzE,wGAAkG;AAClG,4CAAqC;AACrC,yEAGwC;AAE3B,QAAA,oBAAoB,GAAG,IAAA,mBAAO,EAAC;IAC1C,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE;QACX,OAAO,EAAE,IAAA,0BAAc,EAAC;YACtB,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI;QAClB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QACzB,MAAM,SAAS,GAAG,MAAM,IAAA,kCAAY,EAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7D,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,IAAA,mBAAO,EAAC;IACrC,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,gCAAgC;IAC7C,WAAW,EAAE;QACX,OAAO,EAAE,IAAA,0BAAc,EAAC;YACtB,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,KAAK,EAAE,IAAA,0BAAc,EAAC;YACpB,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,IAAA,0BAAc,EAAC;YACtB,WAAW,EAAE,eAAe;YAC5B,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI;QAClB,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QACpD,MAAM,WAAW,GAAG,IAAI,0DAA0B,EAAE,CAAC;QAErD,gCAAgC;QAEhC,MAAM,SAAS,GAAG,MAAM,IAAA,oCAAc,EAAC,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;QACjE,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;QAE1C,MAAM,QAAQ,GAAG;YACf,CAAC,SAAS,CAAC,EAAE;gBACX,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;aACrC;SACF,CAAC;QACF,WAAW,CAAC,SAAS,CAAC,OAAO,CAC3B,IAAA,qCAAc,EAAC,WAAW,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,QAAQ,CAAC,EAC/D,IAAI,CAAC,SAAS,CACZ,IAAA,+CAAwB,EAAC;YACvB,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,QAAQ;SAClB,CAAC,CACH,CACF,CAAC;QACF,0DAA0D;QAC1D,MAAM,IAAA,eAAK,EAAC,KAAK,CAAC,CAAC;QAEnB,OAAO,WAAW,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE;YAC7C,MAAM,IAAA,eAAK,EAAC,IAAI,CAAC,CAAC;SACnB;QACD,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadow.d.ts","sourceRoot":"","sources":["../../../src/subcommands/app/shadow.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB;;
|
|
1
|
+
{"version":3,"file":"shadow.d.ts","sourceRoot":"","sources":["../../../src/subcommands/app/shadow.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB;;4DAqB3B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;4DAqB9B,CAAC"}
|
|
@@ -16,9 +16,8 @@ exports.getShadowCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
|
16
16
|
async action(_, opts) {
|
|
17
17
|
const { project } = opts;
|
|
18
18
|
const deviceAgent = new device_agent_cloud_connection_1.DeviceAgentCloudConnection();
|
|
19
|
-
|
|
20
|
-
//
|
|
21
|
-
// itself. 5 seconds should cover the initial response wait time
|
|
19
|
+
deviceAgent.shadowHandler.getProjectShadowUpdates();
|
|
20
|
+
// 5 seconds should cover the response wait time
|
|
22
21
|
await (0, sleep_1.default)(5000);
|
|
23
22
|
while (deviceAgent.isCmdInProgress(project)) {
|
|
24
23
|
await (0, sleep_1.default)(1000);
|
|
@@ -38,10 +37,12 @@ exports.updateShadowCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
|
38
37
|
async action(_, opts) {
|
|
39
38
|
const { project } = opts;
|
|
40
39
|
const deviceAgent = new device_agent_cloud_connection_1.DeviceAgentCloudConnection();
|
|
41
|
-
await deviceAgent.
|
|
42
|
-
await deviceAgent.updateProjectShadow(project);
|
|
40
|
+
await deviceAgent.shadowHandler.updateProjectShadow(project);
|
|
43
41
|
// 5 seconds should cover the response wait time
|
|
44
42
|
await (0, sleep_1.default)(5000);
|
|
43
|
+
while (deviceAgent.isCmdInProgress(project)) {
|
|
44
|
+
await (0, sleep_1.default)(1000);
|
|
45
|
+
}
|
|
45
46
|
await deviceAgent.stop();
|
|
46
47
|
}
|
|
47
48
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadow.js","sourceRoot":"","sources":["../../../src/subcommands/app/shadow.ts"],"names":[],"mappings":";;;AAAA,mDAA8D;AAC9D,wGAAkG;AAClG,4CAAqC;AAExB,QAAA,gBAAgB,GAAG,IAAA,mBAAO,EAAC;IACtC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,wBAAwB;IACrC,WAAW,EAAE;QACX,OAAO,EAAE,IAAA,0BAAc,EAAC;YACtB,WAAW,EAAE,YAAY;YACzB,QAAQ,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AClB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QACzB,MAAM,WAAW,GAAG,IAAI,0DAA0B,EAAE,CAAC;QACrD,MAAM,WAAW,CAAC,aAAa,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAE7D,gDAAgD;QAChD,MAAM,IAAA,eAAK,EAAC,IAAI,CAAC,CAAC;QAClB,OAAO,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE;YAC3C,MAAM,IAAA,eAAK,EAAC,IAAI,CAAC,CAAC;SACnB;QACD,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/subcommands/app/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/subcommands/app/version.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,eAAe,yKAQ1B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;4DAgD5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;4DA6B9B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;4DAc7B,CAAC"}
|
|
@@ -45,8 +45,7 @@ exports.installAppCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
|
45
45
|
throw new alwayscli_1.CliTerseError('--release-hash flag is required!');
|
|
46
46
|
}
|
|
47
47
|
const deviceAgent = new device_agent_cloud_connection_1.DeviceAgentCloudConnection();
|
|
48
|
-
|
|
49
|
-
const topic = deviceAgent.getToDeviceTopic();
|
|
48
|
+
const topic = (0, device_agent_schemas_1.getToDeviceTopic)(deviceAgent.getClientId());
|
|
50
49
|
const message = {
|
|
51
50
|
timestamp: '',
|
|
52
51
|
topic,
|
|
@@ -77,8 +76,7 @@ exports.uninstallAppCliLeaf = (0, alwayscli_1.CliLeaf)({
|
|
|
77
76
|
async action(_, opts) {
|
|
78
77
|
const { project } = opts;
|
|
79
78
|
const deviceAgent = new device_agent_cloud_connection_1.DeviceAgentCloudConnection();
|
|
80
|
-
|
|
81
|
-
const topic = deviceAgent.getToDeviceTopic();
|
|
79
|
+
const topic = (0, device_agent_schemas_1.getToDeviceTopic)(deviceAgent.getClientId());
|
|
82
80
|
const message = {
|
|
83
81
|
timestamp: '',
|
|
84
82
|
topic,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/subcommands/app/version.ts"],"names":[],"mappings":";;;AAAA,mDAA6E;AAC7E,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/subcommands/app/version.ts"],"names":[],"mappings":";;;AAAA,mDAA6E;AAC7E,yEAKwC;AACxC,mEAAwD;AACxD,wGAAkG;AAClG,oEAAoE;AACpE,4CAAqC;AACrC,8CAA2C;AAE9B,QAAA,eAAe,GAAG,IAAA,mBAAO,EAAC;IACrC,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,EAAE;IACf,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI;QAClB,MAAM,IAAI,GAAG,MAAM,IAAA,8BAAe,GAAE,CAAC,OAAO,EAAE,CAAC;QAC/C,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;CACF,CAAC,CAAC;AAEU,QAAA,iBAAiB,GAAG,IAAA,mBAAO,EAAC;IACvC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,wCAAwC;IACrD,WAAW,EAAE;QACX,OAAO,EAAE,IAAA,0BAAc,EAAC;YACtB,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,cAAc,EAAE,IAAA,0BAAc,EAAC;YAC7B,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,WAAW,EAAE,IAAA,0BAAc,EAAC;YAC1B,WAAW,EA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CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/subcommands/config.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,YAAY,mDAKvB,CAAC"}
|
|
@@ -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,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,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) {
|