docs: add quixzoom-auth-core product to AAMOS
- Product documentation in docs/products/ - Updated MEMORY.md with product info - quiXzoom Auth Core as AAMOS Identity product
This commit is contained in:
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
type AgentType = http.Agent | https.Agent;
|
||||
declare const _default: (originalMethod: Function, agent: AgentType, forceGlobalAgent: boolean) => (...args: any[]) => any;
|
||||
export default _default;
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const http_1 = __importDefault(require("http"));
|
||||
const https_1 = __importDefault(require("https"));
|
||||
exports.default = (originalMethod, agent, forceGlobalAgent) => {
|
||||
return (...args) => {
|
||||
let url;
|
||||
let options;
|
||||
let callback;
|
||||
if (typeof args[0] === 'string' || args[0] instanceof URL) {
|
||||
url = args[0];
|
||||
if (typeof args[1] === 'function') {
|
||||
options = {};
|
||||
callback = args[1];
|
||||
}
|
||||
else {
|
||||
options = {
|
||||
...args[1],
|
||||
};
|
||||
callback = args[2];
|
||||
}
|
||||
}
|
||||
else {
|
||||
options = {
|
||||
...args[0],
|
||||
};
|
||||
callback = args[1];
|
||||
}
|
||||
if (forceGlobalAgent) {
|
||||
options.agent = agent;
|
||||
}
|
||||
else {
|
||||
if (!options.agent) {
|
||||
options.agent = agent;
|
||||
}
|
||||
if (options.agent === http_1.default.globalAgent || options.agent === https_1.default.globalAgent) {
|
||||
options.agent = agent;
|
||||
}
|
||||
}
|
||||
if (url) {
|
||||
return originalMethod(url, options, callback);
|
||||
}
|
||||
else {
|
||||
return originalMethod(options, callback);
|
||||
}
|
||||
};
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
export { default as bindHttpMethod, } from './bindHttpMethod';
|
||||
export { default as isUrlMatchingNoProxy, } from './isUrlMatchingNoProxy';
|
||||
export { default as parseProxyUrl, } from './parseProxyUrl';
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseProxyUrl = exports.isUrlMatchingNoProxy = exports.bindHttpMethod = void 0;
|
||||
var bindHttpMethod_1 = require("./bindHttpMethod");
|
||||
Object.defineProperty(exports, "bindHttpMethod", { enumerable: true, get: function () { return __importDefault(bindHttpMethod_1).default; } });
|
||||
var isUrlMatchingNoProxy_1 = require("./isUrlMatchingNoProxy");
|
||||
Object.defineProperty(exports, "isUrlMatchingNoProxy", { enumerable: true, get: function () { return __importDefault(isUrlMatchingNoProxy_1).default; } });
|
||||
var parseProxyUrl_1 = require("./parseProxyUrl");
|
||||
Object.defineProperty(exports, "parseProxyUrl", { enumerable: true, get: function () { return __importDefault(parseProxyUrl_1).default; } });
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
declare const _default: (subjectUrl: string, noProxy: string) => boolean;
|
||||
export default _default;
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const matcher_1 = __importDefault(require("matcher"));
|
||||
const errors_1 = require("../errors");
|
||||
exports.default = (subjectUrl, noProxy) => {
|
||||
const subjectUrlTokens = new URL(subjectUrl);
|
||||
const rules = noProxy.split(/[\s,]+/).filter(Boolean);
|
||||
for (const rule of rules) {
|
||||
const ruleMatch = rule
|
||||
.replace(/^(?<leadingDot>\.)/, '*')
|
||||
.match(/^(?<hostname>.+?)(?::(?<port>\d+))?$/);
|
||||
if (!ruleMatch || !ruleMatch.groups) {
|
||||
throw new errors_1.UnexpectedStateError('Invalid NO_PROXY pattern.');
|
||||
}
|
||||
if (!ruleMatch.groups.hostname) {
|
||||
throw new errors_1.UnexpectedStateError('NO_PROXY entry pattern must include hostname. Use * to match any hostname.');
|
||||
}
|
||||
const hostnameIsMatch = matcher_1.default.isMatch(subjectUrlTokens.hostname, ruleMatch.groups.hostname);
|
||||
if (hostnameIsMatch && (!ruleMatch.groups || !ruleMatch.groups.port || subjectUrlTokens.port && subjectUrlTokens.port === ruleMatch.groups.port)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Generated
Vendored
+61
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const vitest_1 = require("vitest");
|
||||
const isUrlMatchingNoProxy_1 = __importDefault(require("./isUrlMatchingNoProxy"));
|
||||
(0, vitest_1.test)('returns `true` if hosts match', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://foo.com/', 'foo.com')).toBe(true);
|
||||
});
|
||||
(0, vitest_1.test)('returns `true` if hosts match (IP)', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://127.0.0.1/', '127.0.0.1')).toBe(true);
|
||||
});
|
||||
(0, vitest_1.test)('returns `true` if hosts match (using asterisk wildcard)', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://bar.foo.com/', '*.foo.com')).toBe(true);
|
||||
});
|
||||
(0, vitest_1.test)('returns `true` if domain matches (using dot wildcard)', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://foo.com/', '.foo.com')).toBe(true);
|
||||
});
|
||||
(0, vitest_1.test)('returns `true` if subdomain matches (using dot wildcard)', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://bar.foo.com/', '.foo.com')).toBe(true);
|
||||
});
|
||||
(0, vitest_1.test)('returns `true` if hosts match (*) and ports match', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://foo.com:8080/', '*:8080')).toBe(true);
|
||||
});
|
||||
(0, vitest_1.test)('returns `true` if hosts and ports match', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://foo.com:8080/', 'foo.com:8080')).toBe(true);
|
||||
});
|
||||
(0, vitest_1.test)('returns `true` if hosts match and NO_PROXY does not define port', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://foo.com:8080/', 'foo.com')).toBe(true);
|
||||
});
|
||||
(0, vitest_1.test)('returns `true` if hosts (IP) and ports match', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://127.0.0.1:8080/', '127.0.0.1:8080')).toBe(true);
|
||||
});
|
||||
(0, vitest_1.test)('returns `false` if hosts match and ports do not match (diffferent port)', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://foo.com:8080/', 'foo.com:8000')).toBe(false);
|
||||
});
|
||||
(0, vitest_1.test)('returns `false` if hosts match and ports do not match (port not present subject)', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://foo.com/', 'foo.com:8000')).toBe(false);
|
||||
});
|
||||
(0, vitest_1.test)('returns `true` if hosts match and ports do not match (port not present NO_PROXY)', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://foo.com:8000/', 'foo.com')).toBe(true);
|
||||
});
|
||||
(0, vitest_1.test)('returns `true` if hosts match in one of multiple rules separated with a comma', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://foo.com/', 'bar.org,foo.com,baz.io')).toBe(true);
|
||||
});
|
||||
(0, vitest_1.test)('returns `true` if hosts match in one of multiple rules separated with a comma and a space', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://foo.com/', 'bar.org, foo.com, baz.io')).toBe(true);
|
||||
});
|
||||
(0, vitest_1.test)('returns `true` if hosts match in one of multiple rules separated with a space', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://foo.com/', 'bar.org foo.com baz.io')).toBe(true);
|
||||
});
|
||||
(0, vitest_1.test)('handles trailing newline in NO_PROXY', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://foo.com/', 'foo.com\n')).toBe(true);
|
||||
});
|
||||
(0, vitest_1.test)('handles trailing whitespace in NO_PROXY', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://foo.com/', 'foo.com ')).toBe(true);
|
||||
});
|
||||
(0, vitest_1.test)('handles leading whitespace in NO_PROXY', () => {
|
||||
(0, vitest_1.expect)((0, isUrlMatchingNoProxy_1.default)('http://foo.com/', ' foo.com')).toBe(true);
|
||||
});
|
||||
+1
@@ -0,0 +1 @@
|
||||
export declare const parseBoolean: (value: any) => boolean;
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseBoolean = void 0;
|
||||
const parseBoolean = function (value) {
|
||||
switch (Object.prototype.toString.call(value)) {
|
||||
case '[object String]':
|
||||
return ['true', 't', 'yes', 'y', 'on', '1'].includes(value.trim().toLowerCase());
|
||||
case '[object Number]':
|
||||
return value.valueOf() === 1;
|
||||
case '[object Boolean]':
|
||||
return value.valueOf();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
exports.parseBoolean = parseBoolean;
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
declare const _default: (url: string) => {
|
||||
authorization: string | null;
|
||||
hostname: string;
|
||||
port: number;
|
||||
};
|
||||
export default _default;
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const errors_1 = require("../errors");
|
||||
exports.default = (url) => {
|
||||
const urlTokens = new URL(url);
|
||||
if (urlTokens.search !== '') {
|
||||
throw new errors_1.UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL must not have query.');
|
||||
}
|
||||
if (urlTokens.hash !== '') {
|
||||
throw new errors_1.UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL must not have hash.');
|
||||
}
|
||||
if (urlTokens.protocol !== 'http:') {
|
||||
throw new errors_1.UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL protocol must be "http:".');
|
||||
}
|
||||
let port = 80;
|
||||
if (urlTokens.port) {
|
||||
port = Number.parseInt(urlTokens.port, 10);
|
||||
}
|
||||
let authorization = null;
|
||||
if (urlTokens.username && urlTokens.password) {
|
||||
authorization = urlTokens.username + ':' + urlTokens.password;
|
||||
}
|
||||
else if (urlTokens.username) {
|
||||
authorization = urlTokens.username;
|
||||
}
|
||||
return {
|
||||
authorization,
|
||||
hostname: urlTokens.hostname,
|
||||
port,
|
||||
};
|
||||
};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const vitest_1 = require("vitest");
|
||||
const parseProxyUrl_1 = __importDefault(require("./parseProxyUrl"));
|
||||
(0, vitest_1.test)('extracts hostname', () => {
|
||||
(0, vitest_1.expect)((0, parseProxyUrl_1.default)('http://0.0.0.0').hostname).toBe('0.0.0.0');
|
||||
});
|
||||
(0, vitest_1.test)('extracts port', () => {
|
||||
(0, vitest_1.expect)((0, parseProxyUrl_1.default)('http://0.0.0.0:3000').port).toBe(3000);
|
||||
});
|
||||
(0, vitest_1.test)('extracts authorization', () => {
|
||||
(0, vitest_1.expect)((0, parseProxyUrl_1.default)('http://foo:bar@0.0.0.0').authorization).toBe('foo:bar');
|
||||
});
|
||||
(0, vitest_1.test)('throws an error if protocol is not "http:"', () => {
|
||||
(0, vitest_1.expect)(() => {
|
||||
(0, parseProxyUrl_1.default)('https://0.0.0.0:3000');
|
||||
}).toThrow('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL protocol must be "http:".');
|
||||
});
|
||||
(0, vitest_1.test)('throws an error if query is present', () => {
|
||||
(0, vitest_1.expect)(() => {
|
||||
(0, parseProxyUrl_1.default)('http://0.0.0.0:3000/?foo=bar');
|
||||
}).toThrow('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL must not have query.');
|
||||
});
|
||||
(0, vitest_1.test)('throws an error if hash is present', () => {
|
||||
(0, vitest_1.expect)(() => {
|
||||
(0, parseProxyUrl_1.default)('http://0.0.0.0:3000/#foo');
|
||||
}).toThrow('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL must not have hash.');
|
||||
});
|
||||
Reference in New Issue
Block a user