@fluid-experimental/property-changeset 0.59.2000 → 0.59.3000-67119
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/changeset.d.ts.map +1 -1
- package/dist/changeset.js +50 -50
- package/dist/changeset.js.map +1 -1
- package/dist/changeset_operations/array.d.ts.map +1 -1
- package/dist/changeset_operations/array.js +22 -22
- package/dist/changeset_operations/array.js.map +1 -1
- package/dist/changeset_operations/arrayChangesetIterator.d.ts.map +1 -1
- package/dist/changeset_operations/arrayChangesetIterator.js +3 -3
- package/dist/changeset_operations/arrayChangesetIterator.js.map +1 -1
- package/dist/changeset_operations/indexedCollection.js +21 -21
- package/dist/changeset_operations/indexedCollection.js.map +1 -1
- package/dist/changeset_operations/isEmptyChangeset.js +2 -2
- package/dist/changeset_operations/isEmptyChangeset.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pathHelper.js.map +1 -1
- package/dist/rebase.js +6 -6
- package/dist/rebase.js.map +1 -1
- package/dist/templateSchema.d.ts.map +1 -1
- package/dist/templateSchema.js +1 -0
- package/dist/templateSchema.js.map +1 -1
- package/dist/templateValidator.d.ts.map +1 -1
- package/dist/templateValidator.js +32 -32
- package/dist/templateValidator.js.map +1 -1
- package/dist/test/array.spec.js +40 -40
- package/dist/test/array.spec.js.map +1 -1
- package/dist/test/pathHelper.spec.js +147 -147
- package/dist/test/pathHelper.spec.js.map +1 -1
- package/dist/test/reversibleCs.spec.js +2 -2
- package/dist/test/reversibleCs.spec.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1660
- package/dist/test/validator/templateSyntax.spec.js +29 -29
- package/dist/test/validator/templateSyntax.spec.js.map +1 -1
- package/dist/test/validator/templateValidator.spec.js +202 -202
- package/dist/test/validator/templateValidator.spec.js.map +1 -1
- package/dist/test/validator/typeidHelper.spec.js +39 -39
- package/dist/test/validator/typeidHelper.spec.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +41 -41
- package/dist/utils.js.map +1 -1
- package/lib/changeset.js.map +1 -1
- package/lib/changeset_operations/array.js.map +1 -1
- package/lib/changeset_operations/arrayChangesetIterator.js.map +1 -1
- package/lib/changeset_operations/indexedCollection.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/pathHelper.js.map +1 -1
- package/lib/rebase.js.map +1 -1
- package/lib/templateSchema.js +1 -0
- package/lib/templateSchema.js.map +1 -1
- package/lib/templateValidator.js +1 -1
- package/lib/templateValidator.js.map +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +4 -4
package/dist/rebase.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rebase.js","sourceRoot":"","sources":["../src/rebase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,yDAAoD;AACpD,6DAAqC;AAErC,2CAAwC;AAExC,MAAM,WAAW;IAGb,YAAY,CAAkB;QAC1B,IAAI,CAAC,CAAC,IAAI,YAAY,WAAW,CAAC,EAAE;YAAE,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;SAAE;QAClE,IAAI,CAAC,YAAY,WAAW,EAAE;YAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;SAAE;QAC9C,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACnB,CAAC;IAED,IAAI,CAAC,EAAkC;QACnC,IAAI,CAAC,KAAK,GAAG,IAAI,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;QACnD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,MAAM,IAAI,GAAG,CAAC,OAAqB,EAAE,EAAoE,EAAE,WAA+B,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,MAA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yBAAyB,CAAC,KAAK,EAAE,CAAC;iBACrC;gBAED,mBAAmB,CAAC,cAAc,CAAC,SAAS,EAAE;oBAC1C,yBAAyB;iBAC5B,CAAC,CAAC;aACN;SACJ;QAED,MAAM,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QACzC,mBAAmB,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE;YAC9D,yBAAyB,EAAE,MAAM,CAAC,qBAAqB;SAC1D,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACX,CAAC;AAjJD,sDAiJC;AAED,SAAS,kBAAkB,CAAC,aAAa,EAAE,eAAe;IACtD,IAAI,mBAAmB,GAAG,aAAa,CAAC;IACxC,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE;QAClC,MAAM,eAAe,GAAG,IAAI,qBAAS,CAAC,wBAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QACnE,eAAe,CAAC,kBAAkB,EAAE,CAAC;QAErC,MAAM,SAAS,GAAG,EAAE,CAAC;QACrB,MAAM,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QACzC,mBAAmB,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE;YAC9D,yBAAyB,EAAE,MAAM,CAAC,qBAAqB;SAC1D,CAAC,CAAC;QAEH,eAAe,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;QACpD,eAAe,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE;YAC7C,yBAAyB,EAAE,MAAM,CAAC,qBAAqB;SAC1D,CAAC,CAAC;QACH,mBAAmB,GAAG,eAAe,CAAC;KACzC;AACL,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {copy as cloneDeep} from \"fastest-json-copy\";\nimport isEqual from \"lodash/isEqual\";\n\nimport { ChangeSet } from \"./changeset\";\n\nclass SyncPromise {\n value: any;\n\n constructor(x: { value: any; }) {\n if (!(this instanceof SyncPromise)) { return new SyncPromise(x); }\n if (x instanceof SyncPromise) { x = x.value; }\n this.value = x;\n }\n\n then(fn: (arg0: any) => { value: any; }): SyncPromise {\n this.value = new SyncPromise(fn(this.value)).value;\n return this;\n }\n}\n\nconst loop = (promise: Promise<any>, fn: { (currentChange: any): any; (currentRebasedChange: any): any; }, makePromise: (arg0: any) => any) => promise.then(fn).then((result) => result === null ? result : loop(makePromise(result), fn, makePromise));\n\nexport function rebaseToRemoteChanges(\n change: any,\n getUnrebasedChange: any,\n getRebasedChanges: any,\n isAsync: boolean = false) {\n const makePromise = isAsync ? Promise.resolve.bind(Promise) : (x) => new SyncPromise(x);\n let mainPromise = makePromise();\n\n const commitsOnOtherLocalBranch = {};\n let rebaseBaseChangeSet = new ChangeSet({});\n const changesOnOtherLocalBranch = [];\n if (change.referenceGuid !== change.remoteHeadGuid) {\n // Extract all changes between the remoteHeadGuid and the referenceGuid\n let currentGuid = change.referenceGuid;\n mainPromise = loop(\n makePromise(getUnrebasedChange(currentGuid)),\n (currentChange) => {\n if (currentChange === undefined) {\n throw new Error(\"Received change that references a non-existing parent change\");\n }\n changesOnOtherLocalBranch.unshift(currentChange);\n commitsOnOtherLocalBranch[currentGuid] = currentChange;\n if (currentGuid === change.localBranchStart) {\n return null;\n }\n currentGuid = currentChange.referenceGuid;\n return getUnrebasedChange(currentGuid);\n },\n makePromise,\n );\n\n // Now we extract all changes until we arrive at a change that is relative to a remote change\n const alreadyRebasedChanges = [];\n\n mainPromise = mainPromise.then(() =>\n loop(makePromise(getUnrebasedChange(change.localBranchStart)),\n (currentRebasedChange) => {\n if (currentRebasedChange.remoteHeadGuid === currentRebasedChange.referenceGuid) {\n return null;\n }\n return makePromise(getUnrebasedChange(currentRebasedChange.referenceGuid))\n .then((rebaseChange) => {\n alreadyRebasedChanges.unshift(rebaseChange);\n if (rebaseChange === undefined) {\n throw new Error(\"Received change that references a non-existing parent change\");\n }\n return rebaseChange;\n });\n },\n makePromise,\n ),\n );\n\n // Compute the base Changeset to rebase the changes on the branch that was still the local branch\n // when the incoming change was created\n\n mainPromise = mainPromise\n .then(() => {\n // First invert all changes on the previous local branch\n const startGuid = alreadyRebasedChanges.length > 0 ?\n alreadyRebasedChanges[0].referenceGuid :\n changesOnOtherLocalBranch[0].referenceGuid;\n\n // Then apply all changes on the local remote branch\n const endGuid = change.remoteHeadGuid;\n return getRebasedChanges(startGuid, endGuid);\n })\n .then((relevantRemoteChanges) => {\n let rebaseBaseChangeSetForAlreadyRebasedChanges = new ChangeSet({});\n\n if (relevantRemoteChanges.length > 0) {\n for (const c of relevantRemoteChanges) {\n let changeset = c.changeSet;\n let applyAfterMetaInformation;\n\n if (alreadyRebasedChanges[0] !== undefined && alreadyRebasedChanges[0].guid === c.guid) {\n const invertedChange = new ChangeSet(cloneDeep(alreadyRebasedChanges[0].changeSet));\n invertedChange.toInverseChangeSet();\n invertedChange.applyChangeSet(rebaseBaseChangeSetForAlreadyRebasedChanges);\n applyAfterMetaInformation = new Map();\n const conflicts2 = [];\n changeset = cloneDeep(alreadyRebasedChanges[0].changeSet);\n rebaseBaseChangeSetForAlreadyRebasedChanges._rebaseChangeSet(changeset, conflicts2, {\n applyAfterMetaInformation,\n });\n\n rebaseBaseChangeSetForAlreadyRebasedChanges = invertedChange;\n alreadyRebasedChanges.shift();\n }\n rebaseBaseChangeSetForAlreadyRebasedChanges.applyChangeSet(changeset, { applyAfterMetaInformation });\n }\n\n // Now we have to rebase all changes from the remote local branch with respect to this base changeset\n rebaseChangeArrays(rebaseBaseChangeSetForAlreadyRebasedChanges, changesOnOtherLocalBranch);\n }\n\n // Update the reference for the rebased changes to indicate that they are now with respect to the\n // new remoteHeadGuid\n if (changesOnOtherLocalBranch.length > 0) {\n changesOnOtherLocalBranch[0].remoteHeadGuid = change.remoteHeadGuid;\n changesOnOtherLocalBranch[0].referenceGuid = change.remoteHeadGuid;\n }\n });\n }\n\n return mainPromise\n .then(() => makePromise(getRebasedChanges(change.remoteHeadGuid)))\n .then((remoteChanges) => {\n const conflicts = [];\n if (!isEqual(changesOnOtherLocalBranch.map((change) => change.guid),\n remoteChanges.map((change) => change.guid))) {\n for (const remoteChange of remoteChanges) {\n let applyAfterMetaInformation =\n commitsOnOtherLocalBranch[remoteChange.guid] !== undefined ?\n remoteChange.rebaseMetaInformation :\n undefined;\n\n let changeset = remoteChange.changeSet;\n if (changesOnOtherLocalBranch[0] !== undefined && changesOnOtherLocalBranch[0].guid === remoteChange.guid) {\n const invertedChange = new ChangeSet(cloneDeep(changesOnOtherLocalBranch[0].changeSet));\n invertedChange.toInverseChangeSet();\n invertedChange.applyChangeSet(rebaseBaseChangeSet);\n\n applyAfterMetaInformation = new Map();\n changeset = cloneDeep(changesOnOtherLocalBranch[0].changeSet);\n rebaseBaseChangeSet._rebaseChangeSet(changeset, conflicts, { applyAfterMetaInformation });\n\n // This is disabled for performance reasons. Only used during debugging\n // assert(isEqual(changeset,this.remoteChanges[i].changeSet),\n // \"Failed Rebase in rebaseToRemoteChanges\");\n rebaseBaseChangeSet = invertedChange;\n changesOnOtherLocalBranch.shift();\n }\n\n rebaseBaseChangeSet.applyChangeSet(changeset, {\n applyAfterMetaInformation,\n });\n }\n }\n\n change.rebaseMetaInformation = new Map();\n rebaseBaseChangeSet._rebaseChangeSet(change.changeSet, conflicts, {\n applyAfterMetaInformation: change.rebaseMetaInformation,\n });\n });\n}\n\nfunction rebaseChangeArrays(baseChangeSet, changesToRebase) {\n let rebaseBaseChangeSet = baseChangeSet;\n for (const change of changesToRebase) {\n const copiedChangeSet = new ChangeSet(cloneDeep(change.changeSet));\n copiedChangeSet.toInverseChangeSet();\n\n const conflicts = [];\n change.rebaseMetaInformation = new Map();\n rebaseBaseChangeSet._rebaseChangeSet(change.changeSet, conflicts, {\n applyAfterMetaInformation: change.rebaseMetaInformation,\n });\n\n copiedChangeSet.applyChangeSet(rebaseBaseChangeSet);\n copiedChangeSet.applyChangeSet(change.changeSet, {\n applyAfterMetaInformation: change.rebaseMetaInformation,\n });\n rebaseBaseChangeSet = copiedChangeSet;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rebase.js","sourceRoot":"","sources":["../src/rebase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,yDAAsD;AACtD,6DAAqC;AAErC,2CAAwC;AAExC,MAAM,WAAW;IAGb,YAAY,CAAkB;QAC1B,IAAI,CAAC,CAAC,IAAI,YAAY,WAAW,CAAC,EAAE;YAAE,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;SAAE;QAClE,IAAI,CAAC,YAAY,WAAW,EAAE;YAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;SAAE;QAC9C,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACnB,CAAC;IAED,IAAI,CAAC,EAAkC;QACnC,IAAI,CAAC,KAAK,GAAG,IAAI,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;QACnD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,MAAM,IAAI,GAAG,CAAC,OAAqB,EAAE,EAAoE,EAAE,WAA+B,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC;AAExP,SAAgB,qBAAqB,CACjC,MAAW,EACX,kBAAuB,EACvB,iBAAsB,EACtB,UAAmB,KAAK;IACxB,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,WAAW,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D,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACX,CAAC;AAjJD,sDAiJC;AAED,SAAS,kBAAkB,CAAC,aAAa,EAAE,eAAe;IACtD,IAAI,mBAAmB,GAAG,aAAa,CAAC;IACxC,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE;QAClC,MAAM,eAAe,GAAG,IAAI,qBAAS,CAAC,IAAA,wBAAS,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QACnE,eAAe,CAAC,kBAAkB,EAAE,CAAC;QAErC,MAAM,SAAS,GAAG,EAAE,CAAC;QACrB,MAAM,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QACzC,mBAAmB,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE;YAC9D,yBAAyB,EAAE,MAAM,CAAC,qBAAqB;SAC1D,CAAC,CAAC;QAEH,eAAe,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;QACpD,eAAe,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE;YAC7C,yBAAyB,EAAE,MAAM,CAAC,qBAAqB;SAC1D,CAAC,CAAC;QACH,mBAAmB,GAAG,eAAe,CAAC;KACzC;AACL,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { copy as cloneDeep } from \"fastest-json-copy\";\nimport isEqual from \"lodash/isEqual\";\n\nimport { ChangeSet } from \"./changeset\";\n\nclass SyncPromise {\n value: any;\n\n constructor(x: { value: any; }) {\n if (!(this instanceof SyncPromise)) { return new SyncPromise(x); }\n if (x instanceof SyncPromise) { x = x.value; }\n this.value = x;\n }\n\n then(fn: (arg0: any) => { value: any; }): SyncPromise {\n this.value = new SyncPromise(fn(this.value)).value;\n return this;\n }\n}\n\nconst loop = (promise: Promise<any>, fn: { (currentChange: any): any; (currentRebasedChange: any): any; }, makePromise: (arg0: any) => any) => promise.then(fn).then((result) => result === null ? result : loop(makePromise(result), fn, makePromise));\n\nexport function rebaseToRemoteChanges(\n change: any,\n getUnrebasedChange: any,\n getRebasedChanges: any,\n isAsync: boolean = false) {\n const makePromise = isAsync ? Promise.resolve.bind(Promise) : (x) => new SyncPromise(x);\n let mainPromise = makePromise();\n\n const commitsOnOtherLocalBranch = {};\n let rebaseBaseChangeSet = new ChangeSet({});\n const changesOnOtherLocalBranch = [];\n if (change.referenceGuid !== change.remoteHeadGuid) {\n // Extract all changes between the remoteHeadGuid and the referenceGuid\n let currentGuid = change.referenceGuid;\n mainPromise = loop(\n makePromise(getUnrebasedChange(currentGuid)),\n (currentChange) => {\n if (currentChange === undefined) {\n throw new Error(\"Received change that references a non-existing parent change\");\n }\n changesOnOtherLocalBranch.unshift(currentChange);\n commitsOnOtherLocalBranch[currentGuid] = currentChange;\n if (currentGuid === change.localBranchStart) {\n return null;\n }\n currentGuid = currentChange.referenceGuid;\n return getUnrebasedChange(currentGuid);\n },\n makePromise,\n );\n\n // Now we extract all changes until we arrive at a change that is relative to a remote change\n const alreadyRebasedChanges = [];\n\n mainPromise = mainPromise.then(() =>\n loop(makePromise(getUnrebasedChange(change.localBranchStart)),\n (currentRebasedChange) => {\n if (currentRebasedChange.remoteHeadGuid === currentRebasedChange.referenceGuid) {\n return null;\n }\n return makePromise(getUnrebasedChange(currentRebasedChange.referenceGuid))\n .then((rebaseChange) => {\n alreadyRebasedChanges.unshift(rebaseChange);\n if (rebaseChange === undefined) {\n throw new Error(\"Received change that references a non-existing parent change\");\n }\n return rebaseChange;\n });\n },\n makePromise,\n ),\n );\n\n // Compute the base Changeset to rebase the changes on the branch that was still the local branch\n // when the incoming change was created\n\n mainPromise = mainPromise\n .then(() => {\n // First invert all changes on the previous local branch\n const startGuid = alreadyRebasedChanges.length > 0 ?\n alreadyRebasedChanges[0].referenceGuid :\n changesOnOtherLocalBranch[0].referenceGuid;\n\n // Then apply all changes on the local remote branch\n const endGuid = change.remoteHeadGuid;\n return getRebasedChanges(startGuid, endGuid);\n })\n .then((relevantRemoteChanges) => {\n let rebaseBaseChangeSetForAlreadyRebasedChanges = new ChangeSet({});\n\n if (relevantRemoteChanges.length > 0) {\n for (const c of relevantRemoteChanges) {\n let changeset = c.changeSet;\n let applyAfterMetaInformation;\n\n if (alreadyRebasedChanges[0] !== undefined && alreadyRebasedChanges[0].guid === c.guid) {\n const invertedChange = new ChangeSet(cloneDeep(alreadyRebasedChanges[0].changeSet));\n invertedChange.toInverseChangeSet();\n invertedChange.applyChangeSet(rebaseBaseChangeSetForAlreadyRebasedChanges);\n applyAfterMetaInformation = new Map();\n const conflicts2 = [];\n changeset = cloneDeep(alreadyRebasedChanges[0].changeSet);\n rebaseBaseChangeSetForAlreadyRebasedChanges._rebaseChangeSet(changeset, conflicts2, {\n applyAfterMetaInformation,\n });\n\n rebaseBaseChangeSetForAlreadyRebasedChanges = invertedChange;\n alreadyRebasedChanges.shift();\n }\n rebaseBaseChangeSetForAlreadyRebasedChanges.applyChangeSet(changeset, { applyAfterMetaInformation });\n }\n\n // Now we have to rebase all changes from the remote local branch with respect to this base changeset\n rebaseChangeArrays(rebaseBaseChangeSetForAlreadyRebasedChanges, changesOnOtherLocalBranch);\n }\n\n // Update the reference for the rebased changes to indicate that they are now with respect to the\n // new remoteHeadGuid\n if (changesOnOtherLocalBranch.length > 0) {\n changesOnOtherLocalBranch[0].remoteHeadGuid = change.remoteHeadGuid;\n changesOnOtherLocalBranch[0].referenceGuid = change.remoteHeadGuid;\n }\n });\n }\n\n return mainPromise\n .then(() => makePromise(getRebasedChanges(change.remoteHeadGuid)))\n .then((remoteChanges) => {\n const conflicts = [];\n if (!isEqual(changesOnOtherLocalBranch.map((change) => change.guid),\n remoteChanges.map((change) => change.guid))) {\n for (const remoteChange of remoteChanges) {\n let applyAfterMetaInformation =\n commitsOnOtherLocalBranch[remoteChange.guid] !== undefined ?\n remoteChange.rebaseMetaInformation :\n undefined;\n\n let changeset = remoteChange.changeSet;\n if (changesOnOtherLocalBranch[0] !== undefined && changesOnOtherLocalBranch[0].guid === remoteChange.guid) {\n const invertedChange = new ChangeSet(cloneDeep(changesOnOtherLocalBranch[0].changeSet));\n invertedChange.toInverseChangeSet();\n invertedChange.applyChangeSet(rebaseBaseChangeSet);\n\n applyAfterMetaInformation = new Map();\n changeset = cloneDeep(changesOnOtherLocalBranch[0].changeSet);\n rebaseBaseChangeSet._rebaseChangeSet(changeset, conflicts, { applyAfterMetaInformation });\n\n // This is disabled for performance reasons. Only used during debugging\n // assert(isEqual(changeset,this.remoteChanges[i].changeSet),\n // \"Failed Rebase in rebaseToRemoteChanges\");\n rebaseBaseChangeSet = invertedChange;\n changesOnOtherLocalBranch.shift();\n }\n\n rebaseBaseChangeSet.applyChangeSet(changeset, {\n applyAfterMetaInformation,\n });\n }\n }\n\n change.rebaseMetaInformation = new Map();\n rebaseBaseChangeSet._rebaseChangeSet(change.changeSet, conflicts, {\n applyAfterMetaInformation: change.rebaseMetaInformation,\n });\n });\n}\n\nfunction rebaseChangeArrays(baseChangeSet, changesToRebase) {\n let rebaseBaseChangeSet = baseChangeSet;\n for (const change of changesToRebase) {\n const copiedChangeSet = new ChangeSet(cloneDeep(change.changeSet));\n copiedChangeSet.toInverseChangeSet();\n\n const conflicts = [];\n change.rebaseMetaInformation = new Map();\n rebaseBaseChangeSet._rebaseChangeSet(change.changeSet, conflicts, {\n applyAfterMetaInformation: change.rebaseMetaInformation,\n });\n\n copiedChangeSet.applyChangeSet(rebaseBaseChangeSet);\n copiedChangeSet.applyChangeSet(change.changeSet, {\n applyAfterMetaInformation: change.rebaseMetaInformation,\n });\n rebaseBaseChangeSet = copiedChangeSet;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateSchema.d.ts","sourceRoot":"","sources":["../src/templateSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;;;GAIG;AAEH;;GAEG;AACH,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFhB,CAAC;AAgFF,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GnB,CAAC;AAEF,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"templateSchema.d.ts","sourceRoot":"","sources":["../src/templateSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;;;GAIG;AAEH;;GAEG;AACH,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFhB,CAAC;AAgFF,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GnB,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/templateSchema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateSchema.js","sourceRoot":"","sources":["../src/templateSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;;;GAIG;;;AAEH;;GAEG;AACH,MAAM,WAAW,GAAG;IAChB,YAAY,EAAE;QACV,QAAQ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AK,EAAE,CAAC;wBACJ,UAAU,EAAE;4BACR,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;4BAC7B,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;yBACtC;qBACJ;oBACD;wBACI,UAAU,EAAE;4BACR,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;4BAC1B,UAAU,EAAE,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;yBACzC;qBACJ;iBACA;aACJ;SACJ;QACD,WAAW,EAAE;YACT,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,CAAC;YACX,KAAK,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE;SAC3C;QACD,eAAe,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACR,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACtB,MAAM,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;gBAClC,KAAK,EAAE,EAAE;gBACT,UAAU,EAAE,EAAE;gBACd,OAAO,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;gBACpC,cAAc,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE;gBACpD,UAAU,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE;aAC7C;YACD,QAAQ,EAAE,CAAC,IAAI,CAAC;SACnB;QACD,kBAAkB,EAAE;YAChB,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;SAC7B;KACJ;IACD,KAAK,EAAE;QACH,0BAA0B;QAC1B,cAAc;KACjB;CACJ,CAAC;AAEO,wCAAc","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview\n * Declaration of the TemplateSchema module\n * The TemplateSchema is used for validating PropertySet templates that code is attempting to register\n */\n\n/**\n * Namespace containing all schema-related data for property set validation\n */\nconst NativeTypes = {\n BaseProperty: {\n inherits: [],\n primitive: false,\n },\n ContainerProperty: {\n inherits: [\"BaseProperty\"],\n primitive: false,\n },\n NamedProperty: {\n inherits: [\"ContainerProperty\"],\n primitive: false,\n },\n NodeProperty: {\n inherits: [\"ContainerProperty\"],\n primitive: false,\n },\n NamedNodeProperty: {\n inherits: [\"NodeProperty\", \"NamedProperty\"],\n primitive: false,\n },\n RelationshipProperty: {\n inherits: [\"NodeProperty\", \"NamedProperty\"],\n primitive: false,\n },\n String: {\n inherits: [\"ContainerProperty\"],\n primitive: true,\n },\n Float32: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Float64: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Int8: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Uint8: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Int16: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Uint16: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Int32: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Uint32: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Bool: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Reference: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Enum: {\n inherits: [\"Int32\"],\n primitive: true,\n },\n Int64: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Uint64: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n};\n\nconst primitiveTypes = [];\nconst reservedTypes = [];\n\nObject.keys(NativeTypes).forEach(function(key) {\n if (NativeTypes[key].primitive) {\n primitiveTypes.push(key);\n } else {\n reservedTypes.push(key);\n }\n});\n\nconst requireTypeidIfNotInherits = {\n anyOf: [{\n oneOf: [{\n type: \"object\",\n properties: {\n constants: { typeof: \"undefined\" },\n },\n },\n {\n type: \"object\",\n prohibited: [\"constants\"],\n },\n ],\n },\n {\n type: \"object\",\n required: [\"inherits\"],\n },\n {\n type: \"object\",\n properties: {\n constants: {\n type: \"array\",\n items: {\n type: \"object\",\n required: [\"typeid\"],\n },\n },\n },\n },\n ],\n};\n\nconst originalSchema = {\n type: \"object\",\n minProperties: 1,\n properties: {\n typeid: {\n $ref: \"#/$defs/versioned-typeid\",\n },\n properties: {\n $ref: \"#/$defs/properties\",\n },\n constants: {\n $ref: \"#/$defs/constants\",\n },\n inherits: {\n oneOf: [{\n $ref: \"#/$defs/typeid\",\n },\n {\n type: \"array\",\n items: {\n $ref: \"#/$defs/typeid\",\n },\n },\n ],\n },\n annotation: {\n $ref: \"#/$defs/annotation\",\n },\n },\n required: [\n \"typeid\",\n ],\n};\n\nconst TemplateSchema = {\n $schema: \"http://json-schema.org/schema\",\n title: \"Property set template schema\",\n $id: \"{TEMPLATE_SCHEMA_URL}\",\n $defs: {\n \"annotation\": {\n type: \"object\",\n properties: {\n description: { type: \"string\" },\n // 'doc': { 'type': 'string', 'format': 'uri' }\n },\n },\n \"primitive-typeid\": {\n enum: primitiveTypes,\n type: \"string\",\n },\n \"versioned-typeid\": {\n type: \"string\",\n pattern: \"^[_a-zA-Z0-9\\\\.]+:[_a-zA-Z0-9\\\\.]+-(\\\\d+\\\\.\\\\d+\\\\.\\\\d+|draft)$\",\n },\n \"typed-reference-typeid\": {\n type: \"string\",\n pattern: `^Reference<([_a-zA-Z0-9\\\\.]+:[_a-zA-Z0-9\\\\.]+(-\\\\d+\\\\.\\\\d+\\\\.\\\\d+)?|${primitiveTypes.join(\"|\")}|${reservedTypes.join(\"|\")})>$`,\n },\n \"reserved-typeid\": {\n enum: reservedTypes,\n type: \"string\",\n },\n \"context\": {\n enum: [\"single\", \"array\", \"map\", \"set\"],\n },\n \"typeid\": {\n oneOf: [\n { $ref: \"#/$defs/primitive-typeid\" },\n { $ref: \"#/$defs/versioned-typeid\" },\n { $ref: \"#/$defs/typed-reference-typeid\" },\n { $ref: \"#/$defs/reserved-typeid\" },\n ],\n },\n \"properties\": {\n type: \"array\",\n items: { $ref: \"#/$defs/property-item\" },\n },\n \"property-item\": {\n type: \"object\",\n properties: {\n context: { $ref: \"#/$defs/context\" },\n typeid: { $ref: \"#/$defs/typeid\" },\n id: { type: \"string\" },\n value: {},\n typedValue: {},\n properties: { $ref: \"#/$defs/properties\" },\n annotation: { $ref: \"#/$defs/annotation\" },\n length: {\n type: \"integer\",\n multipleOf: 1.0,\n minimum: 0,\n },\n optional: {\n type: \"boolean\",\n },\n },\n required: [\"id\"],\n if: { properties: { typeid: { const: \"Enum\" } } },\n then: { properties: { properties: { type: \"array\" } } },\n else: {\n anyOf: [{\n properties: {\n properties: { type: \"array\" },\n typeid: { not: { type: \"string\" } },\n },\n },\n {\n properties: {\n typeid: { type: \"string\" },\n properties: { not: { type: \"array\" } },\n },\n },\n ],\n },\n },\n \"constants\": {\n type: \"array\",\n minItems: 1,\n items: { $ref: \"#/$defs/constant-item\" },\n },\n \"constant-item\": {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n typeid: { $ref: \"#/$defs/typeid\" },\n value: {},\n typedValue: {},\n context: { $ref: \"#/$defs/context\" },\n contextKeyType: { $ref: \"#/$defs/context-key-type\" },\n annotation: { $ref: \"#/$defs/annotation\" },\n },\n required: [\"id\"],\n },\n \"context-key-type\": {\n enum: [\"typeid\", \"string\"],\n },\n },\n allOf: [\n requireTypeidIfNotInherits,\n originalSchema,\n ],\n};\n\nexport { TemplateSchema , NativeTypes };\n"]}
|
|
1
|
+
{"version":3,"file":"templateSchema.js","sourceRoot":"","sources":["../src/templateSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;;;GAIG;;;AAEH;;GAEG;AACH,MAAM,WAAW,GAAG;IAChB,YAAY,EAAE;QACV,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,KAAK;KACnB;IACD,iBAAiB,EAAE;QACf,QAAQ,EAAE,CAAC,cAAc,CAAC;QAC1B,SAAS,EAAE,KAAK;KACnB;IACD,aAAa,EAAE;QACX,QAAQ,EAAE,CAAC,mB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E;yBACtC;qBACJ;oBACD;wBACI,UAAU,EAAE;4BACR,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;4BAC1B,UAAU,EAAE,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;yBACzC;qBACJ;iBACA;aACJ;SACJ;QACD,WAAW,EAAE;YACT,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,CAAC;YACX,KAAK,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE;SAC3C;QACD,eAAe,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACR,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACtB,MAAM,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;gBAClC,KAAK,EAAE,EAAE;gBACT,UAAU,EAAE,EAAE;gBACd,OAAO,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;gBACpC,cAAc,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE;gBACpD,UAAU,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE;aAC7C;YACD,QAAQ,EAAE,CAAC,IAAI,CAAC;SACnB;QACD,kBAAkB,EAAE;YAChB,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;SAC7B;KACJ;IACD,KAAK,EAAE;QACH,0BAA0B;QAC1B,cAAc;KACjB;CACJ,CAAC;AAEO,wCAAc","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview\n * Declaration of the TemplateSchema module\n * The TemplateSchema is used for validating PropertySet templates that code is attempting to register\n */\n\n/**\n * Namespace containing all schema-related data for property set validation\n */\nconst NativeTypes = {\n BaseProperty: {\n inherits: [],\n primitive: false,\n },\n ContainerProperty: {\n inherits: [\"BaseProperty\"],\n primitive: false,\n },\n NamedProperty: {\n inherits: [\"ContainerProperty\"],\n primitive: false,\n },\n NodeProperty: {\n inherits: [\"ContainerProperty\"],\n primitive: false,\n },\n NamedNodeProperty: {\n inherits: [\"NodeProperty\", \"NamedProperty\"],\n primitive: false,\n },\n RelationshipProperty: {\n inherits: [\"NodeProperty\", \"NamedProperty\"],\n primitive: false,\n },\n String: {\n inherits: [\"ContainerProperty\"],\n primitive: true,\n },\n Float32: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Float64: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Int8: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Uint8: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Int16: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Uint16: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Int32: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Uint32: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Bool: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Reference: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Enum: {\n inherits: [\"Int32\"],\n primitive: true,\n },\n Int64: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n Uint64: {\n inherits: [\"BaseProperty\"],\n primitive: true,\n },\n};\n\nconst primitiveTypes = [];\nconst reservedTypes = [];\n\nObject.keys(NativeTypes).forEach(function(key) {\n if (NativeTypes[key].primitive) {\n primitiveTypes.push(key);\n } else {\n reservedTypes.push(key);\n }\n});\n\nconst requireTypeidIfNotInherits = {\n anyOf: [{\n oneOf: [{\n type: \"object\",\n properties: {\n constants: { typeof: \"undefined\" },\n },\n },\n {\n type: \"object\",\n prohibited: [\"constants\"],\n },\n ],\n },\n {\n type: \"object\",\n required: [\"inherits\"],\n },\n {\n type: \"object\",\n properties: {\n constants: {\n type: \"array\",\n items: {\n type: \"object\",\n required: [\"typeid\"],\n },\n },\n },\n },\n ],\n};\n\nconst originalSchema = {\n type: \"object\",\n minProperties: 1,\n properties: {\n typeid: {\n $ref: \"#/$defs/versioned-typeid\",\n },\n properties: {\n $ref: \"#/$defs/properties\",\n },\n constants: {\n $ref: \"#/$defs/constants\",\n },\n inherits: {\n oneOf: [{\n $ref: \"#/$defs/typeid\",\n },\n {\n type: \"array\",\n items: {\n $ref: \"#/$defs/typeid\",\n },\n },\n ],\n },\n annotation: {\n $ref: \"#/$defs/annotation\",\n },\n },\n required: [\n \"typeid\",\n ],\n};\n\nconst TemplateSchema = {\n $schema: \"http://json-schema.org/schema\",\n title: \"Property set template schema\",\n $id: \"{TEMPLATE_SCHEMA_URL}\",\n $defs: {\n \"annotation\": {\n type: \"object\",\n properties: {\n description: { type: \"string\" },\n // 'doc': { 'type': 'string', 'format': 'uri' }\n },\n },\n \"primitive-typeid\": {\n enum: primitiveTypes,\n type: \"string\",\n },\n \"versioned-typeid\": {\n type: \"string\",\n pattern: \"^[_a-zA-Z0-9\\\\.]+:[_a-zA-Z0-9\\\\.]+-(\\\\d+\\\\.\\\\d+\\\\.\\\\d+|draft)$\",\n },\n \"typed-reference-typeid\": {\n type: \"string\",\n pattern: `^Reference<([_a-zA-Z0-9\\\\.]+:[_a-zA-Z0-9\\\\.]+(-\\\\d+\\\\.\\\\d+\\\\.\\\\d+)?|${primitiveTypes.join(\"|\")}|${reservedTypes.join(\"|\")})>$`,\n },\n \"reserved-typeid\": {\n enum: reservedTypes,\n type: \"string\",\n },\n \"context\": {\n enum: [\"single\", \"array\", \"map\", \"set\"],\n },\n \"typeid\": {\n oneOf: [\n { $ref: \"#/$defs/primitive-typeid\" },\n { $ref: \"#/$defs/versioned-typeid\" },\n { $ref: \"#/$defs/typed-reference-typeid\" },\n { $ref: \"#/$defs/reserved-typeid\" },\n ],\n },\n \"properties\": {\n type: \"array\",\n items: { $ref: \"#/$defs/property-item\" },\n },\n \"property-item\": {\n type: \"object\",\n properties: {\n context: { $ref: \"#/$defs/context\" },\n typeid: { $ref: \"#/$defs/typeid\" },\n id: { type: \"string\" },\n value: {},\n typedValue: {},\n properties: { $ref: \"#/$defs/properties\" },\n annotation: { $ref: \"#/$defs/annotation\" },\n length: {\n type: \"integer\",\n multipleOf: 1.0,\n minimum: 0,\n },\n optional: {\n type: \"boolean\",\n },\n },\n required: [\"id\"],\n if: { properties: { typeid: { const: \"Enum\" } } },\n then: { properties: { properties: { type: \"array\" } } },\n else: {\n anyOf: [{\n properties: {\n properties: { type: \"array\" },\n typeid: { not: { type: \"string\" } },\n },\n },\n {\n properties: {\n typeid: { type: \"string\" },\n properties: { not: { type: \"array\" } },\n },\n },\n ],\n },\n },\n \"constants\": {\n type: \"array\",\n minItems: 1,\n items: { $ref: \"#/$defs/constant-item\" },\n },\n \"constant-item\": {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n typeid: { $ref: \"#/$defs/typeid\" },\n value: {},\n typedValue: {},\n context: { $ref: \"#/$defs/context\" },\n contextKeyType: { $ref: \"#/$defs/context-key-type\" },\n annotation: { $ref: \"#/$defs/annotation\" },\n },\n required: [\"id\"],\n },\n \"context-key-type\": {\n enum: [\"typeid\", \"string\"],\n },\n },\n allOf: [\n requireTypeidIfNotInherits,\n originalSchema,\n ],\n};\n\nexport { TemplateSchema, NativeTypes };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateValidator.d.ts","sourceRoot":"","sources":["../src/templateValidator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;;;GAIG;AA4BH,OAAO,EAAE,sBAAsB,EAA2B,MAAM,2BAA2B,CAAC;AAc5F,aAAK,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"templateValidator.d.ts","sourceRoot":"","sources":["../src/templateValidator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;;;GAIG;AA4BH,OAAO,EAAE,sBAAsB,EAA2B,MAAM,2BAA2B,CAAC;AAc5F,aAAK,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;CAAE,CA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,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC;IAC3E,UAAU,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAChE,kBAAkB,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACzF,eAAe,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACrF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAU;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAU;gBAC1B,SAAS,GAAE,wBAAmE;IAe1F;;;;;;;;;;;;;;;;;;;;;GAqBD;IACC,QAAQ,CAAC,WAAW,EAAE,cAAc,EAAE,mBAAmB,CAAC,EAAE,cAAc,GAAG,sBAAsB;IAiFnG;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,aAAa,CAAC,WAAW,EAAE,cAAc,EAAE,mBAAmB,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAcvH;;;;;;;;OAQG;YACW,gCAAgC;CAwCjD"}
|
|
@@ -42,8 +42,8 @@ const ajvFactory = new ajv_1.default({
|
|
|
42
42
|
allErrors: true,
|
|
43
43
|
verbose: true,
|
|
44
44
|
});
|
|
45
|
-
ajv_keywords_1.default(ajvFactory, "prohibited");
|
|
46
|
-
ajv_keywords_1.default(ajvFactory, "typeof");
|
|
45
|
+
(0, ajv_keywords_1.default)(ajvFactory, "prohibited");
|
|
46
|
+
(0, ajv_keywords_1.default)(ajvFactory, "typeof");
|
|
47
47
|
const _syntaxValidator = ajvFactory.compile(templateSchema_1.TemplateSchema);
|
|
48
48
|
/**
|
|
49
49
|
* A weighted enumeration of semver change types. Higher values are more important.
|
|
@@ -59,12 +59,12 @@ const CHANGE_LEVEL = {
|
|
|
59
59
|
prerelease: 0,
|
|
60
60
|
prepatch: 0,
|
|
61
61
|
preminor: 1,
|
|
62
|
-
premajor: 2,
|
|
62
|
+
premajor: 2, // '1.0.0-alpha.1' -> '2.0.0'
|
|
63
63
|
};
|
|
64
64
|
const VALID_CONTEXTS = ["single", "array", "map", "set", "enum"];
|
|
65
65
|
const _extractTypeid = function (typeidOrReference) {
|
|
66
66
|
// Take Reference<strong-type-id> and return strong-type-id
|
|
67
|
-
if (!isString_1.default(typeidOrReference)) {
|
|
67
|
+
if (!(0, isString_1.default)(typeidOrReference)) {
|
|
68
68
|
throw new Error(MSG.TYPEID_MUST_BE_STRING + typeidOrReference);
|
|
69
69
|
}
|
|
70
70
|
const reference = "Reference<";
|
|
@@ -93,7 +93,7 @@ const _getSemverFromTypeId = function (in_typeid) {
|
|
|
93
93
|
*/
|
|
94
94
|
const _getType = (in_obj) => Object.prototype.toString.call(in_obj).slice(8, -1);
|
|
95
95
|
function isPropertyArray(source) {
|
|
96
|
-
return every_1.default(source, (entry) => isObject_1.default(entry) && entry.id !== undefined);
|
|
96
|
+
return (0, every_1.default)(source, (entry) => (0, isObject_1.default)(entry) && entry.id !== undefined);
|
|
97
97
|
}
|
|
98
98
|
// function isSchemaTemplate(source: SchemaEntityType): source is PropertySchema {
|
|
99
99
|
// return isObject(source) && !Array.isArray(source);
|
|
@@ -157,7 +157,7 @@ const _psetDeepEquals = function (in_source, in_target) {
|
|
|
157
157
|
// like inheritance lists.
|
|
158
158
|
if (isPropertyArray(source)) {
|
|
159
159
|
const targetMap = {};
|
|
160
|
-
each_1.default(target, function (element) {
|
|
160
|
+
(0, each_1.default)(target, function (element) {
|
|
161
161
|
targetMap[element.id] = element;
|
|
162
162
|
});
|
|
163
163
|
for (let i = 0; i < source.length && result.isEqual; i++) {
|
|
@@ -174,8 +174,8 @@ const _psetDeepEquals = function (in_source, in_target) {
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
else if (isObject_1.default(source)) {
|
|
178
|
-
if (!isObject_1.default(target)) {
|
|
177
|
+
else if ((0, isObject_1.default)(source)) {
|
|
178
|
+
if (!(0, isObject_1.default)(target)) {
|
|
179
179
|
return _getPSetDeepEqualsResult(false);
|
|
180
180
|
}
|
|
181
181
|
const keysSource = Object.keys(source);
|
|
@@ -184,8 +184,8 @@ const _psetDeepEquals = function (in_source, in_target) {
|
|
|
184
184
|
// A template with abstract properties must equal one with an empty properties array
|
|
185
185
|
// We check the difference in keys between the source and target and if the only difference is the
|
|
186
186
|
// properties array we check if it's empty. Then we reverse the condition so it work both ways.
|
|
187
|
-
if ((isEqual_1.default(difference_1.default(keysTarget, keysSource), ["properties"]) && !target.properties.length) ||
|
|
188
|
-
(isEqual_1.default(difference_1.default(keysSource, keysTarget), ["properties"]) && !source.properties.length)) {
|
|
187
|
+
if (((0, isEqual_1.default)((0, difference_1.default)(keysTarget, keysSource), ["properties"]) && !target.properties.length) ||
|
|
188
|
+
((0, isEqual_1.default)((0, difference_1.default)(keysSource, keysTarget), ["properties"]) && !source.properties.length)) {
|
|
189
189
|
return _getPSetDeepEqualsResult(true);
|
|
190
190
|
}
|
|
191
191
|
return _getPSetDeepEqualsResult(false);
|
|
@@ -219,12 +219,12 @@ const _stripSemverFromTypeId = function (in_typeid) {
|
|
|
219
219
|
const _unresolvedTypes = function (in_template) {
|
|
220
220
|
let first = true;
|
|
221
221
|
const that = this;
|
|
222
|
-
const accSet = traverse_1.default(in_template).reduce(function (acc, x) {
|
|
222
|
+
const accSet = (0, traverse_1.default)(in_template).reduce(function (acc, x) {
|
|
223
223
|
if (first) {
|
|
224
224
|
acc = {};
|
|
225
225
|
first = false;
|
|
226
226
|
}
|
|
227
|
-
if (isObject_1.default(x) && has_1.default(x, "typeid")) {
|
|
227
|
+
if ((0, isObject_1.default)(x) && (0, has_1.default)(x, "typeid")) {
|
|
228
228
|
const extractedTypeid = _extractTypeid.call(that, x.typeid);
|
|
229
229
|
if (!typeidHelper_1.TypeIdHelper.isPrimitiveType(extractedTypeid)) {
|
|
230
230
|
acc[extractedTypeid] = "";
|
|
@@ -258,14 +258,14 @@ const _validateBasic = function (in_template) {
|
|
|
258
258
|
* @param in_versionPrevious The previous template version. Ex.: '1.1.3'.
|
|
259
259
|
*/
|
|
260
260
|
const _validatePositiveIncrement = function (in_template, in_templatePrevious, in_version, in_versionPrevious) {
|
|
261
|
-
property_common_1.ConsoleUtils.assert(semver_1.gt(in_version, in_versionPrevious), "property-changeset.TemplateValidator._validatePositiveIncrement called on non incremental " +
|
|
261
|
+
property_common_1.ConsoleUtils.assert((0, semver_1.gt)(in_version, in_versionPrevious), "property-changeset.TemplateValidator._validatePositiveIncrement called on non incremental " +
|
|
262
262
|
"template versions");
|
|
263
|
-
const versionDiff = semver_1.diff(in_version, in_versionPrevious);
|
|
263
|
+
const versionDiff = (0, semver_1.diff)(in_version, in_versionPrevious);
|
|
264
264
|
if (CHANGE_LEVEL[versionDiff] >= CHANGE_LEVEL.major) {
|
|
265
265
|
// No need to warn about change levels since they're already declared to be major.
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
|
-
if (semver_1.major(in_version) === 0) {
|
|
268
|
+
if ((0, semver_1.major)(in_version) === 0) {
|
|
269
269
|
// Unstable version doesn't produce any warning.
|
|
270
270
|
return;
|
|
271
271
|
}
|
|
@@ -331,7 +331,7 @@ const _validatePositiveIncrement = function (in_template, in_templatePrevious, i
|
|
|
331
331
|
}
|
|
332
332
|
if (Array.isArray(sourceObj)) {
|
|
333
333
|
let targetMap = {};
|
|
334
|
-
each_1.default(targetObj, function (element) {
|
|
334
|
+
(0, each_1.default)(targetObj, function (element) {
|
|
335
335
|
targetMap[element.id] = element;
|
|
336
336
|
});
|
|
337
337
|
for (let i = 0; i < sourceObj.length; i++) {
|
|
@@ -339,7 +339,7 @@ const _validatePositiveIncrement = function (in_template, in_templatePrevious, i
|
|
|
339
339
|
_depthFirstCompare.call(this, element.id, element, targetMap[element.id]);
|
|
340
340
|
delete targetMap[element.id];
|
|
341
341
|
}
|
|
342
|
-
if (!isEmpty_1.default(targetMap)) {
|
|
342
|
+
if (!(0, isEmpty_1.default)(targetMap)) {
|
|
343
343
|
// Added array element.
|
|
344
344
|
let minimumLevel = "minor";
|
|
345
345
|
if (CHANGE_LEVEL[versionDiff] < CHANGE_LEVEL[minimumLevel]) {
|
|
@@ -361,10 +361,10 @@ const _validatePositiveIncrement = function (in_template, in_templatePrevious, i
|
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
|
-
else if (isObject_1.default(sourceObj)) {
|
|
364
|
+
else if ((0, isObject_1.default)(sourceObj)) {
|
|
365
365
|
const keysSource = Object.keys(sourceObj);
|
|
366
366
|
let targetMap = {};
|
|
367
|
-
mapValues_1.default(targetObj, function (val, key) {
|
|
367
|
+
(0, mapValues_1.default)(targetObj, function (val, key) {
|
|
368
368
|
targetMap[key] = val;
|
|
369
369
|
});
|
|
370
370
|
for (let i = 0; i < keysSource.length; i++) {
|
|
@@ -374,7 +374,7 @@ const _validatePositiveIncrement = function (in_template, in_templatePrevious, i
|
|
|
374
374
|
delete targetMap[keysSource[i]];
|
|
375
375
|
}
|
|
376
376
|
const remainingKeys = Object.keys(targetMap);
|
|
377
|
-
if (!isEmpty_1.default(remainingKeys)) {
|
|
377
|
+
if (!(0, isEmpty_1.default)(remainingKeys)) {
|
|
378
378
|
// Added new keys to the target. This is a MINOR change, unless they new key is a
|
|
379
379
|
// comment, in which case this is a PATCH level change.
|
|
380
380
|
let minimumLevel = remainingKeys.length === 1 && remainingKeys[0] === "annotation" ? "patch" : "minor";
|
|
@@ -495,7 +495,7 @@ const _validateSemverFormat = function (in_template) {
|
|
|
495
495
|
if (!templateVersion) {
|
|
496
496
|
this._resultBuilder.addError(new Error(MSG.MISSING_VERSION + in_template.typeid));
|
|
497
497
|
}
|
|
498
|
-
else if (semver_1.valid(templateVersion) !== templateVersion) {
|
|
498
|
+
else if ((0, semver_1.valid)(templateVersion) !== templateVersion) {
|
|
499
499
|
this._resultBuilder.addError(new Error(MSG.INVALID_VERSION_1 + templateVersion));
|
|
500
500
|
}
|
|
501
501
|
return templateVersion;
|
|
@@ -525,7 +525,7 @@ const _validateSkipSemver = function (in_template, in_templatePrevious) {
|
|
|
525
525
|
* @this TemplateValidator
|
|
526
526
|
*/
|
|
527
527
|
const getInvalidContextError = function (in_context) {
|
|
528
|
-
if (in_context && !includes_1.default(VALID_CONTEXTS, in_context)) {
|
|
528
|
+
if (in_context && !(0, includes_1.default)(VALID_CONTEXTS, in_context)) {
|
|
529
529
|
return new Error(`${MSG.NOT_A_VALID_CONTEXT} ${in_context}`);
|
|
530
530
|
}
|
|
531
531
|
return undefined;
|
|
@@ -573,7 +573,7 @@ const _validateContextAsync = async function (in_template) {
|
|
|
573
573
|
}
|
|
574
574
|
let typedValuePromises = [Promise.resolve()];
|
|
575
575
|
if (in_template.typedValue) {
|
|
576
|
-
typedValuePromises = map_1.default(in_template.typedValue, (tv) => that.inheritsFrom(tv.typeid, "NamedProperty"));
|
|
576
|
+
typedValuePromises = (0, map_1.default)(in_template.typedValue, (tv) => that.inheritsFrom(tv.typeid, "NamedProperty"));
|
|
577
577
|
}
|
|
578
578
|
else {
|
|
579
579
|
// Since context is 'set' the template must eventually inherit from NamedProperty
|
|
@@ -581,7 +581,7 @@ const _validateContextAsync = async function (in_template) {
|
|
|
581
581
|
return Promise.reject(new Error(MSG.SET_ONLY_NAMED_PROPS));
|
|
582
582
|
}
|
|
583
583
|
// Since context is 'set' the template must eventually inherit from NamedProperty (same as above)
|
|
584
|
-
if (includes_1.default(in_template.inherits, "NamedProperty") || in_template.inherits === "NamedProperty") {
|
|
584
|
+
if ((0, includes_1.default)(in_template.inherits, "NamedProperty") || in_template.inherits === "NamedProperty") {
|
|
585
585
|
return Promise.resolve();
|
|
586
586
|
}
|
|
587
587
|
}
|
|
@@ -594,7 +594,7 @@ const _validateContextAsync = async function (in_template) {
|
|
|
594
594
|
// Combine results from inheritsPromises and typedValuePromise
|
|
595
595
|
inheritsPromises.push(typedValuePromise);
|
|
596
596
|
return Promise.all(inheritsPromises).then(function (results) {
|
|
597
|
-
const foundNamedPropertyDescendant = find_1.default(results, (res) => res);
|
|
597
|
+
const foundNamedPropertyDescendant = (0, find_1.default)(results, (res) => res);
|
|
598
598
|
if (!foundNamedPropertyDescendant) {
|
|
599
599
|
return Promise.reject(Error(MSG.SET_ONLY_NAMED_PROPS));
|
|
600
600
|
}
|
|
@@ -625,7 +625,7 @@ let _validateConstants = function (in_template) {
|
|
|
625
625
|
const constant = in_template.constants[i];
|
|
626
626
|
const context = constant.context;
|
|
627
627
|
if (context === "map" && constant.contextKeyType === "typeid") {
|
|
628
|
-
each_1.default(constant.value, function (value, key) {
|
|
628
|
+
(0, each_1.default)(constant.value, function (value, key) {
|
|
629
629
|
if (!typeidHelper_1.TypeIdHelper.isTemplateTypeid(key)) {
|
|
630
630
|
that._resultBuilder.addError(new Error(MSG.KEY_MUST_BE_TYPEID + key));
|
|
631
631
|
}
|
|
@@ -644,10 +644,10 @@ const _processValidationResults = function (in_template) {
|
|
|
644
644
|
let result = this._resultBuilder.result;
|
|
645
645
|
result.isValid = _syntaxValidator(in_template);
|
|
646
646
|
if (!result.isValid) {
|
|
647
|
-
property_common_1.ConsoleUtils.assert(!isEmpty_1.default(_syntaxValidator.errors), "template validation failed but produced no error");
|
|
647
|
+
property_common_1.ConsoleUtils.assert(!(0, isEmpty_1.default)(_syntaxValidator.errors), "template validation failed but produced no error");
|
|
648
648
|
}
|
|
649
649
|
if (_syntaxValidator.errors) {
|
|
650
|
-
each_1.default(_syntaxValidator.errors, function (error) {
|
|
650
|
+
(0, each_1.default)(_syntaxValidator.errors, function (error) {
|
|
651
651
|
const regexTypeId = /typeid/;
|
|
652
652
|
switch (error.keyword) {
|
|
653
653
|
case "pattern":
|
|
@@ -701,7 +701,7 @@ const _processValidationResults = function (in_template) {
|
|
|
701
701
|
break;
|
|
702
702
|
}
|
|
703
703
|
// Deep-copy for thread-safety.
|
|
704
|
-
that._resultBuilder.addError(fastest_json_copy_1.copy(error));
|
|
704
|
+
that._resultBuilder.addError((0, fastest_json_copy_1.copy)(error));
|
|
705
705
|
});
|
|
706
706
|
}
|
|
707
707
|
result.unresolvedTypes = _unresolvedTypes.call(this, in_template);
|
|
@@ -740,7 +740,7 @@ const createContextCheckAsyncQueue = function () {
|
|
|
740
740
|
});
|
|
741
741
|
};
|
|
742
742
|
// Async queue for schema context check tasks
|
|
743
|
-
return async_1.queue(contextCheckWorker, 5);
|
|
743
|
+
return (0, async_1.queue)(contextCheckWorker, 5);
|
|
744
744
|
};
|
|
745
745
|
/**
|
|
746
746
|
* Validate just the syntax of a template
|
|
@@ -879,7 +879,7 @@ class TemplateValidator {
|
|
|
879
879
|
}
|
|
880
880
|
if (in_templatePrevious) {
|
|
881
881
|
// Validate that the semver change is valid.
|
|
882
|
-
switch (semver_1.compare(version, versionPrevious)) {
|
|
882
|
+
switch ((0, semver_1.compare)(version, versionPrevious)) {
|
|
883
883
|
case 0:
|
|
884
884
|
_validateSameVersion.call(this, in_template, in_templatePrevious);
|
|
885
885
|
break;
|
|
@@ -957,7 +957,7 @@ class TemplateValidator {
|
|
|
957
957
|
const version = _validateSemverFormat.call(that, in_template);
|
|
958
958
|
const versionPrevious = in_templatePrevious ? _validateSemverFormat.call(that, in_templatePrevious) : null;
|
|
959
959
|
// Validate that the semver change is valid.
|
|
960
|
-
switch (semver_1.compare(version, versionPrevious)) {
|
|
960
|
+
switch ((0, semver_1.compare)(version, versionPrevious)) {
|
|
961
961
|
case 0:
|
|
962
962
|
_validateSameVersion.call(that, in_template, in_templatePrevious);
|
|
963
963
|
break;
|