zephyr-agent 0.0.44 → 0.0.46
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/build-context/fs-cache-for-package-json.js +3 -0
- package/dist/lib/build-context/fs-cache-for-package-json.js.map +1 -1
- package/dist/lib/build-context/ze-package-json.type.d.ts +2 -0
- package/dist/lib/build-context/ze-util-read-package-json.js +3 -24
- package/dist/lib/build-context/ze-util-read-package-json.js.map +1 -1
- package/dist/lib/http/fetch-with-retries.js +87 -28
- package/dist/lib/http/fetch-with-retries.js.map +1 -1
- package/dist/package.json +3 -1
- package/dist/zephyr-engine/resolve_remote_dependency.js +7 -5
- package/dist/zephyr-engine/resolve_remote_dependency.js.map +1 -1
- package/package.json +4 -2
|
@@ -5,6 +5,9 @@ exports.setPackageJsonCache = setPackageJsonCache;
|
|
|
5
5
|
const zephyr_edge_contract_1 = require("zephyr-edge-contract");
|
|
6
6
|
const fs_cache_1 = require("../node-persist/fs-cache");
|
|
7
7
|
const cache_prefix = 'package_json';
|
|
8
|
+
// todo: persisting package.json cache should be done in a way it stores path to package.json file
|
|
9
|
+
// and not the content of the package.json file
|
|
10
|
+
// or store last modified time of the file
|
|
8
11
|
async function getPackageJsonCache(startingPath) {
|
|
9
12
|
const cache_key = `${cache_prefix}:${startingPath}`;
|
|
10
13
|
const cached = await (0, fs_cache_1.getCache)(cache_key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs-cache-for-package-json.js","sourceRoot":"","sources":["../../../src/lib/build-context/fs-cache-for-package-json.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"fs-cache-for-package-json.js","sourceRoot":"","sources":["../../../src/lib/build-context/fs-cache-for-package-json.ts"],"names":[],"mappings":";;AASA,kDAOC;AAED,kDAMC;AAxBD,+DAAuD;AAEvD,uDAA+D;AAE/D,MAAM,YAAY,GAAG,cAAc,CAAC;AAEpC,kGAAkG;AAClG,+CAA+C;AAC/C,0CAA0C;AACnC,KAAK,UAAU,mBAAmB,CACvC,YAAoB;IAEpB,MAAM,SAAS,GAAG,GAAG,YAAY,IAAI,YAAY,EAAE,CAAC;IACpD,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAQ,EAAC,SAAS,CAAC,CAAC;IACzC,IAAI,CAAC,MAAM;QAAE,OAAO;IACpB,OAAO,IAAA,sCAAe,EAAgB,MAAM,CAAC,CAAC;AAChD,CAAC;AAEM,KAAK,UAAU,mBAAmB,CACvC,YAAoB,EACpB,mBAAkC;IAElC,MAAM,SAAS,GAAG,GAAG,YAAY,IAAI,YAAY,EAAE,CAAC;IACpD,MAAM,IAAA,oBAAS,EAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -7,6 +7,8 @@ export interface ZePackageJson {
|
|
|
7
7
|
name: string;
|
|
8
8
|
version: string;
|
|
9
9
|
dependencies?: Record<string, string>;
|
|
10
|
+
/** Zephyr:dependencies in package.json */
|
|
11
|
+
['zephyr:dependencies']?: Record<string, string>;
|
|
10
12
|
zephyrDependencies?: Record<string, ZeDependency>;
|
|
11
13
|
/** OptionalDependencies in package.json */
|
|
12
14
|
optionalDependencies?: Record<string, string>;
|
|
@@ -8,7 +8,6 @@ const zephyr_edge_contract_1 = require("zephyr-edge-contract");
|
|
|
8
8
|
const errors_1 = require("../errors");
|
|
9
9
|
const logging_1 = require("../logging");
|
|
10
10
|
const find_nearest_package_json_1 = require("./find-nearest-package-json");
|
|
11
|
-
const fs_cache_for_package_json_1 = require("./fs-cache-for-package-json");
|
|
12
11
|
const ze_util_parse_ze_dependencies_1 = require("./ze-util-parse-ze-dependencies");
|
|
13
12
|
/**
|
|
14
13
|
* Retrieves and parses the package.json file from the given context path or current
|
|
@@ -36,18 +35,6 @@ async function getPackageJson(context) {
|
|
|
36
35
|
catch (error) {
|
|
37
36
|
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_PACKAGE_JSON_NOT_FOUND, `Invalid starting path: ${context}. Error: ${error}`);
|
|
38
37
|
}
|
|
39
|
-
// Check the cache first
|
|
40
|
-
try {
|
|
41
|
-
const cached = await (0, fs_cache_for_package_json_1.getPackageJsonCache)(startingPath);
|
|
42
|
-
if (cached) {
|
|
43
|
-
(0, logging_1.ze_log)('Using cached package.json for path', startingPath);
|
|
44
|
-
return cached;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
// Cache errors are not fatal, just log and continue
|
|
49
|
-
(0, logging_1.ze_log)('Cache retrieval error', error);
|
|
50
|
-
}
|
|
51
38
|
// Find nearest package.json
|
|
52
39
|
let nearest_package_json;
|
|
53
40
|
try {
|
|
@@ -66,7 +53,6 @@ async function getPackageJson(context) {
|
|
|
66
53
|
// Parse and validate package.json
|
|
67
54
|
try {
|
|
68
55
|
const { json, path: packageJsonPath } = nearest_package_json;
|
|
69
|
-
// todo: split parsed package json into parsed and resulting, where resulting is of type ZePackageJson
|
|
70
56
|
const parsed_package_json = (0, zephyr_edge_contract_1.safe_json_parse)(json);
|
|
71
57
|
if (!parsed_package_json) {
|
|
72
58
|
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_PACKAGE_JSON_NOT_VALID, `Invalid JSON in package.json at: ${packageJsonPath}`);
|
|
@@ -78,16 +64,9 @@ async function getPackageJson(context) {
|
|
|
78
64
|
if (!parsed_package_json.version) {
|
|
79
65
|
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_PACKAGE_JSON_MUST_HAVE_NAME_VERSION, `Missing 'version' field in package.json at: ${packageJsonPath}`);
|
|
80
66
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// Cache the result
|
|
85
|
-
try {
|
|
86
|
-
await (0, fs_cache_for_package_json_1.setPackageJsonCache)(startingPath, parsed_package_json);
|
|
87
|
-
}
|
|
88
|
-
catch (cacheError) {
|
|
89
|
-
// Cache errors are not fatal, just log and continue
|
|
90
|
-
(0, logging_1.ze_log)('Cache storage error', cacheError);
|
|
67
|
+
const zephyr_dependencies = parsed_package_json['zephyr:dependencies'];
|
|
68
|
+
if (zephyr_dependencies) {
|
|
69
|
+
parsed_package_json.zephyrDependencies = (0, ze_util_parse_ze_dependencies_1.parseZeDependencies)(zephyr_dependencies);
|
|
91
70
|
}
|
|
92
71
|
(0, logging_1.ze_log)('Successfully parsed package.json', {
|
|
93
72
|
name: parsed_package_json.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ze-util-read-package-json.js","sourceRoot":"","sources":["../../../src/lib/build-context/ze-util-read-package-json.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"ze-util-read-package-json.js","sourceRoot":"","sources":["../../../src/lib/build-context/ze-util-read-package-json.ts"],"names":[],"mappings":";;AAoBA,wCA4FC;;AAhHD,8DAAyB;AACzB,yCAAoC;AACpC,+DAAuD;AACvD,sCAAkD;AAClD,wCAAoC;AACpC,2EAAwE;AAExE,mFAAsE;AACtE;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,cAAc,CAClC,OAA2B;IAE3B,8BAA8B;IAC9B,IAAI,YAAoB,CAAC;IACzB,IAAI,CAAC;QACH,YAAY,GAAG,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAExC,qDAAqD;QACrD,IAAI,YAAY,IAAI,iBAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;YACvD,YAAY,GAAG,IAAA,mBAAO,EAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAC7C,CAAC;QAED,IAAA,gBAAM,EAAC,oCAAoC,EAAE,YAAY,CAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,oBAAW,CACnB,iBAAQ,CAAC,0BAA0B,EACnC,0BAA0B,OAAO,YAAY,KAAK,EAAE,CACrD,CAAC;IACJ,CAAC;IAED,4BAA4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mBAAmB,GAAG,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;QACvE,IAAI,mBAAmB,EAAE,CAAC;YACxB,mBAAmB,CAAC,kBAAkB,GAAG,IAAA,mDAAmB,EAAC,mBAAmB,CAAC,CAAC;QACpF,CAAC;QAED,IAAA,gBAAM,EAAC,kCAAkC,EAAE;YACzC,IAAI,EAAE,mBAAmB,CAAC,IAAI;YAC9B,OAAO,EAAE,mBAAmB,CAAC,OAAO;YACpC,IAAI,EAAE,eAAe;SACtB,CAAC,CAAC;QAEH,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,oBAAW,EAAE,CAAC;YACjC,MAAM,KAAK,CAAC,CAAC,gCAAgC;QAC/C,CAAC;QACD,MAAM,IAAI,oBAAW,CACnB,iBAAQ,CAAC,0BAA0B,EACnC,kCAAkC,KAAK,EAAE,CAC1C,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,41 +1,100 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fetchWithRetries = fetchWithRetries;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const errors_1 = require("../errors");
|
|
6
|
+
const axios_1 = require("axios");
|
|
7
|
+
const axios_2 = tslib_1.__importDefault(require("axios"));
|
|
8
|
+
const axios_retry_1 = tslib_1.__importDefault(require("axios-retry"));
|
|
5
9
|
async function fetchWithRetries(url, options = {}, retries = 3) {
|
|
6
|
-
var _a, _b, _c, _d, _e
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
var _a, _b, _c, _d, _e;
|
|
11
|
+
try {
|
|
12
|
+
// Create a custom axios instance for this request
|
|
13
|
+
const axiosInstance = axios_2.default.create();
|
|
14
|
+
// Configure axios-retry
|
|
15
|
+
(0, axios_retry_1.default)(axiosInstance, {
|
|
16
|
+
retries,
|
|
17
|
+
retryDelay: axios_retry_1.default.exponentialDelay,
|
|
18
|
+
retryCondition: (error) => {
|
|
19
|
+
// Retry on network errors
|
|
20
|
+
if (!error.response) {
|
|
21
|
+
const networkError = error.code || error.message || '';
|
|
22
|
+
return networkError === 'EPIPE' || networkError.includes('network');
|
|
23
|
+
}
|
|
24
|
+
// Retry on server errors (5xx)
|
|
25
|
+
return error.response.status >= 500;
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
// Convert fetch options to axios options
|
|
29
|
+
const axiosConfig = Object.assign({ method: (_a = options.method) !== null && _a !== void 0 ? _a : 'GET', data: options.body }, (options.signal ? { signal: options.signal } : {}));
|
|
30
|
+
if (options.headers) {
|
|
31
|
+
// Convert HeadersInit to a format compatible with axios headers
|
|
32
|
+
if (options.headers instanceof Headers) {
|
|
33
|
+
// Convert Headers object to record
|
|
34
|
+
const headersRecord = {};
|
|
35
|
+
options.headers.forEach((value, key) => {
|
|
36
|
+
headersRecord[key] = value;
|
|
37
|
+
});
|
|
38
|
+
axiosConfig.headers = headersRecord;
|
|
39
|
+
}
|
|
40
|
+
else if (Array.isArray(options.headers)) {
|
|
41
|
+
// Convert header entries array to record
|
|
42
|
+
const headersRecord = {};
|
|
43
|
+
options.headers.forEach(([key, value]) => {
|
|
44
|
+
headersRecord[key] = value;
|
|
45
|
+
});
|
|
46
|
+
axiosConfig.headers = headersRecord;
|
|
17
47
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
48
|
+
else {
|
|
49
|
+
// Already a record object
|
|
50
|
+
axiosConfig.headers = options.headers;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Make the request with retries
|
|
54
|
+
const response = await axiosInstance(url.toString(), axiosConfig);
|
|
55
|
+
// Convert axios response to fetch Response interface
|
|
56
|
+
return {
|
|
57
|
+
ok: response.status >= 200 && response.status < 300,
|
|
58
|
+
status: response.status,
|
|
59
|
+
headers: new Headers(Object.entries(response.headers).reduce((acc, [key, value]) => {
|
|
60
|
+
if (value !== undefined) {
|
|
61
|
+
acc[key] = typeof value === 'string' ? value : String(value);
|
|
62
|
+
}
|
|
63
|
+
return acc;
|
|
64
|
+
}, {})),
|
|
65
|
+
text: async () => typeof response.data === 'string'
|
|
66
|
+
? response.data
|
|
67
|
+
: JSON.stringify(response.data) || '',
|
|
68
|
+
json: async () => response.data,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
// Handle errors after all retries have been exhausted
|
|
73
|
+
if (error instanceof axios_1.AxiosError && error.response) {
|
|
74
|
+
// Client errors (4xx)
|
|
75
|
+
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_HTTP_ERROR, {
|
|
76
|
+
status: error.response.status,
|
|
77
|
+
url: url.toString(),
|
|
78
|
+
content: error.response.data,
|
|
79
|
+
method: (_c = (_b = options.method) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== null && _c !== void 0 ? _c : 'GET',
|
|
21
80
|
});
|
|
22
81
|
}
|
|
23
|
-
//
|
|
24
|
-
if (
|
|
25
|
-
|
|
82
|
+
// Unknown errors
|
|
83
|
+
if (error instanceof axios_1.AxiosError &&
|
|
84
|
+
(error.code === 'EPIPE' || (error.message && error.message.includes('network')))) {
|
|
85
|
+
// Max retries reached for network error
|
|
86
|
+
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_HTTP_ERROR, {
|
|
87
|
+
status: -1,
|
|
88
|
+
url: url.toString(),
|
|
89
|
+
content: 'Max retries reached for network error',
|
|
90
|
+
method: (_e = (_d = options.method) === null || _d === void 0 ? void 0 : _d.toUpperCase()) !== null && _e !== void 0 ? _e : 'GET',
|
|
91
|
+
});
|
|
26
92
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
method: (_e = (_d = options.method) === null || _d === void 0 ? void 0 : _d.toUpperCase()) !== null && _e !== void 0 ? _e : 'GET',
|
|
93
|
+
// Other unknown errors
|
|
94
|
+
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_UNKNOWN, {
|
|
95
|
+
message: 'Unknown error occurred',
|
|
96
|
+
cause: error,
|
|
32
97
|
});
|
|
33
98
|
}
|
|
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
|
-
});
|
|
40
99
|
}
|
|
41
100
|
//# 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":";;
|
|
1
|
+
{"version":3,"file":"fetch-with-retries.js","sourceRoot":"","sources":["../../../src/lib/http/fetch-with-retries.ts"],"names":[],"mappings":";;AAMA,4CA+GC;;AArHD,sCAAkD;AAElD,iCAAmC;AACnC,0DAA0B;AAC1B,sEAAqC;AAE9B,KAAK,UAAU,gBAAgB,CACpC,GAAQ,EACR,UAAuB,EAAE,EACzB,OAAO,GAAG,CAAC;;IAEX,IAAI,CAAC;QACH,kDAAkD;QAClD,MAAM,aAAa,GAAG,eAAK,CAAC,MAAM,EAAE,CAAC;QAErC,wBAAwB;QACxB,IAAA,qBAAU,EAAC,aAAa,EAAE;YACxB,OAAO;YACP,UAAU,EAAE,qBAAU,CAAC,gBAAgB;YACvC,cAAc,EAAE,CAAC,KAAiB,EAAE,EAAE;gBACpC,0BAA0B;gBAC1B,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;oBACpB,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,IAAI,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,CAAC,QAAQ,CAAC,MAAM;gBAC7B,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE;gBACnB,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI;gBAC5B,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,MAAM,0CAAE,WAAW,EAAE,mCAAI,KAAK;aAC/C,CAAC,CAAC;QACL,CAAC;QAED,iBAAiB;QACjB,IACE,KAAK,YAAY,kBAAU;YAC3B,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAChF,CAAC;YACD,wCAAwC;YACxC,MAAM,IAAI,oBAAW,CAAC,iBAAQ,CAAC,cAAc,EAAE;gBAC7C,MAAM,EAAE,CAAC,CAAC;gBACV,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE;gBACnB,OAAO,EAAE,uCAAuC;gBAChD,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,MAAM,0CAAE,WAAW,EAAE,mCAAI,KAAK;aAC/C,CAAC,CAAC;QACL,CAAC;QAED,uBAAuB;QACvB,MAAM,IAAI,oBAAW,CAAC,iBAAQ,CAAC,WAAW,EAAE;YAC1C,OAAO,EAAE,wBAAwB;YACjC,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zephyr-agent",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"description": "Zephyr plugin agent",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
"test": "nx test zephyr-agent"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
+
"axios": "^1.9.0",
|
|
37
|
+
"axios-retry": "^4.5.0",
|
|
36
38
|
"cloudflare": "^3.4.0",
|
|
37
39
|
"debug": "^4.3.4",
|
|
38
40
|
"git-url-parse": "^15.0.0",
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolve_remote_dependency = resolve_remote_dependency;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const zephyr_edge_contract_1 = require("zephyr-edge-contract");
|
|
5
6
|
const token_1 = require("../lib/node-persist/token");
|
|
6
7
|
const errors_1 = require("../lib/errors");
|
|
7
8
|
const logging_1 = require("../lib/logging");
|
|
9
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
8
10
|
async function resolve_remote_dependency({ application_uid, version, platform, }) {
|
|
9
11
|
const resolveDependency = new URL(`${zephyr_edge_contract_1.ze_api_gateway.resolve}/${encodeURIComponent(application_uid)}/${encodeURIComponent(version)}`, (0, zephyr_edge_contract_1.ZE_API_ENDPOINT)());
|
|
10
12
|
if (platform) {
|
|
@@ -13,8 +15,7 @@ async function resolve_remote_dependency({ application_uid, version, platform, }
|
|
|
13
15
|
try {
|
|
14
16
|
(0, logging_1.ze_log)('URL for resolving dependency:', resolveDependency.toString());
|
|
15
17
|
const token = await (0, token_1.getToken)();
|
|
16
|
-
const res = await
|
|
17
|
-
method: 'GET',
|
|
18
|
+
const res = await axios_1.default.get(resolveDependency.toString(), {
|
|
18
19
|
headers: {
|
|
19
20
|
'Content-Type': 'application/json',
|
|
20
21
|
Authorization: `Bearer ${token}`,
|
|
@@ -22,7 +23,8 @@ async function resolve_remote_dependency({ application_uid, version, platform, }
|
|
|
22
23
|
},
|
|
23
24
|
});
|
|
24
25
|
const [appName, projectName, orgName] = application_uid.split('.');
|
|
25
|
-
|
|
26
|
+
// Check response status
|
|
27
|
+
if (res.status < 200 || res.status >= 300) {
|
|
26
28
|
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_RESOLVE_REMOTES, {
|
|
27
29
|
appUid: application_uid,
|
|
28
30
|
appName,
|
|
@@ -31,11 +33,11 @@ async function resolve_remote_dependency({ application_uid, version, platform, }
|
|
|
31
33
|
data: {
|
|
32
34
|
url: resolveDependency.toString(),
|
|
33
35
|
version,
|
|
34
|
-
error:
|
|
36
|
+
error: res.data,
|
|
35
37
|
},
|
|
36
38
|
});
|
|
37
39
|
}
|
|
38
|
-
const response =
|
|
40
|
+
const response = res.data;
|
|
39
41
|
if (response.value) {
|
|
40
42
|
(0, logging_1.ze_log)('resolved dependency:', response.value, 'application_uid: ', application_uid, 'version: ', version);
|
|
41
43
|
return Object.assign({}, response.value, { version, platform });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve_remote_dependency.js","sourceRoot":"","sources":["../../src/zephyr-engine/resolve_remote_dependency.ts"],"names":[],"mappings":";;AAgBA,8DA4EC
|
|
1
|
+
{"version":3,"file":"resolve_remote_dependency.js","sourceRoot":"","sources":["../../src/zephyr-engine/resolve_remote_dependency.ts"],"names":[],"mappings":";;AAgBA,8DA4EC;;AA5FD,+DAAuE;AACvE,qDAAqD;AACrD,0CAAsD;AACtD,4CAAwC;AACxC,0DAA0B;AAYnB,KAAK,UAAU,yBAAyB,CAAC,EAC9C,eAAe,EACf,OAAO,EACP,QAAQ,GAKT;IACC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAC/B,GAAG,qCAAc,CAAC,OAAO,IAAI,kBAAkB,CAAC,eAAe,CAAC,IAAI,kBAAkB,CAAC,OAAO,CAAC,EAAE,EACjG,IAAA,sCAAe,GAAE,CAClB,CAAC;IAEF,IAAI,QAAQ,EAAE,CAAC;QACb,iBAAiB,CAAC,YAAY,CAAC,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IAClE,CAAC;IAED,IAAI,CAAC;QACH,IAAA,gBAAM,EAAC,+BAA+B,EAAE,iBAAiB,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEtE,MAAM,KAA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,QAAQ,EAAE;SAC5B,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,oBAAW;YAAE,MAAM,KAAK,CAAC;QAE9C,MAAM,IAAI,oBAAW,CAAC,iBAAQ,CAAC,wCAAwC,EAAE;YACvE,IAAI,EAAE,EAAE,OAAO,EAAE;YACjB,KAAK;SACN,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zephyr-agent",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"description": "Zephyr plugin agent",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
"main": "dist/index.js",
|
|
29
29
|
"types": "dist/index.d.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"axios": "^1.9.0",
|
|
32
|
+
"axios-retry": "^4.5.0",
|
|
31
33
|
"cloudflare": "^3.4.0",
|
|
32
34
|
"debug": "^4.3.4",
|
|
33
35
|
"git-url-parse": "^15.0.0",
|
|
@@ -38,7 +40,7 @@
|
|
|
38
40
|
"socket.io-client": "^4.7.5",
|
|
39
41
|
"tslib": "^2.8.1",
|
|
40
42
|
"uuid": "^8.3.2",
|
|
41
|
-
"zephyr-edge-contract": "0.0.
|
|
43
|
+
"zephyr-edge-contract": "0.0.46"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
46
|
"@jest/globals": "^29.7.0",
|