zephyr-agent 0.0.41 → 0.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/auth/login.js +1 -0
- package/dist/lib/auth/login.js.map +1 -1
- package/dist/lib/build-context/find-nearest-package-json.js +7 -8
- package/dist/lib/build-context/find-nearest-package-json.js.map +1 -1
- package/dist/lib/build-context/fs-cache-for-package-json.d.ts +1 -1
- package/dist/lib/build-context/git-provider-utils.d.ts +11 -0
- package/dist/lib/build-context/git-provider-utils.js +66 -0
- package/dist/lib/build-context/git-provider-utils.js.map +1 -0
- package/dist/lib/build-context/ze-util-get-git-info.d.ts +1 -1
- package/dist/lib/build-context/ze-util-get-git-info.js +14 -14
- package/dist/lib/build-context/ze-util-get-git-info.js.map +1 -1
- package/dist/lib/build-context/ze-util-read-package-json.d.ts +1 -1
- package/dist/lib/build-context/ze-util-read-package-json.js +6 -8
- package/dist/lib/build-context/ze-util-read-package-json.js.map +1 -1
- package/dist/lib/deployment/cloudflare.strategy.d.ts +1 -1
- package/dist/lib/deployment/fastly.strategy.d.ts +1 -1
- package/dist/lib/deployment/get-upload-strategy.d.ts +1 -1
- package/dist/lib/deployment/get-upload-strategy.js +8 -2
- package/dist/lib/deployment/get-upload-strategy.js.map +1 -1
- package/dist/lib/deployment/netlify.strategy.d.ts +1 -1
- package/dist/lib/deployment/upload-base/upload-assets.d.ts +2 -2
- package/dist/lib/deployment/upload-base/upload-build-stats-and-enable-envs.d.ts +2 -2
- package/dist/lib/edge-actions/ze-enable-snapshot-on-pages.js +4 -1
- package/dist/lib/edge-actions/ze-enable-snapshot-on-pages.js.map +1 -1
- package/dist/lib/edge-actions/ze-upload-assets.d.ts +1 -1
- package/dist/lib/edge-actions/ze-upload-snapshot.d.ts +1 -1
- package/dist/lib/edge-hash-list/distributed-hash-control.d.ts +1 -1
- package/dist/lib/edge-hash-list/get-missing-assets.d.ts +1 -1
- package/dist/lib/edge-requests/get-application-configuration.d.ts +1 -1
- package/dist/lib/errors/codes.d.ts +1 -1
- package/dist/lib/errors/codes.js +5 -1
- package/dist/lib/errors/codes.js.map +1 -1
- package/dist/lib/errors/zephyr-error.d.ts +2 -2
- package/dist/lib/errors/zephyr-error.js +1 -1
- package/dist/lib/errors/zephyr-error.js.map +1 -1
- package/dist/lib/http/fetch-with-retries.d.ts +1 -1
- package/dist/lib/http/fetch-with-retries.js +30 -20
- package/dist/lib/http/fetch-with-retries.js.map +1 -1
- package/dist/lib/http/upload-envs.d.ts +2 -2
- package/dist/lib/http/upload-file.d.ts +1 -1
- package/dist/lib/http/upload-snapshot.d.ts +1 -1
- package/dist/lib/http/ze-http-request.js +5 -13
- package/dist/lib/http/ze-http-request.js.map +1 -1
- package/dist/lib/logging/debug.d.ts +0 -17
- package/dist/lib/logging/debug.js +1 -26
- package/dist/lib/logging/debug.js.map +1 -1
- package/dist/lib/logging/ze-log-event.d.ts +1 -1
- package/dist/lib/logging/ze-log-event.js +7 -4
- package/dist/lib/logging/ze-log-event.js.map +1 -1
- package/dist/lib/node-persist/partial-assets-map.d.ts +1 -1
- package/dist/lib/transformers/ze-build-assets-map.d.ts +1 -1
- package/dist/lib/transformers/ze-build-assets.d.ts +1 -1
- package/dist/lib/transformers/ze-build-dash-data.d.ts +2 -2
- package/dist/lib/transformers/ze-build-snapshot.d.ts +2 -2
- package/dist/lib/transformers/ze-build-snapshot.js +4 -1
- package/dist/lib/transformers/ze-build-snapshot.js.map +1 -1
- package/dist/package.json +29 -15
- package/dist/zephyr-engine/index.d.ts +11 -10
- package/dist/zephyr-engine/index.js +31 -22
- package/dist/zephyr-engine/index.js.map +1 -1
- package/dist/zephyr-engine/resolve_remote_dependency.js +1 -1
- package/dist/zephyr-engine/resolve_remote_dependency.js.map +1 -1
- package/package.json +27 -13
- package/dist/lib/errors/configuration-error.d.ts +0 -3
- package/dist/lib/errors/configuration-error.js +0 -18
- package/dist/lib/errors/configuration-error.js.map +0 -1
- package/dist/lib/errors/package-json-not-found-error.d.ts +0 -4
- package/dist/lib/errors/package-json-not-found-error.js +0 -11
- package/dist/lib/errors/package-json-not-found-error.js.map +0 -1
- package/dist/lib/errors/package-json-not-valid-error.d.ts +0 -4
- package/dist/lib/errors/package-json-not-valid-error.js +0 -11
- package/dist/lib/errors/package-json-not-valid-error.js.map +0 -1
- package/dist/lib/errors/package-not-a-json-error.d.ts +0 -4
- package/dist/lib/errors/package-not-a-json-error.js +0 -11
- package/dist/lib/errors/package-not-a-json-error.js.map +0 -1
- package/dist/lib/logging/error-codes-messages.d.ts +0 -206
- package/dist/lib/logging/error-codes-messages.js +0 -203
- package/dist/lib/logging/error-codes-messages.js.map +0 -1
- package/dist/lib/logging/error-formatted-message.d.ts +0 -5
- package/dist/lib/logging/error-formatted-message.js +0 -36
- package/dist/lib/logging/error-formatted-message.js.map +0 -1
|
@@ -1,31 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fetchWithRetries = fetchWithRetries;
|
|
4
|
-
const
|
|
4
|
+
const errors_1 = require("../errors");
|
|
5
5
|
async function fetchWithRetries(url, options = {}, retries = 3) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
11
|
-
}
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
7
|
+
for (let retry = 0; retry < retries; retry++) {
|
|
8
|
+
const response = await fetch(url, options).catch((error) => ({ ok: false, error }));
|
|
9
|
+
if (response.ok) {
|
|
12
10
|
return response;
|
|
13
11
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
(
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
if (error.code === 'EPIPE' || error.message.includes('network')) {
|
|
21
|
-
(0, debug_1.ze_log)(`Attempt ${attempt} failed due to network issue, retrying...`);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
(0, debug_1.ze_log)(`Attempt ${attempt} failed with error:`, error.message);
|
|
25
|
-
throw error;
|
|
12
|
+
// Network failure, retry until attempts are exhausted
|
|
13
|
+
if ('error' in response) {
|
|
14
|
+
if (((_a = response.error) === null || _a === void 0 ? void 0 : _a.code) === 'EPIPE' ||
|
|
15
|
+
((_c = (_b = response.error) === null || _b === void 0 ? void 0 : _b.message) === null || _c === void 0 ? void 0 : _c.includes('network'))) {
|
|
16
|
+
continue;
|
|
26
17
|
}
|
|
18
|
+
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_UNKNOWN, {
|
|
19
|
+
message: 'Unknown error occurred',
|
|
20
|
+
cause: response.error,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
// Retry on server failures
|
|
24
|
+
if (response.status >= 500) {
|
|
25
|
+
continue;
|
|
27
26
|
}
|
|
27
|
+
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_HTTP_ERROR, {
|
|
28
|
+
status: response.status,
|
|
29
|
+
url: url.toString(),
|
|
30
|
+
content: await response.text(),
|
|
31
|
+
method: (_e = (_d = options.method) === null || _d === void 0 ? void 0 : _d.toUpperCase()) !== null && _e !== void 0 ? _e : 'GET',
|
|
32
|
+
});
|
|
28
33
|
}
|
|
29
|
-
throw new
|
|
34
|
+
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_HTTP_ERROR, {
|
|
35
|
+
status: -1,
|
|
36
|
+
url: url.toString(),
|
|
37
|
+
content: 'Max retries reached',
|
|
38
|
+
method: (_g = (_f = options.method) === null || _f === void 0 ? void 0 : _f.toUpperCase()) !== null && _g !== void 0 ? _g : 'GET',
|
|
39
|
+
});
|
|
30
40
|
}
|
|
31
41
|
//# sourceMappingURL=fetch-with-retries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-with-retries.js","sourceRoot":"","sources":["../../../src/lib/http/fetch-with-retries.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+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,EAAE;YAC9B,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,MAAM,0CAAE,WAAW,EAAE,mCAAI,KAAK;SAC/C,CAAC,CAAC;IACL,CAAC;IAED,MAAM,IAAI,oBAAW,CAAC,iBAAQ,CAAC,cAAc,EAAE;QAC7C,MAAM,EAAE,CAAC,CAAC;QACV,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE;QACnB,OAAO,EAAE,qBAAqB;QAC9B,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,MAAM,0CAAE,WAAW,EAAE,mCAAI,KAAK;KAC/C,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LogEvent } from '../logging/ze-log-event';
|
|
2
|
-
import { ZeUploadBuildStats } from 'zephyr-edge-contract';
|
|
1
|
+
import type { LogEvent } from '../logging/ze-log-event';
|
|
2
|
+
import type { ZeUploadBuildStats } from 'zephyr-edge-contract';
|
|
3
3
|
export declare function uploadEnvs({ body, application_uid, logEvent, }: {
|
|
4
4
|
body: ZeUploadBuildStats;
|
|
5
5
|
application_uid: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type UploadableAsset } from 'zephyr-edge-contract';
|
|
2
|
-
import { ZeApplicationConfig } from '../node-persist/upload-provider-options';
|
|
2
|
+
import type { ZeApplicationConfig } from '../node-persist/upload-provider-options';
|
|
3
3
|
export interface UploadFileProps {
|
|
4
4
|
hash: string;
|
|
5
5
|
asset: UploadableAsset;
|
|
@@ -50,7 +50,7 @@ class ZeHttpRequest {
|
|
|
50
50
|
if (is_preview && tslib_1.__classPrivateFieldGet(req, _ZeHttpRequest_url, "f").host === ze_api_endpoint_host) {
|
|
51
51
|
tslib_1.__classPrivateFieldGet(req, _ZeHttpRequest_url, "f").searchParams.set('api_host', zephyr_api_endpoint);
|
|
52
52
|
}
|
|
53
|
-
tslib_1.__classPrivateFieldGet(req, _ZeHttpRequest_instances, "m", _ZeHttpRequest_request).call(req);
|
|
53
|
+
void tslib_1.__classPrivateFieldGet(req, _ZeHttpRequest_instances, "m", _ZeHttpRequest_request).call(req);
|
|
54
54
|
return req;
|
|
55
55
|
}
|
|
56
56
|
/** Transforms `Promise<HttpResponse<T>>` into `Promise<T>` */
|
|
@@ -68,17 +68,9 @@ _ZeHttpRequest_start = new WeakMap(), _ZeHttpRequest_url = new WeakMap(), _ZeHtt
|
|
|
68
68
|
}, _ZeHttpRequest_resolve = function _ZeHttpRequest_resolve(data) {
|
|
69
69
|
tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_promise, "f").resolve([true, null, data]);
|
|
70
70
|
}, _ZeHttpRequest_request = async function _ZeHttpRequest_request() {
|
|
71
|
-
var _a, _b, _c, _d, _e
|
|
71
|
+
var _a, _b, _c, _d, _e;
|
|
72
72
|
try {
|
|
73
73
|
const response = await (0, fetch_with_retries_1.fetchWithRetries)(tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_url, "f"), Object.assign(Object.assign({}, tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_options, "f")), { body: tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_data, "f") }));
|
|
74
|
-
if (!response) {
|
|
75
|
-
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_HTTP_ERROR, {
|
|
76
|
-
content: 'No response found',
|
|
77
|
-
method: (_b = (_a = tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_options, "f").method) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== null && _b !== void 0 ? _b : 'GET',
|
|
78
|
-
url: tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_url, "f").toString(),
|
|
79
|
-
status: -1,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
74
|
const resText = await response.text();
|
|
83
75
|
if (response.status === 401) {
|
|
84
76
|
// Clean the tokens and throw an error
|
|
@@ -101,7 +93,7 @@ _ZeHttpRequest_start = new WeakMap(), _ZeHttpRequest_url = new WeakMap(), _ZeHtt
|
|
|
101
93
|
if (response.status === undefined) {
|
|
102
94
|
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_HTTP_ERROR, {
|
|
103
95
|
content: 'No status code found',
|
|
104
|
-
method: (
|
|
96
|
+
method: (_b = (_a = tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_options, "f").method) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== null && _b !== void 0 ? _b : 'GET',
|
|
105
97
|
url: tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_url, "f").toString(),
|
|
106
98
|
status: -1,
|
|
107
99
|
});
|
|
@@ -110,13 +102,13 @@ _ZeHttpRequest_start = new WeakMap(), _ZeHttpRequest_url = new WeakMap(), _ZeHtt
|
|
|
110
102
|
(0, debug_1.ze_log)(message);
|
|
111
103
|
}
|
|
112
104
|
// Only parses data if reply content is json
|
|
113
|
-
const resData = (
|
|
105
|
+
const resData = (_c = (0, zephyr_edge_contract_1.safe_json_parse)(resText)) !== null && _c !== void 0 ? _c : resText;
|
|
114
106
|
if (response.status >= 300) {
|
|
115
107
|
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_HTTP_ERROR, {
|
|
116
108
|
status: response.status,
|
|
117
109
|
url: tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_url, "f").toString(),
|
|
118
110
|
content: resData,
|
|
119
|
-
method: (
|
|
111
|
+
method: (_e = (_d = tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_options, "f").method) === null || _d === void 0 ? void 0 : _d.toUpperCase()) !== null && _e !== void 0 ? _e : 'GET',
|
|
120
112
|
});
|
|
121
113
|
}
|
|
122
114
|
tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_instances, "m", _ZeHttpRequest_resolve).call(this, resData);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ze-http-request.js","sourceRoot":"","sources":["../../../src/lib/http/ze-http-request.ts"],"names":[],"mappings":";;;;;AAAA,sCAAkD;AAClD,iDAAoD;AACpD,4CAA0C;AAC1C,+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AAG,+BAAA,IAAI,4BAAO,IAAI;QACjF,CAAA,MAAA,+BAAA,IAAI,2BAAM,0CAAE,MAAM,EAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAA,+BAAA,IAAI,2BAAM,CAAC,MAAM,mCAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;QAChF,QAAQ,CAAC,CAAC,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE;QACvC,+BAAA,IAAI,8BAAS,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,+BAAA,IAAI,8BAAS,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;KACjE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO,GAAG;SACP,OAAO,CAAC,oBAAoB,EAAE,mBAAmB,CAAC;SAClD,OAAO,CAAC,wCAAwC,EAAE,iBAAiB,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
import type { Errors } from './error-codes-messages';
|
|
2
1
|
export declare const dimmedName: string;
|
|
3
2
|
export declare const brightBlueBgName: string;
|
|
4
3
|
export declare const brightYellowBgName: string;
|
|
5
4
|
export declare const brightGreenBgName: string;
|
|
6
5
|
export declare const brightRedBgName: string;
|
|
7
|
-
declare function print_error_with_docs<K extends keyof typeof Errors>(errMsg?: K, ...args: unknown[]): void;
|
|
8
6
|
export declare const ze_log: import("debug").Debugger;
|
|
9
|
-
/**
|
|
10
|
-
* `ze_error` is used widely to debug our local build and deployment. You can turn on
|
|
11
|
-
* debug mode or having it work normally to attached documentation with our error codes in
|
|
12
|
-
* [errors](./error-types.ts). We have added unknown class to the error object. If this is
|
|
13
|
-
* an error we haven't defined yet, you will need to do
|
|
14
|
-
*
|
|
15
|
-
* @deprecated
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* ze_error('ERR_UNKNOWN', `Error creating dist folder: ${(error as Error).message}`);
|
|
19
|
-
* ```
|
|
20
|
-
* to specify this is an undefined error at the front.
|
|
21
|
-
*/
|
|
22
|
-
export declare const ze_error: typeof print_error_with_docs;
|
|
23
|
-
export {};
|
|
@@ -1,42 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ze_log = exports.brightRedBgName = exports.brightGreenBgName = exports.brightYellowBgName = exports.brightBlueBgName = exports.dimmedName = void 0;
|
|
4
4
|
// light weight functions for decorated console.error + able to toggle different parts of whole module's logging result
|
|
5
5
|
const debug_1 = require("debug");
|
|
6
6
|
const picocolor_1 = require("./picocolor");
|
|
7
|
-
const debug_enabled_1 = require("./debug-enabled");
|
|
8
|
-
const error_formatted_message_1 = require("./error-formatted-message");
|
|
9
7
|
//TODO: this should be traced and logged into new relic
|
|
10
|
-
//TODO: print different colors to it + Capitalize maybe?
|
|
11
8
|
const name = ' ZEPHYR ';
|
|
12
9
|
exports.dimmedName = (0, picocolor_1.dim)(name);
|
|
13
10
|
exports.brightBlueBgName = (0, picocolor_1.bold)((0, picocolor_1.bgCyanBright)((0, picocolor_1.black)(name)));
|
|
14
11
|
exports.brightYellowBgName = (0, picocolor_1.bold)((0, picocolor_1.bgYellowBright)((0, picocolor_1.black)(name)));
|
|
15
12
|
exports.brightGreenBgName = (0, picocolor_1.bold)((0, picocolor_1.bgGreenBright)((0, picocolor_1.black)(name)));
|
|
16
13
|
exports.brightRedBgName = (0, picocolor_1.bold)((0, picocolor_1.bgRedBright)((0, picocolor_1.black)(name)));
|
|
17
|
-
function print_error_with_docs(errMsg, ...args) {
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
19
|
-
errMsg
|
|
20
|
-
? console.log(`${exports.brightRedBgName} ${(0, error_formatted_message_1.err)(errMsg)} ${args} \n`)
|
|
21
|
-
: console.log(exports.brightRedBgName, (0, picocolor_1.redBright)('Unknown error'), args);
|
|
22
|
-
}
|
|
23
14
|
exports.ze_log = (0, debug_1.debug)('zephyr:log');
|
|
24
15
|
// If debug mode is not enabled just print whatever console output is
|
|
25
16
|
// If debug mode is enabled print the error from our end
|
|
26
|
-
/**
|
|
27
|
-
* `ze_error` is used widely to debug our local build and deployment. You can turn on
|
|
28
|
-
* debug mode or having it work normally to attached documentation with our error codes in
|
|
29
|
-
* [errors](./error-types.ts). We have added unknown class to the error object. If this is
|
|
30
|
-
* an error we haven't defined yet, you will need to do
|
|
31
|
-
*
|
|
32
|
-
* @deprecated
|
|
33
|
-
* @example
|
|
34
|
-
* ```ts
|
|
35
|
-
* ze_error('ERR_UNKNOWN', `Error creating dist folder: ${(error as Error).message}`);
|
|
36
|
-
* ```
|
|
37
|
-
* to specify this is an undefined error at the front.
|
|
38
|
-
*/
|
|
39
|
-
exports.ze_error = debug_enabled_1.is_debug_enabled
|
|
40
|
-
? (0, debug_1.debug)('zephyr:error')
|
|
41
|
-
: print_error_with_docs;
|
|
42
17
|
//# sourceMappingURL=debug.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../../src/lib/logging/debug.ts"],"names":[],"mappings":";;;AAAA,uHAAuH;AACvH,iCAA8B;AAC9B,
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../../src/lib/logging/debug.ts"],"names":[],"mappings":";;;AAAA,uHAAuH;AACvH,iCAA8B;AAC9B,2CAQqB;AAErB,uDAAuD;AACvD,MAAM,IAAI,GAAG,UAAU,CAAC;AAEX,QAAA,UAAU,GAAG,IAAA,eAAG,EAAC,IAAI,CAAC,CAAC;AAEvB,QAAA,gBAAgB,GAAG,IAAA,gBAAI,EAAC,IAAA,wBAAY,EAAC,IAAA,iBAAK,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEnD,QAAA,kBAAkB,GAAG,IAAA,gBAAI,EAAC,IAAA,0BAAc,EAAC,IAAA,iBAAK,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEvD,QAAA,iBAAiB,GAAG,IAAA,gBAAI,EAAC,IAAA,yBAAa,EAAC,IAAA,iBAAK,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAErD,QAAA,eAAe,GAAG,IAAA,gBAAI,EAAC,IAAA,uBAAW,EAAC,IAAA,iBAAK,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEjD,QAAA,MAAM,GAAG,IAAA,aAAK,EAAC,YAAY,CAAC,CAAC;AAC1C,qEAAqE;AACrE,wDAAwD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ZeGitInfo } from '../build-context/ze-util-get-git-info';
|
|
1
|
+
import type { ZeGitInfo } from '../build-context/ze-util-get-git-info';
|
|
2
2
|
export declare const logFn: (level: string, msg: unknown) => void;
|
|
3
3
|
export declare function formatLogMsg(msg: unknown, level?: string): string;
|
|
4
4
|
export interface LogEventOptions {
|
|
@@ -5,11 +5,12 @@ exports.formatLogMsg = formatLogMsg;
|
|
|
5
5
|
exports.logger = logger;
|
|
6
6
|
const zephyr_edge_contract_1 = require("zephyr-edge-contract");
|
|
7
7
|
const get_application_configuration_1 = require("../edge-requests/get-application-configuration");
|
|
8
|
+
const errors_1 = require("../errors");
|
|
9
|
+
const ze_http_request_1 = require("../http/ze-http-request");
|
|
10
|
+
const token_1 = require("../node-persist/token");
|
|
11
|
+
const debug_1 = require("./debug");
|
|
8
12
|
const debug_enabled_1 = require("./debug-enabled");
|
|
9
13
|
const index_1 = require("./index");
|
|
10
|
-
const debug_1 = require("./debug");
|
|
11
|
-
const token_1 = require("../node-persist/token");
|
|
12
|
-
const ze_http_request_1 = require("../http/ze-http-request");
|
|
13
14
|
const logFn = (level, msg) => {
|
|
14
15
|
if (debug_enabled_1.is_debug_enabled) {
|
|
15
16
|
(0, index_1.ze_log)(msg);
|
|
@@ -60,7 +61,9 @@ function logger(props) {
|
|
|
60
61
|
// Prints logs to the console as fast as possible
|
|
61
62
|
for (const log of logs) {
|
|
62
63
|
if (!log.level && !log.action) {
|
|
63
|
-
throw new
|
|
64
|
+
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_UNKNOWN, {
|
|
65
|
+
message: 'Log level and action are required',
|
|
66
|
+
});
|
|
64
67
|
}
|
|
65
68
|
(0, exports.logFn)(log.level, log.message);
|
|
66
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ze-log-event.js","sourceRoot":"","sources":["../../../src/lib/logging/ze-log-event.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ze-log-event.js","sourceRoot":"","sources":["../../../src/lib/logging/ze-log-event.ts"],"names":[],"mappings":";;;AAwDA,oCAKC;AAoBD,wBAsDC;AAvID,+DAK8B;AAE9B,kGAA6F;AAC7F,sCAAkD;AAClD,6DAAwD;AACxD,iDAAiD;AACjD,mCAKiB;AACjB,mDAAmD;AACnD,mCAAiC;AAE1B,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAY,EAAQ,EAAE;IACzD,IAAI,gCAAgB,EAAE,CAAC;QACrB,IAAA,cAAM,EAAC,GAAG,CAAC,CAAC;QACZ,OAAO;IACT,CAAC;IAED,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAE3C,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,MAAM;YACT,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACxB,MAAM;QACR,KAAK,OAAO;YACV,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACzB,MAAM;QACR,KAAK,OAAO;YACV,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACzB,MAAM;QACR;YACE,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC;AArBW,QAAA,KAAK,SAqBhB;AAEF,SAAS,aAAa,CAAC,KAAa;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,CAAC;YAED,IAAA,aAAK,EAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;QAED,+BAA+B;QAC/B,WAAW,EAAE;aACV,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,CACxB,+BAAa,CAAC,IAAI,CAChB,GAAG,EACH;YACE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,KAAK,EAAE;gBAChC,cAAc,EAAE,kBAAkB;aACnC;SACF,EACD,IAAI,CAAC,SAAS,CACZ,IAAI;YACF,yDAAyD;aACxD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;aAC5C,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACb,eAAe,EAAE,eAAe;YAChC,MAAM,EAAE,MAAM,CAAC,SAAS;YACxB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,SAAS,EAAE,OAAO;YAClB,QAAQ,EAAE,GAAG,CAAC,KAAK;YACnB,UAAU,EAAE,GAAG,CAAC,MAAM;YACtB,GAAG,EAAE,GAAG;YACR,OAAO,EAAE,IAAA,gCAAS,EAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACtC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC,CAAC,CACN,CACF,CAAC,MAAM,EAAE,CACX;YACD,8BAA8B;aAC7B,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ZeBuildAssetsMap } from 'zephyr-edge-contract';
|
|
1
|
+
import type { ZeBuildAssetsMap } from 'zephyr-edge-contract';
|
|
2
2
|
export declare function savePartialAssetMap(application_uid: string, partial_key: string, assetMap: ZeBuildAssetsMap): Promise<void>;
|
|
3
3
|
export declare function getPartialAssetMap(application_uid: string): Promise<ZeBuildAssetsMap | undefined>;
|
|
4
4
|
export declare function removePartialAssetMap(application_uid: string): Promise<void>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ZephyrEngine } from '../../zephyr-engine';
|
|
2
|
-
import { ZephyrBuildStats } from 'zephyr-edge-contract';
|
|
1
|
+
import type { ZephyrEngine } from '../../zephyr-engine';
|
|
2
|
+
import type { ZephyrBuildStats } from 'zephyr-edge-contract';
|
|
3
3
|
export declare function zeBuildDashData(zephyr_engine: ZephyrEngine): Promise<ZephyrBuildStats>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Snapshot, ZeBuildAssetsMap, ZephyrPluginOptions } from 'zephyr-edge-contract';
|
|
2
|
-
import { ZephyrEngine } from '../../zephyr-engine';
|
|
1
|
+
import { type Snapshot, type ZeBuildAssetsMap, type ZephyrPluginOptions } from 'zephyr-edge-contract';
|
|
2
|
+
import type { ZephyrEngine } from '../../zephyr-engine';
|
|
3
3
|
interface CreateSnapshotProps {
|
|
4
4
|
mfConfig: Pick<ZephyrPluginOptions, 'mfConfig'>['mfConfig'];
|
|
5
5
|
assets: ZeBuildAssetsMap;
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createSnapshot = createSnapshot;
|
|
4
4
|
const zephyr_edge_contract_1 = require("zephyr-edge-contract");
|
|
5
|
+
const errors_1 = require("../errors");
|
|
5
6
|
async function createSnapshot(zephyr_engine, { mfConfig, assets }) {
|
|
6
7
|
const buildId = await zephyr_engine.build_id;
|
|
7
8
|
if (!buildId) {
|
|
8
9
|
await zephyr_engine.build_id;
|
|
9
|
-
throw new
|
|
10
|
+
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_DEPLOY_LOCAL_BUILD, {
|
|
11
|
+
message: 'Cannot create snapshot before getting buildId',
|
|
12
|
+
});
|
|
10
13
|
}
|
|
11
14
|
const options = {
|
|
12
15
|
git_branch: zephyr_engine.gitProperties.git.branch,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ze-build-snapshot.js","sourceRoot":"","sources":["../../../src/lib/transformers/ze-build-snapshot.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"ze-build-snapshot.js","sourceRoot":"","sources":["../../../src/lib/transformers/ze-build-snapshot.ts"],"names":[],"mappings":";;AAgBA,wCA8DC;AA9ED,+DAO8B;AAE9B,sCAAkD;AAO3C,KAAK,UAAU,cAAc,CAClC,aAA2B,EAC3B,EAAE,QAAQ,EAAE,MAAM,EAAuB;IAEzC,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC;IAE7C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,aAAa,CAAC,QAAQ,CAAC;QAC7B,MAAM,IAAI,oBAAW,CAAC,iBAAQ,CAAC,sBAAsB,EAAE;YACrD,OAAO,EAAE,+CAA+C;SACzD,CAAC,CAAC;IACL,CAAC;IAED,MAAM,OAAO,GAAG;QACd,UAAU,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM;QAClD,OAAO;QACP,QAAQ,EAAE,CAAC,MAAM,aAAa,CAAC,yBAAyB,CAAC,CAAC,QAAQ;QAClE,KAAK,EAAE,CAAC,MAAM,aAAa,CAAC,yBAAyB,CAAC,CAAC,KAAK;QAC5D,qBAAqB,EAAE,aAAa,CAAC,qBAAqB;QAC1D,QAAQ,EAAE,CAAC,MAAM,aAAa,CAAC,yBAAyB,CAAC,CAAC,QAAQ;QAClE,aAAa,EAAE,aAAa,CAAC,aAAa;QAC1C,QAAQ,EAAE,QAAQ;KACnB,CAAC;IACF,MAAM,eAAe,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI;QAC5C,CAAC,CAAC,GAAG,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE;QA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,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;YAC7D,OAAO,IAAI,CAAC;QACd,CAAC,EACD,EAAmC,CACpC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/package.json
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zephyr-agent",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.43",
|
|
4
|
+
"description": "Zephyr plugin agent",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/ZephyrCloudIO/zephyr-packages.git",
|
|
8
|
+
"directory": "libs/zephyr-agent"
|
|
9
|
+
},
|
|
4
10
|
"license": "Apache-2.0",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"scripts": {
|
|
9
|
-
"build": "nx build zephyr-agent",
|
|
10
|
-
"test": "nx test zephyr-agent",
|
|
11
|
-
"patch-version": "pnpm version"
|
|
11
|
+
"author": {
|
|
12
|
+
"name": "ZephyrCloudIO",
|
|
13
|
+
"url": "https://github.com/ZephyrCloudIO"
|
|
12
14
|
},
|
|
15
|
+
"type": "commonjs",
|
|
13
16
|
"exports": {
|
|
14
17
|
".": {
|
|
15
18
|
"import": "./dist/index.js",
|
|
@@ -22,28 +25,39 @@
|
|
|
22
25
|
"types": "./dist/node-persist/index.d.ts"
|
|
23
26
|
}
|
|
24
27
|
},
|
|
28
|
+
"main": "dist/index.js",
|
|
29
|
+
"types": "dist/index.d.ts",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "nx build zephyr-agent",
|
|
32
|
+
"patch-version": "pnpm version",
|
|
33
|
+
"test": "nx test zephyr-agent"
|
|
34
|
+
},
|
|
25
35
|
"dependencies": {
|
|
26
36
|
"cloudflare": "^3.4.0",
|
|
37
|
+
"debug": "^4.3.4",
|
|
27
38
|
"git-url-parse": "^15.0.0",
|
|
28
39
|
"is-ci": "catalog:plugin-shared",
|
|
29
40
|
"jose": "^5.10.0",
|
|
41
|
+
"node-persist": "^4.0.1",
|
|
30
42
|
"open": "^10.1.0",
|
|
31
43
|
"socket.io-client": "^4.7.5",
|
|
32
44
|
"tslib": "catalog:typescript",
|
|
33
45
|
"uuid": "^8.3.2",
|
|
34
|
-
"node-persist": "^4.0.1",
|
|
35
|
-
"debug": "^4.3.4",
|
|
36
46
|
"zephyr-edge-contract": "workspace:*"
|
|
37
47
|
},
|
|
38
48
|
"devDependencies": {
|
|
49
|
+
"@jest/globals": "catalog:react",
|
|
50
|
+
"@types/debug": "^4.1.12",
|
|
39
51
|
"@types/git-url-parse": "^9.0.3",
|
|
40
52
|
"@types/is-ci": "catalog:typescript",
|
|
53
|
+
"@types/jest": "catalog:typescript",
|
|
54
|
+
"@types/node-persist": "catalog:typescript",
|
|
41
55
|
"@types/uuid": "^9.0.8",
|
|
42
56
|
"@typescript-eslint/eslint-plugin": "catalog:eslint",
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
57
|
+
"ts-jest": "catalog:typescript"
|
|
58
|
+
},
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public",
|
|
61
|
+
"provenance": true
|
|
48
62
|
}
|
|
49
63
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Snapshot, type ZeBuildAsset, ZeBuildAssetsMap, type ZephyrBuildStats, ZephyrPluginOptions } from 'zephyr-edge-contract';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { type Snapshot, type ZeBuildAsset, type ZeBuildAssetsMap, type ZephyrBuildStats, type ZephyrPluginOptions } from 'zephyr-edge-contract';
|
|
2
|
+
import type { ZePackageJson } from '../lib/build-context/ze-package-json.type';
|
|
3
|
+
import { type ZeGitInfo } from '../lib/build-context/ze-util-get-git-info';
|
|
4
|
+
import { type ZeLogger } from '../lib/logging/ze-log-event';
|
|
5
|
+
import type { ZeApplicationConfig } from '../lib/node-persist/upload-provider-options';
|
|
6
|
+
import { type ZeResolvedDependency } from './resolve_remote_dependency';
|
|
7
7
|
export interface ZeApplicationProperties {
|
|
8
8
|
org: string;
|
|
9
9
|
project: string;
|
|
@@ -11,6 +11,10 @@ export interface ZeApplicationProperties {
|
|
|
11
11
|
version: string;
|
|
12
12
|
}
|
|
13
13
|
export type Platform = 'ios' | 'android' | 'web' | undefined;
|
|
14
|
+
export type DeferredZephyrEngine = {
|
|
15
|
+
zephyr_engine_defer: Promise<ZephyrEngine>;
|
|
16
|
+
zephyr_defer_create(options: ZephyrEngineOptions): void;
|
|
17
|
+
};
|
|
14
18
|
export interface ZeDependencyPair {
|
|
15
19
|
name: string;
|
|
16
20
|
version: string;
|
|
@@ -58,10 +62,7 @@ export declare class ZephyrEngine {
|
|
|
58
62
|
version_url: string | null;
|
|
59
63
|
/** This is intentionally PRIVATE use `await ZephyrEngine.create(context)` */
|
|
60
64
|
private constructor();
|
|
61
|
-
static defer_create():
|
|
62
|
-
zephyr_engine_defer: Promise<ZephyrEngine>;
|
|
63
|
-
zephyr_defer_create: (options: ZephyrEngineOptions) => void;
|
|
64
|
-
};
|
|
65
|
+
static defer_create(): DeferredZephyrEngine;
|
|
65
66
|
static create(options: ZephyrEngineOptions): Promise<ZephyrEngine>;
|
|
66
67
|
/**
|
|
67
68
|
* Accept two argument to resolve remote dependencies:
|
|
@@ -5,26 +5,26 @@ exports.is_zephyr_dependency_pair = is_zephyr_dependency_pair;
|
|
|
5
5
|
exports.is_zephyr_resolved_dependency = is_zephyr_resolved_dependency;
|
|
6
6
|
exports.readPackageJson = readPackageJson;
|
|
7
7
|
const tslib_1 = require("tslib");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const zephyr_edge_contract_1 = require("zephyr-edge-contract");
|
|
11
|
-
const resolve_remote_dependency_1 = require("./resolve_remote_dependency");
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
12
10
|
const isCI = tslib_1.__importStar(require("is-ci"));
|
|
11
|
+
const zephyr_edge_contract_1 = require("zephyr-edge-contract");
|
|
12
|
+
const login_1 = require("../lib/auth/login");
|
|
13
13
|
const ze_util_get_git_info_1 = require("../lib/build-context/ze-util-get-git-info");
|
|
14
|
-
const ze_log_event_1 = require("../lib/logging/ze-log-event");
|
|
15
14
|
const ze_util_read_package_json_1 = require("../lib/build-context/ze-util-read-package-json");
|
|
16
|
-
const login_1 = require("../lib/auth/login");
|
|
17
|
-
const get_application_configuration_1 = require("../lib/edge-requests/get-application-configuration");
|
|
18
|
-
const get_build_id_1 = require("../lib/edge-requests/get-build-id");
|
|
19
|
-
const distributed_hash_control_1 = require("../lib/edge-hash-list/distributed-hash-control");
|
|
20
15
|
const get_upload_strategy_1 = require("../lib/deployment/get-upload-strategy");
|
|
16
|
+
const distributed_hash_control_1 = require("../lib/edge-hash-list/distributed-hash-control");
|
|
21
17
|
const get_missing_assets_1 = require("../lib/edge-hash-list/get-missing-assets");
|
|
22
|
-
const
|
|
23
|
-
const
|
|
18
|
+
const get_application_configuration_1 = require("../lib/edge-requests/get-application-configuration");
|
|
19
|
+
const get_build_id_1 = require("../lib/edge-requests/get-build-id");
|
|
24
20
|
const logging_1 = require("../lib/logging");
|
|
25
21
|
const picocolor_1 = require("../lib/logging/picocolor");
|
|
22
|
+
const ze_log_event_1 = require("../lib/logging/ze-log-event");
|
|
23
|
+
const app_deploy_result_cache_1 = require("../lib/node-persist/app-deploy-result-cache");
|
|
24
|
+
const ze_build_snapshot_1 = require("../lib/transformers/ze-build-snapshot");
|
|
25
|
+
const resolve_remote_dependency_1 = require("./resolve_remote_dependency");
|
|
26
26
|
function is_zephyr_dependency_pair(dep) {
|
|
27
|
-
return dep
|
|
27
|
+
return !!dep;
|
|
28
28
|
}
|
|
29
29
|
function is_zephyr_resolved_dependency(dep) {
|
|
30
30
|
return dep !== null;
|
|
@@ -53,11 +53,19 @@ class ZephyrEngine {
|
|
|
53
53
|
this.builder = options.builder;
|
|
54
54
|
}
|
|
55
55
|
static defer_create() {
|
|
56
|
-
let
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
let resolve;
|
|
57
|
+
let reject;
|
|
58
|
+
return {
|
|
59
|
+
zephyr_engine_defer: new Promise((res, rej) => {
|
|
60
|
+
resolve = res;
|
|
61
|
+
reject = rej;
|
|
62
|
+
}),
|
|
63
|
+
// All zephyr_engine_defer calls are wrapped inside a try/catch,
|
|
64
|
+
// so its safe to reject the promise here and expect it to be handled
|
|
65
|
+
zephyr_defer_create(options) {
|
|
66
|
+
ZephyrEngine.create(options).then(resolve, reject);
|
|
67
|
+
},
|
|
68
|
+
};
|
|
61
69
|
}
|
|
62
70
|
// todo: extract to a separate fn
|
|
63
71
|
static async create(options) {
|
|
@@ -83,7 +91,7 @@ class ZephyrEngine {
|
|
|
83
91
|
})
|
|
84
92
|
.catch((err) => (0, logging_1.ze_log)(`Failed to get application configuration: ${err}`));
|
|
85
93
|
await ze.start_new_build();
|
|
86
|
-
ze.logger.then(async (logger) => {
|
|
94
|
+
void ze.logger.then(async (logger) => {
|
|
87
95
|
const { username } = await ze.application_configuration;
|
|
88
96
|
const buildId = await ze.build_id;
|
|
89
97
|
logger({
|
|
@@ -157,12 +165,13 @@ class ZephyrEngine {
|
|
|
157
165
|
ze.build_id
|
|
158
166
|
.then((buildId) => (0, logging_1.ze_log)(`Loaded build id "${buildId}"`))
|
|
159
167
|
.catch((err) => (0, logging_1.ze_log)(`Failed to get build id: ${err}`));
|
|
168
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
160
169
|
if (!ze.logger) {
|
|
161
170
|
(0, logging_1.ze_log)('Initializing: logger');
|
|
162
171
|
let resolve;
|
|
163
172
|
ze.logger = new Promise((r) => (resolve = r));
|
|
164
173
|
// internally logger will try to load app_config
|
|
165
|
-
Promise.all([ze.application_configuration, ze.build_id]).then((record) => {
|
|
174
|
+
void Promise.all([ze.application_configuration, ze.build_id]).then((record) => {
|
|
166
175
|
const buildId = record[1];
|
|
167
176
|
(0, logging_1.ze_log)('Initialized: application configuration, build id and hash list');
|
|
168
177
|
resolve((0, ze_log_event_1.logger)({ application_uid, buildId, git: ze.gitProperties.git }));
|
|
@@ -251,9 +260,9 @@ function mut_zephyr_app_uid(ze) {
|
|
|
251
260
|
ze.application_uid = (0, zephyr_edge_contract_1.createApplicationUid)(ze.applicationProperties);
|
|
252
261
|
}
|
|
253
262
|
function readPackageJson(root) {
|
|
254
|
-
const packageJsonPath = (0,
|
|
255
|
-
const packageJsonContent = (0,
|
|
256
|
-
? (0,
|
|
263
|
+
const packageJsonPath = (0, node_path_1.join)(root, 'package.json');
|
|
264
|
+
const packageJsonContent = (0, node_fs_1.existsSync)(packageJsonPath)
|
|
265
|
+
? (0, node_fs_1.readFileSync)(packageJsonPath, 'utf-8')
|
|
257
266
|
: '{}';
|
|
258
267
|
return JSON.parse(packageJsonContent);
|
|
259
268
|
}
|