@fluid-experimental/property-changeset 2.0.0-internal.1.2.0.93071 → 2.0.0-internal.1.2.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/changeset.d.ts.map +1 -1
- package/dist/changeset.js +3 -6
- package/dist/changeset.js.map +1 -1
- package/dist/changeset_operations/array.d.ts +31 -0
- package/dist/changeset_operations/array.d.ts.map +1 -1
- package/dist/changeset_operations/array.js +52 -47
- package/dist/changeset_operations/array.js.map +1 -1
- package/dist/changeset_operations/indexedCollection.d.ts +12 -14
- package/dist/changeset_operations/indexedCollection.d.ts.map +1 -1
- package/dist/changeset_operations/indexedCollection.js +13 -14
- package/dist/changeset_operations/indexedCollection.js.map +1 -1
- package/dist/helpers/typeidHelper.d.ts +6 -6
- package/dist/helpers/typeidHelper.d.ts.map +1 -1
- package/dist/helpers/typeidHelper.js +16 -26
- package/dist/helpers/typeidHelper.js.map +1 -1
- package/dist/pathHelper.d.ts +1 -1
- package/dist/pathHelper.d.ts.map +1 -1
- package/dist/pathHelper.js +50 -52
- package/dist/pathHelper.js.map +1 -1
- package/dist/templateValidator.d.ts +58 -26
- package/dist/templateValidator.d.ts.map +1 -1
- package/dist/templateValidator.js +64 -38
- package/dist/templateValidator.js.map +1 -1
- package/dist/test/array.spec.js +3 -6
- package/dist/test/array.spec.js.map +1 -1
- package/dist/test/pathHelper.spec.js +2 -4
- package/dist/test/pathHelper.spec.js.map +1 -1
- package/dist/test/reversibleCs.spec.js +2 -4
- package/dist/test/reversibleCs.spec.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1
- package/dist/test/validator/templateValidator.spec.js +5 -10
- package/dist/test/validator/templateValidator.spec.js.map +1 -1
- package/dist/utils.d.ts +131 -103
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +160 -167
- package/dist/utils.js.map +1 -1
- package/dist/validationResultBuilder.d.ts +2 -4
- package/dist/validationResultBuilder.d.ts.map +1 -1
- package/dist/validationResultBuilder.js +1 -7
- package/dist/validationResultBuilder.js.map +1 -1
- package/lib/changeset.js +3 -6
- package/lib/changeset.js.map +1 -1
- package/lib/changeset_operations/array.js +52 -47
- package/lib/changeset_operations/array.js.map +1 -1
- package/lib/changeset_operations/indexedCollection.js +13 -14
- package/lib/changeset_operations/indexedCollection.js.map +1 -1
- package/lib/helpers/typeidHelper.js +16 -26
- package/lib/helpers/typeidHelper.js.map +1 -1
- package/lib/pathHelper.js +50 -52
- package/lib/pathHelper.js.map +1 -1
- package/lib/templateValidator.js +64 -38
- package/lib/templateValidator.js.map +1 -1
- package/lib/utils.js +160 -167
- package/lib/utils.js.map +1 -1
- package/lib/validationResultBuilder.js +1 -7
- package/lib/validationResultBuilder.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeidHelper.js","sourceRoot":"","sources":["../../src/helpers/typeidHelper.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;AAEH,aAAa;AACb,yEAAgE;AAChE,sDAAsF;AAEtF,MAAM,EAAE,GAAG,EAAE,GAAG,2BAAS,CAAC;AAa1B;;;;GAIG;AACH,IAAiB,YAAY,CA8P5B;AA9PD,WAAiB,YAAY;IACzB;;;;;OAKG;IACH,SAAgB,eAAe,CAAC,SAAiB;QAC7C,MAAM,cAAc,GAAG,+BAAkB,CAAC,OAAO,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;QAE/E,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,EAAE,EAAE;YAC7C,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,OAAO;YACrC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,YAAY;YACxC,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAVe,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B,CAAC;IAtCe,+BAAkB,qBAsCjC,CAAA;IAED;;;;OAIG;IACH,SAAgB,mBAAmB;QAC/B,OAAO,+BAAkB,CAAC,OAAO,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;IACnE,CAAC;IAFe,gCAAmB,sBAElC,CAAA;IAED;;;;OAIG;IACH,SAAgB,kBAAkB;QAC9B,OAAO,+BAAkB,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;IAClE,CAAC;IAFe,+BAAkB,qBAEjC,CAAA;AACL,CAAC,EA9PgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QA8P5B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Helper functions to work with typeid strings\n */\n\n// @ts-ignore\nimport { constants } from \"@fluid-experimental/property-common\";\nimport { TemplateSchema as templateSchemaJson, NativeTypes } from \"../templateSchema\";\n\nconst { MSG } = constants;\n\nexport declare interface ExtractedVersion {\n version: string;\n typeidWithoutVersion: string;\n}\n\nexport declare interface ExtractedContext {\n typeid: string;\n context: string;\n isEnum: boolean;\n}\n\n/**\n * Helper for Type IDs\n * @public\n * @description Helper functions to work with typeid strings\n */\nexport namespace TypeIdHelper {\n /**\n * Checks whether the given type is a primitive type.\n *\n * @param in_typeid - The typeid we want to check\n * @returns Is this a base type?\n */\n export function isPrimitiveType(in_typeid: string): boolean {\n const primitiveTypes = templateSchemaJson[\"$defs\"][\"primitive-typeid\"][\"enum\"];\n\n if (in_typeid === undefined || in_typeid === \"\") {\n return false;\n }\n\n return in_typeid.substr(0, 5) === \"enum<\" ||\n in_typeid.substr(0, 10) === \"Reference<\" ||\n primitiveTypes.indexOf(in_typeid) >= 0;\n }\n\n /**\n * Checks whether the given type is a template typeid.\n *\n * @param in_typeid - The typeid we want to check\n * @returns Is this a base template typeid?\n */\n export function isTemplateTypeid(in_typeid: string): boolean {\n return in_typeid.indexOf(\":\") !== -1;\n }\n\n /**\n * Checks whether the given type is a reserved type.\n *\n * @param in_typeid - The typeid we want to check\n * @returns Is this a reserved type?\n */\n export function isReservedType(in_typeid: string): boolean {\n const reservedTypes = templateSchemaJson[\"$defs\"][\"reserved-typeid\"][\"enum\"];\n return reservedTypes.indexOf(in_typeid) >= 0;\n }\n\n /**\n * Extract the version number from the given typeid\n * @param in_typeid - The typeid to check against\n * @returns Extracted version\n */\n export function extractVersion(in_typeid): ExtractedVersion {\n if (!in_typeid) {\n throw new Error(MSG.TYPEID_NOT_DEFINED);\n }\n const splitTypeId = in_typeid.split(\"-\");\n\n return {\n version: splitTypeId[1],\n typeidWithoutVersion: splitTypeId[0],\n };\n }\n\n /**\n * Extracts the context from a typeid\n *\n * @param in_typeid - The typeid to process\n * @returns The typeid without context, the context and if we have an enum type\n */\n export function extractContext(in_typeid: string | undefined): ExtractedContext {\n const bracketIndex = in_typeid.indexOf(\"<\");\n if (bracketIndex !== -1 &&\n in_typeid[in_typeid.length - 1] === \">\") {\n let typeid = in_typeid.substr(bracketIndex + 1, in_typeid.length - bracketIndex - 2);\n let context = in_typeid.substr(0, bracketIndex);\n\n // Special case to handle collections without a typeid (e.g. \"map<>\", which should\n // be able to support all property types\n if (typeid === \"\") {\n typeid = context !== \"set\" ? \"BaseProperty\" : \"NamedProperty\";\n }\n\n // Special case to handle enums (e.g. array<enum<myType>>)\n let isEnum = false;\n if (context === \"enum\" || typeid.substr(0, 5) === \"enum<\") {\n isEnum = true;\n if (context === \"enum\") {\n context = \"single\";\n } else {\n // remove the `enum<...>` tag to get the raw typeid\n typeid = typeid.substr(5, typeid.length - 6);\n }\n }\n if (context === \"Reference\") {\n typeid = `Reference<${typeid}>`;\n context = \"single\";\n }\n\n return {\n typeid,\n context,\n isEnum,\n };\n } else {\n return {\n typeid: in_typeid,\n context: \"single\",\n isEnum: false,\n };\n }\n }\n\n /**\n * Creates a collection typeid string from the\n * typeid and the context.\n *\n * @param in_typeid - The typeid in the collection\n * @param in_context - The context\n * @param in_enum - Set to true if the type should get an enum tag\n *\n * @returns The combined typeid string\n */\n export function createSerializationTypeId(in_typeid: string, in_context: string, in_enum: boolean): string { // in_enum\n if (in_typeid === \"BaseProperty\") {\n // Special case for BaseProperties. These get represented as a collection\n // typeid without a child typeid. E.g. map<> instead of map<BaseProperty>\n return `${in_context}<>`;\n } else {\n if (in_enum) {\n if (in_context === \"\" || in_context === \"single\") {\n return `enum<${in_typeid}>`;\n } else {\n return `${in_context}<enum<${in_typeid}>>`;\n }\n } else {\n return `${in_context}<${in_typeid}>`;\n }\n }\n }\n\n /**\n * Checks, whether the supplied typeid is a reference property type id\n *\n * @param in_typeid - The typeid to check\n * @returns Is this a reference property typeid?\n */\n export function isReferenceTypeId(in_typeid: string | undefined): boolean { // in_enum\n return in_typeid === \"Reference\" ||\n (in_typeid.substr(0, 10) === \"Reference<\" && in_typeid.substr(-1) === \">\");\n }\n\n /**\n * Returns the type of the properties a reference points to\n *\n * @param in_typeid - The typeid to process\n * @return The type of the referenced property\n */\n export function extractReferenceTargetTypeIdFromReference(in_typeid: string): string { // in_enum\n if (in_typeid.substr(0, 10) === \"Reference<\") {\n // Extract the type from the TypeID\n return in_typeid.substr(10, in_typeid.length - 11);\n } else {\n // This is a typeless reference, we allow all types\n return \"BaseProperty\";\n }\n }\n\n /**\n * Checks whether the given type is a template typeid.\n *\n * @param in_typeid - The typeid we want to check\n * @returns Is this a base template typeid?\n */\n export function isSchemaTypeid(in_typeid: string): boolean {\n return typeof in_typeid === \"string\" && (in_typeid.indexOf(\":\") !== -1);\n }\n\n /**\n * Extracts referenced typeid from input typeid\n *\n * @param in_typeid - typeid\n *\n * @return referenced typeid or in_param if it is not a reference\n */\n export function extractTypeId(in_typeid): string {\n const matches = in_typeid.match(/\\<(.*?)\\>/);\n if (matches !== null && matches.length > 0) {\n return matches[0].replace(/[\\<\\>]/gi, \"\");\n } else {\n return in_typeid;\n }\n }\n\n /**\n * Check wether the in_typeid inherits from the in_baseTypeid\n *\n * Note: By default, this also returns true if in_typeid === in_baseTypeid.\n *\n * @param in_typeid - Typeid for which we want to check, whethwe in_baseTypeid is a parent\n * @param in_baseTypeid - The base typeId to check for\n * @throws if in_typeid or in_baseTypeid are not native typeid\n * @returns True if in_baseTypeid is a parent of in_typeid\n */\n export function nativeInheritsFrom(in_typeid: string, in_baseTypeid: string): boolean {\n if (!in_typeid || !in_baseTypeid) {\n throw new Error(MSG.TYPEID_NOT_DEFINED);\n }\n\n if (in_typeid.substr(0, 10) === \"Reference<\") {\n in_typeid = \"Reference\";\n }\n\n if (in_baseTypeid.substr(0, 10) === \"Reference<\") {\n in_baseTypeid = \"Reference\";\n }\n\n if (!NativeTypes[in_typeid]) {\n throw new Error(MSG.TYPEID_NOT_NATIVE + in_typeid);\n }\n\n if (!NativeTypes[in_baseTypeid]) {\n throw new Error(MSG.TYPEID_NOT_NATIVE + in_baseTypeid);\n }\n\n if (in_baseTypeid === \"BaseProperty\" || in_typeid === in_baseTypeid) {\n return true;\n }\n\n if (in_typeid === \"BaseProperty\") {\n return false;\n }\n\n let parents = NativeTypes[in_typeid][\"inherits\"];\n\n // recursively call the function for the parent of the typeid\n for (let i = 0; i < parents.length; i++) {\n if (this.nativeInheritsFrom(parents[i], in_baseTypeid)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * return all primitive typeIds\n *\n * @returns return a list of primitiveTypeIds\n */\n export function getPrimitiveTypeIds(): string[] {\n return templateSchemaJson[\"$defs\"][\"primitive-typeid\"][\"enum\"];\n }\n\n /**\n * return all reserved typeIds\n *\n * @returns return a list of reservedTypeIds\n */\n export function getReservedTypeIds(): string[] {\n return templateSchemaJson[\"$defs\"][\"reserved-typeid\"][\"enum\"];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"typeidHelper.js","sourceRoot":"","sources":["../../src/helpers/typeidHelper.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;AAEH,aAAa;AACb,yEAAgE;A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Aa,CAAC,CAAC;SAC1D;QAED,IAAI,aAAa,KAAK,cAAc,IAAI,SAAS,KAAK,aAAa,EAAE;YACjE,OAAO,IAAI,CAAC;SACf;QAED,IAAI,SAAS,KAAK,cAAc,EAAE;YAC9B,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,OAAO,GAAG,4BAAW,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;QAEjD,6DAA6D;QAC7D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,IAAI,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,EAAE;gBACpD,OAAO,IAAI,CAAC;aACf;SACJ;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAtCe,+BAAkB,qBAsCjC,CAAA;IAED;;;;OAIG;IACH,SAAgB,mBAAmB;QAC/B,OAAO,+BAAkB,CAAC,OAAO,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;IACnE,CAAC;IAFe,gCAAmB,sBAElC,CAAA;IAED;;;;OAIG;IACH,SAAgB,kBAAkB;QAC9B,OAAO,+BAAkB,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;IAClE,CAAC;IAFe,+BAAkB,qBAEjC,CAAA;AACL,CAAC,EAtPgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAsP5B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Helper functions to work with typeid strings\n */\n\n// @ts-ignore\nimport { constants } from \"@fluid-experimental/property-common\";\nimport { TemplateSchema as templateSchemaJson, NativeTypes } from \"../templateSchema\";\n\nconst { MSG } = constants;\n\nexport declare interface ExtractedVersion {\n version: string;\n typeidWithoutVersion: string;\n}\n\nexport declare interface ExtractedContext {\n typeid: string;\n context: string;\n isEnum: boolean;\n}\n\n/**\n * Helper for Type IDs\n * @public\n * @description Helper functions to work with typeid strings\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace TypeIdHelper {\n /**\n * Checks whether the given type is a primitive type.\n *\n * @param in_typeid - The typeid we want to check\n * @returns Is this a base type?\n */\n export function isPrimitiveType(in_typeid: string): boolean {\n const primitiveTypes = templateSchemaJson[\"$defs\"][\"primitive-typeid\"][\"enum\"];\n\n if (in_typeid === undefined || in_typeid === \"\") {\n return false;\n }\n\n return in_typeid.substr(0, 5) === \"enum<\" ||\n in_typeid.substr(0, 10) === \"Reference<\" ||\n primitiveTypes.indexOf(in_typeid) >= 0;\n }\n\n /**\n * Checks whether the given type is a template typeid.\n *\n * @param in_typeid - The typeid we want to check\n * @returns Is this a base template typeid?\n */\n export function isTemplateTypeid(in_typeid: string): boolean {\n return in_typeid.indexOf(\":\") !== -1;\n }\n\n /**\n * Checks whether the given type is a reserved type.\n *\n * @param in_typeid - The typeid we want to check\n * @returns Is this a reserved type?\n */\n export function isReservedType(in_typeid: string): boolean {\n const reservedTypes = templateSchemaJson[\"$defs\"][\"reserved-typeid\"][\"enum\"];\n return reservedTypes.indexOf(in_typeid) >= 0;\n }\n\n /**\n * Extract the version number from the given typeid\n * @param in_typeid - The typeid to check against\n * @returns Extracted version\n */\n export function extractVersion(in_typeid): ExtractedVersion {\n if (!in_typeid) {\n throw new Error(MSG.TYPEID_NOT_DEFINED);\n }\n const splitTypeId = in_typeid.split(\"-\");\n\n return {\n version: splitTypeId[1],\n typeidWithoutVersion: splitTypeId[0],\n };\n }\n\n /**\n * Extracts the context from a typeid\n *\n * @param in_typeid - The typeid to process\n * @returns The typeid without context, the context and if we have an enum type\n */\n export function extractContext(in_typeid: string | undefined): ExtractedContext {\n const bracketIndex = in_typeid.indexOf(\"<\");\n if (bracketIndex !== -1 &&\n in_typeid[in_typeid.length - 1] === \">\") {\n let typeid = in_typeid.substr(bracketIndex + 1, in_typeid.length - bracketIndex - 2);\n let context = in_typeid.substr(0, bracketIndex);\n\n // Special case to handle collections without a typeid (e.g. \"map<>\", which should\n // be able to support all property types\n if (typeid === \"\") {\n typeid = context !== \"set\" ? \"BaseProperty\" : \"NamedProperty\";\n }\n\n // Special case to handle enums (e.g. array<enum<myType>>)\n let isEnum = false;\n if (context === \"enum\" || typeid.substr(0, 5) === \"enum<\") {\n isEnum = true;\n if (context === \"enum\") {\n context = \"single\";\n } else {\n // remove the `enum<...>` tag to get the raw typeid\n typeid = typeid.substr(5, typeid.length - 6);\n }\n }\n if (context === \"Reference\") {\n typeid = `Reference<${typeid}>`;\n context = \"single\";\n }\n\n return {\n typeid,\n context,\n isEnum,\n };\n } else {\n return {\n typeid: in_typeid,\n context: \"single\",\n isEnum: false,\n };\n }\n }\n\n /**\n * Creates a collection typeid string from the\n * typeid and the context.\n *\n * @param in_typeid - The typeid in the collection\n * @param in_context - The context\n * @param in_enum - Set to true if the type should get an enum tag\n *\n * @returns The combined typeid string\n */\n export function createSerializationTypeId(in_typeid: string, in_context: string, in_enum: boolean): string { // in_enum\n if (in_typeid === \"BaseProperty\") {\n // Special case for BaseProperties. These get represented as a collection\n // typeid without a child typeid. E.g. map<> instead of map<BaseProperty>\n return `${in_context}<>`;\n } else {\n if (in_enum) {\n return in_context === \"\" || in_context === \"single\"\n ? `enum<${in_typeid}>`\n : `${in_context}<enum<${in_typeid}>>`;\n } else {\n return `${in_context}<${in_typeid}>`;\n }\n }\n }\n\n /**\n * Checks, whether the supplied typeid is a reference property type id\n *\n * @param in_typeid - The typeid to check\n * @returns Is this a reference property typeid?\n */\n export function isReferenceTypeId(in_typeid: string | undefined): boolean { // in_enum\n return in_typeid === \"Reference\" ||\n (in_typeid.substr(0, 10) === \"Reference<\" && in_typeid.substr(-1) === \">\");\n }\n\n /**\n * Returns the type of the properties a reference points to\n *\n * @param in_typeid - The typeid to process\n * @return The type of the referenced property\n */\n export function extractReferenceTargetTypeIdFromReference(in_typeid: string): string { // in_enum\n return in_typeid.substr(0, 10) === \"Reference<\"\n ? in_typeid.substr(10, in_typeid.length - 11)\n : \"BaseProperty\";\n }\n\n /**\n * Checks whether the given type is a template typeid.\n *\n * @param in_typeid - The typeid we want to check\n * @returns Is this a base template typeid?\n */\n export function isSchemaTypeid(in_typeid: string): boolean {\n return typeof in_typeid === \"string\" && (in_typeid.indexOf(\":\") !== -1);\n }\n\n /**\n * Extracts referenced typeid from input typeid\n *\n * @param in_typeid - typeid\n *\n * @return referenced typeid or in_param if it is not a reference\n */\n export function extractTypeId(in_typeid): string {\n const matches = in_typeid.match(/\\<(.*?)\\>/);\n return matches !== null && matches.length > 0\n ? matches[0].replace(/[\\<\\>]/gi, \"\")\n : in_typeid;\n }\n\n /**\n * Check wether the in_typeid inherits from the in_baseTypeid.\n *\n * @remarks Note: By default, this also returns true if in_typeid === in_baseTypeid.\n *\n * @param in_typeid - Typeid for which we want to check, whethwe in_baseTypeid is a parent.\n * @param in_baseTypeid - The base typeId to check for.\n * @throws If in_typeid or in_baseTypeid are not native typeid.\n * @returns True if in_baseTypeid is a parent of in_typeid.\n */\n export function nativeInheritsFrom(in_typeid: string, in_baseTypeid: string): boolean {\n if (!in_typeid || !in_baseTypeid) {\n throw new Error(MSG.TYPEID_NOT_DEFINED);\n }\n\n if (in_typeid.substr(0, 10) === \"Reference<\") {\n in_typeid = \"Reference\";\n }\n\n if (in_baseTypeid.substr(0, 10) === \"Reference<\") {\n in_baseTypeid = \"Reference\";\n }\n\n if (!NativeTypes[in_typeid]) {\n throw new Error(MSG.TYPEID_NOT_NATIVE + in_typeid);\n }\n\n if (!NativeTypes[in_baseTypeid]) {\n throw new Error(MSG.TYPEID_NOT_NATIVE + in_baseTypeid);\n }\n\n if (in_baseTypeid === \"BaseProperty\" || in_typeid === in_baseTypeid) {\n return true;\n }\n\n if (in_typeid === \"BaseProperty\") {\n return false;\n }\n\n let parents = NativeTypes[in_typeid][\"inherits\"];\n\n // recursively call the function for the parent of the typeid\n for (let i = 0; i < parents.length; i++) {\n if (this.nativeInheritsFrom(parents[i], in_baseTypeid)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * return all primitive typeIds\n *\n * @returns return a list of primitiveTypeIds\n */\n export function getPrimitiveTypeIds(): string[] {\n return templateSchemaJson[\"$defs\"][\"primitive-typeid\"][\"enum\"];\n }\n\n /**\n * return all reserved typeIds\n *\n * @returns return a list of reservedTypeIds\n */\n export function getReservedTypeIds(): string[] {\n return templateSchemaJson[\"$defs\"][\"reserved-typeid\"][\"enum\"];\n }\n}\n"]}
|
package/dist/pathHelper.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ export declare namespace PathHelper {
|
|
|
103
103
|
* @param in_basePath - The property's absolute path in canonical form
|
|
104
104
|
* @param in_paths - The array of paths that must cover the property and its children
|
|
105
105
|
* @returns The coverage of the property and its children. For a coverage of
|
|
106
|
-
*
|
|
106
|
+
* 'FULLY_COVERED', only the first matching path is returned.
|
|
107
107
|
*/
|
|
108
108
|
export const getPathCoverage: (in_basePath: string, in_paths: string[]) => BasePathCoverage;
|
|
109
109
|
export {};
|
package/dist/pathHelper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pathHelper.d.ts","sourceRoot":"","sources":["../src/pathHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAOH,oBAAY,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAE7C;;GAEG;
|
|
1
|
+
{"version":3,"file":"pathHelper.d.ts","sourceRoot":"","sources":["../src/pathHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAOH,oBAAY,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAE7C;;GAEG;AAEH,yBAAiB,UAAU,CAAC;IAIxB;;;OAGG;IACH,MAAM,MAAM,WAAW;QACnB,6CAA6C;QAC7C,kBAAkB,IAAA;QAClB,+CAA+C;QAC/C,WAAW,IAAA;QACX,uCAAuC;QACvC,eAAe,IAAA;QACf,mDAAmD,CACnD,iBAAiB,IAAA;QACjB,2DAA2D;QAC3D,iBAAiB,IAAA;KACpB;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,kBAAkB,YAAqB,MAAM,cAAc,WAAW,EAAE,KAAG,MAAM,EA8Q7F,CAAC;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,gBAAgB,mBAA4B,MAAM,KAAG,MAYjE,CAAC;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,kBAAkB,yBAAkC,MAAM,KAAG,MAiBzE,CAAC;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,wBAAwB,mBAA4B,MAAM,KAAG,MASzE,CAAC;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,gCAAgC,YAAqB,MAAM,SAKvE,CAAC;IAEF;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,8BAA8B,oBAA6B,MAAM,KAAG,MA2BhF,CAAC;IAEF;;;;;;;;OAQG;IACH,MAAM,CAAC,MAAM,6BAA6B,mCAA4C,MAAM,cAAc,MAAM,KAAG,MAKlH,CAAC;IAEF,MAAM,MAAM,cAAc;QAGtB,SAAS,IAAA;QAGT,cAAc,IAAA;QAGd,aAAa,IAAA;KAChB;IAED,UAAU,gBAAgB;QACtB,cAAc,EAAE,cAAc,CAAC;QAC/B,QAAQ,EAAE,MAAM,EAAE,CAAC;KACtB;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,MAAM,eAAe,gBAAyB,MAAM,YAAY,MAAM,EAAE,KAAG,gBA+BjF,CAAC;;CACL"}
|
package/dist/pathHelper.js
CHANGED
|
@@ -14,6 +14,7 @@ const { PROPERTY_PATH_DELIMITER, MSG } = property_common_1.constants;
|
|
|
14
14
|
/**
|
|
15
15
|
* Helper functions for string processing
|
|
16
16
|
*/
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
17
18
|
var PathHelper;
|
|
18
19
|
(function (PathHelper) {
|
|
19
20
|
const RE_ALL_OPEN_SQUARE_BRACKETS = new RegExp("[[]", "g");
|
|
@@ -199,49 +200,54 @@ var PathHelper;
|
|
|
199
200
|
}
|
|
200
201
|
}
|
|
201
202
|
else if (!inSquareBrackets) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
allowSegmentStart = true;
|
|
206
|
-
}
|
|
207
|
-
else if (character === "[") {
|
|
208
|
-
// An opening square bracket starts a new token
|
|
209
|
-
if (tokenStarted) {
|
|
203
|
+
switch (character) {
|
|
204
|
+
case PROPERTY_PATH_DELIMITER: {
|
|
205
|
+
// A dot symbols starts a new token
|
|
210
206
|
storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);
|
|
207
|
+
allowSegmentStart = true;
|
|
208
|
+
break;
|
|
211
209
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
if (tokenStarted) {
|
|
221
|
-
storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);
|
|
210
|
+
case "[": {
|
|
211
|
+
// An opening square bracket starts a new token
|
|
212
|
+
if (tokenStarted) {
|
|
213
|
+
storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);
|
|
214
|
+
}
|
|
215
|
+
// And sets the state to inSquareBrackets
|
|
216
|
+
inSquareBrackets = true;
|
|
217
|
+
break;
|
|
222
218
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (out_types) {
|
|
226
|
-
out_types.push(TOKEN_TYPES.DEREFERENCE_TOKEN);
|
|
219
|
+
case "]": {
|
|
220
|
+
throw new Error(MSG.CLOSING_BRACKET_WITHOUT_OPENING + in_path);
|
|
227
221
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
222
|
+
case "*": {
|
|
223
|
+
// Store the last token
|
|
224
|
+
if (tokenStarted) {
|
|
225
|
+
storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);
|
|
226
|
+
}
|
|
227
|
+
// Create a new dereference token
|
|
228
|
+
tokens.push("*");
|
|
229
|
+
if (out_types) {
|
|
230
|
+
out_types.push(TOKEN_TYPES.DEREFERENCE_TOKEN);
|
|
231
|
+
}
|
|
232
|
+
// Reset the token started flag
|
|
233
|
+
tokenStarted = false;
|
|
234
|
+
atStartToken = true;
|
|
235
|
+
allowSegmentStart = false;
|
|
236
|
+
break;
|
|
238
237
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
238
|
+
default: {
|
|
239
|
+
if (!tokenStarted &&
|
|
240
|
+
!allowSegmentStart &&
|
|
241
|
+
!inSquareBrackets) {
|
|
242
|
+
throw new Error(MSG.MISSING_DOT_AT_SEGMENT_START + in_path);
|
|
243
|
+
}
|
|
244
|
+
currentToken += character;
|
|
245
|
+
// We have started parsing the token
|
|
246
|
+
tokenStarted = true;
|
|
247
|
+
// When a symbols appears after a closing quotation mark, we have an error
|
|
248
|
+
if (lastTokenWasQuoted) {
|
|
249
|
+
throw new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);
|
|
250
|
+
}
|
|
245
251
|
}
|
|
246
252
|
}
|
|
247
253
|
}
|
|
@@ -352,19 +358,14 @@ var PathHelper;
|
|
|
352
358
|
* @returns quoted path string
|
|
353
359
|
*/
|
|
354
360
|
PathHelper.quotePathSegmentIfNeeded = function (in_pathSegment) {
|
|
355
|
-
|
|
361
|
+
return in_pathSegment.indexOf(PROPERTY_PATH_DELIMITER) !== -1 ||
|
|
356
362
|
in_pathSegment.indexOf('"') !== -1 ||
|
|
357
363
|
in_pathSegment.indexOf("\\") !== -1 ||
|
|
358
364
|
in_pathSegment.indexOf("/") !== -1 ||
|
|
359
365
|
in_pathSegment.indexOf("*") !== -1 ||
|
|
360
366
|
in_pathSegment.indexOf("[") !== -1 ||
|
|
361
367
|
in_pathSegment.indexOf("]") !== -1 ||
|
|
362
|
-
in_pathSegment.length === 0)
|
|
363
|
-
return PathHelper.quotePathSegment(in_pathSegment);
|
|
364
|
-
}
|
|
365
|
-
else {
|
|
366
|
-
return in_pathSegment;
|
|
367
|
-
}
|
|
368
|
+
in_pathSegment.length === 0 ? PathHelper.quotePathSegment(in_pathSegment) : in_pathSegment;
|
|
368
369
|
};
|
|
369
370
|
/**
|
|
370
371
|
* This function checks, whether the supplied path is a valid repository absolute path.
|
|
@@ -426,12 +427,9 @@ var PathHelper;
|
|
|
426
427
|
*/
|
|
427
428
|
PathHelper.getChildAbsolutePathCanonical = function (in_parentAbsolutePathCanonical, in_childId) {
|
|
428
429
|
const childPath = PathHelper.quotePathSegmentIfNeeded(String(in_childId));
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
else {
|
|
433
|
-
return childPath;
|
|
434
|
-
}
|
|
430
|
+
return in_parentAbsolutePathCanonical
|
|
431
|
+
? (in_parentAbsolutePathCanonical + PROPERTY_PATH_DELIMITER + childPath)
|
|
432
|
+
: childPath;
|
|
435
433
|
};
|
|
436
434
|
let CoverageExtent;
|
|
437
435
|
(function (CoverageExtent) {
|
|
@@ -454,7 +452,7 @@ var PathHelper;
|
|
|
454
452
|
* @param in_basePath - The property's absolute path in canonical form
|
|
455
453
|
* @param in_paths - The array of paths that must cover the property and its children
|
|
456
454
|
* @returns The coverage of the property and its children. For a coverage of
|
|
457
|
-
*
|
|
455
|
+
* 'FULLY_COVERED', only the first matching path is returned.
|
|
458
456
|
*/
|
|
459
457
|
PathHelper.getPathCoverage = function (in_basePath, in_paths) {
|
|
460
458
|
// First, check if the base path is entirely included in one of the paths
|
package/dist/pathHelper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pathHelper.js","sourceRoot":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CAAC,aAAa;oBAC5C,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;iBAC1B,CAAC;aACL;SACJ;QACD,sEAAsE;QACtE,mDAAmD;QACnD,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;gBACrC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;aAC3B;SACJ;QACD,IAAI,KAAK,CAAC,MAAM,EAAE;YACd,+DAA+D;YAC/D,OAAO;gBACH,cAAc,EAAE,cAAc,CAAC,cAAc;gBAC7C,QAAQ,EAAE,KAAK;aAClB,CAAC;SACL;QAED,yDAAyD;QACzD,OAAO;YACH,cAAc,EAAE,cAAc,CAAC,SAAS;YACxC,QAAQ,EAAE,KAAK;SAClB,CAAC;IACN,CAAC,CAAC;AACN,CAAC,EA1egB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QA0e1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Helper functions to work with path strings\n */\n\n// @ts-ignore\nimport { constants } from '@fluid-experimental/property-common';\n\nconst { PROPERTY_PATH_DELIMITER, MSG } = constants;\n\nexport type PathTree = Map<String, PathTree>;\n\n/**\n * Helper functions for string processing\n */\nexport namespace PathHelper {\n\n const RE_ALL_OPEN_SQUARE_BRACKETS = new RegExp(\"[[]\", \"g\");\n\n /**\n * Token Types\n * Type of the token in the path string\n */\n export enum TOKEN_TYPES {\n /** A normal path segment, separated via . */\n PATH_SEGMENT_TOKEN,\n /** An array path segment, separated via [ ] */\n ARRAY_TOKEN,\n /** A / at the beginning of the path */\n PATH_ROOT_TOKEN,\n /** A * that indicates a dereferencing operation */ // note: reversed!\n DEREFERENCE_TOKEN,\n /** A ../ that indicates one step above the current path */\n RAISE_LEVEL_TOKEN,\n }\n\n /**\n * Tokenizes a path string\n *\n * @param in_path - The path string to divide into tokens\n * @param out_types - The types of the tokens\n *\n * @returns the tokens from the path string\n */\n export const tokenizePathString = function(in_path: string, out_types?: TOKEN_TYPES[]): string[] { // eslint-disable-line complexity\n const tokens = [];\n let currentToken = \"\";\n\n if (out_types) {\n // Make sure out_types is empty\n out_types.splice(0, out_types.length);\n }\n\n // Handle a / at the beginning of the path by adding a special token for it\n let path_start = 0;\n if (in_path[0] === \"/\") {\n tokens.push(\"/\");\n if (out_types) {\n out_types.push(TOKEN_TYPES.PATH_ROOT_TOKEN);\n }\n path_start = 1;\n } else if (in_path.substr(0, 3) === \"../\") {\n // Handle relative paths by extracting the number steps above\n var extractLevel = function(current_path) {\n if (current_path.substr(0, 3) === \"../\") {\n if (out_types) {\n out_types.push(TOKEN_TYPES.RAISE_LEVEL_TOKEN);\n }\n tokens.push(\"../\");\n extractLevel(current_path.substr(3));\n path_start = path_start + 3;\n }\n };\n extractLevel(in_path);\n }\n\n // Let's see if the path is simple enough to use a fast-track algorithm.\n let hackedPath = in_path.substr(path_start);\n if (in_path.indexOf(\"\\\\\") === -1 && in_path.indexOf('\"') === -1 && in_path.indexOf(\"*\") === -1) {\n // Yes, we can do something faster than parsing each character one by one.\n let additionalTokens: string[] = [];\n const additionalTypes = [];\n let token: string | string[];\n let i: number;\n // Hack for simplicity, let's first replace all occurences of '[' by '.['\n hackedPath = hackedPath.replace(RE_ALL_OPEN_SQUARE_BRACKETS, \".[\");\n // Then split on '.'\n additionalTokens = hackedPath.split(\".\");\n // And validate each token.\n for (i = 0; i < additionalTokens.length; ++i) {\n token = additionalTokens[i];\n // Empty tokens are considered errors... but shouldn't '' be a valid name?\n if (token.length === 0) {\n // There's an error somewhere. Let's abort the fast-track.\n break;\n } else if (token[0] === \"[\") {\n if (token.length > 2 && token[token.length - 1] === \"]\") {\n additionalTypes.push(TOKEN_TYPES.ARRAY_TOKEN);\n additionalTokens[i] = token.substr(1, token.length - 2);\n } else {\n // There's an error somewhere. Let's abort the fast-track.\n break;\n }\n } else {\n if (token.indexOf(\"]\") !== -1) {\n // There's an error somewhere. Let's abort the fast-track.\n break;\n } else {\n // It was a simple property name.\n additionalTypes.push(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n }\n }\n if (i === additionalTokens.length) {\n // Parsed everything successfully so end function here.\n if (out_types) {\n for (i = 0; i < additionalTypes.length; i++) {\n out_types.push(additionalTypes[i]);\n }\n }\n return tokens.concat(additionalTokens);\n }\n }\n\n let inSquareBrackets = false;\n let tokenStarted = false;\n let lastTokenWasQuoted = false;\n\n // We are in a context where an empty token is valid\n let atStartToken = false;\n let allowSegmentStart = true;\n\n const storeNextToken = function(tokenType) {\n // Make sure, this is not an empty token (E.g. a .. or a [] )\n if (!tokenStarted) {\n if (!atStartToken) {\n throw new Error(MSG.EMPTY_TOKEN + in_path);\n } else {\n return;\n }\n }\n\n // Store the token\n tokens.push(currentToken);\n currentToken = \"\";\n tokenStarted = false;\n atStartToken = false;\n lastTokenWasQuoted = false;\n allowSegmentStart = false;\n\n if (out_types) {\n out_types.push(tokenType);\n }\n };\n\n for (var i = path_start; i < in_path.length; i++) {\n const character = in_path[i];\n\n if (character === '\"') {\n // If we encounter a quotation mark, we start parsing the\n // quoted section\n if (!tokenStarted) {\n let endFound = false;\n\n // Read the quoted token\n for (i++; i < in_path.length; i++) {\n if (in_path[i] === '\"') {\n // We have found the end of the quoted token\n endFound = true;\n break;\n } else if (in_path[i] === \"\\\\\") {\n // Read an escaped symbol\n if (in_path.length > i + 1) {\n if (in_path[i + 1] === \"\\\\\") {\n currentToken += \"\\\\\";\n i++;\n } else if (in_path[i + 1] === '\"') {\n currentToken += '\"';\n i++;\n } else {\n throw new Error(MSG.INVALID_ESCAPE_SEQUENCE + in_path);\n }\n } else {\n throw new Error(MSG.INVALID_ESCAPE_SEQUENCE + in_path);\n }\n } else {\n // Everything else is just added to the token\n currentToken += in_path[i];\n }\n }\n\n if (!endFound) {\n throw new Error(MSG.UNCLOSED_QUOTATION_MARKS + in_path);\n }\n lastTokenWasQuoted = true;\n tokenStarted = true;\n } else {\n throw new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n }\n } else if (!inSquareBrackets) {\n if (character === PROPERTY_PATH_DELIMITER) {\n // A dot symbols starts a new token\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n\n allowSegmentStart = true;\n } else if (character === \"[\") {\n // An opening square bracket starts a new token\n if (tokenStarted) {\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n\n // And sets the state to inSquareBrackets\n inSquareBrackets = true;\n } else if (character === \"]\") {\n throw new Error(MSG.CLOSING_BRACKET_WITHOUT_OPENING + in_path);\n } else if (character === \"*\") {\n // Store the last token\n if (tokenStarted) {\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n\n // Create a new dereference token\n tokens.push(\"*\");\n if (out_types) {\n out_types.push(TOKEN_TYPES.DEREFERENCE_TOKEN);\n }\n\n // Reset the token started flag\n tokenStarted = false;\n atStartToken = true;\n allowSegmentStart = false;\n } else {\n if (!tokenStarted &&\n !allowSegmentStart &&\n !inSquareBrackets) {\n throw new Error(MSG.MISSING_DOT_AT_SEGMENT_START + in_path);\n }\n\n currentToken += character;\n\n // We have started parsing the token\n tokenStarted = true;\n\n // When a symbols appears after a closing quotation mark, we have an error\n if (lastTokenWasQuoted) {\n throw new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n }\n }\n } else {\n if (character === \"]\") {\n // A closing square bracket starts a new token\n storeNextToken(TOKEN_TYPES.ARRAY_TOKEN);\n\n // We now have to check the next character,\n // as only the combinations '][' and '].' are\n // valid\n if (in_path.length > i + 1) { // We only have to check this at the end of the string\n if (in_path[i + 1] === PROPERTY_PATH_DELIMITER) {\n // We are no longer in square brackets\n inSquareBrackets = false;\n allowSegmentStart = true;\n i++;\n } else if (in_path[i + 1] === \"[\") {\n // We remain in square brackets\n // so inSquareBrackets remains true;\n i++;\n } else if (in_path[i + 1] === \"*\") {\n // We leave the square brackets\n inSquareBrackets = false;\n } else {\n throw new Error(MSG.INVALID_END_OF_SQUARE_BRACKETS + in_path);\n }\n } else {\n inSquareBrackets = false;\n tokenStarted = false;\n }\n } else if (character === PROPERTY_PATH_DELIMITER) {\n throw new Error(MSG.DOTS_IN_SQUARE_BRACKETS + in_path);\n } else {\n currentToken += character;\n\n // We have started parsing the token\n tokenStarted = true;\n\n // When a symbols appears after a closing quotation mark, we have an error\n if (lastTokenWasQuoted) {\n throw new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n }\n }\n }\n }\n\n // At the end of the path we have to distinguish a few error cases\n if (inSquareBrackets) {\n // There was a un-closed bracket at the end\n throw new Error(MSG.UNCLOSED_BRACKETS + in_path);\n } else if (in_path[in_path.length - 1] === PROPERTY_PATH_DELIMITER) {\n // A path ended with a PROPERTY_PATH_DELIMITER\n throw new Error(MSG.DOT_AT_END + in_path);\n } else if (tokenStarted) {\n // There was a valid, not yet ended token\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n\n return tokens;\n };\n\n /**\n * Creates a quoted string for a path seqment to make sure it parses correctly\n *\n * @param in_pathSegment - The path string to put in quotes\n *\n * @returns quoted path string\n */\n export const quotePathSegment = function(in_pathSegment: string): string {\n // WARNING: I use RegExps here, as the normal replace\n // function only replaces the first occurrence\n\n // First we escape escape symbols\n in_pathSegment = in_pathSegment.replace(/\\\\/g, \"\\\\\\\\\");\n\n // Then we escape quotes\n in_pathSegment = in_pathSegment.replace(/\"/g, '\\\\\"');\n\n // And finally, we put the string into quotation marks\n return `\"${in_pathSegment}\"`;\n };\n\n /**\n * Reverse a quoted/escaped string for a path seqment\n *\n * @param in_quotedPathSegment - The quoted/escaped path string to put in quotes\n *\n * @return unquoted path string\n */\n export const unquotePathSegment = function(in_quotedPathSegment: string): string {\n if (typeof in_quotedPathSegment !== \"string\") {\n throw new TypeError(`Expecting a string as a path: ${in_quotedPathSegment}`);\n }\n\n if (in_quotedPathSegment[0] === '\"' && in_quotedPathSegment[in_quotedPathSegment.length - 1] === '\"') {\n // We remove double quotes\n in_quotedPathSegment = in_quotedPathSegment.substr(1, in_quotedPathSegment.length - 2);\n\n // Then we unescape escape symbols\n in_quotedPathSegment = in_quotedPathSegment.replace(/\\\\\\\\/g, \"\\\\\");\n\n // Then we unescape quotes\n in_quotedPathSegment = in_quotedPathSegment.replace(/\\\\\"/g, '\"');\n }\n\n return in_quotedPathSegment;\n };\n\n /**\n * Adds quotation marks to a path string if they are needed\n *\n * @param in_pathSegment - The path string to put in quotes\n *\n * @returns quoted path string\n */\n export const quotePathSegmentIfNeeded = function(in_pathSegment: string): string {\n if (in_pathSegment.indexOf(PROPERTY_PATH_DELIMITER) !== -1 ||\n in_pathSegment.indexOf('\"') !== -1 ||\n in_pathSegment.indexOf(\"\\\\\") !== -1 ||\n in_pathSegment.indexOf(\"/\") !== -1 ||\n in_pathSegment.indexOf(\"*\") !== -1 ||\n in_pathSegment.indexOf(\"[\") !== -1 ||\n in_pathSegment.indexOf(\"]\") !== -1 ||\n in_pathSegment.length === 0) {\n return quotePathSegment(in_pathSegment);\n } else {\n return in_pathSegment;\n }\n };\n\n /**\n * This function checks, whether the supplied path is a valid repository absolute path.\n *\n * It has to be either an empty string, or a path starting with a /\n *\n * @param in_path - The path to check\n */\n export const checkValidRepositoryAbsolutePath = function(in_path: string) {\n if (in_path !== \"\" && // either an empty reference\n in_path[0] !== \"/\") { // or an absolute path starting with /\n throw new Error(MSG.INVALID_PATH_IN_REFERENCE);\n }\n };\n\n /**\n * This utility function provides a canonical representation of an absolute property path.\n * It is useful to compare partial checkout paths and property paths.\n * The canonical form of paths is not suitable for ChangeSets.\n *\n * @param in_absolutePath - The absolute path to make canonical\n * @return Absolute path in canonical form\n */\n export const convertAbsolutePathToCanonical = function(in_absolutePath: string): string {\n const tokenTypes = [];\n const tokens = tokenizePathString(in_absolutePath, tokenTypes);\n let path = \"\";\n for (let i = 0; i < tokenTypes.length; i++) {\n const tokenType = tokenTypes[i];\n switch (tokenType) {\n case TOKEN_TYPES.PATH_ROOT_TOKEN:\n // Skip the leading '/'\n break;\n case TOKEN_TYPES.RAISE_LEVEL_TOKEN:\n throw new Error(`No level up (\"../\") is expected in an absolute path: ${in_absolutePath}`);\n case TOKEN_TYPES.DEREFERENCE_TOKEN:\n throw new Error(`Dereference (\"*\") is not supported in canonical paths: ${in_absolutePath}`);\n case TOKEN_TYPES.ARRAY_TOKEN:\n case TOKEN_TYPES.PATH_SEGMENT_TOKEN:\n path += (PROPERTY_PATH_DELIMITER + quotePathSegmentIfNeeded(tokens[i]));\n break;\n default:\n break;\n }\n }\n // Removes the leading PROPERTY_PATH_DELIMITER.\n if (path) {\n path = path.substring(1);\n }\n return path;\n };\n\n /**\n * This utility function provides a canonical representation of a child property path.\n * It is useful to compare partial checkout paths and property paths.\n * The canonical form of paths is not suitable for ChangeSets.\n *\n * @param in_parentAbsolutePathCanonical - The absolute path of the parent property in canonical form\n * @param in_childId - The name of the child property in its parent\n * @returns Absolute path of the child property in canonical form\n */\n export const getChildAbsolutePathCanonical = function(in_parentAbsolutePathCanonical: string, in_childId: string): string {\n const childPath = quotePathSegmentIfNeeded(String(in_childId));\n if (in_parentAbsolutePathCanonical) {\n return (in_parentAbsolutePathCanonical + PROPERTY_PATH_DELIMITER + childPath);\n } else {\n return childPath;\n }\n };\n\n export enum CoverageExtent {\n // The base path is not covered by any path from a given list of paths.\n // This means a property with this path and all its children would not be covered.\n UNCOVERED,\n // The base path is partially covered by at least one path from a given list of paths.\n // This means a property with this path would be covered, but some of its children could be uncovered.\n PARTLY_COVERED,\n // The base path is fully covered by at least one path from a given list of paths.\n // This means a property with this path would be covered and all of its children would be covered also.\n FULLY_COVERED,\n }\n\n interface BasePathCoverage {\n coverageExtent: CoverageExtent;\n pathList: string[];\n }\n\n /**\n * Determines if the base path is covered by the given list of paths. From that you can deduce if a\n * property with that path and all its children are covered by the given list of paths.\n *\n * This function uses the canonical representation of the property paths.\n *\n * @param in_basePath - The property's absolute path in canonical form\n * @param in_paths - The array of paths that must cover the property and its children\n * @returns The coverage of the property and its children. For a coverage of\n * 'FULLY_COVERED', only the first matching path is returned.\n */\n export const getPathCoverage = function(in_basePath: string, in_paths: string[]): BasePathCoverage {\n // First, check if the base path is entirely included in one of the paths\n for (let i = 0; i < in_paths.length; i++) {\n if (in_basePath.startsWith(in_paths[i])) {\n return {\n coverageExtent: CoverageExtent.FULLY_COVERED,\n pathList: [in_paths[i]],\n };\n }\n }\n // We did not find a path including all the children of this insertion\n // Let's check if there are paths going through it.\n const paths = [];\n for (let i = 0; i < in_paths.length; i++) {\n if (in_paths[i].startsWith(in_basePath)) {\n paths.push(in_paths[i]);\n }\n }\n if (paths.length) {\n // We found at least one path including parts of the base path.\n return {\n coverageExtent: CoverageExtent.PARTLY_COVERED,\n pathList: paths,\n };\n }\n\n // We did not find any path covering the given base path.\n return {\n coverageExtent: CoverageExtent.UNCOVERED,\n pathList: paths,\n };\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pathHelper.js","sourceRoot":"","sources":["../src/pathHelper.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;AAEH,aAAa;AACb,yEAAgE;AAEhE,MAAM,EAAE,uBAAuB,EAAE,GAAG,EAAE,GAAG,2BAAS,CAAC;AAInD;;GAEG;AACH,2DAA2D;AAC3D,IAAiB,UAAU,CA6e1B;AA7eD,WAAiB,UAAU;IAEvB,MAAM,2BAA2B,GAAG,IAAI,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAE3D;;;OAGG;IACH,IAAY,WAWX;IAXD,WAAY,WAAW;QACnB,6CAA6C;QAC7C,yEAAkB,CAAA;QAClB,+CAA+C;QAC/C,2DAAW,CAAA;QACX,uCAAuC;QACvC,mEAAe,CAAA;QACf,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,MAAM,EAAE;YACd,+DAA+D;YAC/D,OAAO;gBACH,cAAc,EAAE,cAAc,CAAC,cAAc;gBAC7C,QAAQ,EAAE,KAAK;aAClB,CAAC;SACL;QAED,yDAAyD;QACzD,OAAO;YACH,cAAc,EAAE,cAAc,CAAC,SAAS;YACxC,QAAQ,EAAE,KAAK;SAClB,CAAC;IACN,CAAC,CAAC;AACN,CAAC,EA7egB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QA6e1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Helper functions to work with path strings\n */\n\n// @ts-ignore\nimport { constants } from '@fluid-experimental/property-common';\n\nconst { PROPERTY_PATH_DELIMITER, MSG } = constants;\n\nexport type PathTree = Map<String, PathTree>;\n\n/**\n * Helper functions for string processing\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace PathHelper {\n\n const RE_ALL_OPEN_SQUARE_BRACKETS = new RegExp(\"[[]\", \"g\");\n\n /**\n * Token Types\n * Type of the token in the path string\n */\n export enum TOKEN_TYPES {\n /** A normal path segment, separated via . */\n PATH_SEGMENT_TOKEN,\n /** An array path segment, separated via [ ] */\n ARRAY_TOKEN,\n /** A / at the beginning of the path */\n PATH_ROOT_TOKEN,\n /** A * that indicates a dereferencing operation */ // note: reversed!\n DEREFERENCE_TOKEN,\n /** A ../ that indicates one step above the current path */\n RAISE_LEVEL_TOKEN,\n }\n\n /**\n * Tokenizes a path string\n *\n * @param in_path - The path string to divide into tokens\n * @param out_types - The types of the tokens\n *\n * @returns the tokens from the path string\n */\n export const tokenizePathString = function(in_path: string, out_types?: TOKEN_TYPES[]): string[] { // eslint-disable-line complexity\n const tokens = [];\n let currentToken = \"\";\n\n if (out_types) {\n // Make sure out_types is empty\n out_types.splice(0, out_types.length);\n }\n\n // Handle a / at the beginning of the path by adding a special token for it\n let path_start = 0;\n if (in_path[0] === \"/\") {\n tokens.push(\"/\");\n if (out_types) {\n out_types.push(TOKEN_TYPES.PATH_ROOT_TOKEN);\n }\n path_start = 1;\n } else if (in_path.substr(0, 3) === \"../\") {\n // Handle relative paths by extracting the number steps above\n var extractLevel = function(current_path) {\n if (current_path.substr(0, 3) === \"../\") {\n if (out_types) {\n out_types.push(TOKEN_TYPES.RAISE_LEVEL_TOKEN);\n }\n tokens.push(\"../\");\n extractLevel(current_path.substr(3));\n path_start = path_start + 3;\n }\n };\n extractLevel(in_path);\n }\n\n // Let's see if the path is simple enough to use a fast-track algorithm.\n let hackedPath = in_path.substr(path_start);\n if (in_path.indexOf(\"\\\\\") === -1 && in_path.indexOf('\"') === -1 && in_path.indexOf(\"*\") === -1) {\n // Yes, we can do something faster than parsing each character one by one.\n let additionalTokens: string[] = [];\n const additionalTypes = [];\n let token: string | string[];\n let i: number;\n // Hack for simplicity, let's first replace all occurences of '[' by '.['\n hackedPath = hackedPath.replace(RE_ALL_OPEN_SQUARE_BRACKETS, \".[\");\n // Then split on '.'\n additionalTokens = hackedPath.split(\".\");\n // And validate each token.\n for (i = 0; i < additionalTokens.length; ++i) {\n token = additionalTokens[i];\n // Empty tokens are considered errors... but shouldn't '' be a valid name?\n if (token.length === 0) {\n // There's an error somewhere. Let's abort the fast-track.\n break;\n } else if (token[0] === \"[\") {\n if (token.length > 2 && token[token.length - 1] === \"]\") {\n additionalTypes.push(TOKEN_TYPES.ARRAY_TOKEN);\n additionalTokens[i] = token.substr(1, token.length - 2);\n } else {\n // There's an error somewhere. Let's abort the fast-track.\n break;\n }\n } else {\n if (token.indexOf(\"]\") !== -1) {\n // There's an error somewhere. Let's abort the fast-track.\n break;\n } else {\n // It was a simple property name.\n additionalTypes.push(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n }\n }\n if (i === additionalTokens.length) {\n // Parsed everything successfully so end function here.\n if (out_types) {\n for (i = 0; i < additionalTypes.length; i++) {\n out_types.push(additionalTypes[i]);\n }\n }\n return tokens.concat(additionalTokens);\n }\n }\n\n let inSquareBrackets = false;\n let tokenStarted = false;\n let lastTokenWasQuoted = false;\n\n // We are in a context where an empty token is valid\n let atStartToken = false;\n let allowSegmentStart = true;\n\n const storeNextToken = function(tokenType) {\n // Make sure, this is not an empty token (E.g. a .. or a [] )\n if (!tokenStarted) {\n if (!atStartToken) {\n throw new Error(MSG.EMPTY_TOKEN + in_path);\n } else {\n return;\n }\n }\n\n // Store the token\n tokens.push(currentToken);\n currentToken = \"\";\n tokenStarted = false;\n atStartToken = false;\n lastTokenWasQuoted = false;\n allowSegmentStart = false;\n\n if (out_types) {\n out_types.push(tokenType);\n }\n };\n\n for (var i = path_start; i < in_path.length; i++) {\n const character = in_path[i];\n\n if (character === '\"') {\n // If we encounter a quotation mark, we start parsing the\n // quoted section\n if (!tokenStarted) {\n let endFound = false;\n\n // Read the quoted token\n for (i++; i < in_path.length; i++) {\n if (in_path[i] === '\"') {\n // We have found the end of the quoted token\n endFound = true;\n break;\n } else if (in_path[i] === \"\\\\\") {\n // Read an escaped symbol\n if (in_path.length > i + 1) {\n if (in_path[i + 1] === \"\\\\\") {\n currentToken += \"\\\\\";\n i++;\n } else if (in_path[i + 1] === '\"') {\n currentToken += '\"';\n i++;\n } else {\n throw new Error(MSG.INVALID_ESCAPE_SEQUENCE + in_path);\n }\n } else {\n throw new Error(MSG.INVALID_ESCAPE_SEQUENCE + in_path);\n }\n } else {\n // Everything else is just added to the token\n currentToken += in_path[i];\n }\n }\n\n if (!endFound) {\n throw new Error(MSG.UNCLOSED_QUOTATION_MARKS + in_path);\n }\n lastTokenWasQuoted = true;\n tokenStarted = true;\n } else {\n throw new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n }\n } else if (!inSquareBrackets) {\n switch (character) {\n case PROPERTY_PATH_DELIMITER: {\n // A dot symbols starts a new token\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n\n allowSegmentStart = true;\n break;\n }\n case \"[\": {\n // An opening square bracket starts a new token\n if (tokenStarted) {\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n\n // And sets the state to inSquareBrackets\n inSquareBrackets = true;\n break;\n }\n case \"]\": {\n throw new Error(MSG.CLOSING_BRACKET_WITHOUT_OPENING + in_path);\n }\n case \"*\": {\n // Store the last token\n if (tokenStarted) {\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n\n // Create a new dereference token\n tokens.push(\"*\");\n if (out_types) {\n out_types.push(TOKEN_TYPES.DEREFERENCE_TOKEN);\n }\n\n // Reset the token started flag\n tokenStarted = false;\n atStartToken = true;\n allowSegmentStart = false;\n break;\n }\n default: {\n if (!tokenStarted &&\n !allowSegmentStart &&\n !inSquareBrackets) {\n throw new Error(MSG.MISSING_DOT_AT_SEGMENT_START + in_path);\n }\n\n currentToken += character;\n\n // We have started parsing the token\n tokenStarted = true;\n\n // When a symbols appears after a closing quotation mark, we have an error\n if (lastTokenWasQuoted) {\n throw new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n }\n }\n }\n } else {\n if (character === \"]\") {\n // A closing square bracket starts a new token\n storeNextToken(TOKEN_TYPES.ARRAY_TOKEN);\n\n // We now have to check the next character,\n // as only the combinations '][' and '].' are\n // valid\n if (in_path.length > i + 1) { // We only have to check this at the end of the string\n if (in_path[i + 1] === PROPERTY_PATH_DELIMITER) {\n // We are no longer in square brackets\n inSquareBrackets = false;\n allowSegmentStart = true;\n i++;\n } else if (in_path[i + 1] === \"[\") {\n // We remain in square brackets\n // so inSquareBrackets remains true;\n i++;\n } else if (in_path[i + 1] === \"*\") {\n // We leave the square brackets\n inSquareBrackets = false;\n } else {\n throw new Error(MSG.INVALID_END_OF_SQUARE_BRACKETS + in_path);\n }\n } else {\n inSquareBrackets = false;\n tokenStarted = false;\n }\n } else if (character === PROPERTY_PATH_DELIMITER) {\n throw new Error(MSG.DOTS_IN_SQUARE_BRACKETS + in_path);\n } else {\n currentToken += character;\n\n // We have started parsing the token\n tokenStarted = true;\n\n // When a symbols appears after a closing quotation mark, we have an error\n if (lastTokenWasQuoted) {\n throw new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n }\n }\n }\n }\n\n // At the end of the path we have to distinguish a few error cases\n if (inSquareBrackets) {\n // There was a un-closed bracket at the end\n throw new Error(MSG.UNCLOSED_BRACKETS + in_path);\n } else if (in_path[in_path.length - 1] === PROPERTY_PATH_DELIMITER) {\n // A path ended with a PROPERTY_PATH_DELIMITER\n throw new Error(MSG.DOT_AT_END + in_path);\n } else if (tokenStarted) {\n // There was a valid, not yet ended token\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n\n return tokens;\n };\n\n /**\n * Creates a quoted string for a path seqment to make sure it parses correctly\n *\n * @param in_pathSegment - The path string to put in quotes\n *\n * @returns quoted path string\n */\n export const quotePathSegment = function(in_pathSegment: string): string {\n // WARNING: I use RegExps here, as the normal replace\n // function only replaces the first occurrence\n\n // First we escape escape symbols\n in_pathSegment = in_pathSegment.replace(/\\\\/g, \"\\\\\\\\\");\n\n // Then we escape quotes\n in_pathSegment = in_pathSegment.replace(/\"/g, '\\\\\"');\n\n // And finally, we put the string into quotation marks\n return `\"${in_pathSegment}\"`;\n };\n\n /**\n * Reverse a quoted/escaped string for a path seqment\n *\n * @param in_quotedPathSegment - The quoted/escaped path string to put in quotes\n *\n * @return unquoted path string\n */\n export const unquotePathSegment = function(in_quotedPathSegment: string): string {\n if (typeof in_quotedPathSegment !== \"string\") {\n throw new TypeError(`Expecting a string as a path: ${in_quotedPathSegment}`);\n }\n\n if (in_quotedPathSegment[0] === '\"' && in_quotedPathSegment[in_quotedPathSegment.length - 1] === '\"') {\n // We remove double quotes\n in_quotedPathSegment = in_quotedPathSegment.substr(1, in_quotedPathSegment.length - 2);\n\n // Then we unescape escape symbols\n in_quotedPathSegment = in_quotedPathSegment.replace(/\\\\\\\\/g, \"\\\\\");\n\n // Then we unescape quotes\n in_quotedPathSegment = in_quotedPathSegment.replace(/\\\\\"/g, '\"');\n }\n\n return in_quotedPathSegment;\n };\n\n /**\n * Adds quotation marks to a path string if they are needed\n *\n * @param in_pathSegment - The path string to put in quotes\n *\n * @returns quoted path string\n */\n export const quotePathSegmentIfNeeded = function(in_pathSegment: string): string {\n return in_pathSegment.indexOf(PROPERTY_PATH_DELIMITER) !== -1 ||\n in_pathSegment.indexOf('\"') !== -1 ||\n in_pathSegment.indexOf(\"\\\\\") !== -1 ||\n in_pathSegment.indexOf(\"/\") !== -1 ||\n in_pathSegment.indexOf(\"*\") !== -1 ||\n in_pathSegment.indexOf(\"[\") !== -1 ||\n in_pathSegment.indexOf(\"]\") !== -1 ||\n in_pathSegment.length === 0 ? quotePathSegment(in_pathSegment) : in_pathSegment;\n };\n\n /**\n * This function checks, whether the supplied path is a valid repository absolute path.\n *\n * It has to be either an empty string, or a path starting with a /\n *\n * @param in_path - The path to check\n */\n export const checkValidRepositoryAbsolutePath = function(in_path: string) {\n if (in_path !== \"\" && // either an empty reference\n in_path[0] !== \"/\") { // or an absolute path starting with /\n throw new Error(MSG.INVALID_PATH_IN_REFERENCE);\n }\n };\n\n /**\n * This utility function provides a canonical representation of an absolute property path.\n * It is useful to compare partial checkout paths and property paths.\n * The canonical form of paths is not suitable for ChangeSets.\n *\n * @param in_absolutePath - The absolute path to make canonical\n * @return Absolute path in canonical form\n */\n export const convertAbsolutePathToCanonical = function(in_absolutePath: string): string {\n const tokenTypes = [];\n const tokens = tokenizePathString(in_absolutePath, tokenTypes);\n let path = \"\";\n for (let i = 0; i < tokenTypes.length; i++) {\n const tokenType = tokenTypes[i];\n switch (tokenType) {\n case TOKEN_TYPES.PATH_ROOT_TOKEN:\n // Skip the leading '/'\n break;\n case TOKEN_TYPES.RAISE_LEVEL_TOKEN:\n throw new Error(`No level up (\"../\") is expected in an absolute path: ${in_absolutePath}`);\n case TOKEN_TYPES.DEREFERENCE_TOKEN:\n throw new Error(`Dereference (\"*\") is not supported in canonical paths: ${in_absolutePath}`);\n case TOKEN_TYPES.ARRAY_TOKEN:\n case TOKEN_TYPES.PATH_SEGMENT_TOKEN:\n path += (PROPERTY_PATH_DELIMITER + quotePathSegmentIfNeeded(tokens[i]));\n break;\n default:\n break;\n }\n }\n // Removes the leading PROPERTY_PATH_DELIMITER.\n if (path) {\n path = path.substring(1);\n }\n return path;\n };\n\n /**\n * This utility function provides a canonical representation of a child property path.\n * It is useful to compare partial checkout paths and property paths.\n * The canonical form of paths is not suitable for ChangeSets.\n *\n * @param in_parentAbsolutePathCanonical - The absolute path of the parent property in canonical form\n * @param in_childId - The name of the child property in its parent\n * @returns Absolute path of the child property in canonical form\n */\n export const getChildAbsolutePathCanonical = function(in_parentAbsolutePathCanonical: string, in_childId: string): string {\n const childPath = quotePathSegmentIfNeeded(String(in_childId));\n return in_parentAbsolutePathCanonical\n ? (in_parentAbsolutePathCanonical + PROPERTY_PATH_DELIMITER + childPath)\n : childPath;\n };\n\n export enum CoverageExtent {\n // The base path is not covered by any path from a given list of paths.\n // This means a property with this path and all its children would not be covered.\n UNCOVERED,\n // The base path is partially covered by at least one path from a given list of paths.\n // This means a property with this path would be covered, but some of its children could be uncovered.\n PARTLY_COVERED,\n // The base path is fully covered by at least one path from a given list of paths.\n // This means a property with this path would be covered and all of its children would be covered also.\n FULLY_COVERED,\n }\n\n interface BasePathCoverage {\n coverageExtent: CoverageExtent;\n pathList: string[];\n }\n\n /**\n * Determines if the base path is covered by the given list of paths. From that you can deduce if a\n * property with that path and all its children are covered by the given list of paths.\n *\n * This function uses the canonical representation of the property paths.\n *\n * @param in_basePath - The property's absolute path in canonical form\n * @param in_paths - The array of paths that must cover the property and its children\n * @returns The coverage of the property and its children. For a coverage of\n * 'FULLY_COVERED', only the first matching path is returned.\n */\n export const getPathCoverage = function(in_basePath: string, in_paths: string[]): BasePathCoverage {\n // First, check if the base path is entirely included in one of the paths\n for (let i = 0; i < in_paths.length; i++) {\n if (in_basePath.startsWith(in_paths[i])) {\n return {\n coverageExtent: CoverageExtent.FULLY_COVERED,\n pathList: [in_paths[i]],\n };\n }\n }\n // We did not find a path including all the children of this insertion\n // Let's check if there are paths going through it.\n const paths = [];\n for (let i = 0; i < in_paths.length; i++) {\n if (in_paths[i].startsWith(in_basePath)) {\n paths.push(in_paths[i]);\n }\n }\n if (paths.length) {\n // We found at least one path including parts of the base path.\n return {\n coverageExtent: CoverageExtent.PARTLY_COVERED,\n pathList: paths,\n };\n }\n\n // We did not find any path covering the given base path.\n return {\n coverageExtent: CoverageExtent.UNCOVERED,\n pathList: paths,\n };\n };\n}\n"]}
|
|
@@ -57,7 +57,7 @@ export interface TemplateValidatorOptions {
|
|
|
57
57
|
hasSchemaAsync?: (schema: PropertySchema, typeid: string) => Promise<boolean>;
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
60
|
+
* Instantiates a new TemplateValidator. Must be provided with a set of inheritsFrom and hasSchema
|
|
61
61
|
* function or inheritsFromAsync and hasSchemaAsync, but not both.
|
|
62
62
|
*/
|
|
63
63
|
export declare class TemplateValidator {
|
|
@@ -73,48 +73,80 @@ export declare class TemplateValidator {
|
|
|
73
73
|
private readonly _skipSemver;
|
|
74
74
|
constructor(in_params?: TemplateValidatorOptions);
|
|
75
75
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
76
|
+
* Validates that all templates conform to the following mandatory rules:
|
|
77
|
+
*
|
|
78
|
+
* 1. Must have a typeid attribute.
|
|
79
|
+
*
|
|
80
|
+
* 2. typeid must end in a valid semver string.
|
|
81
|
+
*
|
|
82
|
+
* 3. When both in_template (B) and in_templatePrevious (A) are supplied:
|
|
83
|
+
*
|
|
84
|
+
* - 3a. Semver is identical only if content is identical.
|
|
85
|
+
*
|
|
86
|
+
* - 3b. B's semver >= A's semver
|
|
87
|
+
*
|
|
88
|
+
* Additionally, the following soft rules will produce warnings when violated:
|
|
89
|
+
*
|
|
90
|
+
* 3.5. Elements of sets must eventually inherit from 'NamedProperty'
|
|
91
|
+
*
|
|
92
|
+
* 4. PATCH revision should be increased when _only_ the template description changes.
|
|
93
|
+
*
|
|
94
|
+
* 5. Adding one or more template attributes is a MINOR change.
|
|
95
|
+
*
|
|
96
|
+
* 6. Removing one or more template attributes is a MAJOR change.
|
|
97
|
+
*
|
|
98
|
+
* @param in_template - The latest template version, as a JSON object.
|
|
99
|
+
* @param in_templatePrevious - The previous template version, as a JSON object. Optional.
|
|
100
|
+
* @returns The validation results. Example:
|
|
101
|
+
*
|
|
102
|
+
* ```json
|
|
103
|
+
* {
|
|
104
|
+
* isValid: false,
|
|
105
|
+
* errors: ['Something went wrong. Validation failed.'],
|
|
106
|
+
* warnings: ['A non-fatal warning'],
|
|
107
|
+
* typeid: 'SomeNamespace:PointID-1.0.0'
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* It's possible for 'isValid' to be true while 'warnings' contains one or more messages.
|
|
112
|
+
*/
|
|
97
113
|
validate(in_template: PropertySchema, in_templatePrevious?: PropertySchema): SchemaValidationResult;
|
|
98
114
|
/**
|
|
99
115
|
* Validates that all templates conform to the following mandatory rules:
|
|
116
|
+
*
|
|
100
117
|
* 1. Must have a typeid attribute.
|
|
118
|
+
*
|
|
101
119
|
* 2. typeid must end in a valid semver string.
|
|
120
|
+
*
|
|
102
121
|
* 3. When both in_template (B) and in_templatePrevious (A) are supplied:
|
|
103
|
-
*
|
|
104
|
-
*
|
|
122
|
+
*
|
|
123
|
+
* - 3a. Semver is identical only if content is identical.
|
|
124
|
+
*
|
|
125
|
+
* - 3b. B's semver >= A's semver
|
|
126
|
+
*
|
|
105
127
|
* Additionally, the following soft rules will produce warnings when violated:
|
|
106
|
-
*
|
|
128
|
+
*
|
|
129
|
+
* 3.5. Elements of sets must eventually inherit from 'NamedProperty'
|
|
130
|
+
*
|
|
107
131
|
* 4. PATCH revision should be increased when _only_ the template description changes.
|
|
132
|
+
*
|
|
108
133
|
* 5. Adding one or more template attributes is a MINOR change.
|
|
134
|
+
*
|
|
109
135
|
* 6. Removing one or more template attributes is a MAJOR change.
|
|
136
|
+
*
|
|
110
137
|
* @param in_template - The latest template version, as a JSON object.
|
|
111
138
|
* @param in_templatePrevious - The previous template version, as a JSON object. Optional.
|
|
112
|
-
* @returns A promise that resolves to the validation results as an object. Example:
|
|
139
|
+
* @returns A promise that resolves to the validation results as an object. Example:
|
|
140
|
+
*
|
|
141
|
+
* ```json
|
|
142
|
+
* {
|
|
113
143
|
* isValid: false,
|
|
114
144
|
* errors: ['Something went wrong. Validation failed.'],
|
|
115
145
|
* warnings: ['A non-fatal warning'],
|
|
116
146
|
* typeid: 'SomeNamespace:PointID-1.0.0'
|
|
117
147
|
* }
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
118
150
|
* It's possible for 'isValid' to be true while 'warnings' contains one or more messages.
|
|
119
151
|
*/
|
|
120
152
|
validateAsync(in_template: PropertySchema, in_templatePrevious?: PropertySchema): Promise<SchemaValidationResult>;
|
|
@@ -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,CAAC;CAAE,CAAC;AAEjD,aAAK,YAAY,GAAG;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;CACtB,CAAC;AAEF,aAAK,cAAc,GAAG,YAAY,EA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