зеркало из https://github.com/microsoft/CDM.git
Revert "Microsoft CDM Release Version: P1"
This reverts commit 3afca06d7b
.
This commit is contained in:
Родитель
ca46f41dde
Коммит
70fd5dccc2
|
@ -0,0 +1,64 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
# ignore the tsc output
|
||||
lib/
|
|
@ -0,0 +1,20 @@
|
|||
# Introduction
|
||||
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
|
||||
|
||||
# Getting Started
|
||||
TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:
|
||||
1. Installation process
|
||||
2. Software dependencies
|
||||
3. Latest releases
|
||||
4. API references
|
||||
|
||||
# Build and Test
|
||||
TODO: Describe and show how to build your code and run the tests.
|
||||
|
||||
# Contribute
|
||||
TODO: Explain how other users and developers can contribute to make your code better.
|
||||
|
||||
If you want to learn more about creating good readme files then refer the following [guidelines](https://www.visualstudio.com/en-us/docs/git/create-a-readme). You can also seek inspiration from the below readme files:
|
||||
- [ASP.NET Core](https://github.com/aspnet/Home)
|
||||
- [Visual Studio Code](https://github.com/Microsoft/vscode)
|
||||
- [Chakra Core](https://github.com/Microsoft/ChakraCore)
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,4 @@
|
|||
import * as types from "./cdm-types"
|
||||
export { types }
|
||||
import * as loc from "./local-corpus"
|
||||
export { loc }
|
|
@ -0,0 +1,129 @@
|
|||
import * as cdm from "./cdm-types"
|
||||
import { readFileSync, writeFileSync, readFile, mkdirSync, existsSync, readdirSync, statSync } from "fs";
|
||||
|
||||
|
||||
export function consoleStatusReport(level: cdm.cdmStatusLevel, msg : string, path : string) {
|
||||
if (level == cdm.cdmStatusLevel.error)
|
||||
console.error(`Err: ${msg} @ ${path}`) ;
|
||||
else if (level == cdm.cdmStatusLevel.warning)
|
||||
console.warn(`Wrn: ${msg} @ ${path}`);
|
||||
else if (level == cdm.cdmStatusLevel.progress)
|
||||
console.log(msg);
|
||||
}
|
||||
|
||||
export function resolveLocalCorpus(cdmCorpus : cdm.ICdmCorpusDef, finishStep : cdm.cdmValidationStep) : Promise<boolean> {
|
||||
return new Promise<boolean>((localCorpusResolve, localCorpusReject) => {
|
||||
console.log('resolving imports');
|
||||
// first resolve all of the imports to pull other docs into the namespace
|
||||
cdmCorpus.resolveImports((uri : string) : Promise<[string, string]> =>{
|
||||
return new Promise<[string, string]>((resolve, reject) => {
|
||||
// resolve imports take a callback that askes for promise to do URI resolution.
|
||||
// so here we are, working on that promise
|
||||
readFile(cdmCorpus.rootPath + uri, "utf8", (err : NodeJS.ErrnoException, data:string)=>{
|
||||
if(err)
|
||||
reject([uri, err]);
|
||||
else
|
||||
resolve([uri, data]);
|
||||
})
|
||||
});
|
||||
}).then((r:boolean) => {
|
||||
// success resolving all imports
|
||||
console.log(r);
|
||||
let startTime = Date.now();
|
||||
console.log('validate schema:');
|
||||
if (r) {
|
||||
let validateStep = (currentStep:cdm.cdmValidationStep)=> {
|
||||
return cdmCorpus.resolveReferencesAndValidate(currentStep, finishStep, undefined).then((nextStep:cdm.cdmValidationStep) => {
|
||||
if (nextStep == cdm.cdmValidationStep.error) {
|
||||
console.log('validation step failed');
|
||||
}
|
||||
else if (nextStep == cdm.cdmValidationStep.finished) {
|
||||
console.log('validation finished');
|
||||
console.log(Date.now() - startTime);
|
||||
localCorpusResolve(true);
|
||||
}
|
||||
else {
|
||||
// success resolving all imports
|
||||
return validateStep(nextStep);
|
||||
}
|
||||
}).catch((reason)=> {
|
||||
console.log('exception during validation');
|
||||
console.log(reason);
|
||||
localCorpusReject(reason);
|
||||
});
|
||||
}
|
||||
return validateStep(cdm.cdmValidationStep.start);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// "analyticalCommon"
|
||||
// "applicationCommon"
|
||||
|
||||
export function loadCorpusFolder(corpus : cdm.ICdmCorpusDef, folder : cdm.ICdmFolderDef, ignoreFolders : string[], version : string) {
|
||||
let path = corpus.rootPath + folder.getRelativePath();
|
||||
if (ignoreFolders && ignoreFolders.find(ig => ig == folder.getName()))
|
||||
return;
|
||||
let endMatch = (version ? "." + version : "" )+ ".cdm.json";
|
||||
// for every document or directory
|
||||
readdirSync(path).forEach(dirEntry => {
|
||||
let entryName = path + dirEntry;
|
||||
let stats = statSync(entryName);
|
||||
if (stats.isDirectory()) {
|
||||
this.loadCorpusFolder(corpus, folder.addFolder(dirEntry), ignoreFolders, version);
|
||||
}
|
||||
else {
|
||||
let postfix = dirEntry.slice(dirEntry.indexOf("."));
|
||||
if (postfix == endMatch) {
|
||||
let sourceBuff = readFileSync(entryName);
|
||||
if (sourceBuff.length > 3) {
|
||||
let bom1 = sourceBuff.readInt8(0);
|
||||
let bom2 = sourceBuff.readInt8(1);
|
||||
let bom3 = sourceBuff.readInt8(2);
|
||||
if (bom1 == -17 && bom2 == -69 && bom3 == -65) {
|
||||
// this is ff fe encode in utf8 and is the bom that json parser hates.
|
||||
sourceBuff.writeInt8(32, 0);
|
||||
sourceBuff.writeInt8(32, 1);
|
||||
sourceBuff.writeInt8(32, 2);
|
||||
}
|
||||
}
|
||||
let sourceDoc = sourceBuff.toString();
|
||||
corpus.addDocumentFromContent(folder.getRelativePath() + dirEntry, sourceDoc);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export function persistCorpus(cdmCorpus : cdm.ICdmCorpusDef, directives: cdm.TraitDirectiveSet, options?: cdm.copyOptions) {
|
||||
if (cdmCorpus && cdmCorpus.getSubFolders() && cdmCorpus.getSubFolders().length == 1)
|
||||
persistCorpusFolder(cdmCorpus.rootPath, cdmCorpus.getSubFolders()[0], directives, options);
|
||||
}
|
||||
|
||||
export function persistCorpusFolder(rootPath : string, cdmFolder : cdm.ICdmFolderDef, directives: cdm.TraitDirectiveSet, options?: cdm.copyOptions): void {
|
||||
if (cdmFolder) {
|
||||
let folderPath = rootPath + cdmFolder.getRelativePath();
|
||||
if (!existsSync(folderPath))
|
||||
mkdirSync(folderPath);
|
||||
if (cdmFolder.getDocuments())
|
||||
cdmFolder.getDocuments().forEach(doc => {
|
||||
let resOpt: cdm.resolveOptions = {wrtDoc: doc, directives: directives};
|
||||
persistDocument(rootPath, resOpt, options);
|
||||
});
|
||||
if (cdmFolder.getSubFolders()) {
|
||||
cdmFolder.getSubFolders().forEach(f => {
|
||||
persistCorpusFolder(rootPath, f, directives, options);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function persistDocument(rootPath : string, resOpt : cdm.resolveOptions, options?: cdm.copyOptions) {
|
||||
let docPath = rootPath + resOpt.wrtDoc.getFolder().getRelativePath() + resOpt.wrtDoc.getName();
|
||||
let data = resOpt.wrtDoc.copyData(resOpt, options);
|
||||
let content = JSON.stringify(data, null, 4);
|
||||
writeFileSync(docPath, content);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,337 @@
|
|||
{
|
||||
"name": "cdm.objectmodel",
|
||||
"version": "0.8.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz",
|
||||
"integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/highlight": "7.0.0"
|
||||
}
|
||||
},
|
||||
"@babel/highlight": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz",
|
||||
"integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "2.4.2",
|
||||
"esutils": "2.0.2",
|
||||
"js-tokens": "4.0.0"
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "10.12.15",
|
||||
"resolved": "https://microsoft.pkgs.visualstudio.com/_packaging/Universal.Store.NPM/npm/registry/@types/node/-/node-10.12.15.tgz",
|
||||
"integrity": "sha1-IOhWUbYv2GZW5Xycm8dxqxVwvFk=",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-convert": "1.9.3"
|
||||
}
|
||||
},
|
||||
"argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"sprintf-js": "1.0.3"
|
||||
}
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"balanced-match": "1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"builtin-modules": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
|
||||
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
|
||||
"dev": true
|
||||
},
|
||||
"chalk": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "3.2.1",
|
||||
"escape-string-regexp": "1.0.5",
|
||||
"supports-color": "5.5.0"
|
||||
}
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||
"dev": true
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.20.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
|
||||
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
|
||||
"dev": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||
"dev": true
|
||||
},
|
||||
"diff": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
|
||||
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
|
||||
"dev": true
|
||||
},
|
||||
"escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
||||
"dev": true
|
||||
},
|
||||
"esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
||||
"dev": true
|
||||
},
|
||||
"esutils": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
|
||||
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
|
||||
"dev": true
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
||||
"dev": true
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.1.4",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
|
||||
"integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fs.realpath": "1.0.0",
|
||||
"inflight": "1.0.6",
|
||||
"inherits": "2.0.3",
|
||||
"minimatch": "3.0.4",
|
||||
"once": "1.4.0",
|
||||
"path-is-absolute": "1.0.1"
|
||||
}
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
||||
"dev": true
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"once": "1.4.0",
|
||||
"wrappy": "1.0.2"
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
|
||||
"dev": true
|
||||
},
|
||||
"js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
|
||||
"dev": true
|
||||
},
|
||||
"js-yaml": {
|
||||
"version": "3.13.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
|
||||
"integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"argparse": "1.0.10",
|
||||
"esprima": "4.0.1"
|
||||
}
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"brace-expansion": "1.1.11"
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||
"dev": true
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"wrappy": "1.0.2"
|
||||
}
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||
"dev": true
|
||||
},
|
||||
"path-parse": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
|
||||
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
|
||||
"dev": true
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz",
|
||||
"integrity": "sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-parse": "1.0.6"
|
||||
}
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.7.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
|
||||
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
|
||||
"dev": true
|
||||
},
|
||||
"sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
|
||||
"dev": true
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "3.0.0"
|
||||
}
|
||||
},
|
||||
"tslib": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://microsoft.pkgs.visualstudio.com/_packaging/Universal.Store.NPM/npm/registry/tslib/-/tslib-1.9.3.tgz",
|
||||
"integrity": "sha1-1+TdeSRdhUKMTX5IIqeZF5VMooY=",
|
||||
"dev": true
|
||||
},
|
||||
"tslint": {
|
||||
"version": "5.17.0",
|
||||
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.17.0.tgz",
|
||||
"integrity": "sha512-pflx87WfVoYepTet3xLfDOLDm9Jqi61UXIKePOuca0qoAZyrGWonDG9VTbji58Fy+8gciUn8Bt7y69+KEVjc/w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "7.0.0",
|
||||
"builtin-modules": "1.1.1",
|
||||
"chalk": "2.4.2",
|
||||
"commander": "2.20.0",
|
||||
"diff": "3.5.0",
|
||||
"glob": "7.1.4",
|
||||
"js-yaml": "3.13.1",
|
||||
"minimatch": "3.0.4",
|
||||
"mkdirp": "0.5.1",
|
||||
"resolve": "1.11.1",
|
||||
"semver": "5.7.0",
|
||||
"tslib": "1.9.3",
|
||||
"tsutils": "2.29.0"
|
||||
}
|
||||
},
|
||||
"tslint-microsoft-contrib": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://microsoft.pkgs.visualstudio.com/_packaging/Universal.Store.NPM/npm/registry/tslint-microsoft-contrib/-/tslint-microsoft-contrib-5.2.1.tgz",
|
||||
"integrity": "sha1-pihoOfgA4lkdBB6igAx3SHhErYE=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"tsutils": "2.28.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"tsutils": {
|
||||
"version": "2.28.0",
|
||||
"resolved": "https://microsoft.pkgs.visualstudio.com/_packaging/Universal.Store.NPM/npm/registry/tsutils/-/tsutils-2.28.0.tgz",
|
||||
"integrity": "sha1-a9ceFggo+dAZtvToRHQiKPhRaaE=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"tslib": "1.9.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tsutils": {
|
||||
"version": "2.29.0",
|
||||
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz",
|
||||
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"tslib": "1.9.3"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://microsoft.pkgs.visualstudio.com/_packaging/Universal.Store.NPM/npm/registry/typescript/-/typescript-3.2.2.tgz",
|
||||
"integrity": "sha1-/oEBxGqhI/g1NSPr3PVzDCrkk+U=",
|
||||
"dev": true
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "cdm.objectmodel",
|
||||
"version": "0.8.1",
|
||||
"description": "The typescript object model for CDM.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@types/node": "^10.12.0",
|
||||
"tslint": "^5.17.0",
|
||||
"tslint-microsoft-contrib": "^5.2.1",
|
||||
"typescript": "^3.1.3"
|
||||
},
|
||||
"author": "Microsoft Corporation"
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"emitDecoratorMetadata": true,
|
||||
"declaration": true,
|
||||
"experimentalDecorators": true,
|
||||
"target": "ES6",
|
||||
"sourceMap": true,
|
||||
"outDir": "./lib"
|
||||
},
|
||||
"files": [
|
||||
"./index.ts"
|
||||
]
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -1,3 +1,20 @@
|
|||
# CDM Explorer
|
||||
# Introduction
|
||||
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
|
||||
|
||||
This folder contains the source code and executables for the Entity Explorer (https://microsoft.github.io/CDM/)
|
||||
# Getting Started
|
||||
TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:
|
||||
1. Installation process
|
||||
2. Software dependencies
|
||||
3. Latest releases
|
||||
4. API references
|
||||
|
||||
# Build and Test
|
||||
TODO: Describe and show how to build your code and run the tests.
|
||||
|
||||
# Contribute
|
||||
TODO: Explain how other users and developers can contribute to make your code better.
|
||||
|
||||
If you want to learn more about creating good readme files then refer the following [guidelines](https://www.visualstudio.com/en-us/docs/git/create-a-readme). You can also seek inspiration from the below readme files:
|
||||
- [ASP.NET Core](https://github.com/aspnet/Home)
|
||||
- [Visual Studio Code](https://github.com/Microsoft/vscode)
|
||||
- [Chakra Core](https://github.com/Microsoft/ChakraCore)
|
|
@ -9328,42 +9328,6 @@ class CorpusImpl extends FolderImpl {
|
|||
get profiler() {
|
||||
return p;
|
||||
}
|
||||
|
||||
// Generates warnings into the status report.
|
||||
generateWarnings() {
|
||||
let directives = new TraitDirectiveSet(new Set(["referenceOnly", "normalized"]));
|
||||
let resOpt = { wrtDoc: undefined, directives: directives, relationshipDepth: 0 };
|
||||
let l = this.allDocuments.length;
|
||||
for (let i = 0; i < l; i++) {
|
||||
let fd = this.allDocuments[i];
|
||||
this.generateWarningsForSingleDoc(fd["1"], resOpt);
|
||||
}
|
||||
}
|
||||
// Generates the warnings for a single document.
|
||||
generateWarningsForSingleDoc(doc, resOpt) {
|
||||
if (doc.getDefinitions() == null) {
|
||||
return;
|
||||
}
|
||||
let checkPrimaryKeyAttributes = this.checkPrimaryKeyAttributes;
|
||||
let ctx = this.ctx;
|
||||
resOpt.wrtDoc = doc;
|
||||
doc.getDefinitions().forEach(function (element) {
|
||||
if (element instanceof EntityImpl && element.hasAttributes !== undefined) {
|
||||
var resolvedEntity = element.createResolvedEntity(resOpt, element.entityName + "_");
|
||||
// TODO: Add additional checks here.
|
||||
checkPrimaryKeyAttributes(resolvedEntity, resOpt, ctx);
|
||||
}
|
||||
});
|
||||
resOpt.wrtDoc = null;
|
||||
}
|
||||
|
||||
// Checks whether a resolved entity has an "is.identifiedBy" trait.
|
||||
checkPrimaryKeyAttributes(resolvedEntity, resOpt, ctx) {
|
||||
if (resolvedEntity.getResolvedTraits(resOpt).find(resOpt, "is.identifiedBy") == null) {
|
||||
ctx.statusRpt(cdmStatusLevel.warning, "There is a primary key missing for the entity " + resolvedEntity.getName() + ".", null);
|
||||
}
|
||||
}
|
||||
|
||||
resolveReferencesAndValidate(stage, stageThrough, resOpt) {
|
||||
//let bodyCode = () =>
|
||||
{
|
||||
|
@ -9448,7 +9412,6 @@ class CorpusImpl extends FolderImpl {
|
|||
this.declareObjectDefinitions("");
|
||||
ctx.currentDoc = undefined;
|
||||
}
|
||||
|
||||
if (errors > 0) {
|
||||
resolve(cdmValidationStep.error);
|
||||
}
|
||||
|
@ -9552,7 +9515,7 @@ class CorpusImpl extends FolderImpl {
|
|||
}, null);
|
||||
ctx.currentDoc = undefined;
|
||||
}
|
||||
|
||||
;
|
||||
if (errors > 0)
|
||||
resolve(cdmValidationStep.error);
|
||||
else {
|
||||
|
@ -9563,7 +9526,6 @@ class CorpusImpl extends FolderImpl {
|
|||
else
|
||||
resolve(cdmValidationStep.traits);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else if (stage == cdmValidationStep.traits) {
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -217,9 +217,6 @@ function messageHandlePingMainControl(messageType, data1, data2) {
|
|||
controller.mainContainer.messageHandle("navigateEntitySelect", controller.multiSelectEntityList, singleSelected);
|
||||
}
|
||||
}
|
||||
else if (messageType == "additionalValidationRequest") {
|
||||
controller.corpus.generateWarnings();
|
||||
}
|
||||
else {
|
||||
controller.mainContainer.messageHandle(messageType, data1, data2);
|
||||
}
|
||||
|
@ -240,11 +237,17 @@ function messageHandlePingMainControl(messageType, data1, data2) {
|
|||
}
|
||||
if (messageType === "loadFail") {
|
||||
let waitPanel = document.getElementById("wait_pane");
|
||||
let errorContent = "Loading failed for file: '"+data1.docName+"'. This might be caused by ad blocking software. Please disable the ad blockers on this site and reload the page.";
|
||||
let errorContent = "File load failed for file: '"+data1.docName+"'. This might be caused by Ad Blockers. Please disable AdBlock on this site and reload the page.";
|
||||
waitPanel.children[0].textContent = errorContent;
|
||||
waitPanel.style.background = "#FF6464";
|
||||
waitPanel.style.color = "#ffffff";
|
||||
throw new Error(errorContent);
|
||||
let entState = data1;
|
||||
controller.loadFails++;
|
||||
entState.rawContent = null;
|
||||
entState.loadState = 2;
|
||||
controller.pendingLoads.delete(entState.path + entState.docName);
|
||||
controller.mainContainer.messageHandle("loadEntity", entState, data2);
|
||||
}
|
||||
else if (messageType === "loadModeResult") {
|
||||
if (controller.pendingLoads.size == 0) {
|
||||
|
|
|
@ -1072,7 +1072,7 @@
|
|||
"Inactive",
|
||||
"1"
|
||||
]
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче