zephyr-agent 0.1.5 → 0.1.6-next.1
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 +5 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/http/fetch-with-retries.js +61 -0
- package/dist/lib/http/fetch-with-retries.js.map +1 -1
- package/dist/lib/utils/read-dir-recursive.d.ts +27 -0
- package/dist/lib/utils/read-dir-recursive.js +49 -0
- package/dist/lib/utils/read-dir-recursive.js.map +1 -0
- package/dist/package.json +5 -1
- package/package.json +6 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { onIndexHtmlResolved, resolveIndexHtml } from './lib/hacks/resolve-index-html';
|
|
2
2
|
export { getPartialAssetMap, removePartialAssetMap, savePartialAssetMap, } from './lib/node-persist/partial-assets-map';
|
|
3
3
|
export { getGlobal } from './lib/utils/get-global';
|
|
4
|
+
export { readDirRecursive, readDirRecursiveWithContents, type FileInfo, } from './lib/utils/read-dir-recursive';
|
|
4
5
|
export { ZeErrors, ZephyrError } from './lib/errors';
|
|
5
6
|
export { handleGlobalError } from './lib/errors';
|
|
6
7
|
export { getAllAppDeployResults, getAllDeployedApps, getAppDeployResult, type DeployResult, } from './lib/node-persist/app-deploy-result-cache';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.generateManifestContent = exports.buildEnvJsonAsset = exports.injectBeforeHeadClose = exports.buildModulePreload = exports.injectImportMap = exports.buildImportMap = exports.detectEnvReads = exports.VIRTUAL_SPECIFIER = exports.rewriteEnvReadsToVirtualModule = exports.buildEnvModuleSource = exports.buildEnvImportMapScript = exports.buildEnvImportMap = exports.readPackageJson = exports.is_zephyr_dependency_pair = exports.ZephyrEngine = exports.TOKEN_EXPIRY = exports.DEFAULT_AUTH_COMPLETION_TIMEOUT_MS = exports.createZephyrManifest = exports.createManifestContent = exports.createManifestAsset = exports.convertResolvedDependencies = exports.zeBuildDashData = exports.buildAssetsMap = exports.zeBuildAssets = exports.normalizeBasePath = exports.applyBaseHrefToAssets = exports.getLogFormat = exports.getLogBasePath = exports.isFileLoggingEnabled = exports.writeRunSummary = exports.writeLogToFile = exports.resetLogRun = exports.getCurrentRunDir = exports.initializeLogRun = exports.logFn = exports.ze_log = exports.getAppDeployResult = exports.getAllDeployedApps = exports.getAllAppDeployResults = exports.handleGlobalError = exports.ZephyrError = exports.ZeErrors = exports.readDirRecursiveWithContents = exports.readDirRecursive = exports.getGlobal = exports.savePartialAssetMap = exports.removePartialAssetMap = exports.getPartialAssetMap = exports.resolveIndexHtml = exports.onIndexHtmlResolved = void 0;
|
|
4
|
+
exports.collectZEPublicVars = exports.calculateManifestHash = void 0;
|
|
4
5
|
// hack for angular
|
|
5
6
|
var resolve_index_html_1 = require("./lib/hacks/resolve-index-html");
|
|
6
7
|
Object.defineProperty(exports, "onIndexHtmlResolved", { enumerable: true, get: function () { return resolve_index_html_1.onIndexHtmlResolved; } });
|
|
@@ -13,6 +14,9 @@ Object.defineProperty(exports, "savePartialAssetMap", { enumerable: true, get: f
|
|
|
13
14
|
// global utilities
|
|
14
15
|
var get_global_1 = require("./lib/utils/get-global");
|
|
15
16
|
Object.defineProperty(exports, "getGlobal", { enumerable: true, get: function () { return get_global_1.getGlobal; } });
|
|
17
|
+
var read_dir_recursive_1 = require("./lib/utils/read-dir-recursive");
|
|
18
|
+
Object.defineProperty(exports, "readDirRecursive", { enumerable: true, get: function () { return read_dir_recursive_1.readDirRecursive; } });
|
|
19
|
+
Object.defineProperty(exports, "readDirRecursiveWithContents", { enumerable: true, get: function () { return read_dir_recursive_1.readDirRecursiveWithContents; } });
|
|
16
20
|
// errors
|
|
17
21
|
var errors_1 = require("./lib/errors");
|
|
18
22
|
Object.defineProperty(exports, "ZeErrors", { enumerable: true, get: function () { return errors_1.ZeErrors; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
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,mBAAmB;AACnB,qDAAmD;AAA1C,uGAAA,SAAS,OAAA;AAClB,qEAIwC;AAHtC,sHAAA,gBAAgB,OAAA;AAChB,kIAAA,4BAA4B,OAAA;AAI9B,SAAS;AACT,uCAAqD;AAA5C,kGAAA,QAAQ,OAAA;AAAE,qGAAA,WAAW,OAAA;AAC9B,uCAAiD;AAAxC,2GAAA,iBAAiB,OAAA;AAE1B,gBAAgB;AAChB,sFAKoD;AAJlD,iIAAA,sBAAsB,OAAA;AACtB,6HAAA,kBAAkB,OAAA;AAClB,6HAAA,kBAAkB,OAAA;AAIpB,SAAS;AACT,yCAAuC;AAA9B,iGAAA,MAAM,OAAA;AACf,2DAAmD;AAA1C,qGAAA,KAAK,OAAA;AACd,yDAUmC;AATjC,+GAAA,gBAAgB,OAAA;AAChB,+GAAA,gBAAgB,OAAA;AAChB,0GAAA,WAAW,OAAA;AACX,6GAAA,cAAc,OAAA;AACd,8GAAA,eAAe,OAAA;AACf,mHAAA,oBAAoB,OAAA;AACpB,6GAAA,cAAc,OAAA;AACd,2GAAA,YAAY,OAAA;AAId,uBAAuB;AACvB,8EAGgD;AAF9C,4HAAA,qBAAqB,OAAA;AACrB,wHAAA,iBAAiB,OAAA;AAEnB,sEAAmE;AAA1D,gHAAA,aAAa,OAAA;AACtB,8EAGgD;AAF9C,qHAAA,kBAAkB,OAAkB;AAGtC,4EAAwE;AAA/D,qHAAA,eAAe,OAAA;AACxB,4EAK+C;AAJ7C,iIAAA,2BAA2B,OAAA;AAC3B,yHAAA,mBAAmB,OAAA;AACnB,2HAAA,qBAAqB,OAAA;AACrB,0HAAA,oBAAoB,OAAA;AAGtB,uBAAuB;AACvB,oDAAyF;AAAhF,gIAAA,kCAAkC,OAAA;AAAE,0GAAA,YAAY,OAAA;AAEzD,qDAAqD;AACrD,iDAOyB;AANvB,6GAAA,YAAY,OAAA;AACZ,0HAAA,yBAAyB,OAAA;AACzB,gHAAA,eAAe,OAAA;AAQjB,iCAAiC;AACjC,qDAgB6B;AAf3B,kHAAA,iBAAiB,OAAA;AACjB,wHAAA,uBAAuB,OAAA;AACvB,qHAAA,oBAAoB,OAAA;AACpB,+HAAA,8BAA8B,OAAA;AAE9B,kHAAA,iBAAiB,OAAA;AACjB,+GAAA,cAAc,OAAA;AACd,+GAAA,cAAc,OAAA;AACd,gHAAA,eAAe,OAAA;AACf,mHAAA,kBAAkB,OAAA;AAClB,sHAAA,qBAAqB,OAAA;AACrB,kHAAA,iBAAiB,OAAA;AACjB,wHAAA,uBAAuB,OAAA;AACvB,sHAAA,qBAAqB,OAAA;AACrB,oHAAA,mBAAmB,OAAA"}
|
|
@@ -4,6 +4,8 @@ exports.fetchWithRetries = fetchWithRetries;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const axios_1 = tslib_1.__importStar(require("axios"));
|
|
6
6
|
const axios_retry_1 = tslib_1.__importDefault(require("axios-retry"));
|
|
7
|
+
const http_proxy_agent_1 = require("http-proxy-agent");
|
|
8
|
+
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
7
9
|
const is_ci_1 = tslib_1.__importDefault(require("is-ci"));
|
|
8
10
|
const errors_1 = require("../errors");
|
|
9
11
|
const IPV4_FAMILY = 4;
|
|
@@ -14,6 +16,60 @@ const RETRY_ERROR_CODES = [
|
|
|
14
16
|
'ECONNREFUSED',
|
|
15
17
|
'EPIPE',
|
|
16
18
|
];
|
|
19
|
+
/**
|
|
20
|
+
* Gets proxy URL from environment variables.
|
|
21
|
+
* Checks both uppercase and lowercase variants.
|
|
22
|
+
* Returns undefined if no proxy is configured.
|
|
23
|
+
*/
|
|
24
|
+
function getProxyUrl(protocol) {
|
|
25
|
+
const envVars = protocol === 'https'
|
|
26
|
+
? ['HTTPS_PROXY', 'https_proxy', 'HTTP_PROXY', 'http_proxy']
|
|
27
|
+
: ['HTTP_PROXY', 'http_proxy'];
|
|
28
|
+
for (const envVar of envVars) {
|
|
29
|
+
const value = process.env[envVar];
|
|
30
|
+
if (value) {
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Checks if a host should bypass the proxy based on NO_PROXY environment variable.
|
|
38
|
+
* NO_PROXY is a comma-separated list of hosts that should not use the proxy.
|
|
39
|
+
*/
|
|
40
|
+
function shouldBypassProxy(hostname) {
|
|
41
|
+
const noProxy = process.env['NO_PROXY'] || process.env['no_proxy'];
|
|
42
|
+
if (!noProxy) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
const noProxyList = noProxy.split(',').map((h) => h.trim().toLowerCase());
|
|
46
|
+
const hostLower = hostname.toLowerCase();
|
|
47
|
+
return noProxyList.some((noProxyHost) => {
|
|
48
|
+
if (noProxyHost === '*') {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
// Handle wildcard domains like .example.com
|
|
52
|
+
if (noProxyHost.startsWith('.')) {
|
|
53
|
+
return hostLower.endsWith(noProxyHost) || hostLower === noProxyHost.slice(1);
|
|
54
|
+
}
|
|
55
|
+
return hostLower === noProxyHost || hostLower.endsWith(`.${noProxyHost}`);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Creates HTTP/HTTPS agents with proxy support if configured via environment variables.
|
|
60
|
+
*/
|
|
61
|
+
function getProxyAgents(url) {
|
|
62
|
+
// Check if this host should bypass the proxy
|
|
63
|
+
if (shouldBypassProxy(url.hostname)) {
|
|
64
|
+
return {};
|
|
65
|
+
}
|
|
66
|
+
const httpProxyUrl = getProxyUrl('http');
|
|
67
|
+
const httpsProxyUrl = getProxyUrl('https');
|
|
68
|
+
return {
|
|
69
|
+
httpAgent: httpProxyUrl ? new http_proxy_agent_1.HttpProxyAgent(httpProxyUrl) : undefined,
|
|
70
|
+
httpsAgent: httpsProxyUrl ? new https_proxy_agent_1.HttpsProxyAgent(httpsProxyUrl) : undefined,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
17
73
|
function shouldRetry(error) {
|
|
18
74
|
// Retry on network errors (no response received)
|
|
19
75
|
if (!error.response) {
|
|
@@ -29,12 +85,17 @@ function shouldRetry(error) {
|
|
|
29
85
|
async function fetchWithRetries(url, options = {}, retries = 3) {
|
|
30
86
|
var _a, _b, _c, _d, _e;
|
|
31
87
|
try {
|
|
88
|
+
// Get proxy agents if configured via environment variables
|
|
89
|
+
const { httpAgent, httpsAgent } = getProxyAgents(url);
|
|
32
90
|
// Create a custom axios instance for this request with CI-friendly settings
|
|
33
91
|
const axiosInstance = axios_1.default.create({
|
|
34
92
|
// Force IPv4 in CI environments to avoid IPv6 connectivity issues
|
|
35
93
|
// References: https://github.com/actions/runner/issues/3138
|
|
36
94
|
// https://x.com/matteocollina/status/1640384245834055680
|
|
37
95
|
family: is_ci_1.default ? IPV4_FAMILY : undefined,
|
|
96
|
+
// Apply proxy agents if configured
|
|
97
|
+
httpAgent,
|
|
98
|
+
httpsAgent,
|
|
38
99
|
});
|
|
39
100
|
// Configure axios-retry
|
|
40
101
|
(0, axios_retry_1.default)(axiosInstance, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-with-retries.js","sourceRoot":"","sources":["../../../src/lib/http/fetch-with-retries.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":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/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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface FileInfo {
|
|
2
|
+
/** Full absolute path to the file */
|
|
3
|
+
fullPath: string;
|
|
4
|
+
/** Relative path from the root directory */
|
|
5
|
+
relativePath: string;
|
|
6
|
+
/** Whether this is a directory */
|
|
7
|
+
isDirectory: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Reads a directory recursively and returns information about all files. Returns an empty
|
|
11
|
+
* array if the directory doesn't exist.
|
|
12
|
+
*
|
|
13
|
+
* @param dirPath - The absolute path to the directory to read
|
|
14
|
+
* @returns Array of file information objects
|
|
15
|
+
*/
|
|
16
|
+
export declare function readDirRecursive(dirPath: string): Promise<FileInfo[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Reads a directory recursively and returns file contents along with metadata. Skips
|
|
19
|
+
* directories and only returns actual files with their contents. Returns an empty array
|
|
20
|
+
* if the directory doesn't exist.
|
|
21
|
+
*
|
|
22
|
+
* @param dirPath - The absolute path to the directory to read
|
|
23
|
+
* @returns Array of file information with contents
|
|
24
|
+
*/
|
|
25
|
+
export declare function readDirRecursiveWithContents(dirPath: string): Promise<Array<FileInfo & {
|
|
26
|
+
content: Buffer;
|
|
27
|
+
}>>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readDirRecursive = readDirRecursive;
|
|
4
|
+
exports.readDirRecursiveWithContents = readDirRecursiveWithContents;
|
|
5
|
+
const promises_1 = require("node:fs/promises");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
/**
|
|
8
|
+
* Reads a directory recursively and returns information about all files. Returns an empty
|
|
9
|
+
* array if the directory doesn't exist.
|
|
10
|
+
*
|
|
11
|
+
* @param dirPath - The absolute path to the directory to read
|
|
12
|
+
* @returns Array of file information objects
|
|
13
|
+
*/
|
|
14
|
+
async function readDirRecursive(dirPath) {
|
|
15
|
+
try {
|
|
16
|
+
await (0, promises_1.stat)(dirPath);
|
|
17
|
+
}
|
|
18
|
+
catch (_a) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
const entries = await (0, promises_1.readdir)(dirPath, {
|
|
22
|
+
recursive: true,
|
|
23
|
+
withFileTypes: true,
|
|
24
|
+
});
|
|
25
|
+
return entries.map((entry) => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
return ({
|
|
28
|
+
fullPath: (0, node_path_1.resolve)((_a = entry.parentPath) !== null && _a !== void 0 ? _a : entry.path, entry.name),
|
|
29
|
+
relativePath: (0, node_path_1.relative)(dirPath, (0, node_path_1.resolve)((_b = entry.parentPath) !== null && _b !== void 0 ? _b : entry.path, entry.name)),
|
|
30
|
+
isDirectory: entry.isDirectory(),
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Reads a directory recursively and returns file contents along with metadata. Skips
|
|
36
|
+
* directories and only returns actual files with their contents. Returns an empty array
|
|
37
|
+
* if the directory doesn't exist.
|
|
38
|
+
*
|
|
39
|
+
* @param dirPath - The absolute path to the directory to read
|
|
40
|
+
* @returns Array of file information with contents
|
|
41
|
+
*/
|
|
42
|
+
async function readDirRecursiveWithContents(dirPath) {
|
|
43
|
+
const files = await readDirRecursive(dirPath);
|
|
44
|
+
const fileContents = await Promise.all(files
|
|
45
|
+
.filter((file) => !file.isDirectory)
|
|
46
|
+
.map(async (file) => (Object.assign(Object.assign({}, file), { content: await (0, promises_1.readFile)(file.fullPath) }))));
|
|
47
|
+
return fileContents;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=read-dir-recursive.js.map
|
|
@@ -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AAC,iCAChB,IAAI,KACP,OAAO,EAAE,MAAM,IAAA,mBAAQ,EAAC,IAAI,CAAC,QAAQ,CAAC,IACtC,CAAC,CACN,CAAC;IAEF,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zephyr-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Zephyr plugin agent",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -59,6 +59,10 @@
|
|
|
59
59
|
"@typescript-eslint/eslint-plugin": "catalog:eslint",
|
|
60
60
|
"ts-jest": "catalog:typescript"
|
|
61
61
|
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"http-proxy-agent": "^7.0.2",
|
|
64
|
+
"https-proxy-agent": "^7.0.6"
|
|
65
|
+
},
|
|
62
66
|
"publishConfig": {
|
|
63
67
|
"access": "public",
|
|
64
68
|
"provenance": true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zephyr-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6-next.1",
|
|
4
4
|
"description": "Zephyr plugin agent",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"open": "^10.1.0",
|
|
41
41
|
"proper-lockfile": "^4.1.2",
|
|
42
42
|
"tslib": "^2.8.1",
|
|
43
|
-
"zephyr-edge-contract": "0.1.
|
|
43
|
+
"zephyr-edge-contract": "0.1.6-next.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@jest/globals": "^29.7.0",
|
|
@@ -54,6 +54,10 @@
|
|
|
54
54
|
"@typescript-eslint/eslint-plugin": "^8.27.0",
|
|
55
55
|
"ts-jest": "^29.2.6"
|
|
56
56
|
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"http-proxy-agent": "^7.0.2",
|
|
59
|
+
"https-proxy-agent": "^7.0.6"
|
|
60
|
+
},
|
|
57
61
|
"publishConfig": {
|
|
58
62
|
"access": "public",
|
|
59
63
|
"provenance": true
|