@c8y/devkit 1019.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/builders.json +29 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/options.d.ts +2 -0
- package/dist/options.js +6 -0
- package/dist/options.js.map +1 -0
- package/dist/src/builders/BuilderOptions.d.ts +90 -0
- package/dist/src/builders/BuilderOptions.js +3 -0
- package/dist/src/builders/BuilderOptions.js.map +1 -0
- package/dist/src/builders/browser/index.d.ts +2 -0
- package/dist/src/builders/browser/index.js +17 -0
- package/dist/src/builders/browser/index.js.map +1 -0
- package/dist/src/builders/browser/schema.json +606 -0
- package/dist/src/builders/compile-i18n/compile-i18n-builder.d.ts +5 -0
- package/dist/src/builders/compile-i18n/compile-i18n-builder.js +88 -0
- package/dist/src/builders/compile-i18n/compile-i18n-builder.js.map +1 -0
- package/dist/src/builders/compile-i18n/schema.json +24 -0
- package/dist/src/builders/create-schema.d.ts +1 -0
- package/dist/src/builders/create-schema.js +32 -0
- package/dist/src/builders/create-schema.js.map +1 -0
- package/dist/src/builders/deploy/Deploy.model.d.ts +30 -0
- package/dist/src/builders/deploy/Deploy.model.js +8 -0
- package/dist/src/builders/deploy/Deploy.model.js.map +1 -0
- package/dist/src/builders/deploy/app-as-zip-file.d.ts +8 -0
- package/dist/src/builders/deploy/app-as-zip-file.js +74 -0
- package/dist/src/builders/deploy/app-as-zip-file.js.map +1 -0
- package/dist/src/builders/deploy/build-and-zip-app.d.ts +10 -0
- package/dist/src/builders/deploy/build-and-zip-app.js +105 -0
- package/dist/src/builders/deploy/build-and-zip-app.js.map +1 -0
- package/dist/src/builders/deploy/deploy-builder.d.ts +5 -0
- package/dist/src/builders/deploy/deploy-builder.js +268 -0
- package/dist/src/builders/deploy/deploy-builder.js.map +1 -0
- package/dist/src/builders/deploy/helpers.d.ts +25 -0
- package/dist/src/builders/deploy/helpers.js +45 -0
- package/dist/src/builders/deploy/helpers.js.map +1 -0
- package/dist/src/builders/deploy/schema.json +42 -0
- package/dist/src/builders/dev-server/index.d.ts +2 -0
- package/dist/src/builders/dev-server/index.js +67 -0
- package/dist/src/builders/dev-server/index.js.map +1 -0
- package/dist/src/builders/dev-server/schema.json +120 -0
- package/dist/src/builders/extract-i18n/extract-i18n-builder.d.ts +5 -0
- package/dist/src/builders/extract-i18n/extract-i18n-builder.js +126 -0
- package/dist/src/builders/extract-i18n/extract-i18n-builder.js.map +1 -0
- package/dist/src/builders/extract-i18n/schema.json +30 -0
- package/dist/src/options.d.ts +82 -0
- package/dist/src/options.js +98 -0
- package/dist/src/options.js.map +1 -0
- package/dist/src/schematics/collection.json +9 -0
- package/dist/src/schematics/ng-add/configs/angular-json.d.ts +28 -0
- package/dist/src/schematics/ng-add/configs/angular-json.js +93 -0
- package/dist/src/schematics/ng-add/configs/angular-json.js.map +1 -0
- package/dist/src/schematics/ng-add/configs/app-module.d.ts +3 -0
- package/dist/src/schematics/ng-add/configs/app-module.js +13 -0
- package/dist/src/schematics/ng-add/configs/app-module.js.map +1 -0
- package/dist/src/schematics/ng-add/configs/app-routing.d.ts +2 -0
- package/dist/src/schematics/ng-add/configs/app-routing.js +16 -0
- package/dist/src/schematics/ng-add/configs/app-routing.js.map +1 -0
- package/dist/src/schematics/ng-add/configs/index-html.d.ts +2 -0
- package/dist/src/schematics/ng-add/configs/index-html.js +15 -0
- package/dist/src/schematics/ng-add/configs/index-html.js.map +1 -0
- package/dist/src/schematics/ng-add/configs/index.d.ts +2 -0
- package/dist/src/schematics/ng-add/configs/index.js +37 -0
- package/dist/src/schematics/ng-add/configs/index.js.map +1 -0
- package/dist/src/schematics/ng-add/configs/main.d.ts +2 -0
- package/dist/src/schematics/ng-add/configs/main.js +30 -0
- package/dist/src/schematics/ng-add/configs/main.js.map +1 -0
- package/dist/src/schematics/ng-add/configs/ng1.d.ts +3 -0
- package/dist/src/schematics/ng-add/configs/ng1.js +13 -0
- package/dist/src/schematics/ng-add/configs/ng1.js.map +1 -0
- package/dist/src/schematics/ng-add/configs/package-json.d.ts +17 -0
- package/dist/src/schematics/ng-add/configs/package-json.js +67 -0
- package/dist/src/schematics/ng-add/configs/package-json.js.map +1 -0
- package/dist/src/schematics/ng-add/configs/translation.d.ts +2 -0
- package/dist/src/schematics/ng-add/configs/translation.js +36 -0
- package/dist/src/schematics/ng-add/configs/translation.js.map +1 -0
- package/dist/src/schematics/ng-add/configs/tsconfig-app-json.d.ts +2 -0
- package/dist/src/schematics/ng-add/configs/tsconfig-app-json.js +21 -0
- package/dist/src/schematics/ng-add/configs/tsconfig-app-json.js.map +1 -0
- package/dist/src/schematics/ng-add/configs/tsconfig-json.d.ts +2 -0
- package/dist/src/schematics/ng-add/configs/tsconfig-json.js +19 -0
- package/dist/src/schematics/ng-add/configs/tsconfig-json.js.map +1 -0
- package/dist/src/schematics/ng-add/index.d.ts +4 -0
- package/dist/src/schematics/ng-add/index.js +93 -0
- package/dist/src/schematics/ng-add/index.js.map +1 -0
- package/dist/src/schematics/ng-add/model.d.ts +19 -0
- package/dist/src/schematics/ng-add/model.js +3 -0
- package/dist/src/schematics/ng-add/model.js.map +1 -0
- package/dist/src/schematics/ng-add/ng-add.json +18 -0
- package/dist/src/schematics/ng-add/utils.d.ts +13 -0
- package/dist/src/schematics/ng-add/utils.js +32 -0
- package/dist/src/schematics/ng-add/utils.js.map +1 -0
- package/dist/src/utils/locale-compiler.d.ts +48 -0
- package/dist/src/utils/locale-compiler.js +83 -0
- package/dist/src/utils/locale-compiler.js.map +1 -0
- package/dist/src/utils/locale-json-paths.d.ts +19 -0
- package/dist/src/utils/locale-json-paths.js +63 -0
- package/dist/src/utils/locale-json-paths.js.map +1 -0
- package/dist/src/utils/locale-utils.d.ts +24 -0
- package/dist/src/utils/locale-utils.js +104 -0
- package/dist/src/utils/locale-utils.js.map +1 -0
- package/dist/src/utils/package-config.d.ts +1 -0
- package/dist/src/utils/package-config.js +13 -0
- package/dist/src/utils/package-config.js.map +1 -0
- package/dist/src/webpack/ApplicationOptions.d.ts +344 -0
- package/dist/src/webpack/ApplicationOptions.js +3 -0
- package/dist/src/webpack/ApplicationOptions.js.map +1 -0
- package/dist/src/webpack/BuildDefaults.d.ts +10 -0
- package/dist/src/webpack/BuildDefaults.js +15 -0
- package/dist/src/webpack/BuildDefaults.js.map +1 -0
- package/dist/src/webpack/EnvironmentOptions.d.ts +132 -0
- package/dist/src/webpack/EnvironmentOptions.js +15 -0
- package/dist/src/webpack/EnvironmentOptions.js.map +1 -0
- package/dist/src/webpack/config/babel.d.ts +2 -0
- package/dist/src/webpack/config/babel.js +65 -0
- package/dist/src/webpack/config/babel.js.map +1 -0
- package/dist/src/webpack/config/base.d.ts +27 -0
- package/dist/src/webpack/config/base.js +125 -0
- package/dist/src/webpack/config/base.js.map +1 -0
- package/dist/src/webpack/config/development.d.ts +4 -0
- package/dist/src/webpack/config/development.js +37 -0
- package/dist/src/webpack/config/development.js.map +1 -0
- package/dist/src/webpack/config/extra.d.ts +3 -0
- package/dist/src/webpack/config/extra.js +24 -0
- package/dist/src/webpack/config/extra.js.map +1 -0
- package/dist/src/webpack/config/favicon.d.ts +2 -0
- package/dist/src/webpack/config/favicon.js +20 -0
- package/dist/src/webpack/config/favicon.js.map +1 -0
- package/dist/src/webpack/config/federation.d.ts +3 -0
- package/dist/src/webpack/config/federation.js +66 -0
- package/dist/src/webpack/config/federation.js.map +1 -0
- package/dist/src/webpack/config/legacy.d.ts +2 -0
- package/dist/src/webpack/config/legacy.js +72 -0
- package/dist/src/webpack/config/legacy.js.map +1 -0
- package/dist/src/webpack/config/plugin.d.ts +5 -0
- package/dist/src/webpack/config/plugin.js +89 -0
- package/dist/src/webpack/config/plugin.js.map +1 -0
- package/dist/src/webpack/config/production.d.ts +3 -0
- package/dist/src/webpack/config/production.js +30 -0
- package/dist/src/webpack/config/production.js.map +1 -0
- package/dist/src/webpack/config/styles.d.ts +3 -0
- package/dist/src/webpack/config/styles.js +54 -0
- package/dist/src/webpack/config/styles.js.map +1 -0
- package/dist/src/webpack/config/translation.d.ts +2 -0
- package/dist/src/webpack/config/translation.js +23 -0
- package/dist/src/webpack/config/translation.js.map +1 -0
- package/dist/src/webpack/loaders/loader-data.d.ts +1 -0
- package/dist/src/webpack/loaders/loader-data.js +53 -0
- package/dist/src/webpack/loaders/loader-data.js.map +1 -0
- package/dist/src/webpack/loaders/loader-less.d.ts +1 -0
- package/dist/src/webpack/loaders/loader-less.js +23 -0
- package/dist/src/webpack/loaders/loader-less.js.map +1 -0
- package/dist/src/webpack/loaders/loader-manifest.d.ts +1 -0
- package/dist/src/webpack/loaders/loader-manifest.js +88 -0
- package/dist/src/webpack/loaders/loader-manifest.js.map +1 -0
- package/dist/src/webpack/loaders/loader-ngtemplate.d.ts +1 -0
- package/dist/src/webpack/loaders/loader-ngtemplate.js +16 -0
- package/dist/src/webpack/loaders/loader-ngtemplate.js.map +1 -0
- package/dist/src/webpack/loaders/loader-pluginpath.d.ts +1 -0
- package/dist/src/webpack/loaders/loader-pluginpath.js +10 -0
- package/dist/src/webpack/loaders/loader-pluginpath.js.map +1 -0
- package/dist/src/webpack/loaders/loader-po.d.ts +3 -0
- package/dist/src/webpack/loaders/loader-po.js +9 -0
- package/dist/src/webpack/loaders/loader-po.js.map +1 -0
- package/dist/src/webpack/plugin/index-content.d.ts +2 -0
- package/dist/src/webpack/plugin/index-content.js +113 -0
- package/dist/src/webpack/plugin/index-content.js.map +1 -0
- package/dist/src/webpack/plugin/locales.d.ts +6 -0
- package/dist/src/webpack/plugin/locales.js +746 -0
- package/dist/src/webpack/plugin/locales.js.map +1 -0
- package/dist/src/webpack/plugin/plugin.d.ts +259 -0
- package/dist/src/webpack/plugin/plugin.js +286 -0
- package/dist/src/webpack/plugin/plugin.js.map +1 -0
- package/dist/src/webpack/plugin/translation-aggregation-plugin.d.ts +80 -0
- package/dist/src/webpack/plugin/translation-aggregation-plugin.js +152 -0
- package/dist/src/webpack/plugin/translation-aggregation-plugin.js.map +1 -0
- package/dist/src/webpack/plugin/translation-data-store.d.ts +27 -0
- package/dist/src/webpack/plugin/translation-data-store.js +37 -0
- package/dist/src/webpack/plugin/translation-data-store.js.map +1 -0
- package/dist/src/webpack/utils/federationUtils.d.ts +26 -0
- package/dist/src/webpack/utils/federationUtils.js +234 -0
- package/dist/src/webpack/utils/federationUtils.js.map +1 -0
- package/dist/src/webpack/utils/helpers.d.ts +45 -0
- package/dist/src/webpack/utils/helpers.js +137 -0
- package/dist/src/webpack/utils/helpers.js.map +1 -0
- package/dist/src/webpack/utils/index.d.ts +1 -0
- package/dist/src/webpack/utils/index.js +5 -0
- package/dist/src/webpack/utils/index.js.map +1 -0
- package/dist/src/webpack/utils/legacy-manifest-resolver.d.ts +4 -0
- package/dist/src/webpack/utils/legacy-manifest-resolver.js +27 -0
- package/dist/src/webpack/utils/legacy-manifest-resolver.js.map +1 -0
- package/dist/src/webpack/utils/proxy.d.ts +2 -0
- package/dist/src/webpack/utils/proxy.js +39 -0
- package/dist/src/webpack/utils/proxy.js.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-i18n-builder.js","sourceRoot":"","sources":["../../../../src/builders/compile-i18n/compile-i18n-builder.ts"],"names":[],"mappings":";;AAAA,yDAA0D;AAE1D,+BAA+B;AAC/B,+BAA+B;AAC/B,yCAAgE;AAChE,uCAA0D;AAC1D,2CAA4D;AAC5D,iEAAyE;AAEzE;;GAEG;AACH,MAAM,OAAO,GAAY,IAAA,yBAAa,EAA+B,kBAAkB,CAAC,CAAC;AACzF,kBAAe,OAAO,CAAC;AAEvB;;GAEG;AACH,IAAI,UAAkB,CAAC;AACvB;;GAEG;AACH,IAAI,cAA8B,CAAC;AACnC;;;;;;;;GAQG;AACH,KAAK,UAAU,kBAAkB,CAC/B,OAAqC;IAErC,IAAI;QACF,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;KAC/B;IA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,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IACrF,MAAM,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC;AACxC,CAAC;AACD;;;;GAIG;AACH,KAAK,UAAU,IAAI,CAAC,KAAe;IACjC,OAAO,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAA,mBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAc,EAAE,EAAE,CACnF,MAAM,CAAC,QAAQ,EAAE,CAClB,CAAC;AACJ,CAAC;AACD;;;;GAIG;AACH,KAAK,UAAU,KAAK,CAAC,KAAmB;IACtC,OAAO,MAAM,OAAO,CAAC,GAAG,CACtB,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE;QACrC,MAAM,IAAA,oBAAS,EAAC,UAAU,CAAC,CAAC;QAC5B,MAAM,cAAc,GAAG,GAAG,UAAU,IAAI,QAAQ,OAAO,CAAC;QACxD,MAAM,IAAA,oBAAS,EAAC,IAAA,cAAO,EAAC,cAAc,CAAC,EAAE,IAAI,CAAC,CAAC;QAC/C,MAAM,GAAG,GAAG,iBAAgB,CAAC,+BAA+B,CAAC,CAAC,cAAc,CAAC,CAAC;QAC9E,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"title": "Compile i18n schema",
|
|
4
|
+
"description": "Compiles the globs for po files into json.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"output": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Output directory for the compiled json files.",
|
|
10
|
+
"alias": "o"
|
|
11
|
+
},
|
|
12
|
+
"paths": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"items": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"$default": {
|
|
18
|
+
"$source": "argv"
|
|
19
|
+
},
|
|
20
|
+
"alias": "p",
|
|
21
|
+
"description": "Glob patterns list to compile locales from."
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fs = require("fs-extra");
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const targetNames = ['dev-server', 'browser', 'deploy', 'extract-i18n', 'compile-i18n'];
|
|
6
|
+
const availableTargets = [
|
|
7
|
+
{ targetName: 'dev-server', angularDevkitTarget: 'dev-server' },
|
|
8
|
+
{ targetName: 'browser', angularDevkitTarget: 'browser' },
|
|
9
|
+
{ targetName: 'deploy' },
|
|
10
|
+
{ targetName: 'extract-i18n' },
|
|
11
|
+
{ targetName: 'compile-i18n' }
|
|
12
|
+
];
|
|
13
|
+
(async () => {
|
|
14
|
+
var _a;
|
|
15
|
+
for (const target of availableTargets) {
|
|
16
|
+
if (!target.angularDevkitTarget) {
|
|
17
|
+
fs.copyFile(`./src/builders/${target.targetName}/properties.ext.json`, `./dist/src/builders/${target.targetName}/schema.json`);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const propertiesExtensionSchema = fs.readJSONSync(`./src/builders/${target.targetName}/properties.ext.json`);
|
|
21
|
+
const defaultSchema = await (_a = `@angular-devkit/build-angular/src/builders/${target.targetName}/schema.json`, Promise.resolve().then(() => require(_a)));
|
|
22
|
+
defaultSchema.properties = (0, lodash_1.merge)(defaultSchema.properties, propertiesExtensionSchema.properties);
|
|
23
|
+
// allow to overwrite requires
|
|
24
|
+
defaultSchema.required = propertiesExtensionSchema.required || defaultSchema.required;
|
|
25
|
+
fs.ensureFileSync(`./dist/src/builders/${target.targetName}/schema.json`);
|
|
26
|
+
fs.writeJSONSync(`./dist/src/builders/${target.targetName}/schema.json`, defaultSchema, {
|
|
27
|
+
spaces: 2
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
})();
|
|
32
|
+
//# sourceMappingURL=create-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-schema.js","sourceRoot":"","sources":["../../../src/builders/create-schema.ts"],"names":[],"mappings":";;AAAA,+BAA+B;AAC/B,mCAA+B;AAE/B,MAAM,WAAW,GAAG,CAAC,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,CAAU,CAAC;AAOjG,MAAM,gBAAgB,GAAoB;IACxC,EAAE,UAAU,EAAE,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE;IAC/D,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,SAAS,EAAE;IACzD,EAAE,UAAU,EAAE,QAAQ,EAAE;IACxB,EAAE,UAAU,EAAE,cAAc,EAAE;IAC9B,EAAE,UAAU,EAAE,cAAc,EAAE;CAC/B,CAAC;AAEF,CAAC,KAAK,IAAI,EAAE;;IACV,KAAK,MAAM,MAAM,IAAI,gBAAgB,EAAE;QACrC,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE;YAC/B,EAAE,CAAC,QAAQ,CACT,kBAAkB,MAAM,CAAC,UAAU,sBAAsB,EACzD,uBAAuB,MAAM,CAAC,UAAU,cAAc,CACvD,CAAC;SACH;aAAM;YACL,MAAM,yBAAyB,GAAG,EAAE,CAAC,YAAY,CAC/C,kBAAkB,MAAM,CAAC,UAAU,sBAAsB,CAC1D,CAAC;YACF,MAAM,aAAa,GAAG,YACpB,8CAA8C,MAAM,CAAC,UAAU,cAAc,4CAC9E,CAAC;YAEF,aAAa,CAAC,UAAU,GAAG,IAAA,cAAK,EAC9B,aAAa,CAAC,UAAU,EACxB,yBAAyB,CAAC,UAAU,CACrC,CAAC;YAEF,8BAA8B;YAC9B,aAAa,CAAC,QAAQ,GAAG,yBAAyB,CAAC,QAAQ,IAAI,aAAa,CAAC,QAAQ,CAAC;YAEtF,EAAE,CAAC,cAAc,CAAC,uBAAuB,MAAM,CAAC,UAAU,cAAc,CAAC,CAAC;YAC1E,EAAE,CAAC,aAAa,CAAC,uBAAuB,MAAM,CAAC,UAAU,cAAc,EAAE,aAAa,EAAE;gBACtF,MAAM,EAAE,CAAC;aACV,CAAC,CAAC;SACJ;KACF;AACH,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ApplicationAvailability, ApplicationType } from '@c8y/client';
|
|
2
|
+
import { C8yDeployBuilderOptions } from '../BuilderOptions';
|
|
3
|
+
export type AppToDeploy = {
|
|
4
|
+
/**
|
|
5
|
+
* Metadata of application, necessary for proper uploading application file to server.
|
|
6
|
+
*/
|
|
7
|
+
json: {
|
|
8
|
+
key: string;
|
|
9
|
+
name: string;
|
|
10
|
+
contextPath: string;
|
|
11
|
+
type: ApplicationType;
|
|
12
|
+
availability: ApplicationAvailability;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Raw data of zip file that contains application.
|
|
16
|
+
*/
|
|
17
|
+
buffer: any;
|
|
18
|
+
/**
|
|
19
|
+
* Name of file provided as already zipped file, that contains application.
|
|
20
|
+
*/
|
|
21
|
+
fileName?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Size of application that is provided as already zipped file.
|
|
24
|
+
*/
|
|
25
|
+
size?: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Options required to run deploy builder. They can be provided as flags in deploy command or in .env file.
|
|
29
|
+
*/
|
|
30
|
+
export declare const REQUIRED_OPTIONS: (keyof C8yDeployBuilderOptions)[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REQUIRED_OPTIONS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Options required to run deploy builder. They can be provided as flags in deploy command or in .env file.
|
|
6
|
+
*/
|
|
7
|
+
exports.REQUIRED_OPTIONS = ['url', 'user', 'password'];
|
|
8
|
+
//# sourceMappingURL=Deploy.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Deploy.model.js","sourceRoot":"","sources":["../../../../src/builders/deploy/Deploy.model.ts"],"names":[],"mappings":";;;AA4BA;;GAEG;AACU,QAAA,gBAAgB,GAAsC,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AppToDeploy } from './Deploy.model';
|
|
2
|
+
/**
|
|
3
|
+
* Reads zipped file by provided path, extracts application metadata, file metadata and file buffer (raw data).
|
|
4
|
+
*
|
|
5
|
+
* @param path - The path to the zip file.
|
|
6
|
+
* @returns A Promise that resolves to object representing the application.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getAppAsZip(path: string): Promise<AppToDeploy>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAppAsZip = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const options_1 = require("../../options");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const unzip_stream_1 = require("unzip-stream");
|
|
9
|
+
const helpers_1 = require("./helpers");
|
|
10
|
+
/**
|
|
11
|
+
* Reads zipped file by provided path, extracts application metadata, file metadata and file buffer (raw data).
|
|
12
|
+
*
|
|
13
|
+
* @param path - The path to the zip file.
|
|
14
|
+
* @returns A Promise that resolves to object representing the application.
|
|
15
|
+
*/
|
|
16
|
+
async function getAppAsZip(path) {
|
|
17
|
+
const size = (0, fs_1.statSync)(path).size;
|
|
18
|
+
let appData = {};
|
|
19
|
+
let closed = false;
|
|
20
|
+
let pendingFiles = 0;
|
|
21
|
+
let readJsonInnerResolveMethod;
|
|
22
|
+
const parseFileData = (data) => {
|
|
23
|
+
try {
|
|
24
|
+
const fileData = JSON.parse(data.toString());
|
|
25
|
+
appData = Object.assign(appData, (0, helpers_1.dataToAppData)(fileData));
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
// do nothing
|
|
29
|
+
}
|
|
30
|
+
pendingFiles--;
|
|
31
|
+
resolveIfReady();
|
|
32
|
+
};
|
|
33
|
+
const onClose = () => {
|
|
34
|
+
closed = true;
|
|
35
|
+
resolveIfReady();
|
|
36
|
+
};
|
|
37
|
+
const resolveIfReady = () => {
|
|
38
|
+
if (pendingFiles === 0 && closed) {
|
|
39
|
+
const appDataCopy = (0, lodash_1.cloneDeep)(appData);
|
|
40
|
+
const name = (0, helpers_1.getName)(appDataCopy, (0, path_1.basename)(path));
|
|
41
|
+
const key = (0, helpers_1.getKey)(appDataCopy, name);
|
|
42
|
+
const contextPath = (0, helpers_1.getContextPath)(appDataCopy, name);
|
|
43
|
+
(0, lodash_1.assign)(appDataCopy, { name, key, contextPath });
|
|
44
|
+
readJsonInnerResolveMethod(appDataCopy);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const json = await new Promise(resolve => {
|
|
48
|
+
readJsonInnerResolveMethod = resolve;
|
|
49
|
+
(0, fs_1.createReadStream)(path)
|
|
50
|
+
.pipe((0, unzip_stream_1.Parse)())
|
|
51
|
+
.on('entry', entry => {
|
|
52
|
+
const fileName = entry.path;
|
|
53
|
+
const isCumulocity = !!fileName.match(options_1.options['PATH.BUILT_MANIFEST_FILE']);
|
|
54
|
+
const macTrash = !!fileName.match(/__MACOSX/);
|
|
55
|
+
const readFile = isCumulocity && !macTrash;
|
|
56
|
+
if (readFile) {
|
|
57
|
+
pendingFiles++;
|
|
58
|
+
entry.on('data', parseFileData);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
entry.autodrain();
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
.on('close', onClose);
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
fileName: (0, path_1.basename)(path),
|
|
68
|
+
json,
|
|
69
|
+
buffer: (0, fs_1.createReadStream)(path),
|
|
70
|
+
size
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
exports.getAppAsZip = getAppAsZip;
|
|
74
|
+
//# sourceMappingURL=app-as-zip-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-as-zip-file.js","sourceRoot":"","sources":["../../../../src/builders/deploy/app-as-zip-file.ts"],"names":[],"mappings":";;;AAAA,mCAA2C;AAC3C,+BAAgC;AAChC,2CAA6D;AAC7D,2BAAgD;AAChD,+CAAmD;AACnD,uCAA2E;AAG3E;;;;;GAKG;AACI,KAAK,UAAU,WAAW,CAAC,IAAY;IAC5C,MAAM,IAAI,GAAG,IAAA,aAAQ,EAAC,IAAI,CAAC,CAAC,IAAI,CAAC;IACjC,IAAI,OAAO,GAAG,EAAyB,CAAC;IACxC,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,0BAAgE,CAAC;IACrE,MAAM,aAAa,GAAG,CAAC,IAAS,EAAE,EAAE;QAClC,IAAI;YACF,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC7C,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAA,uBAAa,EAAC,QAAQ,CAAC,CAAC,CAAC;SAC3D;QAAC,OAAO,CAAC,EAAE;YACV,aAAa;SACd;QACD,YAAY,EAAE,CAAC;QACf,cAAc,EAAE,CAAC;IACnB,CAAC,CAAC;IACF,MAAM,OAAO,GAAG,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MAAM,EAAE,aAAa,CAAC,CAAC;aACjC;iBAAM;gBACL,KAAK,CAAC,SAAS,EAAE,CAAC;aACnB;QACH,CAAC,CAAC;aACD,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ,EAAE,IAAA,eAAQ,EAAC,IAAI,CAAC;QACxB,IAAI;QACJ,MAAM,EAAE,IAAA,qBAAgB,EAAC,IAAI,CAAC;QAC9B,IAAI;KACL,CAAC;AACJ,CAAC;AA1DD,kCA0DC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BuilderContext } from '@angular-devkit/architect';
|
|
2
|
+
import { AppToDeploy } from './Deploy.model';
|
|
3
|
+
/**
|
|
4
|
+
* Builds an application, zips it and extracts application metadata and file buffer (raw data).
|
|
5
|
+
*
|
|
6
|
+
* @param browserTarget - Target build configuration.
|
|
7
|
+
* @param context - The Angular builder context.
|
|
8
|
+
* @returns A Promise that resolves to object representing the application.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildAndZipApp(browserTarget: string, context: BuilderContext): Promise<AppToDeploy>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildAndZipApp = void 0;
|
|
4
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const fs_extra_1 = require("fs-extra");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
const zipdir = require("zip-dir");
|
|
11
|
+
const options_1 = require("../../options");
|
|
12
|
+
const helpers_1 = require("../../webpack/utils/helpers");
|
|
13
|
+
const helpers_2 = require("./helpers");
|
|
14
|
+
/**
|
|
15
|
+
* Builds an application, zips it and extracts application metadata and file buffer (raw data).
|
|
16
|
+
*
|
|
17
|
+
* @param browserTarget - Target build configuration.
|
|
18
|
+
* @param context - The Angular builder context.
|
|
19
|
+
* @returns A Promise that resolves to object representing the application.
|
|
20
|
+
*/
|
|
21
|
+
async function buildAndZipApp(browserTarget, context) {
|
|
22
|
+
const envOptions = await (0, helpers_1.getOptionsFromContext)(context);
|
|
23
|
+
const buildTarget = (0, architect_1.targetFromTargetString)(browserTarget);
|
|
24
|
+
const build = await context.scheduleTarget(buildTarget, {});
|
|
25
|
+
const result = await build.result;
|
|
26
|
+
const outputPath = result.baseOutputPath;
|
|
27
|
+
return await getAppAsDirectory(outputPath, envOptions.runTime);
|
|
28
|
+
}
|
|
29
|
+
exports.buildAndZipApp = buildAndZipApp;
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves an application as a directory by path, including application metadata and a zipped buffer.
|
|
32
|
+
*
|
|
33
|
+
* @param path - The path to the application directory.
|
|
34
|
+
* @param appOptions - The runtime options for the application.
|
|
35
|
+
* @returns A promise that resolves to an object containing application metadata and a zipped buffer.
|
|
36
|
+
*/
|
|
37
|
+
async function getAppAsDirectory(path, appOptions) {
|
|
38
|
+
let appFileData = {};
|
|
39
|
+
try {
|
|
40
|
+
appFileData = await fileToAppData((0, path_1.resolve)(path, options_1.options['PATH.BUILT_MANIFEST_FILE']));
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
// do nothing
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
json: getAppData(appFileData, path, appOptions),
|
|
47
|
+
buffer: await zipApplication(path)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Reads a JSON file from the specified file path and converts it to application metadata.
|
|
52
|
+
*
|
|
53
|
+
* @param filePath - The path to the JSON file.
|
|
54
|
+
* @returns Application metadata extracted from the JSON file.
|
|
55
|
+
*/
|
|
56
|
+
async function fileToAppData(filePath) {
|
|
57
|
+
const fileData = await (0, fs_extra_1.readJSON)(filePath);
|
|
58
|
+
return (0, helpers_2.dataToAppData)(fileData);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Constructs application data based on the provided file data, path, and runtime options.
|
|
62
|
+
*
|
|
63
|
+
* @param fileData - The data extracted from the JSON file.
|
|
64
|
+
* @param path - The path to the application directory.
|
|
65
|
+
* @param appOptions - The runtime options for the application.
|
|
66
|
+
* @returns Constructed application data.
|
|
67
|
+
*/
|
|
68
|
+
function getAppData(fileData, path, appOptions) {
|
|
69
|
+
const data = Object.assign(fileData, appOptions);
|
|
70
|
+
const defaults = {
|
|
71
|
+
type: 'HOSTED'
|
|
72
|
+
};
|
|
73
|
+
const requiredKeys = ['contextPath', 'key', 'name'];
|
|
74
|
+
const copyKeys = requiredKeys.concat(['type', 'availability']);
|
|
75
|
+
const appData = Object.assign({}, defaults, (0, lodash_1.pick)(data, copyKeys));
|
|
76
|
+
const name = (0, helpers_2.getName)(appData, (0, path_1.basename)(path));
|
|
77
|
+
const key = (0, helpers_2.getKey)(appData, name);
|
|
78
|
+
const contextPath = (0, helpers_2.getContextPath)(appData, name);
|
|
79
|
+
const isPackage = data.isPackage;
|
|
80
|
+
const version = data.version;
|
|
81
|
+
(0, lodash_1.assign)(appData, { name, key, contextPath, isPackage, version });
|
|
82
|
+
requiredKeys.forEach(field => {
|
|
83
|
+
if (!appData[field]) {
|
|
84
|
+
throw new Error(`Application property "${field}" not defined.`);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return appData;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Zips the specified application directory.
|
|
91
|
+
*
|
|
92
|
+
* @param applicationPath - The path to the application directory.
|
|
93
|
+
* @returns A promise that resolves to a buffer containing the zipped application.
|
|
94
|
+
*/
|
|
95
|
+
async function zipApplication(applicationPath) {
|
|
96
|
+
return new Promise(resolve => {
|
|
97
|
+
zipdir(applicationPath, (err, buffer) => {
|
|
98
|
+
if (err) {
|
|
99
|
+
throw err;
|
|
100
|
+
}
|
|
101
|
+
resolve(buffer);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=build-and-zip-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-and-zip-app.js","sourceRoot":"","sources":["../../../../src/builders/deploy/build-and-zip-app.ts"],"names":[],"mappings":";;;AAAA,yDAAmF;AACnF,mCAAsC;AACtC,uCAAoC;AACpC,+BAAwD;AACxD,6DAA6D;AAC7D,aAAa;AACb,kCAAkC;AAClC,2CAA6D;AAC7D,yDAAoE;AAEpE,uCAA2E;AAG3E;;;;;;GAMG;AACI,KAAK,UAAU,cAAc,CAClC,aAAqB,EACrB,OAAuB;IAEvB,MAAM,UAAU,GAAG,MAAM,IAAA,+BAAqB,EAAC,OAAO,CAAC,CAAC;IAExD,MAAM,WAAW,GAAG,IAAA,kCAAsB,EAAC,aAAa,CAAC,CAAC;IAE1D,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC;IAClC,MAAM,UAAU,GAAG,MAAM,CAAC,cAAwB,CAAC;IACnD,OAAO,MAAM,iBAAiB,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AAZD,wCAYC;AACD;;;;;;GAMG;AACH,KAAK,UAAU,iBAAiB,CAAC,IAAY,EAAE,UAA0B;IACvE,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,IAAI;QACF,WAAW,GAAG,MAAM,aAAa,CAC/B,IAAA,cAAW,EAAC,IAAI,EAAE,iBAAiB,CAAC,0BAA0B,CAAC,CAAC,CACjE,CAAC;KACH;IAAC,OAAO,CAAC,EAAE;QACV,aAAa;KACd;IACD,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,WAAW,EAAE,IAAI,EAAE,UAAU,CAAC;QAC/C,MAAM,EAAE,MAAM,cAAc,CAAC,I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,EAAE;QAC3B,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,yBAAyB,KAAK,gBAAgB,CAAC,CAAC;SACjE;IACH,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC;AACD;;;;;GAKG;AACH,KAAK,UAAU,cAAc,CAAC,eAAuB;IACnD,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,MAAM,CAAC,eAAe,EAAE,CAAC,GAAQ,EAAE,MAAW,EAAE,EAAE;YAChD,IAAI,GAAG,EAAE;gBACP,MAAM,GAAG,CAAC;aACX;YACD,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
4
|
+
const client_1 = require("@c8y/client");
|
|
5
|
+
const options_1 = require("../../options");
|
|
6
|
+
const chalk = require("chalk");
|
|
7
|
+
const app_as_zip_file_1 = require("./app-as-zip-file");
|
|
8
|
+
const build_and_zip_app_1 = require("./build-and-zip-app");
|
|
9
|
+
const dotenv_1 = require("dotenv");
|
|
10
|
+
const Deploy_model_1 = require("./Deploy.model");
|
|
11
|
+
/**
|
|
12
|
+
* Creates a Builder instance for deploying an application using the specified deploy builder function.
|
|
13
|
+
*/
|
|
14
|
+
const builder = (0, architect_1.createBuilder)(deployBuilder);
|
|
15
|
+
exports.default = builder;
|
|
16
|
+
/**
|
|
17
|
+
* Client class instance for communicating with server (authentication, application upload).
|
|
18
|
+
*/
|
|
19
|
+
let client;
|
|
20
|
+
/**
|
|
21
|
+
* Deployment options.
|
|
22
|
+
*/
|
|
23
|
+
let builderOptions;
|
|
24
|
+
/**
|
|
25
|
+
* Deploys an application based on the provided options.
|
|
26
|
+
* There are two scenarios for deployment:
|
|
27
|
+
* - user provides workspace: application is build, zipped and deployed
|
|
28
|
+
* - user provides already zipped application: application data is extracted and app is then deployed
|
|
29
|
+
*
|
|
30
|
+
* @param options - The options for deployment.
|
|
31
|
+
* @param context - Angular builder context.
|
|
32
|
+
* @returns A success flag indicating whether the deployment was successful.
|
|
33
|
+
*/
|
|
34
|
+
async function deployBuilder(options, context) {
|
|
35
|
+
var _a;
|
|
36
|
+
(0, dotenv_1.config)();
|
|
37
|
+
builderOptions = getDeployOptions(options);
|
|
38
|
+
client = await createClient(options);
|
|
39
|
+
const appToDeploy = !!options.zipPath
|
|
40
|
+
? await (0, app_as_zip_file_1.getAppAsZip)(options.zipPath)
|
|
41
|
+
: await (0, build_and_zip_app_1.buildAndZipApp)(options.browserTarget, context);
|
|
42
|
+
(_a = appToDeploy.json).type ?? (_a.type = client_1.ApplicationType.HOSTED);
|
|
43
|
+
try {
|
|
44
|
+
await deploy(appToDeploy);
|
|
45
|
+
}
|
|
46
|
+
catch (ex) {
|
|
47
|
+
console.error(options_1.options['TXT.APP_CREATE_FAILED']);
|
|
48
|
+
console.error(ex);
|
|
49
|
+
return { success: false };
|
|
50
|
+
}
|
|
51
|
+
return { success: true };
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Retrieves options from .env file and overrides deploy options if environment properties are provided.
|
|
55
|
+
* Validates required options.
|
|
56
|
+
*
|
|
57
|
+
* @param options - Base options provided to builder.
|
|
58
|
+
* @returns Builder options with values from environment.
|
|
59
|
+
*/
|
|
60
|
+
function getDeployOptions(options) {
|
|
61
|
+
for (const [key, value] of Object.entries(options)) {
|
|
62
|
+
options[key] =
|
|
63
|
+
value || process.env[`${options_1.options.ENV_PREFIX}${key.toUpperCase()}`];
|
|
64
|
+
}
|
|
65
|
+
Deploy_model_1.REQUIRED_OPTIONS.forEach(key => {
|
|
66
|
+
if (!options[key]) {
|
|
67
|
+
throw new Error(options_1.options['TXT.REQUIRED_OPTION'](key));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return options;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates client class instance for communicating with server (authentication, application upload).
|
|
74
|
+
*
|
|
75
|
+
* @param options - Authorization options.
|
|
76
|
+
* @returns A Promise that resolves to the created client.
|
|
77
|
+
*/
|
|
78
|
+
async function createClient({ user, password, url: baseUrl, tenant }) {
|
|
79
|
+
const basicAuth = {
|
|
80
|
+
user,
|
|
81
|
+
password,
|
|
82
|
+
tenant
|
|
83
|
+
};
|
|
84
|
+
try {
|
|
85
|
+
return await client_1.Client.authenticate(basicAuth, baseUrl);
|
|
86
|
+
}
|
|
87
|
+
catch (ex) {
|
|
88
|
+
console.debug(ex);
|
|
89
|
+
throw new Error(options_1.options['TXT.INVALID_CREDENTIALS_BASEURL'](basicAuth.baseUrl));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Uploads an application to server, make it active and subscribes tenant to this app.
|
|
94
|
+
*
|
|
95
|
+
* @param appToDeploy - The application to deploy.
|
|
96
|
+
* @returns A Promise that resolves when the deployment is complete.
|
|
97
|
+
*/
|
|
98
|
+
async function deploy({ json, buffer, fileName, size }) {
|
|
99
|
+
const application = await getApplicationOrCreateIfNotExists(json);
|
|
100
|
+
const uploadedFile = await uploadApplication(application, buffer, fileName, size);
|
|
101
|
+
if (application.isPackage) {
|
|
102
|
+
await client.application.update({
|
|
103
|
+
id: application.id,
|
|
104
|
+
activeVersionId: uploadedFile.binaryId
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
await activateBinary(uploadedFile, application);
|
|
109
|
+
}
|
|
110
|
+
if (json.type === 'HOSTED' && json.availability === client_1.ApplicationAvailability.MARKET) {
|
|
111
|
+
await subscribeTenantToApp(application);
|
|
112
|
+
console.info(chalk.blue('Subscribing app to current tenant.'));
|
|
113
|
+
}
|
|
114
|
+
const msg = options_1.options['TXT.APP_DEPLOYED'](application.contextPath);
|
|
115
|
+
console.info(chalk.green.bold(msg));
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Retrieves an existing application from server or creates a new one if it doesn't exist.
|
|
119
|
+
*
|
|
120
|
+
* @param application - The application to retrieve or create.
|
|
121
|
+
* @returns A Promise that resolves to the retrieved or created application.
|
|
122
|
+
*/
|
|
123
|
+
async function getApplicationOrCreateIfNotExists(application) {
|
|
124
|
+
const remoteApplication = await getApplication(application);
|
|
125
|
+
return !remoteApplication
|
|
126
|
+
? await createApplication(application)
|
|
127
|
+
: Object.assign(remoteApplication, application);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Uploads an application binary to the server.
|
|
131
|
+
*
|
|
132
|
+
* @param application - The application for which the binary is being uploaded.
|
|
133
|
+
* @param buffer - The binary data to upload.
|
|
134
|
+
* @param filePath - The file path for the binary (optional).
|
|
135
|
+
* @param size - The size of the binary (optional).
|
|
136
|
+
* @returns A Promise that resolves to the uploaded binary data.
|
|
137
|
+
*/
|
|
138
|
+
async function uploadApplication(application, buffer, filePath, size) {
|
|
139
|
+
if (!filePath) {
|
|
140
|
+
filePath = `${application.contextPath}.zip`;
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
const msg = options_1.options['TXT.APP_UPLOADING'](buffer.length || size);
|
|
144
|
+
const tags = builderOptions.tags;
|
|
145
|
+
if (tags && !application.isPackage) {
|
|
146
|
+
console.info(chalk.yellow(options_1.options['TXT.NOT_PACKAGE_WARNING']));
|
|
147
|
+
}
|
|
148
|
+
console.info(chalk.green(msg));
|
|
149
|
+
const uploadOverrides = getPackageUploadOverrides(application);
|
|
150
|
+
const { data } = await client.application
|
|
151
|
+
.binary(application)
|
|
152
|
+
.upload(buffer, filePath, uploadOverrides);
|
|
153
|
+
return data;
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
console.debug(err);
|
|
157
|
+
console.error(`${options_1.options['TXT.APP_UPLOAD_ERROR']} ${err.res.status}`);
|
|
158
|
+
console.error(JSON.stringify(err.data, null, 2));
|
|
159
|
+
process.exit(9);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Activates a binary for an application.
|
|
164
|
+
*
|
|
165
|
+
* @param uploadedFile - The uploaded binary file.
|
|
166
|
+
* @param application - The application to activate the binary for.
|
|
167
|
+
*/
|
|
168
|
+
async function activateBinary(uploadedFile, application) {
|
|
169
|
+
application.activeVersionId = `${uploadedFile.id}`;
|
|
170
|
+
delete application.type;
|
|
171
|
+
try {
|
|
172
|
+
console.info(chalk.green(options_1.options['TXT.APP_ACTIVATING'](uploadedFile.id)));
|
|
173
|
+
await client.application.update(application);
|
|
174
|
+
}
|
|
175
|
+
catch (err) {
|
|
176
|
+
console.debug(err);
|
|
177
|
+
const msg = options_1.options['TXT.APP_ACTIVATING_FAILED'](application.contextPath);
|
|
178
|
+
console.error(`${msg} ${err.res.status}`);
|
|
179
|
+
console.error(JSON.stringify(err.data, null, 2));
|
|
180
|
+
process.exit(9);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Subscribes a tenant to an application.
|
|
185
|
+
*
|
|
186
|
+
* @param app - The application to subscribe to.
|
|
187
|
+
*/
|
|
188
|
+
async function subscribeTenantToApp(app) {
|
|
189
|
+
const headers = { 'content-type': 'application/json', accept: 'application/json' };
|
|
190
|
+
const body = JSON.stringify({ application: { id: app.id } });
|
|
191
|
+
await client.core.fetch(`/tenant/tenants/${client.core.tenant}/applications`, {
|
|
192
|
+
method: 'POST',
|
|
193
|
+
headers,
|
|
194
|
+
body
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Retrieves an application based on the provided application object.
|
|
199
|
+
*
|
|
200
|
+
* @param application - The application to retrieve.
|
|
201
|
+
* @returns A Promise that resolves to the retrieved application or null if not found.
|
|
202
|
+
*/
|
|
203
|
+
async function getApplication(application) {
|
|
204
|
+
const { tenant } = client.core;
|
|
205
|
+
try {
|
|
206
|
+
console.info(chalk.green(options_1.options['TXT.APP_FETCHING']));
|
|
207
|
+
const { data: applications } = await client.application.listByOwner(client.core.tenant, {
|
|
208
|
+
pageSize: 1000
|
|
209
|
+
});
|
|
210
|
+
return applications.find(v => v.owner?.tenant.id === tenant && v.contextPath === application.contextPath);
|
|
211
|
+
}
|
|
212
|
+
catch (err) {
|
|
213
|
+
console.debug(err);
|
|
214
|
+
console.error(`${options_1.options['TXT.APP_FETCHING_FAILED']} ${err.res.status}`);
|
|
215
|
+
console.error(JSON.stringify(err.data, null, 2));
|
|
216
|
+
process.exit(9);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Creates a new application on the server.
|
|
221
|
+
*
|
|
222
|
+
* @param application - The application to create.
|
|
223
|
+
* @returns A Promise that resolves to the created application.
|
|
224
|
+
*/
|
|
225
|
+
async function createApplication(application) {
|
|
226
|
+
try {
|
|
227
|
+
console.info(chalk.green(options_1.options['TXT.APP_CREATING']));
|
|
228
|
+
const { data } = await client.application.create(application);
|
|
229
|
+
return data;
|
|
230
|
+
}
|
|
231
|
+
catch (err) {
|
|
232
|
+
console.debug(err);
|
|
233
|
+
console.error(`${options_1.options['TXT.APP_CREATE_FAILED']} ${err.res.status}`);
|
|
234
|
+
console.error(JSON.stringify(err.data, null, 2));
|
|
235
|
+
process.exit(9);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Generates upload overrides for package uploads.
|
|
240
|
+
*
|
|
241
|
+
* @param app - The application for which overrides are generated.
|
|
242
|
+
* @returns Upload overrides or undefined if the application is not a package.
|
|
243
|
+
*/
|
|
244
|
+
function getPackageUploadOverrides(app) {
|
|
245
|
+
if (!app.isPackage) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const tag = builderOptions.tags;
|
|
249
|
+
let tagsArray;
|
|
250
|
+
if (!tag) {
|
|
251
|
+
tagsArray = [];
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
tagsArray = tag.includes(',') ? tag.split(',') : [tag];
|
|
255
|
+
}
|
|
256
|
+
const version = app.version;
|
|
257
|
+
return {
|
|
258
|
+
listUrl: 'versions',
|
|
259
|
+
headers: {
|
|
260
|
+
Accept: 'application/vnd.com.nsn.cumulocity.applicationVersion+json;charset=UTF-8;ver=0.9'
|
|
261
|
+
},
|
|
262
|
+
bodyFileProperty: 'applicationBinary',
|
|
263
|
+
requestBody: {
|
|
264
|
+
applicationVersion: Object.assign({ version, tags: tagsArray })
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
//# sourceMappingURL=deploy-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy-builder.js","sourceRoot":"","sources":["../../../../src/builders/deploy/deploy-builder.ts"],"names":[],"mappings":";;AAAA,yDAA0E;AAC1E,wCAOqB;AACrB,2CAA6D;AAE7D,+BAA+B;AAC/B,uDAAgD;AAChD,2DAAqD;AACrD,mCAAgD;AAChD,iDAA+D;AAE/D;;GAEG;AACH,MAAM,OAAO,GAAY,IAAA,yBAAa,EAA0B,aAAa,CAAC,CAAC;AAC/E,kBAAe,OAAO,CAAC;AAEvB;;GAEG;AACH,IAAI,MAAc,CAAC;AACnB;;GAEG;AACH,IAAI,cAAuC,CAAC;AAE5C;;;;;;;;;GASG;AACH,KAAK,UAAU,aAAa,CAC1B,OAAgC,EAChC,OAAuB;;IAEvB,IAAA,eAAY,GAAE,CAAC;IACf,cAAc,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAE3C,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC;IAErC,MAAM,WAAW,GAAgB,CAAC,CAAC,OAAO,CAAC,OAAO;QAChD,CAAC,CAAC,MAAM,IAAA,6BAAW,EAAC,OAAO,CAAC,OAAO,CAAC;QACpC,CAAC,CAAC,MAAM,IAAA,kCAAc,EAAC,OAAO,CAAC,aAAuB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SAAS,EAAE,CAAC;SAChE;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AppToDeploy } from './Deploy.model';
|
|
2
|
+
/**
|
|
3
|
+
* Converts the provided file data to application data.
|
|
4
|
+
*
|
|
5
|
+
* @param fileData - The file data to convert.
|
|
6
|
+
* @returns The application data.
|
|
7
|
+
*/
|
|
8
|
+
export declare function dataToAppData(fileData: any): any;
|
|
9
|
+
/**
|
|
10
|
+
* Gets the name from the application data.
|
|
11
|
+
*
|
|
12
|
+
* @param appData - The application data.
|
|
13
|
+
* @param fallbackStr - The fallback string to use if name is not found.
|
|
14
|
+
* @returns The name of the application.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getName(appData: AppToDeploy['json'], fallbackStr?: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the key from the application data.
|
|
19
|
+
*
|
|
20
|
+
* @param appData - The application data.
|
|
21
|
+
* @param name - The name to use in case the key is not found.
|
|
22
|
+
* @returns The key of the application.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getKey(appData: AppToDeploy['json'], name: string): string;
|
|
25
|
+
export declare function getContextPath(appData: AppToDeploy['json'], name: string): string;
|