@accordproject/concerto-util 4.2.0 → 5.0.0-beta.2
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/baseexception.d.ts +2 -1
- package/dist/baseexception.js +5 -2
- package/dist/basefileexception.d.ts +3 -2
- package/dist/basefileexception.js +10 -4
- package/dist/esm/baseexception.mjs +13 -0
- package/dist/esm/baseexception.mjs.map +7 -0
- package/dist/esm/basefileexception.mjs +14 -0
- package/dist/esm/basefileexception.mjs.map +7 -0
- package/dist/esm/chunk-3RJ6JXLX.mjs +29 -0
- package/dist/esm/chunk-3RJ6JXLX.mjs.map +7 -0
- package/dist/esm/chunk-3U4T7O4P.mjs +41 -0
- package/dist/esm/chunk-3U4T7O4P.mjs.map +7 -0
- package/dist/esm/chunk-D4MNWWBB.mjs +43 -0
- package/dist/esm/chunk-D4MNWWBB.mjs.map +7 -0
- package/dist/esm/chunk-DTVQ7VXD.mjs +30 -0
- package/dist/esm/chunk-DTVQ7VXD.mjs.map +7 -0
- package/dist/esm/chunk-FHUVVHGR.mjs +48 -0
- package/dist/esm/chunk-FHUVVHGR.mjs.map +7 -0
- package/dist/esm/chunk-FK2LDKS6.mjs +36 -0
- package/dist/esm/chunk-FK2LDKS6.mjs.map +7 -0
- package/dist/esm/chunk-G6IDW2UD.mjs +183 -0
- package/dist/esm/chunk-G6IDW2UD.mjs.map +7 -0
- package/dist/esm/chunk-GOLEPEBI.mjs +56 -0
- package/dist/esm/chunk-GOLEPEBI.mjs.map +7 -0
- package/dist/esm/chunk-I33X6SGY.mjs +70 -0
- package/dist/esm/chunk-I33X6SGY.mjs.map +7 -0
- package/dist/esm/chunk-K4OOJFK5.mjs +93 -0
- package/dist/esm/chunk-K4OOJFK5.mjs.map +7 -0
- package/dist/esm/chunk-LPNGJFU2.mjs +22 -0
- package/dist/esm/chunk-LPNGJFU2.mjs.map +7 -0
- package/dist/esm/chunk-PBL5N3A2.mjs +33 -0
- package/dist/esm/chunk-PBL5N3A2.mjs.map +7 -0
- package/dist/esm/chunk-PMP2SMHG.mjs +17 -0
- package/dist/esm/chunk-PMP2SMHG.mjs.map +7 -0
- package/dist/esm/chunk-Q6G4HQJ7.mjs +151 -0
- package/dist/esm/chunk-Q6G4HQJ7.mjs.map +7 -0
- package/dist/esm/chunk-RBUQLLXW.mjs +51 -0
- package/dist/esm/chunk-RBUQLLXW.mjs.map +7 -0
- package/dist/esm/chunk-T6ZBQYEB.mjs +97 -0
- package/dist/esm/chunk-T6ZBQYEB.mjs.map +7 -0
- package/dist/esm/chunk-TP3CT6S4.mjs +35 -0
- package/dist/esm/chunk-TP3CT6S4.mjs.map +7 -0
- package/dist/esm/chunk-WPVG6LP3.mjs +63 -0
- package/dist/esm/chunk-WPVG6LP3.mjs.map +7 -0
- package/dist/esm/chunk-YQVUNOO6.mjs +93 -0
- package/dist/esm/chunk-YQVUNOO6.mjs.map +7 -0
- package/dist/esm/errorcodes.mjs +22 -0
- package/dist/esm/errorcodes.mjs.map +7 -0
- package/dist/esm/filedownloader.mjs +12 -0
- package/dist/esm/filedownloader.mjs.map +7 -0
- package/dist/esm/filewriter.mjs +13 -0
- package/dist/esm/filewriter.mjs.map +7 -0
- package/dist/esm/identifiers.mjs +12 -0
- package/dist/esm/identifiers.mjs.map +7 -0
- package/dist/esm/index.mjs +78 -0
- package/dist/esm/index.mjs.map +7 -0
- package/dist/esm/inmemorywriter.mjs +13 -0
- package/dist/esm/inmemorywriter.mjs.map +7 -0
- package/dist/esm/label.mjs +12 -0
- package/dist/esm/label.mjs.map +7 -0
- package/dist/esm/loaders/compositefileloader.mjs +12 -0
- package/dist/esm/loaders/compositefileloader.mjs.map +7 -0
- package/dist/esm/loaders/defaultfileloader.mjs +15 -0
- package/dist/esm/loaders/defaultfileloader.mjs.map +7 -0
- package/dist/esm/loaders/fileloader.mjs +3 -0
- package/dist/esm/loaders/fileloader.mjs.map +7 -0
- package/dist/esm/loaders/githubfileloader.mjs +13 -0
- package/dist/esm/loaders/githubfileloader.mjs.map +7 -0
- package/dist/esm/loaders/httpfileloader.mjs +12 -0
- package/dist/esm/loaders/httpfileloader.mjs.map +7 -0
- package/dist/esm/logger.mjs +12 -0
- package/dist/esm/logger.mjs.map +7 -0
- package/dist/esm/modelwriter.mjs +10 -0
- package/dist/esm/modelwriter.mjs.map +7 -0
- package/dist/esm/null.mjs +12 -0
- package/dist/esm/null.mjs.map +7 -0
- package/dist/esm/typedstack.mjs +12 -0
- package/dist/esm/typedstack.mjs.map +7 -0
- package/dist/esm/warning.mjs +10 -0
- package/dist/esm/warning.mjs.map +7 -0
- package/dist/esm/writer.mjs +12 -0
- package/dist/esm/writer.mjs.map +7 -0
- package/dist/esm-browser/baseexception.mjs +11 -0
- package/dist/esm-browser/baseexception.mjs.map +7 -0
- package/dist/esm-browser/basefileexception.mjs +12 -0
- package/dist/esm-browser/basefileexception.mjs.map +7 -0
- package/dist/esm-browser/chunk-3XGAUT4O.mjs +100 -0
- package/dist/esm-browser/chunk-3XGAUT4O.mjs.map +7 -0
- package/dist/esm-browser/chunk-4X5DBZDM.mjs +24 -0
- package/dist/esm-browser/chunk-4X5DBZDM.mjs.map +7 -0
- package/dist/esm-browser/chunk-6SOOHVQB.mjs +65 -0
- package/dist/esm-browser/chunk-6SOOHVQB.mjs.map +7 -0
- package/dist/esm-browser/chunk-7DYPHXUR.mjs +50 -0
- package/dist/esm-browser/chunk-7DYPHXUR.mjs.map +7 -0
- package/dist/esm-browser/chunk-7LYWQ57N.mjs +461 -0
- package/dist/esm-browser/chunk-7LYWQ57N.mjs.map +7 -0
- package/dist/esm-browser/chunk-BDMF4RRF.mjs +72 -0
- package/dist/esm-browser/chunk-BDMF4RRF.mjs.map +7 -0
- package/dist/esm-browser/chunk-BSBOEFWN.mjs +57 -0
- package/dist/esm-browser/chunk-BSBOEFWN.mjs.map +7 -0
- package/dist/esm-browser/chunk-DOL2YKDZ.mjs +26 -0
- package/dist/esm-browser/chunk-DOL2YKDZ.mjs.map +7 -0
- package/dist/esm-browser/chunk-EGOFDABS.mjs +62 -0
- package/dist/esm-browser/chunk-EGOFDABS.mjs.map +7 -0
- package/dist/esm-browser/chunk-LZTTRWN3.mjs +153 -0
- package/dist/esm-browser/chunk-LZTTRWN3.mjs.map +7 -0
- package/dist/esm-browser/chunk-MCUSZIV7.mjs +41 -0
- package/dist/esm-browser/chunk-MCUSZIV7.mjs.map +7 -0
- package/dist/esm-browser/chunk-N42BHUZ6.mjs +35 -0
- package/dist/esm-browser/chunk-N42BHUZ6.mjs.map +7 -0
- package/dist/esm-browser/chunk-NAP47VIV.mjs +36 -0
- package/dist/esm-browser/chunk-NAP47VIV.mjs.map +7 -0
- package/dist/esm-browser/chunk-NQ5PDAAD.mjs +95 -0
- package/dist/esm-browser/chunk-NQ5PDAAD.mjs.map +7 -0
- package/dist/esm-browser/chunk-NSJTBLWA.mjs +71 -0
- package/dist/esm-browser/chunk-NSJTBLWA.mjs.map +7 -0
- package/dist/esm-browser/chunk-R6CSKES3.mjs +183 -0
- package/dist/esm-browser/chunk-R6CSKES3.mjs.map +7 -0
- package/dist/esm-browser/chunk-S52XDDAF.mjs +30 -0
- package/dist/esm-browser/chunk-S52XDDAF.mjs.map +7 -0
- package/dist/esm-browser/chunk-SU6SG5PJ.mjs +45 -0
- package/dist/esm-browser/chunk-SU6SG5PJ.mjs.map +7 -0
- package/dist/esm-browser/chunk-WCGRUR5U.mjs +30 -0
- package/dist/esm-browser/chunk-WCGRUR5U.mjs.map +7 -0
- package/dist/esm-browser/chunk-YJQCJTA7.mjs +53 -0
- package/dist/esm-browser/chunk-YJQCJTA7.mjs.map +7 -0
- package/dist/esm-browser/chunk-YURYZDD2.mjs +453 -0
- package/dist/esm-browser/chunk-YURYZDD2.mjs.map +7 -0
- package/dist/esm-browser/errorcodes.mjs +20 -0
- package/dist/esm-browser/errorcodes.mjs.map +7 -0
- package/dist/esm-browser/filedownloader.mjs +11 -0
- package/dist/esm-browser/filedownloader.mjs.map +7 -0
- package/dist/esm-browser/filewriter.mjs +12 -0
- package/dist/esm-browser/filewriter.mjs.map +7 -0
- package/dist/esm-browser/identifiers.mjs +10 -0
- package/dist/esm-browser/identifiers.mjs.map +7 -0
- package/dist/esm-browser/index.mjs +83 -0
- package/dist/esm-browser/index.mjs.map +7 -0
- package/dist/esm-browser/inmemorywriter.mjs +11 -0
- package/dist/esm-browser/inmemorywriter.mjs.map +7 -0
- package/dist/esm-browser/label.mjs +10 -0
- package/dist/esm-browser/label.mjs.map +7 -0
- package/dist/esm-browser/loaders/compositefileloader.mjs +10 -0
- package/dist/esm-browser/loaders/compositefileloader.mjs.map +7 -0
- package/dist/esm-browser/loaders/defaultfileloader.mjs +14 -0
- package/dist/esm-browser/loaders/defaultfileloader.mjs.map +7 -0
- package/dist/esm-browser/loaders/fileloader.mjs +7 -0
- package/dist/esm-browser/loaders/fileloader.mjs.map +7 -0
- package/dist/esm-browser/loaders/githubfileloader.mjs +12 -0
- package/dist/esm-browser/loaders/githubfileloader.mjs.map +7 -0
- package/dist/esm-browser/loaders/httpfileloader.mjs +11 -0
- package/dist/esm-browser/loaders/httpfileloader.mjs.map +7 -0
- package/dist/esm-browser/logger.mjs +10 -0
- package/dist/esm-browser/logger.mjs.map +7 -0
- package/dist/esm-browser/modelwriter.mjs +9 -0
- package/dist/esm-browser/modelwriter.mjs.map +7 -0
- package/dist/esm-browser/null.mjs +10 -0
- package/dist/esm-browser/null.mjs.map +7 -0
- package/dist/esm-browser/typedstack.mjs +10 -0
- package/dist/esm-browser/typedstack.mjs.map +7 -0
- package/dist/esm-browser/warning.mjs +8 -0
- package/dist/esm-browser/warning.mjs.map +7 -0
- package/dist/esm-browser/writer.mjs +10 -0
- package/dist/esm-browser/writer.mjs.map +7 -0
- package/dist/filedownloader.d.ts +14 -6
- package/dist/filedownloader.js +32 -12
- package/dist/filewriter.d.ts +3 -2
- package/dist/filewriter.js +10 -4
- package/dist/identifiers.js +4 -2
- package/dist/index.d.ts +18 -17
- package/dist/index.js +34 -31
- package/dist/inmemorywriter.d.ts +3 -2
- package/dist/inmemorywriter.js +10 -4
- package/dist/loaders/compositefileloader.d.ts +2 -1
- package/dist/loaders/compositefileloader.js +5 -2
- package/dist/loaders/defaultfileloader.d.ts +3 -2
- package/dist/loaders/defaultfileloader.js +14 -8
- package/dist/loaders/githubfileloader.d.ts +3 -2
- package/dist/loaders/githubfileloader.js +10 -4
- package/dist/loaders/httpfileloader.d.ts +2 -1
- package/dist/loaders/httpfileloader.js +10 -3
- package/dist/logger.d.ts +2 -1
- package/dist/logger.js +5 -2
- package/dist/modelwriter.js +6 -4
- package/dist/null.d.ts +3 -2
- package/dist/null.js +5 -2
- package/dist/typedstack.d.ts +2 -1
- package/dist/typedstack.js +5 -2
- package/dist/writer.d.ts +2 -1
- package/dist/writer.js +5 -2
- package/package.json +16 -8
- package/dist/concerto-util.js +0 -2
- package/dist/concerto-util.js.LICENSE.txt +0 -19
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
const require = __createRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// src/filedownloader.ts
|
|
5
|
+
import createDebug from "debug";
|
|
6
|
+
import PromisePool from "@supercharge/promise-pool";
|
|
7
|
+
var debug = createDebug("concerto:FileDownloader");
|
|
8
|
+
function flatten(arr) {
|
|
9
|
+
return [].concat(...arr);
|
|
10
|
+
}
|
|
11
|
+
var filterUndefined = (arr) => arr.filter((value) => Boolean(value));
|
|
12
|
+
var handleJobError = async (error, job) => {
|
|
13
|
+
const errLike = error;
|
|
14
|
+
const badHttpResponse = errLike.response && errLike.response.status && errLike.response.status !== 200;
|
|
15
|
+
const dnsFailure = errLike.code && errLike.code === "ENOTFOUND";
|
|
16
|
+
const jobUrl = job.url;
|
|
17
|
+
if (badHttpResponse || dnsFailure) {
|
|
18
|
+
const err = new Error(`Unable to download external model dependency '${jobUrl}'`);
|
|
19
|
+
err.code = "MISSING_DEPENDENCY";
|
|
20
|
+
throw err;
|
|
21
|
+
}
|
|
22
|
+
throw new Error("Failed to load model file. Job: " + jobUrl + " Details: " + error);
|
|
23
|
+
};
|
|
24
|
+
var FileDownloader = class {
|
|
25
|
+
/**
|
|
26
|
+
* Create a FileDownloader and bind to a FileLoader.
|
|
27
|
+
* @param fileLoader - the loader to use to download model files
|
|
28
|
+
* @param getExternalImports - a function taking a file and returning new files
|
|
29
|
+
* @param concurrency - the number of model files to download concurrently
|
|
30
|
+
*/
|
|
31
|
+
constructor(fileLoader, getExternalImports, concurrency = 10) {
|
|
32
|
+
this.fileLoader = fileLoader;
|
|
33
|
+
this.concurrency = concurrency;
|
|
34
|
+
this.getExternalImports = getExternalImports;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Download all external dependencies for an array of model files
|
|
38
|
+
* @param files - the model files to start the walk from
|
|
39
|
+
* @param options - Options object passed to FileLoaders
|
|
40
|
+
* @return a promise that resolves to Files[] for the external model files
|
|
41
|
+
*/
|
|
42
|
+
downloadExternalDependencies(files, options = {}) {
|
|
43
|
+
const method = "downloadExternalDependencies";
|
|
44
|
+
debug(method);
|
|
45
|
+
const downloadedUris = /* @__PURE__ */ new Set();
|
|
46
|
+
const jobs = flatten(files.map((file) => {
|
|
47
|
+
const externalImports = this.getExternalImports(file);
|
|
48
|
+
return Object.keys(externalImports).map((importDeclaration) => ({
|
|
49
|
+
downloadedUris,
|
|
50
|
+
url: externalImports[importDeclaration],
|
|
51
|
+
options
|
|
52
|
+
}));
|
|
53
|
+
}));
|
|
54
|
+
return PromisePool.withConcurrency(this.concurrency).for(jobs).handleError(handleJobError).process((x) => this.runJob(x, this.fileLoader)).then(({ results }) => filterUndefined(flatten(results)));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Execute a Job
|
|
58
|
+
* @param job - the job to execute
|
|
59
|
+
* @param fileLoader - the loader to use to download model files.
|
|
60
|
+
* @return a promise to the job results
|
|
61
|
+
*/
|
|
62
|
+
runJob(job, fileLoader) {
|
|
63
|
+
const downloadedUris = job.downloadedUris;
|
|
64
|
+
const options = job.options;
|
|
65
|
+
const url = job.url;
|
|
66
|
+
downloadedUris.add(url);
|
|
67
|
+
debug("runJob", "Loading", url);
|
|
68
|
+
return fileLoader.load(url, options).then(async (file) => {
|
|
69
|
+
debug("runJob", "Loaded", url);
|
|
70
|
+
const externalImports = this.getExternalImports(file);
|
|
71
|
+
const importedUris = Array.from(
|
|
72
|
+
new Set(
|
|
73
|
+
Object.keys(externalImports).map((importDeclaration) => externalImports[importDeclaration])
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
debug("runJob", "importedUris", importedUris);
|
|
77
|
+
const externalImportsFiles = await PromisePool.withConcurrency(this.concurrency).for(importedUris).handleError(handleJobError).process((uri) => {
|
|
78
|
+
if (!downloadedUris.has(uri)) {
|
|
79
|
+
return this.runJob({
|
|
80
|
+
options,
|
|
81
|
+
url: uri,
|
|
82
|
+
downloadedUris
|
|
83
|
+
}, fileLoader);
|
|
84
|
+
}
|
|
85
|
+
return void 0;
|
|
86
|
+
}).then(({ results }) => filterUndefined(flatten(results)));
|
|
87
|
+
return externalImportsFiles.concat([file]);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var filedownloader_default = FileDownloader;
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
FileDownloader,
|
|
95
|
+
filedownloader_default
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=chunk-T6ZBQYEB.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filedownloader.ts"],
|
|
4
|
+
"sourcesContent": ["/*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport createDebug from 'debug';\nimport PromisePool from '@supercharge/promise-pool';\n\nimport type { FileLoader } from './loaders/fileloader';\n\nconst debug = createDebug('concerto:FileDownloader');\n\ntype ExternalImportMap = Record<string, string>;\ntype DownloadJob<TFile> = {\n downloadedUris: Set<string>;\n url: string;\n options: RequestInit;\n};\n\nfunction flatten<T>(arr: T[][]): T[];\nfunction flatten<T>(arr: Array<T[] | undefined>): Array<T | undefined>;\nfunction flatten<T>(arr: Array<T[] | undefined>): Array<T | undefined> {\n return ([] as Array<T | undefined>).concat(...arr);\n}\nconst filterUndefined = <T>(arr: Array<T | undefined | null>): T[] => arr.filter((value): value is T => Boolean(value));\n\n// Used as the PromisePool error handler for both the outer pool (whose items are\n// DownloadJob objects) and the inner recursive pool (whose items are plain URI\n// strings), hence the union.\nconst handleJobError = async (error: unknown, job: DownloadJob<unknown> | string): Promise<never> => {\n const errLike = error as { response?: { status?: number }; code?: string };\n const badHttpResponse = errLike.response && errLike.response.status && errLike.response.status !== 200;\n const dnsFailure = errLike.code && errLike.code === 'ENOTFOUND';\n // undefined for the inner pool's string jobs, as it has always been\n const jobUrl = (job as DownloadJob<unknown>).url;\n if(badHttpResponse || dnsFailure){\n const err = new Error(`Unable to download external model dependency '${jobUrl}'`);\n (err as { code?: string }).code = 'MISSING_DEPENDENCY';\n throw err;\n }\n throw new Error('Failed to load model file. Job: ' + jobUrl + ' Details: ' + error);\n};\n\n/**\n * Downloads the transitive closure of a set of model files.\n *\n * The files handed in to start the walk are not necessarily the same type as the files\n * the loader produces: a caller may seed the walk with model files it has already parsed\n * into its own representation, while everything downloaded from a URI is whatever the\n * bound FileLoader returns. TSeed is the former, TFile the latter, and both are only ever\n * inspected through getExternalImports. TSeed defaults to TFile for the common case where\n * a caller seeds the walk with files of the same type the loader produces.\n * @memberof module:concerto-core\n */\nclass FileDownloader<TFile = unknown, TSeed = TFile> {\n public fileLoader: FileLoader<TFile>;\n public getExternalImports: (file: TFile | TSeed) => ExternalImportMap;\n public concurrency: number;\n\n /**\n * Create a FileDownloader and bind to a FileLoader.\n * @param fileLoader - the loader to use to download model files\n * @param getExternalImports - a function taking a file and returning new files\n * @param concurrency - the number of model files to download concurrently\n */\n constructor(fileLoader: FileLoader<TFile>, getExternalImports: (file: TFile | TSeed) => ExternalImportMap, concurrency = 10) {\n this.fileLoader = fileLoader;\n this.concurrency = concurrency;\n this.getExternalImports = getExternalImports;\n }\n\n /**\n * Download all external dependencies for an array of model files\n * @param files - the model files to start the walk from\n * @param options - Options object passed to FileLoaders\n * @return a promise that resolves to Files[] for the external model files\n */\n downloadExternalDependencies(files: TSeed[], options: RequestInit = {} as RequestInit): Promise<TFile[]> {\n const method = 'downloadExternalDependencies';\n debug(method);\n\n const downloadedUris = new Set<string>();\n\n const jobs: Array<DownloadJob<TFile>> = flatten(files.map(file => {\n const externalImports = this.getExternalImports(file);\n return Object.keys(externalImports).map(importDeclaration => ({\n downloadedUris: downloadedUris,\n url: externalImports[importDeclaration],\n options: options\n }));\n }));\n\n return PromisePool\n .withConcurrency(this.concurrency)\n .for(jobs)\n .handleError(handleJobError)\n .process((x: DownloadJob<TFile>) => this.runJob(x, this.fileLoader))\n .then(({ results }) => filterUndefined(flatten(results)));\n }\n\n /**\n * Execute a Job\n * @param job - the job to execute\n * @param fileLoader - the loader to use to download model files.\n * @return a promise to the job results\n */\n runJob(job: DownloadJob<TFile>, fileLoader: FileLoader<TFile>): Promise<TFile[]> {\n const downloadedUris = job.downloadedUris;\n const options = job.options;\n const url = job.url;\n\n // cache the URI, so we don't download it again\n downloadedUris.add(url);\n\n debug('runJob', 'Loading', url);\n return fileLoader.load(url, options).\n then(async (file: TFile) => {\n debug('runJob', 'Loaded', url, );\n\n // get the external imports\n const externalImports = this.getExternalImports(file);\n const importedUris = Array.from(\n new Set(\n Object.keys(externalImports)\n .map((importDeclaration) => externalImports[importDeclaration])\n )\n );\n debug('runJob', 'importedUris', importedUris);\n\n const externalImportsFiles = await PromisePool\n .withConcurrency(this.concurrency)\n .for(importedUris)\n .handleError(handleJobError)\n .process((uri: string) => {\n if (!downloadedUris.has(uri)) {\n // recurse and add a new job for the referenced URI\n return this.runJob({\n options: options,\n url: uri,\n downloadedUris: downloadedUris\n }, fileLoader);\n }\n return undefined;\n })\n .then(({ results }) => filterUndefined(flatten(results)));\n\n return externalImportsFiles.concat([file]);\n });\n }\n}\n\nexport { FileDownloader };\nexport default FileDownloader;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
const require = __createRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
__export
|
|
5
|
+
} from "./chunk-PMP2SMHG.mjs";
|
|
6
|
+
|
|
7
|
+
// src/modelwriter.ts
|
|
8
|
+
var modelwriter_exports = {};
|
|
9
|
+
__export(modelwriter_exports, {
|
|
10
|
+
writeModelsToFileSystem: () => writeModelsToFileSystem
|
|
11
|
+
});
|
|
12
|
+
import * as fs from "fs";
|
|
13
|
+
import * as fsPath from "path";
|
|
14
|
+
import slash from "slash";
|
|
15
|
+
function writeModelsToFileSystem(files, path, options = {}) {
|
|
16
|
+
if (!path) {
|
|
17
|
+
throw new Error("`path` is a required parameter of writeModelsToFileSystem");
|
|
18
|
+
}
|
|
19
|
+
const opts = Object.assign({
|
|
20
|
+
includeExternalModels: true
|
|
21
|
+
}, options);
|
|
22
|
+
files.forEach(function(file) {
|
|
23
|
+
if (file.external && !opts.includeExternalModels) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const filename = slash(file.fileName).split("/").pop();
|
|
27
|
+
fs.writeFileSync(path + fsPath.sep + filename, file.definitions);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
writeModelsToFileSystem,
|
|
33
|
+
modelwriter_exports
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=chunk-TP3CT6S4.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/modelwriter.ts"],
|
|
4
|
+
"sourcesContent": ["/*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from 'fs';\nimport * as fsPath from 'path';\nimport slash from 'slash';\n\n/**\n * Writes a set of model files to disk\n * @param files - the set of files to write, with names and whether they are external\n * @param path - a path to the directory where to write the files\n * @param options - a set of options\n */\nexport interface WritableModelFile {\n fileName: string;\n definitions: string;\n external?: boolean;\n}\n\nexport interface WriteModelsOptions {\n includeExternalModels?: boolean;\n}\n\nexport function writeModelsToFileSystem(files: WritableModelFile[], path: string, options: WriteModelsOptions = {}): void {\n if(!path){\n throw new Error('`path` is a required parameter of writeModelsToFileSystem');\n }\n\n const opts = Object.assign({\n includeExternalModels: true,\n }, options);\n files.forEach(function (file) {\n if (file.external && !opts.includeExternalModels) {\n return;\n }\n // Always assume file names have been normalized from `\\` to `/`\n const filename = slash(file.fileName).split('/').pop();\n fs.writeFileSync(path + fsPath.sep + filename, file.definitions);\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAAA;AAAA;AAAA;AAAA;AAcA,YAAY,QAAQ;AACpB,YAAY,YAAY;AACxB,OAAO,WAAW;AAkBX,SAAS,wBAAwB,OAA4B,MAAc,UAA8B,CAAC,GAAS;AACtH,MAAG,CAAC,MAAK;AACL,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC/E;AAEA,QAAM,OAAO,OAAO,OAAO;AAAA,IACvB,uBAAuB;AAAA,EAC3B,GAAG,OAAO;AACV,QAAM,QAAQ,SAAU,MAAM;AAC1B,QAAI,KAAK,YAAY,CAAC,KAAK,uBAAuB;AAC9C;AAAA,IACJ;AAEA,UAAM,WAAW,MAAM,KAAK,QAAQ,EAAE,MAAM,GAAG,EAAE,IAAI;AACrD,IAAG,iBAAc,OAAc,aAAM,UAAU,KAAK,WAAW;AAAA,EACnE,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
const require = __createRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// src/typedstack.ts
|
|
5
|
+
var TypedStack = class {
|
|
6
|
+
/**
|
|
7
|
+
* Create the Stack with the resource at the head.
|
|
8
|
+
* @param resource - the resource to be put at the head of the stack
|
|
9
|
+
*/
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
+
constructor(resource) {
|
|
12
|
+
this.stack = [];
|
|
13
|
+
this.push(resource);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Push a new object.
|
|
17
|
+
* @param obj - the object being visited
|
|
18
|
+
* @param expectedType - the expected type of the object being pushed
|
|
19
|
+
*/
|
|
20
|
+
push(obj, expectedType) {
|
|
21
|
+
if (expectedType && !(obj instanceof expectedType)) {
|
|
22
|
+
throw new Error("Did not find expected type " + expectedType.name + " as argument to push. Found: " + obj?.toString());
|
|
23
|
+
}
|
|
24
|
+
this.stack.push(obj);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Push a new object.
|
|
28
|
+
* @param expectedType - the type that should be the result of pop
|
|
29
|
+
* @return the result of pop
|
|
30
|
+
*/
|
|
31
|
+
pop(expectedType) {
|
|
32
|
+
this.peek(expectedType);
|
|
33
|
+
return this.stack.pop();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Peek the top of the stack
|
|
37
|
+
* @param expectedType - the type that should be the result of pop
|
|
38
|
+
* @return the result of peek
|
|
39
|
+
*/
|
|
40
|
+
peek(expectedType) {
|
|
41
|
+
if (this.stack.length < 1) {
|
|
42
|
+
throw new Error("Stack is empty!");
|
|
43
|
+
}
|
|
44
|
+
const result = this.stack[this.stack.length - 1];
|
|
45
|
+
if (expectedType && !(result instanceof expectedType)) {
|
|
46
|
+
throw new Error("Did not find expected type " + expectedType.name + " on head of stack. Found: " + result);
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Clears the stack
|
|
52
|
+
*/
|
|
53
|
+
clear() {
|
|
54
|
+
this.stack = [];
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var typedstack_default = TypedStack;
|
|
58
|
+
|
|
59
|
+
export {
|
|
60
|
+
TypedStack,
|
|
61
|
+
typedstack_default
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=chunk-WPVG6LP3.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/typedstack.ts"],
|
|
4
|
+
"sourcesContent": ["/*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntype Constructor<T> = new (...args: unknown[]) => T;\n\n/**\n * Tracks a stack of typed instances. The type information is used to detect\n * overflow / underflow bugs by the caller. It also performs basic sanity\n * checking on push/pop to make detecting bugs easier.\n * @class\n * @memberof module:concerto-core\n */\nclass TypedStack<T> {\n public stack: T[];\n\n /**\n * Create the Stack with the resource at the head.\n * @param resource - the resource to be put at the head of the stack\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(resource: T) {\n this.stack = [];\n this.push(resource);\n }\n\n /**\n * Push a new object.\n * @param obj - the object being visited\n * @param expectedType - the expected type of the object being pushed\n */\n push(obj: T, expectedType?: Constructor<T>): void {\n if(expectedType && !(obj instanceof expectedType)) {\n throw new Error('Did not find expected type ' + expectedType.name + ' as argument to push. Found: ' + obj?.toString());\n }\n\n this.stack.push(obj);\n }\n\n /**\n * Push a new object.\n * @param expectedType - the type that should be the result of pop\n * @return the result of pop\n */\n pop(expectedType?: Constructor<T>): T | undefined {\n this.peek(expectedType);\n return this.stack.pop();\n }\n\n /**\n * Peek the top of the stack\n * @param expectedType - the type that should be the result of pop\n * @return the result of peek\n */\n peek(expectedType?: Constructor<T>): T {\n\n if(this.stack.length < 1) {\n throw new Error('Stack is empty!');\n }\n\n const result = this.stack[this.stack.length-1];\n if(expectedType && !(result instanceof expectedType)) {\n throw new Error('Did not find expected type ' + expectedType.name + ' on head of stack. Found: ' + result);\n }\n\n return result;\n }\n\n /**\n * Clears the stack\n */\n clear(): void {\n this.stack = [];\n }\n}\n\nexport { TypedStack };\nexport default TypedStack;\n"],
|
|
5
|
+
"mappings": ";;;;AAuBA,IAAM,aAAN,MAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQhB,YAAY,UAAa;AACrB,SAAK,QAAQ,CAAC;AACd,SAAK,KAAK,QAAQ;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,KAAK,KAAQ,cAAqC;AAC9C,QAAG,gBAAgB,EAAE,eAAe,eAAe;AAC/C,YAAM,IAAI,MAAM,gCAAgC,aAAa,OAAO,kCAAkC,KAAK,SAAS,CAAC;AAAA,IACzH;AAEA,SAAK,MAAM,KAAK,GAAG;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,cAA8C;AAC9C,SAAK,KAAK,YAAY;AACtB,WAAO,KAAK,MAAM,IAAI;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,KAAK,cAAkC;AAEnC,QAAG,KAAK,MAAM,SAAS,GAAG;AACtB,YAAM,IAAI,MAAM,iBAAiB;AAAA,IACrC;AAEA,UAAM,SAAS,KAAK,MAAM,KAAK,MAAM,SAAO,CAAC;AAC7C,QAAG,gBAAgB,EAAE,kBAAkB,eAAe;AAClD,YAAM,IAAI,MAAM,gCAAgC,aAAa,OAAO,+BAA+B,MAAM;AAAA,IAC7G;AAEA,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,QAAc;AACV,SAAK,QAAQ,CAAC;AAAA,EAClB;AACJ;AAGA,IAAO,qBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
const require = __createRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
writer_default
|
|
5
|
+
} from "./chunk-K4OOJFK5.mjs";
|
|
6
|
+
|
|
7
|
+
// src/filewriter.ts
|
|
8
|
+
import * as fs from "fs";
|
|
9
|
+
import * as path from "path";
|
|
10
|
+
var FileWriter = class extends writer_default {
|
|
11
|
+
/**
|
|
12
|
+
* Create a FileWriter.
|
|
13
|
+
* @param outputDirectory - the output directory
|
|
14
|
+
*/
|
|
15
|
+
constructor(outputDirectory) {
|
|
16
|
+
super();
|
|
17
|
+
this.fileName = null;
|
|
18
|
+
this.relativeDir = null;
|
|
19
|
+
this.outputDirectory = outputDirectory;
|
|
20
|
+
this.relativeDir = null;
|
|
21
|
+
this.fileName = null;
|
|
22
|
+
fs.mkdirSync(outputDirectory, { recursive: true });
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Open a file for writing. The file is created in the
|
|
26
|
+
* output directory.
|
|
27
|
+
* @param fileName - the name of the file to open
|
|
28
|
+
*/
|
|
29
|
+
openFile(fileName) {
|
|
30
|
+
this.fileName = fileName;
|
|
31
|
+
this.relativeDir = null;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Open a file for writing. The file is created in the
|
|
35
|
+
* output directory, plus the relative directory path.
|
|
36
|
+
* @param relativeDir - the relative directory
|
|
37
|
+
* @param fileName - the name of the file to open
|
|
38
|
+
*/
|
|
39
|
+
openRelativeFile(relativeDir, fileName) {
|
|
40
|
+
this.fileName = fileName;
|
|
41
|
+
this.relativeDir = relativeDir;
|
|
42
|
+
this.clearBuffer();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Writes text to the current open file
|
|
46
|
+
* @param tabs - the number of tabs to use
|
|
47
|
+
* @param text - the text to write
|
|
48
|
+
*/
|
|
49
|
+
writeLine(tabs, text) {
|
|
50
|
+
if (this.fileName) {
|
|
51
|
+
super.writeLine(tabs, text);
|
|
52
|
+
} else {
|
|
53
|
+
throw new Error("File has not been opened!");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Writes text to the start of the current open file
|
|
58
|
+
* @param tabs - the number of tabs to use
|
|
59
|
+
* @param text - the text to write
|
|
60
|
+
*/
|
|
61
|
+
writeBeforeLine(tabs, text) {
|
|
62
|
+
if (this.fileName) {
|
|
63
|
+
super.writeBeforeLine(tabs, text);
|
|
64
|
+
} else {
|
|
65
|
+
throw new Error("File has not been opened!");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Closes the file, flushing the buffer to disk.
|
|
70
|
+
*/
|
|
71
|
+
closeFile() {
|
|
72
|
+
if (!this.fileName) {
|
|
73
|
+
throw new Error("No file open");
|
|
74
|
+
}
|
|
75
|
+
let filePath = this.outputDirectory;
|
|
76
|
+
if (this.relativeDir) {
|
|
77
|
+
filePath = path.resolve(filePath, this.relativeDir);
|
|
78
|
+
}
|
|
79
|
+
filePath = path.resolve(filePath, this.fileName);
|
|
80
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
81
|
+
fs.writeFileSync(filePath, this.getBuffer());
|
|
82
|
+
this.fileName = null;
|
|
83
|
+
this.relativeDir = null;
|
|
84
|
+
this.clearBuffer();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
var filewriter_default = FileWriter;
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
FileWriter,
|
|
91
|
+
filewriter_default
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=chunk-YQVUNOO6.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filewriter.ts"],
|
|
4
|
+
"sourcesContent": ["/*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport Writer from './writer';\n\n/**\n * FileWriter buffers text to be written to a file.\n * @private\n * @class\n * @memberof module:concerto-util\n */\nclass FileWriter extends Writer {\n public outputDirectory: string;\n public fileName: string | null = null;\n public relativeDir: string | null = null;\n\n /**\n * Create a FileWriter.\n * @param outputDirectory - the output directory\n */\n constructor(outputDirectory: string) {\n super();\n this.outputDirectory = outputDirectory;\n this.relativeDir = null;\n this.fileName = null;\n fs.mkdirSync(outputDirectory, {recursive:true});\n }\n\n /**\n * Open a file for writing. The file is created in the\n * output directory.\n * @param fileName - the name of the file to open\n */\n openFile(fileName: string): void {\n this.fileName = fileName;\n this.relativeDir = null;\n }\n\n /**\n * Open a file for writing. The file is created in the\n * output directory, plus the relative directory path.\n * @param relativeDir - the relative directory\n * @param fileName - the name of the file to open\n */\n openRelativeFile(relativeDir: string, fileName: string): void {\n this.fileName = fileName;\n this.relativeDir = relativeDir;\n this.clearBuffer();\n }\n\n /**\n * Writes text to the current open file\n * @param tabs - the number of tabs to use\n * @param text - the text to write\n */\n writeLine(tabs: number, text: string): void {\n if (this.fileName) {\n super.writeLine(tabs,text);\n } else {\n throw new Error('File has not been opened!');\n }\n }\n\n /**\n * Writes text to the start of the current open file\n * @param tabs - the number of tabs to use\n * @param text - the text to write\n */\n writeBeforeLine(tabs: number, text: string): void {\n if (this.fileName) {\n super.writeBeforeLine(tabs,text);\n } else {\n throw new Error('File has not been opened!');\n }\n }\n\n /**\n * Closes the file, flushing the buffer to disk.\n */\n closeFile(): void {\n if (!this.fileName) {\n throw new Error('No file open');\n }\n\n let filePath = this.outputDirectory;\n if (this.relativeDir) {\n filePath = path.resolve(filePath, this.relativeDir);\n }\n filePath = path.resolve(filePath, this.fileName);\n\n //console.log('Writing to ' + filePath );\n fs.mkdirSync(path.dirname(filePath), {recursive:true});\n fs.writeFileSync(filePath, this.getBuffer());\n\n this.fileName = null;\n this.relativeDir = null;\n this.clearBuffer();\n }\n}\n\nexport { FileWriter };\nexport default FileWriter;\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAcA,YAAY,QAAQ;AACpB,YAAY,UAAU;AAStB,IAAM,aAAN,cAAyB,eAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAS5B,YAAY,iBAAyB;AACjC,UAAM;AARV,SAAO,WAA0B;AACjC,SAAO,cAA6B;AAQhC,SAAK,kBAAkB;AACvB,SAAK,cAAc;AACnB,SAAK,WAAW;AAChB,IAAG,aAAU,iBAAiB,EAAC,WAAU,KAAI,CAAC;AAAA,EAClD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAS,UAAwB;AAC7B,SAAK,WAAW;AAChB,SAAK,cAAc;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,iBAAiB,aAAqB,UAAwB;AAC1D,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,YAAY;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,UAAU,MAAc,MAAoB;AACxC,QAAI,KAAK,UAAU;AACf,YAAM,UAAU,MAAK,IAAI;AAAA,IAC7B,OAAO;AACH,YAAM,IAAI,MAAM,2BAA2B;AAAA,IAC/C;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,gBAAgB,MAAc,MAAoB;AAC9C,QAAI,KAAK,UAAU;AACf,YAAM,gBAAgB,MAAK,IAAI;AAAA,IACnC,OAAO;AACH,YAAM,IAAI,MAAM,2BAA2B;AAAA,IAC/C;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA,EAKA,YAAkB;AACd,QAAI,CAAC,KAAK,UAAU;AAChB,YAAM,IAAI,MAAM,cAAc;AAAA,IAClC;AAEA,QAAI,WAAW,KAAK;AACpB,QAAI,KAAK,aAAa;AAClB,iBAAgB,aAAQ,UAAU,KAAK,WAAW;AAAA,IACtD;AACA,eAAgB,aAAQ,UAAU,KAAK,QAAQ;AAG/C,IAAG,aAAe,aAAQ,QAAQ,GAAG,EAAC,WAAU,KAAI,CAAC;AACrD,IAAG,iBAAc,UAAU,KAAK,UAAU,CAAC;AAE3C,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,YAAY;AAAA,EACrB;AACJ;AAGA,IAAO,qBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
const require = __createRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CONCERTO_DEPRECATION_001,
|
|
5
|
+
CONCERTO_DEPRECATION_002,
|
|
6
|
+
DEFAULT_BASE_EXCEPTION,
|
|
7
|
+
DEFAULT_VALIDATOR_EXCEPTION,
|
|
8
|
+
DEPRECATION_WARNING,
|
|
9
|
+
REGEX_VALIDATOR_EXCEPTION,
|
|
10
|
+
TYPE_NOT_FOUND_EXCEPTION
|
|
11
|
+
} from "./chunk-FK2LDKS6.mjs";
|
|
12
|
+
import "./chunk-PMP2SMHG.mjs";
|
|
13
|
+
export {
|
|
14
|
+
CONCERTO_DEPRECATION_001,
|
|
15
|
+
CONCERTO_DEPRECATION_002,
|
|
16
|
+
DEFAULT_BASE_EXCEPTION,
|
|
17
|
+
DEFAULT_VALIDATOR_EXCEPTION,
|
|
18
|
+
DEPRECATION_WARNING,
|
|
19
|
+
REGEX_VALIDATOR_EXCEPTION,
|
|
20
|
+
TYPE_NOT_FOUND_EXCEPTION
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=errorcodes.mjs.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
const require = __createRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
FileDownloader,
|
|
5
|
+
filedownloader_default
|
|
6
|
+
} from "./chunk-T6ZBQYEB.mjs";
|
|
7
|
+
import "./chunk-PMP2SMHG.mjs";
|
|
8
|
+
export {
|
|
9
|
+
FileDownloader,
|
|
10
|
+
filedownloader_default as default
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=filedownloader.mjs.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
const require = __createRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
FileWriter,
|
|
5
|
+
filewriter_default
|
|
6
|
+
} from "./chunk-YQVUNOO6.mjs";
|
|
7
|
+
import "./chunk-K4OOJFK5.mjs";
|
|
8
|
+
import "./chunk-PMP2SMHG.mjs";
|
|
9
|
+
export {
|
|
10
|
+
FileWriter,
|
|
11
|
+
filewriter_default as default
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=filewriter.mjs.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
const require = __createRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
ID_REGEX,
|
|
5
|
+
normalizeIdentifier
|
|
6
|
+
} from "./chunk-3U4T7O4P.mjs";
|
|
7
|
+
import "./chunk-PMP2SMHG.mjs";
|
|
8
|
+
export {
|
|
9
|
+
ID_REGEX,
|
|
10
|
+
normalizeIdentifier
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=identifiers.mjs.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
const require = __createRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
null_default
|
|
5
|
+
} from "./chunk-LPNGJFU2.mjs";
|
|
6
|
+
import {
|
|
7
|
+
typedstack_default
|
|
8
|
+
} from "./chunk-WPVG6LP3.mjs";
|
|
9
|
+
import {
|
|
10
|
+
warning_exports
|
|
11
|
+
} from "./chunk-3RJ6JXLX.mjs";
|
|
12
|
+
import {
|
|
13
|
+
label_exports
|
|
14
|
+
} from "./chunk-DTVQ7VXD.mjs";
|
|
15
|
+
import {
|
|
16
|
+
defaultfileloader_default
|
|
17
|
+
} from "./chunk-PBL5N3A2.mjs";
|
|
18
|
+
import {
|
|
19
|
+
compositefileloader_default
|
|
20
|
+
} from "./chunk-I33X6SGY.mjs";
|
|
21
|
+
import {
|
|
22
|
+
githubfileloader_default
|
|
23
|
+
} from "./chunk-D4MNWWBB.mjs";
|
|
24
|
+
import {
|
|
25
|
+
httpfileloader_default
|
|
26
|
+
} from "./chunk-GOLEPEBI.mjs";
|
|
27
|
+
import {
|
|
28
|
+
logger_default
|
|
29
|
+
} from "./chunk-Q6G4HQJ7.mjs";
|
|
30
|
+
import {
|
|
31
|
+
modelwriter_exports
|
|
32
|
+
} from "./chunk-TP3CT6S4.mjs";
|
|
33
|
+
import {
|
|
34
|
+
basefileexception_default
|
|
35
|
+
} from "./chunk-RBUQLLXW.mjs";
|
|
36
|
+
import {
|
|
37
|
+
baseexception_default
|
|
38
|
+
} from "./chunk-G6IDW2UD.mjs";
|
|
39
|
+
import {
|
|
40
|
+
errorcodes_exports
|
|
41
|
+
} from "./chunk-FK2LDKS6.mjs";
|
|
42
|
+
import {
|
|
43
|
+
filedownloader_default
|
|
44
|
+
} from "./chunk-T6ZBQYEB.mjs";
|
|
45
|
+
import {
|
|
46
|
+
filewriter_default
|
|
47
|
+
} from "./chunk-YQVUNOO6.mjs";
|
|
48
|
+
import {
|
|
49
|
+
identifiers_exports
|
|
50
|
+
} from "./chunk-3U4T7O4P.mjs";
|
|
51
|
+
import {
|
|
52
|
+
inmemorywriter_default
|
|
53
|
+
} from "./chunk-FHUVVHGR.mjs";
|
|
54
|
+
import {
|
|
55
|
+
writer_default
|
|
56
|
+
} from "./chunk-K4OOJFK5.mjs";
|
|
57
|
+
import "./chunk-PMP2SMHG.mjs";
|
|
58
|
+
export {
|
|
59
|
+
baseexception_default as BaseException,
|
|
60
|
+
basefileexception_default as BaseFileException,
|
|
61
|
+
compositefileloader_default as CompositeFileLoader,
|
|
62
|
+
defaultfileloader_default as DefaultFileLoader,
|
|
63
|
+
errorcodes_exports as ErrorCodes,
|
|
64
|
+
filedownloader_default as FileDownloader,
|
|
65
|
+
filewriter_default as FileWriter,
|
|
66
|
+
githubfileloader_default as GitHubFileLoader,
|
|
67
|
+
httpfileloader_default as HTTPFileLoader,
|
|
68
|
+
identifiers_exports as Identifiers,
|
|
69
|
+
inmemorywriter_default as InMemoryWriter,
|
|
70
|
+
label_exports as Label,
|
|
71
|
+
logger_default as Logger,
|
|
72
|
+
modelwriter_exports as ModelWriter,
|
|
73
|
+
null_default as NullUtil,
|
|
74
|
+
typedstack_default as TypedStack,
|
|
75
|
+
warning_exports as Warning,
|
|
76
|
+
writer_default as Writer
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
const require = __createRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
InMemoryWriter,
|
|
5
|
+
inmemorywriter_default
|
|
6
|
+
} from "./chunk-FHUVVHGR.mjs";
|
|
7
|
+
import "./chunk-K4OOJFK5.mjs";
|
|
8
|
+
import "./chunk-PMP2SMHG.mjs";
|
|
9
|
+
export {
|
|
10
|
+
InMemoryWriter,
|
|
11
|
+
inmemorywriter_default as default
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=inmemorywriter.mjs.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
const require = __createRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
labelToSentence,
|
|
5
|
+
sentenceToLabel
|
|
6
|
+
} from "./chunk-DTVQ7VXD.mjs";
|
|
7
|
+
import "./chunk-PMP2SMHG.mjs";
|
|
8
|
+
export {
|
|
9
|
+
labelToSentence,
|
|
10
|
+
sentenceToLabel
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=label.mjs.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
const require = __createRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CompositeFileLoader,
|
|
5
|
+
compositefileloader_default
|
|
6
|
+
} from "../chunk-I33X6SGY.mjs";
|
|
7
|
+
import "../chunk-PMP2SMHG.mjs";
|
|
8
|
+
export {
|
|
9
|
+
CompositeFileLoader,
|
|
10
|
+
compositefileloader_default as default
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=compositefileloader.mjs.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
const require = __createRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
DefaultFileLoader,
|
|
5
|
+
defaultfileloader_default
|
|
6
|
+
} from "../chunk-PBL5N3A2.mjs";
|
|
7
|
+
import "../chunk-I33X6SGY.mjs";
|
|
8
|
+
import "../chunk-D4MNWWBB.mjs";
|
|
9
|
+
import "../chunk-GOLEPEBI.mjs";
|
|
10
|
+
import "../chunk-PMP2SMHG.mjs";
|
|
11
|
+
export {
|
|
12
|
+
DefaultFileLoader,
|
|
13
|
+
defaultfileloader_default as default
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=defaultfileloader.mjs.map
|