@fluid-experimental/property-changeset 0.52.1 → 0.53.0-46105

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.
@@ -53,7 +53,7 @@ export declare namespace TypeIdHelper {
53
53
  * @param in_typeid - The typeid to process
54
54
  * @returns Returns the typeid without context, the context and if we have an enum type
55
55
  */
56
- function extractContext(in_typeid: string): ExtractedContext;
56
+ function extractContext(in_typeid: string | undefined): ExtractedContext;
57
57
  /**
58
58
  * Creates a collection typeid string from the
59
59
  * typeid and the context.
@@ -71,7 +71,7 @@ export declare namespace TypeIdHelper {
71
71
  * @param in_typeid - The typeid to check
72
72
  * @returns Is this a reference property typeid?
73
73
  */
74
- function isReferenceTypeId(in_typeid: string): boolean;
74
+ function isReferenceTypeId(in_typeid: string | undefined): boolean;
75
75
  /**
76
76
  * Returns the type of the properties a reference points to
77
77
  *
@@ -1 +1 @@
1
- {"version":3,"file":"typeidHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/typeidHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAQH,MAAM,CAAC,OAAO,WAAW,gBAAgB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,CAAC,OAAO,WAAW,gBAAgB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,yBAAiB,YAAY,CAAC;IAC1B;;;;;OAKG;IACH,SAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAU1D;IAED;;;;;MAKE;IACF,SAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE3D;IAED;;;;;OAKG;IACH,SAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAGzD;IAED;;;;OAIG;IACH,SAAgB,cAAc,CA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C7B,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,iBAAiB,GAAG,aAAa,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,EA/PgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QA+P5B;AAAA,CAAC","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\nimport { TemplateSchema as templateSchemaJson, NativeTypes } from \"../templateSchema\";\n// @ts-ignore\nimport { constants } from \"@fluid-experimental/property-common\";\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 Returns the typeid without context, the context and if we have an enum type\n */\n export function extractContext(in_typeid: string): 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): 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(/\\<(.*?)\\>/); // eslint-disable-line\n if (matches !== null && matches.length > 0) {\n return matches[0].replace(/[\\<\\>]/gi, \"\"); // eslint-disable-line\n } else {\n return in_typeid;\n }\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,sDAAsF;AACtF,aAAa;AACb,yEAAgE;AAEhE,MAAM,EAAE,GAAG,EAAE,GAAG,2BAAS,CAAC;AAa1B;;;;GAIG;AACH,IAAiB,YAAY,CA+P5B;AA/PD,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,4BAAe,kBAU9B,CAAA;IAED;;;;;MAKE;IACF,SAAgB,gBAAgB,CAAC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AAA;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,EA/PgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QA+P5B;AAAA,CAAC","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\nimport { TemplateSchema as templateSchemaJson, NativeTypes } from \"../templateSchema\";\n// @ts-ignore\nimport { constants } from \"@fluid-experimental/property-common\";\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 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(/\\<(.*?)\\>/); // eslint-disable-line\n if (matches !== null && matches.length > 0) {\n return matches[0].replace(/[\\<\\>]/gi, \"\"); // eslint-disable-line\n } else {\n return in_typeid;\n }\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"]}
package/dist/index.d.ts CHANGED
@@ -4,11 +4,12 @@
4
4
  */
5
5
  import { ChangeSet, SerializedChangeSet } from "./changeset";
6
6
  import { ArrayChangeSetIterator } from "./changeset_operations/arrayChangesetIterator";
7
- import { TypeIdHelper } from "./helpers/typeidHelper";
7
+ import { ExtractedContext, TypeIdHelper } from "./helpers/typeidHelper";
8
8
  import { PathHelper } from "./pathHelper";
9
9
  import { rebaseToRemoteChanges } from "./rebase";
10
10
  import { TemplateSchema } from "./templateSchema";
11
11
  import { TemplateValidator } from "./templateValidator";
12
12
  import { Utils } from "./utils";
13
- export { TemplateSchema, TemplateValidator, TypeIdHelper, ChangeSet, Utils, PathHelper, ArrayChangeSetIterator, rebaseToRemoteChanges, SerializedChangeSet };
13
+ declare const TraversalContext: typeof Utils.TraversalContext;
14
+ export { TemplateSchema, TemplateValidator, TypeIdHelper, ChangeSet, Utils, PathHelper, ArrayChangeSetIterator, rebaseToRemoteChanges, SerializedChangeSet, TraversalContext, ExtractedContext };
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EACH,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,KAAK,EACL,UAAU,EACV,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACtB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAC,MAAM,SAAS,CAAC;AAE/B,QAAA,MAAQ,gBAAgB,+BAAU,CAAC;AAEnC,OAAO,EACH,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,KAAK,EACL,UAAU,EACV,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EACnB,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rebaseToRemoteChanges = exports.ArrayChangeSetIterator = exports.PathHelper = exports.Utils = exports.ChangeSet = exports.TypeIdHelper = exports.TemplateValidator = exports.TemplateSchema = void 0;
3
+ exports.TraversalContext = exports.rebaseToRemoteChanges = exports.ArrayChangeSetIterator = exports.PathHelper = exports.Utils = exports.ChangeSet = exports.TypeIdHelper = exports.TemplateValidator = exports.TemplateSchema = void 0;
4
4
  /*!
5
5
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
6
6
  * Licensed under the MIT License.
@@ -21,4 +21,6 @@ const templateValidator_1 = require("./templateValidator");
21
21
  Object.defineProperty(exports, "TemplateValidator", { enumerable: true, get: function () { return templateValidator_1.TemplateValidator; } });
22
22
  const utils_1 = require("./utils");
23
23
  Object.defineProperty(exports, "Utils", { enumerable: true, get: function () { return utils_1.Utils; } });
24
+ const { TraversalContext } = utils_1.Utils;
25
+ exports.TraversalContext = TraversalContext;
24
26
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2CAA6D;AAazD,0FAbK,qBAAS,OAaL;AAZb,0FAAuF;AAenF,uGAfK,+CAAsB,OAeL;AAd1B,yDAAsD;AAUlD,6FAVK,2BAAY,OAUL;AAThB,6CAA0C;AAYtC,2FAZK,uBAAU,OAYL;AAXd,qCAAiD;AAa7C,sGAbK,8BAAqB,OAaL;AAZzB,qDAAkD;AAK9C,+FALK,+BAAc,OAKL;AAJlB,2DAAwD;AAKpD,kGALK,qCAAiB,OAKL;AAJrB,mCAAgC;AAO5B,sFAPK,aAAK,OAOL","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ChangeSet, SerializedChangeSet } from \"./changeset\";\nimport { ArrayChangeSetIterator } from \"./changeset_operations/arrayChangesetIterator\";\nimport { TypeIdHelper } from \"./helpers/typeidHelper\";\nimport { PathHelper } from \"./pathHelper\";\nimport { rebaseToRemoteChanges } from \"./rebase\";\nimport { TemplateSchema } from \"./templateSchema\";\nimport { TemplateValidator } from \"./templateValidator\";\nimport { Utils } from \"./utils\";\n\nexport {\n TemplateSchema,\n TemplateValidator,\n TypeIdHelper,\n ChangeSet,\n Utils,\n PathHelper,\n ArrayChangeSetIterator,\n rebaseToRemoteChanges,\n SerializedChangeSet\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2CAA6D;AAezD,0FAfK,qBAAS,OAeL;AAdb,0FAAuF;AAiBnF,uGAjBK,+CAAsB,OAiBL;AAhB1B,yDAAwE;AAYpE,6FAZuB,2BAAY,OAYvB;AAXhB,6CAA0C;AActC,2FAdK,uBAAU,OAcL;AAbd,qCAAiD;AAe7C,sGAfK,8BAAqB,OAeL;AAdzB,qDAAkD;AAO9C,+FAPK,+BAAc,OAOL;AANlB,2DAAwD;AAOpD,kGAPK,qCAAiB,OAOL;AANrB,mCAA+B;AAS3B,sFATK,aAAK,OASL;AAPT,MAAM,EAAE,gBAAgB,EAAE,GAAG,aAAK,CAAC;AAY/B,4CAAgB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ChangeSet, SerializedChangeSet } from \"./changeset\";\nimport { ArrayChangeSetIterator } from \"./changeset_operations/arrayChangesetIterator\";\nimport { ExtractedContext, TypeIdHelper } from \"./helpers/typeidHelper\";\nimport { PathHelper } from \"./pathHelper\";\nimport { rebaseToRemoteChanges } from \"./rebase\";\nimport { TemplateSchema } from \"./templateSchema\";\nimport { TemplateValidator } from \"./templateValidator\";\nimport { Utils} from \"./utils\";\n\nconst { TraversalContext } = Utils;\n\nexport {\n TemplateSchema,\n TemplateValidator,\n TypeIdHelper,\n ChangeSet,\n Utils,\n PathHelper,\n ArrayChangeSetIterator,\n rebaseToRemoteChanges,\n SerializedChangeSet,\n TraversalContext,\n ExtractedContext\n};\n"]}
@@ -287,8 +287,8 @@
287
287
  "affectsGlobalScope": false
288
288
  },
289
289
  "../helpers/typeidHelper.d.ts": {
290
- "version": "ef2e322f8fb91029614702bdfe0d711a0b0305bb8d52ee04bddaeafc0106bb56",
291
- "signature": "ef2e322f8fb91029614702bdfe0d711a0b0305bb8d52ee04bddaeafc0106bb56",
290
+ "version": "b08594f0655ff58c74cee26a7ca80e0cc640dc567c190f51a2cdda3db04b89fb",
291
+ "signature": "b08594f0655ff58c74cee26a7ca80e0cc640dc567c190f51a2cdda3db04b89fb",
292
292
  "affectsGlobalScope": false
293
293
  },
294
294
  "../../src/test/schemaValidator.ts": {
package/dist/utils.d.ts CHANGED
@@ -2,14 +2,14 @@ import { ErrorCallback } from "async";
2
2
  import { SerializedChangeSet } from "./changeset";
3
3
  import { ExtractedContext } from "./helpers/typeidHelper";
4
4
  import { PathTree } from "./pathHelper";
5
- declare type OperationType = "modify" | "insert" | "remove";
6
- declare type PropertyContainerType = "array" | "map" | "set" | "root" | "NodeProperty" | "template";
7
5
  /**
8
6
  * Utils
9
7
  * @alias property-changeset.Utils
10
8
  * @class
11
9
  */
12
10
  export declare namespace Utils {
11
+ export type OperationType = "modify" | "insert" | "remove";
12
+ export type PropertyContainerType = "array" | "map" | "set" | "root" | "NodeProperty" | "template";
13
13
  interface TraversalOptions {
14
14
  /**
15
15
  * The(pre-order) callback function that is invoked for each property
@@ -34,6 +34,12 @@ export declare namespace Utils {
34
34
  */
35
35
  rootTypeid?: string;
36
36
  }
37
+ interface TraversalContextParams {
38
+ fullPostPath?: string;
39
+ fullPath?: string;
40
+ propertyContainerType?: PropertyContainerType;
41
+ operationType?: OperationType;
42
+ }
37
43
  /**
38
44
  * Provides traversal information when parsing ChangeSets via the traverseChangeSetRecursively function.
39
45
  */
@@ -59,7 +65,7 @@ export declare namespace Utils {
59
65
  _containerStack: string[];
60
66
  _userStack: any[];
61
67
  _operationType: OperationType;
62
- constructor();
68
+ constructor(params?: TraversalContextParams);
63
69
  /**
64
70
  * @returns Whether it's traversing or not
65
71
  */
@@ -246,9 +252,7 @@ export declare namespace Utils {
246
252
  *
247
253
  * At least one of the pre- or post-order callbacks must be specified. Both may be specified as well.
248
254
  *
249
- * @param {property-changeset.SerializedChangeset} in_changeSet - The ChangeSet to process
250
-
251
- * @alias property-changeset.Utils.traverseChangeSetRecursively
255
+ * @param in_changeSet - The ChangeSet to process
252
256
  */
253
257
  export function traverseChangeSetRecursively(in_changeSet: SerializedChangeSet, in_params?: TraversalOptions): void;
254
258
  /**
@@ -257,7 +261,7 @@ export declare namespace Utils {
257
261
  * At least one of the pre- or post-order callbacks must be specified. Both may be specified as well.
258
262
  *
259
263
  * @param in_changeSet - The ChangeSet to process
260
- * @param {function} [in_finalizer] - A callback when traversal is completed
264
+ * @param in_finalizer - A callback when traversal is completed
261
265
  *
262
266
  */
263
267
  export function traverseChangeSetRecursivelyAsync(in_changeSet: SerializedChangeSet, in_params?: TraversalOptions, in_finalizer?: (any: any) => any): void;
@@ -496,5 +500,4 @@ export declare namespace Utils {
496
500
  };
497
501
  export {};
498
502
  }
499
- export {};
500
503
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAA4B,aAAa,EAA+B,MAAM,OAAO,CAAC;AAW7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAgB,MAAM,wBAAwB,CAAC;AAExE,OAAO,EAAc,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKpD,aAAK,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACpD,aAAK,qBAAqB,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,cAAc,GAAG,UAAU,CAAC;AAK5F;;;;EAIE;AACF,yBAAiB,KAAK,CAAC;IAEnB,UAAU,gBAAgB;QACtB;;WAEG;QACH,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,GAAG,CAAC;QACjD;;WAEG;QACH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,GAAG,CAAC;QAClD;;WAEG;QACH,QAAQ,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;SAAE,CAAC;QAClC;;WAEG;QACH,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B;;WAEG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;KACvB;IAwvBD;;OAEG;IACH,MAAM,OAAO,gBAAgB;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAA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AAO,CAAC;QAAC,aAAa,CAAC,EAAE,aAAa,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;KAAsE,QAiJnL;IAED,KAAK,SAAS,GAAG,MAAM,EAAE,GAAG,QAAQ,CAAC;IAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,MAAM,UAAU,2BAA2B,CAAC,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAE,SAAS,GAAG,mBAAmB,CAuMvH;IAED;;;;;;;OAOG;IACH,MAAM,UAAU,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,QAAQ,CAuCnE;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,MAAM,UAAU,yBAAyB,CAAC,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,mBAAmB,CAyBpH;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,UAAU,yBAAyB,CAAC,YAAY,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;KAAE,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAiBlN;;CACJ"}
package/dist/utils.js CHANGED
@@ -647,8 +647,8 @@ var Utils;
647
647
  * Provides traversal information when parsing ChangeSets via the traverseChangeSetRecursively function.
648
648
  */
649
649
  class TraversalContext {
650
- constructor() {
651
- this._fullPath = "";
650
+ constructor(params = {}) {
651
+ this._fullPath = params.fullPath || "";
652
652
  this._lastSegment = "";
653
653
  this._lastSegmentString = "";
654
654
  this._typeid = undefined;
@@ -657,19 +657,19 @@ var Utils;
657
657
  this._traversalStopped = false;
658
658
  this._nestedChangeSet = undefined;
659
659
  this._parentNestedChangeSet = undefined;
660
- this._propertyContainerType = "root";
660
+ this._propertyContainerType = params.propertyContainerType || "root";
661
661
  this._arrayLocalIndex = undefined;
662
662
  this._arrayOperationIndex = undefined;
663
663
  this._arrayOperationOffset = undefined;
664
664
  this._arrayIteratorOffset = undefined;
665
- this._fullPostPath = "";
665
+ this._fullPostPath = params.fullPostPath || "";
666
666
  this._stackDepth = 0;
667
667
  this._typeStack = [];
668
668
  this._parentStack = [];
669
669
  this._containerStack = [];
670
670
  this._userStack = [];
671
671
  // By default, operations are modify operations
672
- this._operationType = "modify";
672
+ this._operationType = params.operationType || "modify";
673
673
  }
674
674
  /**
675
675
  * @returns Whether it's traversing or not
@@ -979,9 +979,7 @@ var Utils;
979
979
  *
980
980
  * At least one of the pre- or post-order callbacks must be specified. Both may be specified as well.
981
981
  *
982
- * @param {property-changeset.SerializedChangeset} in_changeSet - The ChangeSet to process
983
-
984
- * @alias property-changeset.Utils.traverseChangeSetRecursively
982
+ * @param in_changeSet - The ChangeSet to process
985
983
  */
986
984
  function traverseChangeSetRecursively(in_changeSet, in_params) {
987
985
  property_common_1.ConsoleUtils.assert(in_params.preCallback || in_params.postCallback, MSG.MISSING_PRE_POST_CALLBACK);
@@ -1018,7 +1016,7 @@ var Utils;
1018
1016
  * At least one of the pre- or post-order callbacks must be specified. Both may be specified as well.
1019
1017
  *
1020
1018
  * @param in_changeSet - The ChangeSet to process
1021
- * @param {function} [in_finalizer] - A callback when traversal is completed
1019
+ * @param in_finalizer - A callback when traversal is completed
1022
1020
  *
1023
1021
  */
1024
1022
  function traverseChangeSetRecursivelyAsync(in_changeSet, in_params, in_finalizer) {