autorest
Version:
The AutoRest tool generates client libraries for accessing RESTful web services. Input to AutoRest is an OpenAPI spec that describes the REST API.
1,361 lines (1,321 loc) • 470 kB
JavaScript
exports.id = "src_autorest-as-a-service_ts";
exports.ids = ["src_autorest-as-a-service_ts"];
exports.modules = {
/***/ "../../libs/codegen/dist/apiversion/apiversion.js":
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.toSemver = toSemver;
exports.lt = lt;
exports.gt = gt;
exports.lowest = lowest;
exports.highest = highest;
exports.minimum = minimum;
exports.maximum = maximum;
const semver = __importStar(__webpack_require__("../../../common/temp/node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.js"));
/*
Handling:
yyyy-mm n(yyyy).n(mm).0
yyyy-mm-preview n(yyyy).n(mm).0-preview
yyyy-mm-dd n(yyyy).n(mm).n(dd)
yyyy-mm-dd-preview n(yyyy).n(mm).n(dd)-preview
yyyy-mm-dd.x1.x2 (miliseconds since 1970-01-01).x1.x2
x1.x2.x3.x4 x1.x2.x3
x.x x.x.0
vx.x x.x.0
vx.x-preview x.x.0-preview
*/
function toSemver(apiversion) {
// let result = '';
// strip off leading "v" or "=" character
apiversion = apiversion.replace(/^v|^=/gi, "");
// eslint-disable-next-line no-useless-escape
const versionedDateRegex = new RegExp(/(^\d{4}\-\d{2}\-\d{2})(\.\d+\.\d+$)/gi);
if (apiversion.match(versionedDateRegex)) {
// convert yyyy-mm-dd.x1.x2 ---> (miliseconds since 1970-01-01).x1.x2
const date = apiversion.replace(versionedDateRegex, "$1");
const miliseconds = new Date(date).getTime();
const lastNumbers = apiversion.replace(versionedDateRegex, "$2");
return `${miliseconds}${lastNumbers}`;
}
const [whole, major, minor, revision, tag] = /^(\d+)-(\d+)(?:-(\d+))?(.*)/.exec(apiversion) ||
/(\d*)\.(\d*)\.(\d*)(.*)/.exec(apiversion) ||
/(\d*)\.(\d*)()(.*)/.exec(apiversion) ||
/(\d*)()()(.*)/.exec(apiversion) ||
[];
return `${Number.parseInt(major || "0") || 0}.${Number.parseInt(minor || "0") || 0}.${Number.parseInt(revision || "0") || 0}${(tag === null || tag === void 0 ? void 0 : tag.startsWith("-")) ? tag : ""}`;
}
function lt(apiVersion1, apiVersion2) {
const v1 = toSemver(apiVersion1);
const v2 = toSemver(apiVersion2);
return semver.lt(v1, v2);
}
function gt(apiVersion1, apiVersion2) {
const v1 = toSemver(apiVersion1);
const v2 = toSemver(apiVersion2);
return semver.gt(v1, v2);
}
function lowest(apiVersion1, apiVersion2) {
return lt(apiVersion1, apiVersion2) ? apiVersion1 : apiVersion2;
}
function highest(apiVersion1, apiVersion2) {
return gt(apiVersion1, apiVersion2) ? apiVersion1 : apiVersion2;
}
function minimum(apiversions) {
if (apiversions.length === 0) {
return "";
}
let result = apiversions[0];
for (const each of apiversions) {
result = lowest(result, each);
}
return result;
}
function maximum(apiversions) {
if (apiversions.length === 0) {
return "";
}
let result = apiversions[0];
for (const each of apiversions) {
result = highest(result, each);
}
return result;
}
//# sourceMappingURL=apiversion.js.map
/***/ }),
/***/ "../../libs/codegen/dist/exec.js":
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.cmdlineToArray = cmdlineToArray;
exports.resolveFullPath = resolveFullPath;
exports.execute = execute;
const child_process_1 = __webpack_require__("child_process");
const path = __importStar(__webpack_require__("path"));
const async_io_1 = __webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+async-io@3.0.254/node_modules/@azure-tools/async-io/dist/main.js");
function cmdlineToArray(text, result = [], matcher = /[^\s"]+|"([^"]*)"/gi, count = 0) {
text = text.replace(/\\"/g, "\ufffe");
const match = matcher.exec(text);
return match
? cmdlineToArray(text, result, matcher, result.push(match[1] ? match[1].replace(/\ufffe/g, '\\"') : match[0].replace(/\ufffe/g, '\\"')))
: result;
}
function getPathVariableName() {
// windows calls it's path 'Path' usually, but this is not guaranteed.
if (process.platform === "win32") {
let PATH = "Path";
Object.keys(process.env).forEach(function (e) {
if (e.match(/^PATH$/i)) {
PATH = e;
}
});
return PATH;
}
return "PATH";
}
async function realPathWithExtension(command) {
const pathExt = (process.env.pathext || ".EXE").split(";");
for (const each of pathExt) {
const filename = `${command}${each}`;
if (await (0, async_io_1.isFile)(filename)) {
return filename;
}
}
return undefined;
}
async function getFullPath(command, recursive = false, searchPath) {
command = command.replace(/"/g, "");
const ext = path.extname(command);
if (path.isAbsolute(command)) {
// if the file has an extension, or we're not on win32, and this is an actual file, use it.
if (ext || process.platform !== "win32") {
if (await (0, async_io_1.isFile)(command)) {
return command;
}
}
// if we're on windows, look for a file with an acceptable extension.
if (process.platform === "win32") {
// try all the PATHEXT extensions to see if it is a recognized program
const cmd = await realPathWithExtension(command);
if (cmd) {
return cmd;
}
}
return undefined;
}
if (searchPath) {
for (const folder of searchPath) {
let fullPath = await getFullPath(path.resolve(folder, command));
if (fullPath) {
return fullPath;
}
if (recursive) {
try {
for (const entry of await (0, async_io_1.readdir)(folder)) {
const folderPath = path.resolve(folder, entry);
if (await (0, async_io_1.isDirectory)(folderPath)) {
fullPath =
(await getFullPath(path.join(folderPath, command))) || (await getFullPath(command, true, [folderPath]));
if (fullPath) {
return fullPath;
}
}
}
}
catch (_a) {
// ignore failures
}
}
}
}
return undefined;
}
function quoteIfNecessary(text) {
if (text && text.indexOf(" ") > -1 && text.charAt(0) !== '"') {
return `"${text}"`;
}
return text;
}
function getSearchPath() {
return (process.env[getPathVariableName()] || "").split(path.delimiter);
}
async function resolveFullPath(command, alternateRecursiveFolders) {
let fullCommandPath = await getFullPath(command, false, getSearchPath());
if (!fullCommandPath) {
// fallback to searching the subfolders we're given.
if (alternateRecursiveFolders) {
fullCommandPath = await getFullPath(command, true, alternateRecursiveFolders);
}
}
return fullCommandPath;
}
async function execute(cwd, command, ...parameters) {
const fullCommandPath = await resolveFullPath(command);
if (!fullCommandPath) {
throw new Error(`Unknown command ${command}`);
}
// quote parameters if necessary?
for (let i = 0; i < parameters.length; i++) {
// parameters[i] = quoteIfNecessary(parameters[i]);
}
return new Promise((r, j) => {
if (process.platform === "win32" && fullCommandPath.indexOf(" ") > -1 && !/.exe$/gi.exec(fullCommandPath)) {
const pathVar = getPathVariableName();
// preserve the current path
const originalPath = process.env[pathVar];
try {
// insert the dir into the path
process.env[pathVar] = `${path.dirname(fullCommandPath)}${path.delimiter}${originalPath}`;
// call spawn and return
(0, child_process_1.spawn)(path.basename(fullCommandPath), parameters, { env: process.env, cwd, stdio: "inherit" }).on("close", (c, s) => {
if (c) {
j("Command Failed");
}
r();
});
return;
}
finally {
// regardless, restore the original path on the way out!
process.env[pathVar] = originalPath;
}
}
(0, child_process_1.spawn)(fullCommandPath, parameters, { env: process.env, cwd, stdio: "inherit" }).on("close", (c, s) => {
if (c) {
j("Command Failed");
}
r();
});
return;
});
}
//# sourceMappingURL=exec.js.map
/***/ }),
/***/ "../../libs/codegen/dist/file-generator.js":
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.TextWithRegions = exports.Text = void 0;
exports.isText = isText;
exports.isTextEdit = isTextEdit;
const initializer_1 = __webpack_require__("../../libs/codegen/dist/initializer.js");
const text_manipulation_1 = __webpack_require__("../../libs/codegen/dist/text-manipulation.js");
function isText(object) {
return object.text ? true : false;
}
function isTextEdit(object) {
return object.edit ? true : false;
}
class Text extends initializer_1.Initializer {
constructor(content, objectIntializer) {
super();
this.content = new Array();
this.toString = () => {
return this.text;
};
if (content) {
this.add(content);
}
this.apply(objectIntializer);
}
get count() {
return this.content.length;
}
add(text) {
if (typeof text === "string") {
this.content.push(text);
return this;
}
if (text instanceof Text) {
this.content.push(text);
return this;
}
if (isText(text) || isTextEdit(text)) {
this.content.push(text);
return this;
}
if (typeof text === "function") {
return this.add(text());
}
for (const each of text) {
this.add(each);
}
return this;
}
get text() {
let output = "";
for (const each of this.content) {
if (typeof each === "string") {
output = output + text_manipulation_1.EOL + each;
continue;
}
if (isTextEdit(each)) {
output = each.edit(output) + text_manipulation_1.EOL;
continue;
}
output = output + text_manipulation_1.EOL + each.text;
}
return output;
}
trim() {
this.add({ edit: (s) => s.trim() });
}
}
exports.Text = Text;
class TextWithRegions extends Text {
constructor(content, objectIntializer, prefix = "#", postfix = "") {
super(content);
this.apply(objectIntializer);
this.prefix = prefix;
this.postfix = postfix;
}
removeRegion(region) {
this.add({ edit: (s) => (0, text_manipulation_1.setRegion)(s, region, "", undefined, this.prefix, this.postfix) });
}
setRegion(region, content, prepend = true) {
this.add({ edit: (s) => (0, text_manipulation_1.setRegion)(s, region, content, prepend, this.prefix, this.postfix) });
}
has(name) {
for (const each of (0, text_manipulation_1.getRegions)(this.text, this.prefix, this.postfix)) {
if (each.name === name) {
return true;
}
}
return false;
}
append(name, content) {
this.add({ edit: (s) => (0, text_manipulation_1.setRegion)(s, name, content, false, this.prefix, this.postfix) });
}
prepend(name, content) {
this.add({ edit: (s) => (0, text_manipulation_1.setRegion)(s, name, content, true, this.prefix, this.postfix) });
}
get regions() {
if (!this.text.trim()) {
return [];
}
return [...(0, text_manipulation_1.getRegions)(this.text, this.prefix, this.postfix)];
}
}
exports.TextWithRegions = TextWithRegions;
//# sourceMappingURL=file-generator.js.map
/***/ }),
/***/ "../../libs/codegen/dist/formatter/formatter.js":
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Style = void 0;
const text_manipulation_1 = __webpack_require__("../../libs/codegen/dist/text-manipulation.js");
function capitalize(s) {
return s ? `${s.charAt(0).toUpperCase()}${s.slice(1)}` : s;
}
function uncapitalize(s) {
return s ? `${s.charAt(0).toLowerCase()}${s.slice(1)}` : s;
}
function IsFullyUpperCase(identifier, maxUppercasePreserve) {
const len = identifier.length;
if (len > 1) {
if (len <= maxUppercasePreserve && identifier === identifier.toUpperCase()) {
return true;
}
if (len <= maxUppercasePreserve + 1 && identifier.endsWith("s")) {
const i = identifier.substring(0, len - 1);
if (i.toUpperCase() === i) {
return true;
}
}
}
return false;
}
function deconstruct(identifier, maxUppercasePreserve) {
if (Array.isArray(identifier)) {
return [...identifier.flatMap((each) => deconstruct(each, maxUppercasePreserve))];
}
return `${identifier}`
.replace(/([a-z]+)([A-Z])/g, "$1 $2") // Add a space in between camelCase words(e.g. fooBar => foo Bar)
.replace(/(\d+)/g, " $1 ") // Adds a space after numbers(e.g. foo123 => foo123 bar)
.replace(/\b([A-Z]+)([A-Z])s([^a-z])(.*)/g, "$1$2« $3$4") // Add a space after a plural uppper cased word(e.g. MBsFoo => MBs Foo)
.replace(/\b([A-Z]+)([A-Z])([a-z]+)/g, "$1 $2$3") // Add a space between an upper case word(2 char+) and the last captial case.(e.g. SQLConnection -> SQL Connection)
.replace(/«/g, "s")
.trim()
.split(/[\W|_]+/)
.map((each) => (IsFullyUpperCase(each, maxUppercasePreserve) ? each : each.toLowerCase()));
}
function wrap(prefix, postfix, style, maxUppercasePreserve) {
if (postfix || prefix) {
return (i, r, o) => typeof i === "string" && typeof o === "object"
? o[i.toLowerCase()] || `${prefix}${style(i, r, o, maxUppercasePreserve)}${postfix}`
: `${prefix}${style(i, r, o, maxUppercasePreserve)}${postfix}`;
}
return (i, r, o) => style(i, r, o, maxUppercasePreserve);
}
function applyFormat(normalizedContent, overrides = {}, separator = "", formatter = (s, i) => s) {
return normalizedContent
.map((each, index) => overrides[each.toLowerCase()] || formatter(each, index))
.join(separator);
}
function normalize(identifier, removeDuplicates = true, overrides = {}, maxUppercasePreserve = 0) {
if (!identifier || identifier.length === 0) {
return [""];
}
return typeof identifier === "string"
? normalize((0, text_manipulation_1.fixLeadingNumber)(deconstruct(identifier, maxUppercasePreserve)), removeDuplicates, overrides, maxUppercasePreserve)
: removeDuplicates
? (0, text_manipulation_1.removeSequentialDuplicates)(identifier)
: identifier;
}
class Style {
static select(style, fallback, maxUppercasePreserve) {
if (style) {
const styles = /^([a-zA-Z0-9_]*?\+?)([a-zA-Z]+)(\+?[a-zA-Z0-9_]*)$/g.exec(style.replace(/\s*/g, ""));
if (styles) {
const prefix = styles[1] ? styles[1].substring(0, styles[1].length - 1) : "";
const postfix = styles[3] ? styles[3].substring(1) : "";
switch (styles[2]) {
case "camelcase":
case "camel":
return wrap(prefix, postfix, Style.camel, maxUppercasePreserve);
case "pascalcase":
case "pascal":
return wrap(prefix, postfix, Style.pascal, maxUppercasePreserve);
case "snakecase":
case "snake":
return wrap(prefix, postfix, Style.snake, maxUppercasePreserve);
case "uppercase":
case "upper":
return wrap(prefix, postfix, Style.upper, maxUppercasePreserve);
case "kebabcase":
case "kebab":
return wrap(prefix, postfix, Style.kebab, maxUppercasePreserve);
case "spacecase":
case "space":
return wrap(prefix, postfix, Style.space, maxUppercasePreserve);
}
}
}
return wrap("", "", fallback, maxUppercasePreserve);
}
static kebab(identifier, removeDuplicates = true, overrides = {}, maxUppercasePreserve = 0) {
return (overrides[identifier] ||
applyFormat(normalize(identifier, removeDuplicates, overrides, maxUppercasePreserve), overrides, "-").replace(/([^\d])-(\d+)/g, "$1$2"));
}
static space(identifier, removeDuplicates = true, overrides = {}, maxUppercasePreserve = 0) {
return (overrides[identifier] ||
applyFormat(normalize(identifier, removeDuplicates, overrides, maxUppercasePreserve), overrides, " ").replace(/([^\d]) (\d+)/g, "$1$2"));
}
static snake(identifier, removeDuplicates = true, overrides = {}, maxUppercasePreserve = 0) {
return (overrides[identifier] ||
applyFormat(normalize(identifier, removeDuplicates, overrides, maxUppercasePreserve), overrides, "_").replace(/([^\d])_(\d+)/g, "$1$2"));
}
static upper(identifier, removeDuplicates = true, overrides = {}, maxUppercasePreserve = 0) {
return (overrides[identifier] ||
applyFormat(normalize(identifier, removeDuplicates, overrides, maxUppercasePreserve), overrides, "_", (each) => each.toUpperCase()).replace(/([^\d])_(\d+)/g, "$1$2"));
}
static pascal(identifier, removeDuplicates = true, overrides = {}, maxUppercasePreserve = 0) {
return (overrides[identifier] ||
applyFormat(normalize(identifier, removeDuplicates, overrides, maxUppercasePreserve), overrides, "", (each) => capitalize(each)));
}
static camel(identifier, removeDuplicates = true, overrides = {}, maxUppercasePreserve = 0) {
return (overrides[identifier] ||
applyFormat(normalize(identifier, removeDuplicates, overrides, maxUppercasePreserve), overrides, "", (each, index) => index ? capitalize(each) : IsFullyUpperCase(each, maxUppercasePreserve) ? each : uncapitalize(each)));
}
}
exports.Style = Style;
//# sourceMappingURL=formatter.js.map
/***/ }),
/***/ "../../libs/codegen/dist/index.js":
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
__exportStar(__webpack_require__("../../libs/codegen/dist/exec.js"), exports);
__exportStar(__webpack_require__("../../libs/codegen/dist/file-generator.js"), exports);
__exportStar(__webpack_require__("../../libs/codegen/dist/initializer.js"), exports);
__exportStar(__webpack_require__("../../libs/codegen/dist/intersect.js"), exports);
__exportStar(__webpack_require__("../../libs/codegen/dist/pluralization.js"), exports);
__exportStar(__webpack_require__("../../libs/codegen/dist/text-manipulation.js"), exports);
__exportStar(__webpack_require__("../../libs/codegen/dist/utility.js"), exports);
__exportStar(__webpack_require__("../../libs/codegen/dist/yaml.js"), exports);
__exportStar(__webpack_require__("../../libs/codegen/dist/apiversion/apiversion.js"), exports);
__exportStar(__webpack_require__("../../libs/codegen/dist/safe-eval.js"), exports);
__exportStar(__webpack_require__("../../libs/codegen/dist/source-track.js"), exports);
__exportStar(__webpack_require__("../../libs/codegen/dist/media-types.js"), exports);
__exportStar(__webpack_require__("../../libs/codegen/dist/formatter/formatter.js"), exports);
//# sourceMappingURL=index.js.map
/***/ }),
/***/ "../../libs/codegen/dist/initializer.js":
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Initializer = void 0;
const empty = new Set();
function applyTo(source, target, exclusions, cache = new Set()) {
if (cache.has(source)) {
throw new Error("Circular refrenced models are not permitted in apply() initializers.");
}
for (const i of Object.keys(source !== null && source !== void 0 ? source : {})) {
if (exclusions.has(i)) {
continue;
}
switch (typeof source[i]) {
case "object":
// merge objects
if (source[i] != null && source[i] != undefined && typeof target[i] === "object") {
cache.add(source);
try {
applyTo(source[i], target[i], exclusions, cache);
}
catch (E) {
// eslint-disable-next-line no-console
console.error(` in property: ${i} `);
throw E;
}
cache.delete(source);
continue;
}
// otherwise, just use that object.
target[i] = source[i];
continue;
/* bad idea? :
this recursively cloned the contents of the intializer
but this has the effect of breaking referencs where I wanted
them.
// copy toarray
if (Array.isArray(source[i])) {
cache.add(source);
applyTo(source[i], target[i] = [], cache);
cache.delete(source);
continue;
}
// otherwise, copy into an empty object
cache.add(source);
applyTo(source[i], target[i] = {}, cache);
cache.delete(source);
continue;
*/
default:
// everything else just replace.
target[i] = source[i];
continue;
}
}
}
/** inheriting from Initializer adds an apply<T> method to the class, allowing you to accept an object initalizer, and applying it to the class in the constructor. */
class Initializer {
apply(...initializer) {
for (const each of initializer) {
applyTo(each, this, empty);
}
}
applyWithExclusions(exclusions, ...initializer) {
const filter = new Set(exclusions);
for (const each of initializer) {
applyTo(each, this, filter);
}
}
applyTo($this, ...initializer) {
for (const each of initializer) {
applyTo(each, $this, empty);
}
}
}
exports.Initializer = Initializer;
//# sourceMappingURL=initializer.js.map
/***/ }),
/***/ "../../libs/codegen/dist/intersect.js":
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.intersect = intersect;
/**
* Creates an intersection object from two source objects.
*
* Typescript nicely supports defining intersection types (ie, Foo & Bar )
* But if you have two seperate *instances*, and you want to use them as the implementation
* of that intersection, the language doesn't solve that for you.
*
* This function creates a strongly typed proxy type around the two objects,
* and returns members for the intersection of them.
*
* This works well for properties and member functions the same.
*
* Members in the primary object will take precedence over members in the secondary object if names conflict.
*
* This can also be used to "add" arbitrary members to an existing type (without mutating the original object)
*
* @example
* const combined = intersect( new Foo(), { test: () => { console.log('testing'); } });
* combined.test(); // writes out 'testing' to console
*
* @param primary primary object - members from this will have precedence.
* @param secondary secondary object - members from this will be used if primary does not have a member
*/
function intersect(primary, secondary) {
return new Proxy({ primary, secondary }, {
// member get proxy handler
get(target, property, receiver) {
// check for properties on the objects first
const propertyName = property.toString();
if (Object.getOwnPropertyNames(target.primary).indexOf(propertyName) > -1) {
return target.primary[property];
}
if (Object.getOwnPropertyNames(target.secondary).indexOf(propertyName) > -1) {
return target.secondary[property];
}
// try binding member function
if (typeof target.primary[property] === "function") {
return target.primary[property].bind(primary);
}
if (typeof target.secondary[property] === "function") {
return target.secondary[property].bind(secondary);
}
return target.primary[property] || target.secondary[property];
},
// member set proxy handler
set(target, property, value) {
const propertyName = property.toString();
if (Object.getOwnPropertyNames(target.primary).indexOf(propertyName) > -1) {
return (target.primary[property] = value);
}
if (Object.getOwnPropertyNames(target.secondary).indexOf(propertyName) > -1) {
return (target.secondary[property] = value);
}
return undefined;
},
});
}
//# sourceMappingURL=intersect.js.map
/***/ }),
/***/ "../../libs/codegen/dist/media-types.js":
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.FormatType = exports.KnownMediaType = void 0;
exports.parseMediaType = parseMediaType;
exports.knownMediaType = knownMediaType;
exports.normalizeMediaType = normalizeMediaType;
exports.isMediaTypeJson = isMediaTypeJson;
exports.isMediaTypeXml = isMediaTypeXml;
exports.isMediaTypeMultipartFormData = isMediaTypeMultipartFormData;
// Media Type is: type "/" [tree "."] subtype ["+" suffix] * [";" parameter]
const json = "json";
const xml = "xml";
const application = "application";
const text = "text";
const multipart = "multipart";
const formData = "form-data";
const formEncoded = "x-www-form-urlencoded";
var KnownMediaType;
(function (KnownMediaType) {
KnownMediaType["Json"] = "json";
KnownMediaType["Xml"] = "xml";
KnownMediaType["Form"] = "form";
KnownMediaType["Binary"] = "binary";
KnownMediaType["Multipart"] = "multipart";
KnownMediaType["Text"] = "text";
KnownMediaType["Unknown"] = "unknown";
})(KnownMediaType || (exports.KnownMediaType = KnownMediaType = {}));
var FormatType;
(function (FormatType) {
FormatType["QueryParameter"] = "-query-parameter-";
FormatType["UriParameter"] = "-uri-parameter-";
FormatType["Header"] = "-header-";
FormatType["Cookie"] = "-cookie-";
})(FormatType || (exports.FormatType = FormatType = {}));
function parseMediaType(mediaType) {
if (mediaType) {
const parsed = /(application|audio|font|example|image|message|model|multipart|text|video|x-(?:[0-9A-Za-z!#$%&'*+.^_`|~-]+))\/([0-9A-Za-z!#$%&'*.^_`|~-]+)\s*(?:\+([0-9A-Za-z!#$%&'*.^_`|~-]+))?\s*(?:;.\s*(\S*))?/g.exec(mediaType);
if (parsed) {
return {
type: parsed[1],
subtype: parsed[2],
suffix: parsed[3],
parameter: parsed[4],
};
}
}
return undefined;
}
function knownMediaType(mediaType) {
const mt = parseMediaType(mediaType);
if (mt) {
if ((mt.subtype === json || mt.suffix === json) && (mt.type === application || mt.type === text)) {
return KnownMediaType.Json;
}
if ((mt.subtype === xml || mt.suffix === xml) && (mt.type === application || mt.type === text)) {
return KnownMediaType.Xml;
}
if (mt.type === "audio" || mt.type === "image" || mt.type === "video" || mt.subtype === "octet-stream") {
return KnownMediaType.Binary;
}
if (mt.type === application && mt.subtype === formEncoded) {
return KnownMediaType.Form;
}
if (mt.type === "multipart" && mt.subtype === "form-data") {
return KnownMediaType.Multipart;
}
if (mt.type === application) {
// at this point, an unrecognized application/* is considered a binary format
// since we don't have any other way of dealing with it.
return KnownMediaType.Binary;
}
if (mt.type === "text") {
return KnownMediaType.Text;
}
}
// pseudo-media types for figuring out how to de/serialize from from/to other types.
/* switch (mediaType) {
case 'header':
return KnownMediaType.Header;
case 'cookie':
return KnownMediaType.Cookie;
case 'urlencoding':
return KnownMediaType.Cookie;
}
*/
return KnownMediaType.Unknown;
}
function normalizeMediaType(contentType) {
if (contentType) {
const mt = parseMediaType(contentType);
if (mt) {
return mt.suffix ? `${mt.type}/${mt.subtype}+${mt.suffix}` : `${mt.type}/${mt.subtype}`;
}
}
return undefined;
}
function isMediaTypeJson(mediaType) {
const mt = parseMediaType(mediaType);
return mt ? (mt.subtype === json || mt.suffix === json) && (mt.type === application || mt.type === text) : false;
}
function isMediaTypeXml(mediaType) {
const mt = parseMediaType(mediaType);
return mt ? (mt.subtype === xml || mt.suffix === xml) && (mt.type === application || mt.type === text) : false;
}
function isMediaTypeMultipartFormData(mediaType) {
const mt = parseMediaType(mediaType);
return mt ? mt.type === multipart && mt.subtype === formData : false;
}
//# sourceMappingURL=media-types.js.map
/***/ }),
/***/ "../../libs/codegen/dist/pluralization.js":
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.EnglishPluralizationService = void 0;
const text_manipulation_1 = __webpack_require__("../../libs/codegen/dist/text-manipulation.js");
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/*
* PORTED FROM System.Data.Entity.Infrastructure.Pluralization.EnglishPluralizationService (EntityFramework.dll)
*/
class StringBidirectionalDictionary {
constructor(dict = {}) {
this.dictForward = new Map();
this.dictBackward = new Map();
for (const key of Object.keys(dict)) {
const value = dict[key];
this.addValue(key, value);
}
}
addValue(first, second) {
this.dictForward.set(first, second);
this.dictBackward.set(second, first);
}
existsInFirst(s) {
return this.dictForward.has(s);
}
existsInSecond(s) {
return this.dictBackward.has(s);
}
getFirstValue(s) {
return (this.dictBackward.get(s) ||
(() => {
throw new Error("Cannot find key.");
})());
}
getSecondValue(s) {
return (this.dictForward.get(s) ||
(() => {
throw new Error("Cannot find key.");
})());
}
}
function endsWithIgnoreCase(word, suffix) {
return word.toLowerCase().endsWith(suffix.toLowerCase());
}
class PluralizationServiceUtil {
static DoesWordContainSuffix(word, suffixes) {
return suffixes.some((s) => endsWithIgnoreCase(word, s));
}
static TryInflectOnSuffixInWord(word, suffixes, operationOnWord) {
if (PluralizationServiceUtil.DoesWordContainSuffix(word, suffixes)) {
return operationOnWord(word);
}
else {
return null;
}
}
}
class EnglishPluralizationService {
constructor() {
this.uninflectiveSuffixList = ["fish", "ois", "sheep", "deer", "pos", "itis", "ism"];
this.uninflectiveWordList = [
"bison",
"flounder",
"pliers",
"bream",
"gallows",
"proceedings",
"breeches",
"graffiti",
"rabies",
"britches",
"headquarters",
"salmon",
"carp",
"----",
"scissors",
"ch----is",
"high-jinks",
"sea-bass",
"clippers",
"homework",
"series",
"cod",
"innings",
"shears",
"contretemps",
"jackanapes",
"species",
"corps",
"mackerel",
"swine",
"debris",
"measles",
"trout",
"diabetes",
"mews",
"tuna",
"djinn",
"mumps",
"whiting",
"eland",
"news",
"wildebeest",
"elk",
"pincers",
"police",
"hair",
"ice",
"chaos",
"milk",
"cotton",
"pneumonoultramicroscopicsilicovolcanoconiosis",
"information",
"aircraft",
"scabies",
"traffic",
"corn",
"millet",
"rice",
"hay",
"----",
"tobacco",
"cabbage",
"okra",
"broccoli",
"asparagus",
"lettuce",
"beef",
"pork",
"venison",
"mutton",
"cattle",
"offspring",
"molasses",
"shambles",
"shingles",
"https",
"sas",
"statuses",
"as",
"statistics",
"alias",
"dns",
"ms",
"os",
"vmss",
"acls",
"rights",
"credentials",
"ddos",
"media",
"gbps",
"kbps",
"mbps",
"bps",
"fips",
];
this.irregularVerbList = {
am: "are",
are: "are",
is: "are",
was: "were",
were: "were",
has: "have",
have: "have",
};
this.pronounList = [
"I",
"we",
"you",
"he",
"she",
"they",
"it",
"me",
"us",
"him",
"her",
"them",
"myself",
"ourselves",
"yourself",
"himself",
"herself",
"itself",
"oneself",
"oneselves",
"my",
"our",
"your",
"his",
"their",
"its",
"mine",
"yours",
"hers",
"theirs",
"this",
"that",
"these",
"those",
"all",
"another",
"any",
"anybody",
"anyone",
"anything",
"both",
"each",
"other",
"either",
"everyone",
"everybody",
"everything",
"most",
"much",
"nothing",
"nobody",
"none",
"one",
"others",
"some",
"somebody",
"someone",
"something",
"what",
"whatever",
"which",
"whichever",
"who",
"whoever",
"whom",
"whomever",
"whose",
];
this.irregularPluralsDictionary = {
brother: "brothers",
child: "children",
cow: "cows",
ephemeris: "ephemerides",
genie: "genies",
money: "moneys",
mongoose: "mongooses",
mythos: "mythoi",
octopus: "octopuses",
ox: "oxen",
soliloquy: "soliloquies",
trilby: "trilbys",
crisis: "crises",
synopsis: "synopses",
rose: "roses",
gas: "gases",
bus: "buses",
axis: "axes",
memo: "memos",
casino: "casinos",
silo: "silos",
stereo: "stereos",
studio: "studios",
lens: "lenses",
alias: "aliases",
pie: "pies",
corpus: "corpora",
viscus: "viscera",
hippopotamus: "hippopotami",
trace: "traces",
person: "people",
chili: "chilies",
analysis: "analyses",
basis: "bases",
neurosis: "neuroses",
oasis: "oases",
synthesis: "syntheses",
thesis: "theses",
change: "changes",
lie: "lies",
calorie: "calories",
freebie: "freebies",
case: "cases",
house: "houses",
valve: "valves",
cloth: "clothes",
tie: "ties",
movie: "movies",
bonus: "bonuses",
specimen: "specimens",
};
this.assimilatedClassicalInflectionDictionary = {
alumna: "alumnae",
alga: "algae",
vertebra: "vertebrae",
codex: "codices",
murex: "murices",
silex: "silices",
aphelion: "aphelia",
hyperbaton: "hyperbata",
perihelion: "perihelia",
asyndeton: "asyndeta",
noumenon: "noumena",
phenomenon: "phenomena",
criterion: "criteria",
organon: "organa",
prolegomenon: "prolegomena",
agendum: "agenda",
extremum: "extrema",
bacterium: "bacteria",
desideratum: "desiderata",
stratum: "strata",
candelabrum: "candelabra",
erratum: "errata",
ovum: "ova",
forum: "fora",
addendum: "addenda",
stadium: "stadia",
automaton: "automata",
polyhedron: "polyhedra",
};
this.oSuffixDictionary = {
albino: "albinos",
generalissimo: "generalissimos",
manifesto: "manifestos",
archipelago: "archipelagos",
ghetto: "ghettos",
medico: "medicos",
armadillo: "armadillos",
guano: "guanos",
octavo: "octavos",
commando: "commandos",
inferno: "infernos",
photo: "photos",
ditto: "dittos",
jumbo: "jumbos",
pro: "pros",
dynamo: "dynamos",
lingo: "lingos",
quarto: "quartos",
embryo: "embryos",
lumbago: "lumbagos",
rhino: "rhinos",
fiasco: "fiascos",
magneto: "magnetos",
stylo: "stylos",
};
this.classicalInflectionDictionary = {
stamen: "stamina",
foramen: "foramina",
lumen: "lumina",
anathema: "anathemata",
"----": "----ta",
oedema: "oedemata",
bema: "bemata",
enigma: "enigmata",
sarcoma: "sarcomata",
carcinoma: "carcinomata",
gumma: "gummata",
schema: "schemata",
charisma: "charismata",
lemma: "lemmata",
soma: "somata",
diploma: "diplomata",
lymphoma: "lymphomata",
stigma: "stigmata",
dogma: "dogmata",
magma: "magmata",
stoma: "stomata",
drama: "dramata",
melisma: "melismata",
trauma: "traumata",
edema: "edemata",
miasma: "miasmata",
abscissa: "abscissae",
formula: "formulae",
medusa: "medusae",
amoeba: "amoebae",
hydra: "hydrae",
nebula: "nebulae",
antenna: "antennae",
hyperbola: "hyperbolae",
nova: "novae",
aurora: "aurorae",
lacuna: "lacunae",
parabola: "parabolae",
apex: "apices",
latex: "latices",
vertex: "vertices",
cortex: "cortices",
pontifex: "pontifices",
vortex: "vortices",
index: "indices",
simplex: "simplices",
iris: "irides",
"----oris": "----orides",
alto: "alti",
contralto: "contralti",
soprano: "soprani",
"b----o": "b----i",
crescendo: "crescendi",
tempo: "tempi",
canto: "canti",
solo: "soli",
aquarium: "aquaria",
interregnum: "interregna",
quantum: "quanta",
compendium: "compendia",
lustrum: "lustra",
rostrum: "rostra",
consortium: "consortia",
maximum: "maxima",
spectrum: "spectra",
cranium: "crania",
medium: "media",
speculum: "specula",
curriculum: "curricula",
memorandum: "memoranda",
stadium: "stadia",
dictum: "dicta",
millenium: "millenia",
"t----zium": "t----zia",
emporium: "emporia",
minimum: "minima",
ultimatum: "ultimata",
enconium: "enconia",
momentum: "momenta",
vacuum: "vacua",
gymnasium: "gymnasia",
optimum: "optima",
velum: "vela",
honorarium: "honoraria",
phylum: "phyla",
focus: "foci",
nimbus: "nimbi",
succubus: "succubi",
fungus: "fungi",
nucleolus: "nucleoli",
torus: "tori",
genius: "genii",
radius: "radii",
umbilicus: "umbilici",
incubus: "incubi",
stylus: "styli",
uterus: "uteri",
stimulus: "stimuli",
apparatus: "apparatus",
impetus: "impetus",
prospectus: "prospectus",
cantus: "cantus",
nexus: "nexus",
sinus: "sinus",
coitus: "coitus",
plexus: "plexus",
status: "status",
hiatus: "hiatus",
afreet: "afreeti",
afrit: "afriti",
efreet: "efreeti",
cherub: "cherubim",
goy: "goyim",
seraph: "seraphim",
alumnus: "alumni",
};
// this list contains all the plural words that being treated as singluar form, for example, "they" -> "they"
this.knownConflictingPluralList = ["they", "them", "their", "have", "were", "yourself", "are"];
// this list contains the words ending with "se" and we special case these words since
// we need to add a rule for "ses" singularize to "s"
this.wordsEndingWithSeDictionary = {
house: "houses",
case: "cases",
enterprise: "enterprises",
purchase: "purchases",
surprise: "surprises",
release: "releases",
disease: "diseases",
promise: "promises",
refuse: "refuses",
whose: "whoses",
phase: "phases",
noise: "noises",
nurse: "nurses",
rose: "roses",