zephyr-agent 0.0.0-canary-20241122025316 → 0.0.0-canary-20241122064756
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/index.d.ts +1 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/http/upload-file.js +30 -71
- package/dist/lib/http/upload-file.js.map +1 -1
- package/dist/zephyr-engine/resolve_remote_dependency.js +4 -0
- package/dist/zephyr-engine/resolve_remote_dependency.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -12,3 +12,4 @@ export { get_missing_assets } from './lib/edge-hash-list/get-missing-assets';
|
|
|
12
12
|
export * from './lib/logging/picocolor';
|
|
13
13
|
export { verify_mf_config, verify_fastly_config, } from './lib/build-context/ze-util-verification';
|
|
14
14
|
export { resolve_remote_dependency } from './zephyr-engine/resolve_remote_dependency';
|
|
15
|
+
export { getAppDeployResult, setAppDeployResult, } from './lib/node-persist/app-deploy-result-cache';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolve_remote_dependency = exports.verify_fastly_config = exports.verify_mf_config = exports.get_missing_assets = exports.is_zephyr_dependency_pair = exports.ZephyrEngine = exports.zeBuildAssets = exports.zeBuildDashData = exports.buildAssetsMap = exports.logFn = exports.ze_log = exports.ZeErrors = exports.ZephyrError = exports.savePartialAssetMap = exports.removePartialAssetMap = exports.getPartialAssetMap = exports.resolveIndexHtml = exports.onIndexHtmlResolved = void 0;
|
|
3
|
+
exports.setAppDeployResult = exports.getAppDeployResult = exports.resolve_remote_dependency = exports.verify_fastly_config = exports.verify_mf_config = exports.get_missing_assets = exports.is_zephyr_dependency_pair = exports.ZephyrEngine = exports.zeBuildAssets = exports.zeBuildDashData = exports.buildAssetsMap = exports.logFn = exports.ze_log = exports.ZeErrors = exports.ZephyrError = exports.savePartialAssetMap = exports.removePartialAssetMap = exports.getPartialAssetMap = exports.resolveIndexHtml = exports.onIndexHtmlResolved = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
// hack for angular
|
|
6
6
|
var resolve_index_html_1 = require("./lib/hacks/resolve-index-html");
|
|
@@ -40,4 +40,7 @@ Object.defineProperty(exports, "verify_mf_config", { enumerable: true, get: func
|
|
|
40
40
|
Object.defineProperty(exports, "verify_fastly_config", { enumerable: true, get: function () { return ze_util_verification_1.verify_fastly_config; } });
|
|
41
41
|
var resolve_remote_dependency_1 = require("./zephyr-engine/resolve_remote_dependency");
|
|
42
42
|
Object.defineProperty(exports, "resolve_remote_dependency", { enumerable: true, get: function () { return resolve_remote_dependency_1.resolve_remote_dependency; } });
|
|
43
|
+
var app_deploy_result_cache_1 = require("./lib/node-persist/app-deploy-result-cache");
|
|
44
|
+
Object.defineProperty(exports, "getAppDeployResult", { enumerable: true, get: function () { return app_deploy_result_cache_1.getAppDeployResult; } });
|
|
45
|
+
Object.defineProperty(exports, "setAppDeployResult", { enumerable: true, get: function () { return app_deploy_result_cache_1.setAppDeployResult; } });
|
|
43
46
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,mBAAmB;AACnB,qEAAuF;AAA9E,yHAAA,mBAAmB,OAAA;AAAE,sHAAA,gBAAgB,OAAA;AAC9C,sBAAsB;AACtB,4EAI+C;AAH7C,wHAAA,kBAAkB,OAAA;AAClB,2HAAA,qBAAqB,OAAA;AACrB,yHAAA,mBAAmB,OAAA;AAGrB,SAAS;AACT,uCAAqD;AAA5C,qGAAA,WAAW,OAAA;AAAE,kGAAA,QAAQ,OAAA;AAE9B,SAAS;AACT,yCAAuC;AAA9B,iGAAA,MAAM,OAAA;AACf,2DAAmD;AAA1C,qGAAA,KAAK,OAAA;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B,uFAAsF;AAA7E,sIAAA,yBAAyB,OAAA;AAClC,sFAGoD;AAFlD,6HAAA,kBAAkB,OAAA;AAClB,6HAAA,kBAAkB,OAAA"}
|
|
@@ -1,85 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.uploadFile = void 0;
|
|
4
|
-
const errors_1 = require("../errors");
|
|
5
|
-
const logging_1 = require("../logging");
|
|
6
4
|
const ze_http_request_1 = require("./ze-http-request");
|
|
7
|
-
const
|
|
5
|
+
const errors_1 = require("../errors");
|
|
8
6
|
async function uploadFile({ hash, asset }, { EDGE_URL, jwt }) {
|
|
9
7
|
const type = 'file';
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (!ok) {
|
|
33
|
-
// Because of `ctx.waitUntil`, the worker will continue to upload the files even if the request failed, and if we immediately throw an error the local process will be terminated, we try again here to at least have another level of effort to continue local process.
|
|
34
|
-
try {
|
|
35
|
-
(0, logging_1.ze_log)(`Failed on first time...trying to upload chunk ${chunkIndex} of file ${asset.path} of total ${totalChunks} chunks...`);
|
|
36
|
-
const [retryOk, retryCause] = await ze_http_request_1.ZeHttpRequest.from({
|
|
37
|
-
path: '/upload',
|
|
38
|
-
base: EDGE_URL,
|
|
39
|
-
query: { type, hash, filename: asset.path },
|
|
40
|
-
}, options, chunk);
|
|
41
|
-
if (!retryOk) {
|
|
42
|
-
try {
|
|
43
|
-
(0, logging_1.ze_log)(`Second time...Trying to upload chunk ${chunkIndex} of file ${asset.path} of total ${totalChunks} chunks...`);
|
|
44
|
-
await ze_http_request_1.ZeHttpRequest.from({
|
|
45
|
-
path: '/upload',
|
|
46
|
-
base: EDGE_URL,
|
|
47
|
-
query: { type, hash, filename: asset.path },
|
|
48
|
-
}, options, chunk);
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_FAILED_UPLOAD, {
|
|
52
|
-
type: 'file',
|
|
53
|
-
cause: error,
|
|
54
|
-
data: {
|
|
55
|
-
chunkIndex,
|
|
56
|
-
totalChunks,
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_FAILED_UPLOAD, {
|
|
61
|
-
type: 'file',
|
|
62
|
-
cause: retryCause,
|
|
63
|
-
data: {
|
|
64
|
-
chunkIndex,
|
|
65
|
-
totalChunks,
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
8
|
+
const options = {
|
|
9
|
+
method: 'POST',
|
|
10
|
+
headers: {
|
|
11
|
+
'x-file-size': asset.size.toString(),
|
|
12
|
+
'x-file-path': asset.path,
|
|
13
|
+
can_write_jwt: jwt,
|
|
14
|
+
'Content-Type': 'application/octet-stream',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const [ok, cause] = await ze_http_request_1.ZeHttpRequest.from({
|
|
18
|
+
path: '/upload',
|
|
19
|
+
base: EDGE_URL,
|
|
20
|
+
query: { type, hash, filename: asset.path },
|
|
21
|
+
}, options, asset.buffer);
|
|
22
|
+
if (!ok) {
|
|
23
|
+
try {
|
|
24
|
+
const [ok2, cause2] = await ze_http_request_1.ZeHttpRequest.from({
|
|
25
|
+
path: '/upload',
|
|
26
|
+
base: EDGE_URL,
|
|
27
|
+
query: { type, hash, filename: asset.path },
|
|
28
|
+
}, options, asset.buffer);
|
|
29
|
+
if (!ok2) {
|
|
71
30
|
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_FAILED_UPLOAD, {
|
|
72
31
|
type: 'file',
|
|
73
|
-
cause,
|
|
74
|
-
data: {
|
|
75
|
-
error,
|
|
76
|
-
chunkIndex,
|
|
77
|
-
totalChunks,
|
|
78
|
-
},
|
|
32
|
+
cause: cause2,
|
|
79
33
|
});
|
|
80
34
|
}
|
|
81
35
|
}
|
|
82
|
-
(
|
|
36
|
+
catch (error) {
|
|
37
|
+
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_FAILED_UPLOAD, {
|
|
38
|
+
type: 'file',
|
|
39
|
+
cause,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
83
42
|
}
|
|
84
43
|
}
|
|
85
44
|
exports.uploadFile = uploadFile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-file.js","sourceRoot":"","sources":["../../../src/lib/http/upload-file.ts"],"names":[],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"upload-file.js","sourceRoot":"","sources":["../../../src/lib/http/upload-file.ts"],"names":[],"mappings":";;;AAGA,uDAAkD;AAClD,sCAAkD;AAO3C,KAAK,UAAU,UAAU,CAC9B,EAAE,IAAI,EAAE,KAAK,EAAmB,EAChC,EAAE,QAAQ,EAAE,GAAG,EAAuB;IAEtC,MAAM,IAAI,GAAG,MAAM,CAAC;IAEpB,MAAM,OAAO,GAAsB;QACjC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE;YACpC,aAAa,EAAE,KAAK,CAAC,IAAI;YACzB,aAAa,EAAE,GAAG;YAClB,cAAc,EAAE,0BAA0B;SAC3C;KACF,CAAC;IAEF,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,MAAM,+BAAa,CAAC,IAAI,CAC1C;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE;KAC5C,EACD,OAAO,EACP,KAAK,CAAC,MAAM,CACb,CAAC;IAEF,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,IAAI,CAAC;YACH,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,MAAM,+BAAa,CAAC,IAAI,CAC5C;gBACE,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE;aAC5C,EACD,OAAO,EACP,KAAK,CAAC,MAAM,CACb,CAAC;YACF,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,MAAM,IAAI,oBAAW,CAAC,iBAAQ,CAAC,iBAAiB,EAAE;oBAChD,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,MAAM;iBACd,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,oBAAW,CAAC,iBAAQ,CAAC,iBAAiB,EAAE;gBAChD,IAAI,EAAE,MAAM;gBACZ,KAAK;aACN,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC;AAlDD,gCAkDC"}
|
|
@@ -4,10 +4,13 @@ exports.resolve_remote_dependency = void 0;
|
|
|
4
4
|
const zephyr_edge_contract_1 = require("zephyr-edge-contract");
|
|
5
5
|
const token_1 = require("../lib/node-persist/token");
|
|
6
6
|
const errors_1 = require("../lib/errors");
|
|
7
|
+
const logging_1 = require("../lib/logging");
|
|
7
8
|
async function resolve_remote_dependency({ application_uid, version, platform, }) {
|
|
8
9
|
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)());
|
|
9
10
|
if (platform) {
|
|
11
|
+
(0, logging_1.ze_log)('adding build target to resolve dependency:', platform);
|
|
10
12
|
resolveDependency.searchParams.append('build_target', platform);
|
|
13
|
+
(0, logging_1.ze_log)('URL for resolving dependency:', resolveDependency.toString());
|
|
11
14
|
}
|
|
12
15
|
try {
|
|
13
16
|
const token = await (0, token_1.getToken)();
|
|
@@ -35,6 +38,7 @@ async function resolve_remote_dependency({ application_uid, version, platform, }
|
|
|
35
38
|
}
|
|
36
39
|
const response = await res.json();
|
|
37
40
|
if (response.value) {
|
|
41
|
+
(0, logging_1.ze_log)('resolved dependency:', response.value, 'application_uid: ', application_uid, 'version: ', version);
|
|
38
42
|
return Object.assign({}, response.value, { version });
|
|
39
43
|
}
|
|
40
44
|
throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_RESOLVE_REMOTES, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve_remote_dependency.js","sourceRoot":"","sources":["../../src/zephyr-engine/resolve_remote_dependency.ts"],"names":[],"mappings":";;;AAAA,+DAAuE;AACvE,qDAAqD;AACrD,0CAAsD;
|
|
1
|
+
{"version":3,"file":"resolve_remote_dependency.js","sourceRoot":"","sources":["../../src/zephyr-engine/resolve_remote_dependency.ts"],"names":[],"mappings":";;;AAAA,+DAAuE;AACvE,qDAAqD;AACrD,0CAAsD;AACtD,4CAAwC;AAYjC,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,IAAA,gBAAM,EAAC,4CAA4C,EAAE,QAAQ,CAAC,CAAC;QAC/D,iBAAiB,CAAC,YAAY,CAAC,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;QAChE,IAAA,gBAAM,E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CAAC,mBAAmB,EAAE;YAClD,MAAM,EAAE,eAAe;YACvB,OAAO;YACP,WAAW;YACX,OAAO;YACP,IAAI,EAAE,EAAE,OAAO,EAAE,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;AA7ED,8DA6EC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zephyr-agent",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20241122064756",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"uuid": "^8.3.2",
|
|
29
29
|
"node-persist": "^4.0.1",
|
|
30
30
|
"debug": "^4.3.4",
|
|
31
|
-
"zephyr-edge-contract": "0.0.0-canary-
|
|
31
|
+
"zephyr-edge-contract": "0.0.0-canary-20241122064756"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/git-url-parse": "^9.0.3",
|