@fluid-experimental/property-properties 1.1.0 → 1.2.0

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.
Files changed (34) hide show
  1. package/dist/properties/abstractStaticCollectionProperty.d.ts +1 -1
  2. package/dist/properties/abstractStaticCollectionProperty.js +1 -1
  3. package/dist/properties/abstractStaticCollectionProperty.js.map +1 -1
  4. package/dist/properties/arrayProperty.d.ts +2 -1
  5. package/dist/properties/arrayProperty.d.ts.map +1 -1
  6. package/dist/properties/arrayProperty.js +5 -2
  7. package/dist/properties/arrayProperty.js.map +1 -1
  8. package/dist/properties/mapProperty.d.ts +2 -1
  9. package/dist/properties/mapProperty.d.ts.map +1 -1
  10. package/dist/properties/mapProperty.js +4 -2
  11. package/dist/properties/mapProperty.js.map +1 -1
  12. package/dist/properties/setProperty.d.ts +1 -1
  13. package/dist/properties/setProperty.js +2 -2
  14. package/dist/properties/setProperty.js.map +1 -1
  15. package/dist/properties/stringProperty.js +1 -1
  16. package/dist/properties/stringProperty.js.map +1 -1
  17. package/dist/test/tsconfig.tsbuildinfo +1 -1
  18. package/lib/properties/abstractStaticCollectionProperty.d.ts +1 -1
  19. package/lib/properties/abstractStaticCollectionProperty.js +1 -1
  20. package/lib/properties/abstractStaticCollectionProperty.js.map +1 -1
  21. package/lib/properties/arrayProperty.d.ts +2 -1
  22. package/lib/properties/arrayProperty.d.ts.map +1 -1
  23. package/lib/properties/arrayProperty.js +5 -2
  24. package/lib/properties/arrayProperty.js.map +1 -1
  25. package/lib/properties/mapProperty.d.ts +2 -1
  26. package/lib/properties/mapProperty.d.ts.map +1 -1
  27. package/lib/properties/mapProperty.js +4 -2
  28. package/lib/properties/mapProperty.js.map +1 -1
  29. package/lib/properties/setProperty.d.ts +1 -1
  30. package/lib/properties/setProperty.js +2 -2
  31. package/lib/properties/setProperty.js.map +1 -1
  32. package/lib/properties/stringProperty.js +1 -1
  33. package/lib/properties/stringProperty.js.map +1 -1
  34. package/package.json +4 -4
@@ -69,10 +69,11 @@ class MapProperty extends IndexedCollectionBaseProperty {
69
69
  /**
70
70
  * Sets multiple values in a map.
71
71
  *
72
+ * See {@link MapProperty.setValues}
73
+ *
72
74
  * @param {object} in_values to assign to the collection
73
75
  * @param {Boolean} in_typed - If the map's items have a typeid and a value then create the
74
76
  * properties with that typeid, else use the set's typeid (support polymorphic items).
75
- * @see {setValues}
76
77
  * @private
77
78
  */
78
79
  _setValuesInternal(in_values, in_typed) {
@@ -120,11 +121,12 @@ class MapProperty extends IndexedCollectionBaseProperty {
120
121
  /**
121
122
  * Sets multiple values in a map.
122
123
  *
124
+ * See {@link MapProperty.setValues}
125
+ *
123
126
  * @param {object} in_values to assign to the collection
124
127
  * @param {Bool} in_typed - Whether the values are typed/polymorphic.
125
128
  * @param {Bool} in_initial - Whether we are setting default/initial values
126
129
  * or if the function is called directly with the values to set.
127
- * @see {setValues}
128
130
  * @override
129
131
  */
130
132
  _setValues(in_values, in_typed, in_initial) {
@@ -1 +1 @@
1
- {"version":3,"file":"mapProperty.js","sourceRoot":"","sources":["../../src/properties/mapProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACvF,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACxE,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAC3F,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACnD,MAAM,EAAE,6BAA6B,EAAE,GAAG,OAAO,CAAC,iCAAiC,CAAC,CAAC;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SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEzE,IAAI,KAAK,KAAK,SAAS,EAAE;YACrB,OAAO,KAAK,CAAC;SAChB;aAAM;YACH,OAAO,IAAI,CAAC,MAAM,CAAC;SACtB;IACL,CAAC;IAED;;OAEG;IACH,KAAK;QACD,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,UAAS,EAAE;YAC7B,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AA3XD,kCA2XC;AAED,WAAW,CAAC,SAAS,CAAC,OAAO,GAAG,cAAc,CAAC;AAC/C,WAAW,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Definition of the map property class\n */\nconst { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst { ConsoleUtils } = require('@fluid-experimental/property-common');\nconst _ = require('lodash');\nconst { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');\nconst { BaseProperty } = require('./baseProperty');\nconst { IndexedCollectionBaseProperty } = require('./indexedCollectionBaseProperty');\nconst { LazyLoadedProperties: Property } = require('./lazyLoadedProperties');\n\nconst PATH_TOKENS = BaseProperty.PATH_TOKENS;\n\n/**\n * typedef {property-properties.BaseProperty|string|number|boolean} property-properties.MapProperty~MapValueType\n *\n * The type of the values that are set/inserted into the map. Depending on the type of the map, these can either\n * be property objects or primitive values\n */\n\n/**\n * A MapProperty is a collection class that can contain an dictionary that maps from strings to properties.\n */\nexport class MapProperty extends IndexedCollectionBaseProperty {\n /**\n * @param {Object} in_params - Input parameters for property creation\n * @param {string|undefined} in_scope - The scope in which the map typeid is defined\n * @constructor\n * @protected\n * @extends property-properties.IndexedCollectionBaseProperty\n * @alias property-properties.MapProperty\n * @category Maps\n */\n constructor(in_params, in_scope) {\n super(in_params);\n\n this._scope = in_scope;\n this._contextKeyType = in_params.contextKeyType || 'string';\n\n /** Contains the actual entries of the map */\n this._dynamicChildren = {};\n }\n\n /**\n * Returns the full property type identifier for the ChangeSet including the enum type id\n * @param {boolean} [in_hideCollection=false] - if true the collection type (if applicable) will be omitted\n * @return {string} The typeid\n */\n getFullTypeid(in_hideCollection = false) {\n if (in_hideCollection) {\n return this._typeid;\n } else {\n return TypeIdHelper.createSerializationTypeId(this._typeid, 'map');\n }\n }\n\n /**\n * Is this property a leaf node with regard to flattening?\n *\n * TODO: Which semantics should flattening have? It stops at primitive types and collections?\n *\n * @return {boolean} Is it a leaf with regard to flattening?\n */\n _isFlattenLeaf() {\n return true;\n }\n\n /**\n * Sets multiple values in a map.\n *\n * @param {object} in_values to assign to the collection\n * @param {Boolean} in_typed - If the map's items have a typeid and a value then create the\n * properties with that typeid, else use the set's typeid (support polymorphic items).\n * @see {setValues}\n * @private\n */\n _setValuesInternal(in_values, in_typed) {\n if (this._containsPrimitiveTypes) {\n var that = this;\n _.each(in_values, function(value, key) {\n if (that.has(key)) {\n that.remove(key);\n }\n\n that.insert(key, value);\n });\n } else {\n var that = this;\n _.each(in_values, function(value, key) {\n var property = that.get(String(key), { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER });\n // if key exists in set replace its value else insert a new key/value\n if (property) {\n if (property instanceof Property.ValueProperty || property instanceof Property.StringProperty) {\n property.setValue(value);\n } else if (property instanceof BaseProperty && _.isObject(value)) {\n property._setValues(value, false, false);\n } else {\n throw new TypeError(MSG.SET_VALUES_PATH_INVALID + key);\n }\n } else {\n if (value instanceof BaseProperty) {\n that.insert(key, value);\n } else {\n if (in_typed) {\n that.insert(key, Property.PropertyFactory._createProperty(\n value.typeid || that._typeid, null, value.value, that._getScope()));\n } else {\n that.insert(key, Property.PropertyFactory._createProperty(\n that._typeid, null, value, that._getScope()));\n }\n }\n }\n });\n }\n }\n\n /**\n * Sets multiple values in a map.\n *\n * @param {object} in_values to assign to the collection\n * @param {Bool} in_typed - Whether the values are typed/polymorphic.\n * @param {Bool} in_initial - Whether we are setting default/initial values\n * or if the function is called directly with the values to set.\n * @see {setValues}\n * @override\n */\n _setValues(in_values, in_typed, in_initial) {\n if (in_initial) {\n this.clear();\n }\n\n this._setValuesInternal(in_values, in_typed);\n }\n\n /**\n * Sets multiple values in a map.\n *\n * @param {object} in_values to assign to the collection\n * @throws if one of the path in in_values does not exist in this property\n * @throws if trying to set a value to a path that leads to a Property other than ValueProperty or StringProperty\n * @override\n */\n setValues(in_values) {\n var checkoutView = this._getCheckoutView();\n if (checkoutView !== undefined) {\n checkoutView.pushNotificationDelayScope();\n this._setValues(in_values, false, false);\n checkoutView.popNotificationDelayScope();\n } else {\n this._setValues(in_values, false, false);\n }\n }\n\n /**\n * Returns an object with all the nested values contained in this property\n * @return {object} an object representing the values of your property\n * for example: {\n 'firstString': {\n 'stringValue': 'test1'\n },\n 'secondString': {\n 'stringValue': 'test2'\n }\n }\n */\n getValues() {\n var ids = this.getIds();\n var result = {};\n for (var i = 0; i < ids.length; i++) {\n var child = this.get(ids[i]);\n if (child.isPrimitiveType()) {\n result[ids[i]] = this.get(ids[i]).getValue();\n } else {\n result[ids[i]] = child.getValues();\n }\n }\n return result;\n }\n\n /**\n * Returns the path segment for a child\n *\n * @param {property-properties.BaseProperty} in_childNode - The child for which the path is returned\n *\n * @return {string} The path segment to resolve the child property under this property\n * @protected\n */\n _getPathSegmentForChildNode(in_childNode) {\n return '[' + PathHelper.quotePathSegmentIfNeeded(in_childNode._id) + ']';\n }\n\n /**\n * Resolves a direct child node based on the given path segment\n *\n * @param {String} in_segment - The path segment to resolve\n * @param {property-properties.PathHelper.TOKEN_TYPES} in_segmentType - The type of segment in the tokenized path\n *\n * @return {property-properties.BaseProperty|undefined} The child property that has been resolved\n * @protected\n */\n _resolvePathSegment(in_segment, in_segmentType) {\n // Base Properties only support paths separated via dots\n if (in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN) {\n return this._dynamicChildren[in_segment];\n } else {\n return AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);\n }\n }\n\n /**\n * Inserts a property or value into the map\n *\n * Note: This will trigger an exception when this key already exists in the map. If you want to overwrite\n * existing entries you can use the set function.\n *\n * @param {string} in_key - The key under which the entry is added\n * @param {property-properties.Property} in_property - The property to insert\n * @throws if the property already exists\n * @throws if the property already has a parent\n * @throws if in_key is not a string\n * @throws if the property is a root property\n */\n insert(in_key, in_property) {\n ConsoleUtils.assert(_.isString(in_key), MSG.KEY_NOT_STRING + in_key);\n if (this._dynamicChildren[in_key] !== undefined) {\n throw new Error(MSG.PROPERTY_ALREADY_EXISTS + in_key);\n }\n if (in_property instanceof BaseProperty) {\n in_property._validateInsertIn(this);\n // Set the ID of the entry, to make sure it corresponds to the used key\n in_property._setId(in_key);\n\n // Insert the entry into the collection\n this._insert(in_key, in_property, true);\n } else {\n throw new TypeError(MSG.NONVALUE_MAP_INSERT_PROP);\n }\n }\n\n /**\n * Removes the entry with the given key from the map\n *\n * @param {string} in_key - The key of the entry to remove from the map\n * @throws if trying to remove an entry that does not exist\n * @return {*} the item removed\n */\n remove(in_key) {\n var item = this.get(in_key);\n this._removeByKey(in_key, true);\n return item;\n }\n\n /**\n * Sets the entry with the given key to the property passed in\n *\n * Note: this will overwrite an already existing value\n *\n * @param {string} in_key - The key under which the entry is stored\n * @param {property-properties.MapProperty~MapValueType} in_property - The property to store in the map\n * @throws if in_property is not a property\n * @throws if trying to insert a property that has a parent\n * @throws if in_key is not a string or a number\n */\n set(in_key, in_property) {\n this._checkIsNotReadOnly(true);\n if (this._dynamicChildren[in_key] !== in_property) {\n if (this._containsPrimitiveTypes === false && in_property.getParent() !== undefined) {\n throw new Error(MSG.INSERTED_ENTRY_WITH_PARENT);\n }\n if (this._dynamicChildren[in_key] !== undefined) {\n this._removeByKey(in_key, false);\n }\n // Set the ID of the entry, to make sure it corresponds to the used key\n if (this._containsPrimitiveTypes === false) {\n in_property._setId(in_key);\n }\n this._insert(in_key, in_property, false);\n\n // Make one final report\n this._reportDirtinessToView();\n }\n }\n\n /**\n * Returns an Object with all the entries of the map.\n * Contrary ot .getValues, for Property Maps, this will return the Property, not an object with their nested values.\n * WARNING: This is a direct access to the internal data-structure and the collection MUST NOT be modified. It is\n * read only for fast access and iteration. Insertion and deletion MUST be done via the insert and remove functions\n * of this class.\n *\n * @return {Object} The map with all entries in the map.\n */\n getEntriesReadOnly() {\n return this._dynamicChildren;\n }\n\n /**\n * Returns the collection entry with the given key\n *\n * @param {string|array<string>} in_ids - key of the entry to return or an array of keys\n * if an array is passed, the .get function will be performed on each id in sequence\n * for example .get(['position','x']) is equivalent to .get('position').get('x').\n * If .get resolves to a ReferenceProperty, it will return the property that the ReferenceProperty\n * refers to.\n * @param {Object} in_options - parameter object\n * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS]\n * How should this function behave during reference resolution?\n *\n * @return {property-properties.Property|*|undefined} The entry in the collection or undefined\n * if none could be found\n */\n get(in_ids, in_options) {\n if (_.isArray(in_ids)) {\n // Forward handling of arrays to the BaseProperty function\n return AbstractStaticCollectionProperty.prototype.get.call(this, in_ids, in_options);\n } else {\n in_options = in_options || {};\n in_options.referenceResolutionMode =\n in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :\n in_options.referenceResolutionMode;\n\n var prop = this;\n if (in_ids === PATH_TOKENS.ROOT) {\n prop = prop.getRoot();\n } else if (in_ids === PATH_TOKENS.UP) {\n prop = prop.getParent();\n } else if (in_ids === PATH_TOKENS.REF) {\n throw new Error(MSG.NO_GET_DEREFERENCE_ONLY);\n } else {\n prop = prop._dynamicChildren[in_ids];\n }\n\n // Handle automatic reference resolution\n if (in_options.referenceResolutionMode === BaseProperty.REFERENCE_RESOLUTION.ALWAYS) {\n if (prop instanceof Property.ReferenceProperty) {\n prop = prop.ref;\n }\n }\n\n return prop;\n }\n }\n\n /**\n * Checks whether an entry with the given name exists\n *\n * @param {string} in_id - Name of the property\n * @return {boolean} True if the property exists, otherwise false.\n */\n has(in_id) {\n return this._dynamicChildren[in_id] !== undefined;\n }\n\n /**\n * Returns all entries of the map as an array.\n *\n * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n *\n * @return {Array.<property-properties.BaseProperty | *>} Array with all entries of the map. This array\n * is a shallow copy which can be modified by the caller without effects on the map.\n */\n getAsArray() {\n return _.values(this._dynamicChildren);\n }\n\n /**\n * Returns all keys found in the map\n *\n * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n *\n * @return {Array.<string>} The keys\n */\n getIds() {\n return Object.keys(this._dynamicChildren);\n }\n\n /**\n * Get the scope to which this property belongs to.\n * @return {string|undefined} The guid representing the scope in which the\n * map belongs to. If there is a workspace scope return it, else return the scope of this map.\n * @override\n * @private\n */\n _getScope() {\n var scope = IndexedCollectionBaseProperty.prototype._getScope.call(this);\n\n if (scope !== undefined) {\n return scope;\n } else {\n return this._scope;\n }\n }\n\n /**\n * Deletes all values from the Map\n */\n clear() {\n var that = this;\n this.getIds().forEach(function(id) {\n that.remove(id);\n });\n }\n}\n\nMapProperty.prototype._typeid = 'BaseProperty';\nMapProperty.prototype._context = 'map';\n"]}
1
+ {"version":3,"file":"mapProperty.js","sourceRoot":"","sources":["../../src/properties/mapProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACvF,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACxE,MAAM,CAAC,GAAG,OAAO,C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M,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;OAMG;IACH,MAAM;QACF,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;OAMG;IACH,SAAS;QACL,IAAI,KAAK,GAAG,6BAA6B,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEzE,IAAI,KAAK,KAAK,SAAS,EAAE;YACrB,OAAO,KAAK,CAAC;SAChB;aAAM;YACH,OAAO,IAAI,CAAC,MAAM,CAAC;SACtB;IACL,CAAC;IAED;;OAEG;IACH,KAAK;QACD,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,UAAS,EAAE;YAC7B,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AA7XD,kCA6XC;AAED,WAAW,CAAC,SAAS,CAAC,OAAO,GAAG,cAAc,CAAC;AAC/C,WAAW,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Definition of the map property class\n */\nconst { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst { ConsoleUtils } = require('@fluid-experimental/property-common');\nconst _ = require('lodash');\nconst { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');\nconst { BaseProperty } = require('./baseProperty');\nconst { IndexedCollectionBaseProperty } = require('./indexedCollectionBaseProperty');\nconst { LazyLoadedProperties: Property } = require('./lazyLoadedProperties');\n\nconst PATH_TOKENS = BaseProperty.PATH_TOKENS;\n\n/**\n * typedef {property-properties.BaseProperty|string|number|boolean} property-properties.MapProperty~MapValueType\n *\n * The type of the values that are set/inserted into the map. Depending on the type of the map, these can either\n * be property objects or primitive values\n */\n\n/**\n * A MapProperty is a collection class that can contain an dictionary that maps from strings to properties.\n */\nexport class MapProperty extends IndexedCollectionBaseProperty {\n /**\n * @param {Object} in_params - Input parameters for property creation\n * @param {string|undefined} in_scope - The scope in which the map typeid is defined\n * @constructor\n * @protected\n * @extends property-properties.IndexedCollectionBaseProperty\n * @alias property-properties.MapProperty\n * @category Maps\n */\n constructor(in_params, in_scope) {\n super(in_params);\n\n this._scope = in_scope;\n this._contextKeyType = in_params.contextKeyType || 'string';\n\n /** Contains the actual entries of the map */\n this._dynamicChildren = {};\n }\n\n /**\n * Returns the full property type identifier for the ChangeSet including the enum type id\n * @param {boolean} [in_hideCollection=false] - if true the collection type (if applicable) will be omitted\n * @return {string} The typeid\n */\n getFullTypeid(in_hideCollection = false) {\n if (in_hideCollection) {\n return this._typeid;\n } else {\n return TypeIdHelper.createSerializationTypeId(this._typeid, 'map');\n }\n }\n\n /**\n * Is this property a leaf node with regard to flattening?\n *\n * TODO: Which semantics should flattening have? It stops at primitive types and collections?\n *\n * @return {boolean} Is it a leaf with regard to flattening?\n */\n _isFlattenLeaf() {\n return true;\n }\n\n /**\n * Sets multiple values in a map.\n *\n * See {@link MapProperty.setValues}\n *\n * @param {object} in_values to assign to the collection\n * @param {Boolean} in_typed - If the map's items have a typeid and a value then create the\n * properties with that typeid, else use the set's typeid (support polymorphic items).\n * @private\n */\n _setValuesInternal(in_values, in_typed) {\n if (this._containsPrimitiveTypes) {\n var that = this;\n _.each(in_values, function(value, key) {\n if (that.has(key)) {\n that.remove(key);\n }\n\n that.insert(key, value);\n });\n } else {\n var that = this;\n _.each(in_values, function(value, key) {\n var property = that.get(String(key), { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER });\n // if key exists in set replace its value else insert a new key/value\n if (property) {\n if (property instanceof Property.ValueProperty || property instanceof Property.StringProperty) {\n property.setValue(value);\n } else if (property instanceof BaseProperty && _.isObject(value)) {\n property._setValues(value, false, false);\n } else {\n throw new TypeError(MSG.SET_VALUES_PATH_INVALID + key);\n }\n } else {\n if (value instanceof BaseProperty) {\n that.insert(key, value);\n } else {\n if (in_typed) {\n that.insert(key, Property.PropertyFactory._createProperty(\n value.typeid || that._typeid, null, value.value, that._getScope()));\n } else {\n that.insert(key, Property.PropertyFactory._createProperty(\n that._typeid, null, value, that._getScope()));\n }\n }\n }\n });\n }\n }\n\n /**\n * Sets multiple values in a map.\n *\n * See {@link MapProperty.setValues}\n *\n * @param {object} in_values to assign to the collection\n * @param {Bool} in_typed - Whether the values are typed/polymorphic.\n * @param {Bool} in_initial - Whether we are setting default/initial values\n * or if the function is called directly with the values to set.\n * @override\n */\n _setValues(in_values, in_typed, in_initial) {\n if (in_initial) {\n this.clear();\n }\n\n this._setValuesInternal(in_values, in_typed);\n }\n\n /**\n * Sets multiple values in a map.\n *\n * @param {object} in_values to assign to the collection\n * @throws if one of the path in in_values does not exist in this property\n * @throws if trying to set a value to a path that leads to a Property other than ValueProperty or StringProperty\n * @override\n */\n setValues(in_values) {\n var checkoutView = this._getCheckoutView();\n if (checkoutView !== undefined) {\n checkoutView.pushNotificationDelayScope();\n this._setValues(in_values, false, false);\n checkoutView.popNotificationDelayScope();\n } else {\n this._setValues(in_values, false, false);\n }\n }\n\n /**\n * Returns an object with all the nested values contained in this property\n * @return {object} an object representing the values of your property\n * for example: {\n 'firstString': {\n 'stringValue': 'test1'\n },\n 'secondString': {\n 'stringValue': 'test2'\n }\n }\n */\n getValues() {\n var ids = this.getIds();\n var result = {};\n for (var i = 0; i < ids.length; i++) {\n var child = this.get(ids[i]);\n if (child.isPrimitiveType()) {\n result[ids[i]] = this.get(ids[i]).getValue();\n } else {\n result[ids[i]] = child.getValues();\n }\n }\n return result;\n }\n\n /**\n * Returns the path segment for a child\n *\n * @param {property-properties.BaseProperty} in_childNode - The child for which the path is returned\n *\n * @return {string} The path segment to resolve the child property under this property\n * @protected\n */\n _getPathSegmentForChildNode(in_childNode) {\n return '[' + PathHelper.quotePathSegmentIfNeeded(in_childNode._id) + ']';\n }\n\n /**\n * Resolves a direct child node based on the given path segment\n *\n * @param {String} in_segment - The path segment to resolve\n * @param {property-properties.PathHelper.TOKEN_TYPES} in_segmentType - The type of segment in the tokenized path\n *\n * @return {property-properties.BaseProperty|undefined} The child property that has been resolved\n * @protected\n */\n _resolvePathSegment(in_segment, in_segmentType) {\n // Base Properties only support paths separated via dots\n if (in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN) {\n return this._dynamicChildren[in_segment];\n } else {\n return AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);\n }\n }\n\n /**\n * Inserts a property or value into the map\n *\n * Note: This will trigger an exception when this key already exists in the map. If you want to overwrite\n * existing entries you can use the set function.\n *\n * @param {string} in_key - The key under which the entry is added\n * @param {property-properties.Property} in_property - The property to insert\n * @throws if the property already exists\n * @throws if the property already has a parent\n * @throws if in_key is not a string\n * @throws if the property is a root property\n */\n insert(in_key, in_property) {\n ConsoleUtils.assert(_.isString(in_key), MSG.KEY_NOT_STRING + in_key);\n if (this._dynamicChildren[in_key] !== undefined) {\n throw new Error(MSG.PROPERTY_ALREADY_EXISTS + in_key);\n }\n if (in_property instanceof BaseProperty) {\n in_property._validateInsertIn(this);\n // Set the ID of the entry, to make sure it corresponds to the used key\n in_property._setId(in_key);\n\n // Insert the entry into the collection\n this._insert(in_key, in_property, true);\n } else {\n throw new TypeError(MSG.NONVALUE_MAP_INSERT_PROP);\n }\n }\n\n /**\n * Removes the entry with the given key from the map\n *\n * @param {string} in_key - The key of the entry to remove from the map\n * @throws if trying to remove an entry that does not exist\n * @return {*} the item removed\n */\n remove(in_key) {\n var item = this.get(in_key);\n this._removeByKey(in_key, true);\n return item;\n }\n\n /**\n * Sets the entry with the given key to the property passed in\n *\n * Note: this will overwrite an already existing value\n *\n * @param {string} in_key - The key under which the entry is stored\n * @param {property-properties.MapProperty~MapValueType} in_property - The property to store in the map\n * @throws if in_property is not a property\n * @throws if trying to insert a property that has a parent\n * @throws if in_key is not a string or a number\n */\n set(in_key, in_property) {\n this._checkIsNotReadOnly(true);\n if (this._dynamicChildren[in_key] !== in_property) {\n if (this._containsPrimitiveTypes === false && in_property.getParent() !== undefined) {\n throw new Error(MSG.INSERTED_ENTRY_WITH_PARENT);\n }\n if (this._dynamicChildren[in_key] !== undefined) {\n this._removeByKey(in_key, false);\n }\n // Set the ID of the entry, to make sure it corresponds to the used key\n if (this._containsPrimitiveTypes === false) {\n in_property._setId(in_key);\n }\n this._insert(in_key, in_property, false);\n\n // Make one final report\n this._reportDirtinessToView();\n }\n }\n\n /**\n * Returns an Object with all the entries of the map.\n * Contrary ot .getValues, for Property Maps, this will return the Property, not an object with their nested values.\n * WARNING: This is a direct access to the internal data-structure and the collection MUST NOT be modified. It is\n * read only for fast access and iteration. Insertion and deletion MUST be done via the insert and remove functions\n * of this class.\n *\n * @return {Object} The map with all entries in the map.\n */\n getEntriesReadOnly() {\n return this._dynamicChildren;\n }\n\n /**\n * Returns the collection entry with the given key\n *\n * @param {string|array<string>} in_ids - key of the entry to return or an array of keys\n * if an array is passed, the .get function will be performed on each id in sequence\n * for example .get(['position','x']) is equivalent to .get('position').get('x').\n * If .get resolves to a ReferenceProperty, it will return the property that the ReferenceProperty\n * refers to.\n * @param {Object} in_options - parameter object\n * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS]\n * How should this function behave during reference resolution?\n *\n * @return {property-properties.Property|*|undefined} The entry in the collection or undefined\n * if none could be found\n */\n get(in_ids, in_options) {\n if (_.isArray(in_ids)) {\n // Forward handling of arrays to the BaseProperty function\n return AbstractStaticCollectionProperty.prototype.get.call(this, in_ids, in_options);\n } else {\n in_options = in_options || {};\n in_options.referenceResolutionMode =\n in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :\n in_options.referenceResolutionMode;\n\n var prop = this;\n if (in_ids === PATH_TOKENS.ROOT) {\n prop = prop.getRoot();\n } else if (in_ids === PATH_TOKENS.UP) {\n prop = prop.getParent();\n } else if (in_ids === PATH_TOKENS.REF) {\n throw new Error(MSG.NO_GET_DEREFERENCE_ONLY);\n } else {\n prop = prop._dynamicChildren[in_ids];\n }\n\n // Handle automatic reference resolution\n if (in_options.referenceResolutionMode === BaseProperty.REFERENCE_RESOLUTION.ALWAYS) {\n if (prop instanceof Property.ReferenceProperty) {\n prop = prop.ref;\n }\n }\n\n return prop;\n }\n }\n\n /**\n * Checks whether an entry with the given name exists\n *\n * @param {string} in_id - Name of the property\n * @return {boolean} True if the property exists, otherwise false.\n */\n has(in_id) {\n return this._dynamicChildren[in_id] !== undefined;\n }\n\n /**\n * Returns all entries of the map as an array.\n *\n * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n *\n * @return {Array.<property-properties.BaseProperty | *>} Array with all entries of the map. This array\n * is a shallow copy which can be modified by the caller without effects on the map.\n */\n getAsArray() {\n return _.values(this._dynamicChildren);\n }\n\n /**\n * Returns all keys found in the map\n *\n * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n *\n * @return {Array.<string>} The keys\n */\n getIds() {\n return Object.keys(this._dynamicChildren);\n }\n\n /**\n * Get the scope to which this property belongs to.\n * @return {string|undefined} The guid representing the scope in which the\n * map belongs to. If there is a workspace scope return it, else return the scope of this map.\n * @override\n * @private\n */\n _getScope() {\n var scope = IndexedCollectionBaseProperty.prototype._getScope.call(this);\n\n if (scope !== undefined) {\n return scope;\n } else {\n return this._scope;\n }\n }\n\n /**\n * Deletes all values from the Map\n */\n clear() {\n var that = this;\n this.getIds().forEach(function(id) {\n that.remove(id);\n });\n }\n}\n\nMapProperty.prototype._typeid = 'BaseProperty';\nMapProperty.prototype._context = 'map';\n"]}
@@ -44,7 +44,7 @@ export class SetProperty extends IndexedCollectionBaseProperty {
44
44
  remove(in_entry: any): property;
45
45
  /**
46
46
  * Adds a list of properties to the set.
47
- * @see {setValues}
47
+ * See {@link SetProperty.setValues}
48
48
  * @param {NamedProperty[]|NamedNodeProperty[]|Object[]} in_properties - The list of properties to add to the list
49
49
  * @param {Boolean} in_typed - If the set's items have a typeid and a value then create the
50
50
  * properties with that typeid, else use the set's typeid (support polymorphic items).
@@ -240,7 +240,7 @@ class SetProperty extends IndexedCollectionBaseProperty {
240
240
  }
241
241
  /**
242
242
  * Adds a list of properties to the set.
243
- * @see {setValues}
243
+ * See {@link SetProperty.setValues}
244
244
  * @param {NamedProperty[]|NamedNodeProperty[]|Object[]} in_properties - The list of properties to add to the list
245
245
  * @param {Boolean} in_typed - If the set's items have a typeid and a value then create the
246
246
  * properties with that typeid, else use the set's typeid (support polymorphic items).
@@ -266,7 +266,7 @@ class SetProperty extends IndexedCollectionBaseProperty {
266
266
  }
267
267
  /**
268
268
  * Adds a list of properties to the set.
269
- * @see {setValues}
269
+ * See {@link SetProperty.setValues}
270
270
  * @param {NamedProperty[]|NamedNodeProperty[]|Object[]} in_properties - The list of properties to add to the list
271
271
  * @param {Boolean} in_typed - If the set's items have a typeid and a value then create the
272
272
  * properties with that typeid, else use the set's typeid (support polymorphic items).
@@ -1 +1 @@
1
- {"version":3,"file":"setProperty.js","sourceRoot":"","sources":["../../src/properties/setProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACvF,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAC3F,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACnD,MAAM,EAAE,6BAA6B,EAAE,G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C,UAAS,EAAE;YAC7B,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAzUD,kCAyUC;AAED,WAAW,CAAC,SAAS,CAAC,OAAO,GAAG,eAAe,CAAC;AAChD,WAAW,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Definition of the set property class\n */\nconst { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst _ = require('lodash');\nconst { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');\nconst { BaseProperty } = require('./baseProperty');\nconst { IndexedCollectionBaseProperty } = require('./indexedCollectionBaseProperty');\nconst { LazyLoadedProperties: Property } = require('./lazyLoadedProperties');\n\nvar PATH_TOKENS = BaseProperty.PATH_TOKENS;\n/**\n * A SetProperty is a collection class that can contain an unordered set of properties. These properties\n * must derive from NamedProperty and their URN is used to identify them within the set.\n */\nexport class SetProperty extends IndexedCollectionBaseProperty {\n /**\n * @param {Object} in_params - Input parameters for property creation\n * @param {string|undefined} in_scope - The scope in which the map typeid is defined\n *\n * @constructor\n * @protected\n * @extends property-properties.IndexedCollectionBaseProperty\n * @alias property-properties.SetProperty\n * @category Other Collections\n */\n constructor(in_params, in_scope) {\n super(in_params);\n\n this._scope = in_scope;\n\n /** Contains the actual entries of the set, indexed by their GUID */\n this._dynamicChildren = {};\n }\n\n // A set property falls back to NamedProperty, if none is specified\n\n /**\n * Is this property a leaf node with regard to flattening?\n *\n * TODO: Which semantics should flattening have? It stops at primitive types and collections?\n *\n * @return {boolean} Is it a leaf with regard to flattening?\n */\n _isFlattenLeaf() {\n return true;\n }\n\n /**\n * Returns an object with all the nested values contained in this property\n * @return {object} an object representing the values of your property\n * for example: {\n * position: {\n * x: 2,\n * y: 5\n * }\n * }\n */\n getValues() {\n var ids = this.getIds();\n var result = {};\n for (var i = 0; i < ids.length; i++) {\n var child = this.get(ids[i]);\n if (child instanceof Property.ValueProperty || child instanceof Property.StringProperty) {\n result[ids[i]] = this.get(ids[i]).getValue();\n } else {\n result[ids[i]] = child.getValues();\n }\n }\n return result;\n }\n\n /**\n * Returns the full property type identifier for the ChangeSet including the enum type id\n * @param {boolean} [in_hideCollection=false] - if true the collection type (if applicable) will be omitted\n * @return {string} The typeid\n */\n getFullTypeid(in_hideCollection = false) {\n if (in_hideCollection) {\n return this._typeid;\n } else {\n return TypeIdHelper.createSerializationTypeId(this._typeid, 'set');\n }\n }\n\n /**\n * Returns the path segment for a child\n *\n * @param {property-properties.NamedProperty} in_childNode - The child for which the path is returned\n *\n * @return {string} The path segment to resolve the child property under this property\n * @protected\n */\n _getPathSegmentForChildNode(in_childNode) {\n return '[' + in_childNode.getGuid() + ']';\n }\n\n /**\n * Resolves a direct child node based on the given path segment\n *\n * @param {String} in_segment - The path segment to resolve\n * @param {property-properties.PathHelper.TOKEN_TYPES} in_segmentType - The type of segment in the tokenized path\n *\n * @return {property-properties.BaseProperty|undefined} The child property that has been resolved\n * @protected\n */\n _resolvePathSegment(in_segment, in_segmentType) {\n // Base Properties only support paths separated via dots\n if (in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN) {\n return this._dynamicChildren[in_segment];\n } else {\n return AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);\n }\n }\n\n /**\n * Inserts a property into the set\n *\n * @param {property-properties.NamedProperty} in_property - The property to insert\n * @throws if trying to insert non-named properties\n * @throws if trying to insert a property that has a parent\n * @throws if a property already exists with the same guid as in_property\n */\n insert(in_property) {\n if (in_property instanceof AbstractStaticCollectionProperty && in_property.has('guid')) {\n var guid = in_property.getGuid();\n this._insert(guid, in_property, true);\n } else {\n throw new Error(MSG.CANT_INSERT_NON_NAMED_PROPERTIES);\n }\n }\n\n /**\n * Adds a property to the set\n * - If the property's key exists, the entry is replaced with new one.\n * - If the property's key does not exist, the property is appended.*\n *\n * @param {NamedProperty|NamedNodeProperty|Object} in_property - The property to add to the list\n */\n set(in_property) {\n this._checkIsNotReadOnly(true);\n\n if (in_property instanceof AbstractStaticCollectionProperty && in_property.has('guid')) {\n var guid = in_property.getGuid();\n if (this.has(guid)) {\n this.remove(guid);\n }\n\n this.insert(in_property);\n } else {\n throw new Error(MSG.CANT_INSERT_NON_NAMED_PROPERTIES);\n }\n }\n\n /**\n * Removes the given property from the set\n *\n * @param {property-properties.NamedProperty|string} in_entry - The property or its URN to remove from the set\n * @return {property-properties.NamedProperty} the property that was removed.\n * @throws if trying to remove an entry that does not exist\n */\n remove(in_entry) {\n if (_.isString(in_entry)) {\n var item = this.get(in_entry);\n this._removeByKey(in_entry, true);\n return item;\n } else {\n this._removeByKey(in_entry.getGuid(), true);\n return in_entry;\n }\n }\n\n /**\n * Returns an Object with all the entries of the set.\n *\n * WARNING: This is a direct access to the internal data-structure and the collection MUST NOT be modified.\n * It is read only for fast access and iteration. Insertion and deletion MUST be done via the insert and\n * remove functions of this class.\n *\n * @return {Object<String, property-properties.NamedProperty>} The map with all entries in the set.\n */\n getEntriesReadOnly() {\n return this._dynamicChildren;\n }\n\n /**\n * Returns the name of all the sub-properties of this property.\n *\n * @return {Array.<string>} An array of all the property ids\n */\n getIds() {\n return Object.keys(this._dynamicChildren);\n }\n\n /**\n * Returns the collection entry with the given ID\n *\n * @param {string|array<string|number>} in_ids - key of the entry to return or an array of keys\n * if an array is passed, the .get function will be performed on each id in sequence\n * for example .get(['position','x']) is equivalent to .get('position').get('x').\n * If .get resolves to a ReferenceProperty, it will return the property that the ReferenceProperty\n * refers to.\n * @param {Object} in_options - parameter object\n * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS]\n * How should this function behave during reference resolution?\n *\n * @return {property-properties.NamedProperty|undefined} The entry in the collection or undefined if none could be found\n */\n get(in_ids, in_options) {\n if (_.isArray(in_ids)) {\n // Forward handling of arrays to the BaseProperty function\n return AbstractStaticCollectionProperty.prototype.get.call(this, in_ids, in_options);\n } else {\n var prop = this;\n in_options = in_options || {};\n in_options.referenceResolutionMode =\n in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :\n in_options.referenceResolutionMode;\n if (in_ids === PATH_TOKENS.ROOT) {\n prop = prop.getRoot();\n } else if (in_ids === PATH_TOKENS.UP) {\n prop = prop.getParent();\n } else if (in_ids === PATH_TOKENS.REF) {\n throw new Error(MSG.NO_GET_DEREFERENCE_ONLY);\n } else {\n prop = prop._dynamicChildren[in_ids];\n }\n\n return prop;\n }\n }\n\n /**\n * Checks whether a property with the given name exists\n *\n * @param {string} in_id - Name of the property\n * @return {boolean} True if the property exists, otherwise false.\n */\n has(in_id) {\n return this._dynamicChildren[in_id] !== undefined;\n }\n\n /**\n * Adds a list of properties to the set.\n * @see {setValues}\n * @param {NamedProperty[]|NamedNodeProperty[]|Object[]} in_properties - The list of properties to add to the list\n * @param {Boolean} in_typed - If the set's items have a typeid and a value then create the\n * properties with that typeid, else use the set's typeid (support polymorphic items).\n * @private\n */\n _setValuesInternal(in_properties, in_typed) {\n this._checkIsNotReadOnly(true);\n\n var that = this;\n _.each(in_properties, function(property) {\n if (property instanceof BaseProperty) {\n that.set(property);\n } else {\n // If value is a JSON object (i.e: passed through a default value), create the property and add it to the set.\n if (in_typed) {\n that.set(Property.PropertyFactory._createProperty(\n property.typeid || that._typeid, null, property.value, that._getScope()));\n } else {\n that.set(Property.PropertyFactory._createProperty(\n that._typeid, null, property, that._getScope()));\n }\n }\n });\n }\n\n /**\n * Adds a list of properties to the set.\n * @see {setValues}\n * @param {NamedProperty[]|NamedNodeProperty[]|Object[]} in_properties - The list of properties to add to the list\n * @param {Boolean} in_typed - If the set's items have a typeid and a value then create the\n * properties with that typeid, else use the set's typeid (support polymorphic items).\n * @param {Bool} in_initial - Whether we are setting default/initial values\n * or if the function is called directly with the values to set.\n * @override\n */\n _setValues(in_properties, in_typed, in_initial) {\n if (in_initial) {\n this.clear();\n }\n\n this._setValuesInternal(in_properties, in_typed);\n }\n\n /**\n * Adds a list of properties to the set.\n * - If the property's key exists, the entry is replaced with new one.\n * - If the property's key does not exist, the property is appended.\n * @param {NamedProperty[]|NamedNodeProperty[]|Object[]} in_properties - The list of properties to add to the list\n * @override\n */\n setValues(in_properties) {\n var checkoutView = this._getCheckoutView();\n if (checkoutView !== undefined) {\n checkoutView.pushNotificationDelayScope();\n SetProperty.prototype._setValues.call(this, in_properties, false, false);\n checkoutView.popNotificationDelayScope();\n } else {\n SetProperty.prototype._setValues.call(this, in_properties, false, false);\n }\n }\n\n /**\n * Returns all entries of the set as an array.\n *\n * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n *\n * @return {Array.<property-properties.NamedProperty>} Array with all entries of the set. This array is a shallow copy\n * which can be modified by the caller without effects on the set.\n */\n getAsArray() {\n return _.values(this._dynamicChildren);\n }\n\n /**\n * Get the scope to which this property belongs to.\n * @return {string|undefined} The guid representing the scope in which the\n * set belongs to. If there is a workspace scope return it, else return the scope of this set.\n * @override\n * @private\n */\n _getScope() {\n var scope = IndexedCollectionBaseProperty.prototype._getScope.call(this);\n\n if (scope !== undefined) {\n return scope;\n } else {\n return this._scope;\n }\n }\n\n /**\n * Delete all values from Set\n */\n clear() {\n var that = this;\n this.getIds().forEach(function(id) {\n that.remove(id);\n });\n }\n}\n\nSetProperty.prototype._typeid = 'NamedProperty';\nSetProperty.prototype._context = 'set';\n"]}
1
+ {"version":3,"file":"setProperty.js","sourceRoot":"","sources":["../../src/properties/setProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACvF,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,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C,CAAC;QAEzE,IAAI,KAAK,KAAK,SAAS,EAAE;YACrB,OAAO,KAAK,CAAC;SAChB;aAAM;YACH,OAAO,IAAI,CAAC,MAAM,CAAC;SACtB;IACL,CAAC;IAED;;OAEG;IACH,KAAK;QACD,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,UAAS,EAAE;YAC7B,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAzUD,kCAyUC;AAED,WAAW,CAAC,SAAS,CAAC,OAAO,GAAG,eAAe,CAAC;AAChD,WAAW,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Definition of the set property class\n */\nconst { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst _ = require('lodash');\nconst { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');\nconst { BaseProperty } = require('./baseProperty');\nconst { IndexedCollectionBaseProperty } = require('./indexedCollectionBaseProperty');\nconst { LazyLoadedProperties: Property } = require('./lazyLoadedProperties');\n\nvar PATH_TOKENS = BaseProperty.PATH_TOKENS;\n/**\n * A SetProperty is a collection class that can contain an unordered set of properties. These properties\n * must derive from NamedProperty and their URN is used to identify them within the set.\n */\nexport class SetProperty extends IndexedCollectionBaseProperty {\n /**\n * @param {Object} in_params - Input parameters for property creation\n * @param {string|undefined} in_scope - The scope in which the map typeid is defined\n *\n * @constructor\n * @protected\n * @extends property-properties.IndexedCollectionBaseProperty\n * @alias property-properties.SetProperty\n * @category Other Collections\n */\n constructor(in_params, in_scope) {\n super(in_params);\n\n this._scope = in_scope;\n\n /** Contains the actual entries of the set, indexed by their GUID */\n this._dynamicChildren = {};\n }\n\n // A set property falls back to NamedProperty, if none is specified\n\n /**\n * Is this property a leaf node with regard to flattening?\n *\n * TODO: Which semantics should flattening have? It stops at primitive types and collections?\n *\n * @return {boolean} Is it a leaf with regard to flattening?\n */\n _isFlattenLeaf() {\n return true;\n }\n\n /**\n * Returns an object with all the nested values contained in this property\n * @return {object} an object representing the values of your property\n * for example: {\n * position: {\n * x: 2,\n * y: 5\n * }\n * }\n */\n getValues() {\n var ids = this.getIds();\n var result = {};\n for (var i = 0; i < ids.length; i++) {\n var child = this.get(ids[i]);\n if (child instanceof Property.ValueProperty || child instanceof Property.StringProperty) {\n result[ids[i]] = this.get(ids[i]).getValue();\n } else {\n result[ids[i]] = child.getValues();\n }\n }\n return result;\n }\n\n /**\n * Returns the full property type identifier for the ChangeSet including the enum type id\n * @param {boolean} [in_hideCollection=false] - if true the collection type (if applicable) will be omitted\n * @return {string} The typeid\n */\n getFullTypeid(in_hideCollection = false) {\n if (in_hideCollection) {\n return this._typeid;\n } else {\n return TypeIdHelper.createSerializationTypeId(this._typeid, 'set');\n }\n }\n\n /**\n * Returns the path segment for a child\n *\n * @param {property-properties.NamedProperty} in_childNode - The child for which the path is returned\n *\n * @return {string} The path segment to resolve the child property under this property\n * @protected\n */\n _getPathSegmentForChildNode(in_childNode) {\n return '[' + in_childNode.getGuid() + ']';\n }\n\n /**\n * Resolves a direct child node based on the given path segment\n *\n * @param {String} in_segment - The path segment to resolve\n * @param {property-properties.PathHelper.TOKEN_TYPES} in_segmentType - The type of segment in the tokenized path\n *\n * @return {property-properties.BaseProperty|undefined} The child property that has been resolved\n * @protected\n */\n _resolvePathSegment(in_segment, in_segmentType) {\n // Base Properties only support paths separated via dots\n if (in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN) {\n return this._dynamicChildren[in_segment];\n } else {\n return AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);\n }\n }\n\n /**\n * Inserts a property into the set\n *\n * @param {property-properties.NamedProperty} in_property - The property to insert\n * @throws if trying to insert non-named properties\n * @throws if trying to insert a property that has a parent\n * @throws if a property already exists with the same guid as in_property\n */\n insert(in_property) {\n if (in_property instanceof AbstractStaticCollectionProperty && in_property.has('guid')) {\n var guid = in_property.getGuid();\n this._insert(guid, in_property, true);\n } else {\n throw new Error(MSG.CANT_INSERT_NON_NAMED_PROPERTIES);\n }\n }\n\n /**\n * Adds a property to the set\n * - If the property's key exists, the entry is replaced with new one.\n * - If the property's key does not exist, the property is appended.*\n *\n * @param {NamedProperty|NamedNodeProperty|Object} in_property - The property to add to the list\n */\n set(in_property) {\n this._checkIsNotReadOnly(true);\n\n if (in_property instanceof AbstractStaticCollectionProperty && in_property.has('guid')) {\n var guid = in_property.getGuid();\n if (this.has(guid)) {\n this.remove(guid);\n }\n\n this.insert(in_property);\n } else {\n throw new Error(MSG.CANT_INSERT_NON_NAMED_PROPERTIES);\n }\n }\n\n /**\n * Removes the given property from the set\n *\n * @param {property-properties.NamedProperty|string} in_entry - The property or its URN to remove from the set\n * @return {property-properties.NamedProperty} the property that was removed.\n * @throws if trying to remove an entry that does not exist\n */\n remove(in_entry) {\n if (_.isString(in_entry)) {\n var item = this.get(in_entry);\n this._removeByKey(in_entry, true);\n return item;\n } else {\n this._removeByKey(in_entry.getGuid(), true);\n return in_entry;\n }\n }\n\n /**\n * Returns an Object with all the entries of the set.\n *\n * WARNING: This is a direct access to the internal data-structure and the collection MUST NOT be modified.\n * It is read only for fast access and iteration. Insertion and deletion MUST be done via the insert and\n * remove functions of this class.\n *\n * @return {Object<String, property-properties.NamedProperty>} The map with all entries in the set.\n */\n getEntriesReadOnly() {\n return this._dynamicChildren;\n }\n\n /**\n * Returns the name of all the sub-properties of this property.\n *\n * @return {Array.<string>} An array of all the property ids\n */\n getIds() {\n return Object.keys(this._dynamicChildren);\n }\n\n /**\n * Returns the collection entry with the given ID\n *\n * @param {string|array<string|number>} in_ids - key of the entry to return or an array of keys\n * if an array is passed, the .get function will be performed on each id in sequence\n * for example .get(['position','x']) is equivalent to .get('position').get('x').\n * If .get resolves to a ReferenceProperty, it will return the property that the ReferenceProperty\n * refers to.\n * @param {Object} in_options - parameter object\n * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS]\n * How should this function behave during reference resolution?\n *\n * @return {property-properties.NamedProperty|undefined} The entry in the collection or undefined if none could be found\n */\n get(in_ids, in_options) {\n if (_.isArray(in_ids)) {\n // Forward handling of arrays to the BaseProperty function\n return AbstractStaticCollectionProperty.prototype.get.call(this, in_ids, in_options);\n } else {\n var prop = this;\n in_options = in_options || {};\n in_options.referenceResolutionMode =\n in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :\n in_options.referenceResolutionMode;\n if (in_ids === PATH_TOKENS.ROOT) {\n prop = prop.getRoot();\n } else if (in_ids === PATH_TOKENS.UP) {\n prop = prop.getParent();\n } else if (in_ids === PATH_TOKENS.REF) {\n throw new Error(MSG.NO_GET_DEREFERENCE_ONLY);\n } else {\n prop = prop._dynamicChildren[in_ids];\n }\n\n return prop;\n }\n }\n\n /**\n * Checks whether a property with the given name exists\n *\n * @param {string} in_id - Name of the property\n * @return {boolean} True if the property exists, otherwise false.\n */\n has(in_id) {\n return this._dynamicChildren[in_id] !== undefined;\n }\n\n /**\n * Adds a list of properties to the set.\n * See {@link SetProperty.setValues}\n * @param {NamedProperty[]|NamedNodeProperty[]|Object[]} in_properties - The list of properties to add to the list\n * @param {Boolean} in_typed - If the set's items have a typeid and a value then create the\n * properties with that typeid, else use the set's typeid (support polymorphic items).\n * @private\n */\n _setValuesInternal(in_properties, in_typed) {\n this._checkIsNotReadOnly(true);\n\n var that = this;\n _.each(in_properties, function(property) {\n if (property instanceof BaseProperty) {\n that.set(property);\n } else {\n // If value is a JSON object (i.e: passed through a default value), create the property and add it to the set.\n if (in_typed) {\n that.set(Property.PropertyFactory._createProperty(\n property.typeid || that._typeid, null, property.value, that._getScope()));\n } else {\n that.set(Property.PropertyFactory._createProperty(\n that._typeid, null, property, that._getScope()));\n }\n }\n });\n }\n\n /**\n * Adds a list of properties to the set.\n * See {@link SetProperty.setValues}\n * @param {NamedProperty[]|NamedNodeProperty[]|Object[]} in_properties - The list of properties to add to the list\n * @param {Boolean} in_typed - If the set's items have a typeid and a value then create the\n * properties with that typeid, else use the set's typeid (support polymorphic items).\n * @param {Bool} in_initial - Whether we are setting default/initial values\n * or if the function is called directly with the values to set.\n * @override\n */\n _setValues(in_properties, in_typed, in_initial) {\n if (in_initial) {\n this.clear();\n }\n\n this._setValuesInternal(in_properties, in_typed);\n }\n\n /**\n * Adds a list of properties to the set.\n * - If the property's key exists, the entry is replaced with new one.\n * - If the property's key does not exist, the property is appended.\n * @param {NamedProperty[]|NamedNodeProperty[]|Object[]} in_properties - The list of properties to add to the list\n * @override\n */\n setValues(in_properties) {\n var checkoutView = this._getCheckoutView();\n if (checkoutView !== undefined) {\n checkoutView.pushNotificationDelayScope();\n SetProperty.prototype._setValues.call(this, in_properties, false, false);\n checkoutView.popNotificationDelayScope();\n } else {\n SetProperty.prototype._setValues.call(this, in_properties, false, false);\n }\n }\n\n /**\n * Returns all entries of the set as an array.\n *\n * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n *\n * @return {Array.<property-properties.NamedProperty>} Array with all entries of the set. This array is a shallow copy\n * which can be modified by the caller without effects on the set.\n */\n getAsArray() {\n return _.values(this._dynamicChildren);\n }\n\n /**\n * Get the scope to which this property belongs to.\n * @return {string|undefined} The guid representing the scope in which the\n * set belongs to. If there is a workspace scope return it, else return the scope of this set.\n * @override\n * @private\n */\n _getScope() {\n var scope = IndexedCollectionBaseProperty.prototype._getScope.call(this);\n\n if (scope !== undefined) {\n return scope;\n } else {\n return this._scope;\n }\n }\n\n /**\n * Delete all values from Set\n */\n clear() {\n var that = this;\n this.getIds().forEach(function(id) {\n that.remove(id);\n });\n }\n}\n\nSetProperty.prototype._typeid = 'NamedProperty';\nSetProperty.prototype._context = 'set';\n"]}
@@ -294,10 +294,10 @@ class StringProperty extends ValueArrayProperty {
294
294
  this._setValue(in_value, true);
295
295
  }
296
296
  /**
297
+ * See {@link StringProperty.setValues}
297
298
  * @param {string} in_values the new values
298
299
  * @param {Bool} in_initial - Whether we are setting default/initial values
299
300
  * or if the function is called directly with the values to set.
300
- * @see {setValues}
301
301
  */
302
302
  _setValues(in_values, in_initial) {
303
303
  throw new Error(MSG.NO_VALUE_PROPERTY_SETVALUES);
@@ -1 +1 @@
1
- {"version":3,"file":"stringProperty.js","sourceRoot":"","sources":["../../src/properties/stringProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;AAEH,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACxE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACxE,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACrD,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACnD,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAE/D,IAAI,oBAAoB,GAAG,YAAY,CAAC,oBAAoB,CAAC;AAE7D,uEAAuE;AACvE,2EAA2E;AAC3E,8EAA8E;AAC9E,wDAAwD;AACxD,mFAAmF;AACnF,uCAAuC;AACvC,IAAI,uCAAuC,GAAG;IAC1C,OAAO,EAAE,cAAc;IACvB,KAAK,EAAE,cAAc;IACrB,KAAK,EAAE,oBAAoB,CAAC,cAAc,GAAG,oBAAoB,CAAC,KAAK;CAC1E,CAAC;AACF,IAAI,0CAA0C,GAAG;IAC7C,OAAO,EAAE,cAAc;IAC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,CAAC,OAAO,GAAG,QAAQ,CAAC;AAC5C,cAAc,CAAC,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC7C,cAAc,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Definition of the StringProperty class\n */\n\nconst { ChangeSet } = require('@fluid-experimental/property-changeset');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst { ConsoleUtils } = require('@fluid-experimental/property-common');\nconst _ = require('lodash');\nconst { ArrayProperty } = require('./arrayProperty');\nconst { BaseProperty } = require('./baseProperty');\nconst { ValueArrayProperty } = require('./valueArrayProperty');\n\nvar MODIFIED_STATE_FLAGS = BaseProperty.MODIFIED_STATE_FLAGS;\n\n// Some global constant objects that are used to indicate a few special\n// cases for the dirty object. If the string was directly set to a literal,\n// we don't need to store any ChangeSet, we only need to store the information\n// that it was updated to a literal and the dirty flags.\n// By using these special objects we avoid the memory overhead of having a separate\n// object for each array in this state.\nvar PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE = {\n pending: 'setAsLiteral',\n dirty: 'setAsLiteral',\n flags: MODIFIED_STATE_FLAGS.PENDING_CHANGE | MODIFIED_STATE_FLAGS.DIRTY,\n};\nvar NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE = {\n pending: 'setAsLiteral',\n dirty: undefined,\n flags: MODIFIED_STATE_FLAGS.PENDING_CHANGE,\n};\n\nvar DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE = {\n pending: undefined,\n dirty: 'setAsLiteral',\n _flags: MODIFIED_STATE_FLAGS.DIRTY,\n set flags(flags) {\n this._flags = flags;\n console.log('flags was changed!');\n },\n get flags() {\n return this._flags;\n },\n};\n\nvar STRING_PROPERTY_SET_PROPERTY_VALUE_STATE_FLAGS = [\n undefined,\n NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE,\n DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE,\n PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE,\n];\n\n/**\n * A primitive property for a string value.\n */\nexport class StringProperty extends ValueArrayProperty {\n /**\n * @param {Object=} in_params - the parameters\n * @constructor\n * @protected\n * @extends property-properties.ValueArrayProperty\n * @alias property-properties.StringProperty\n * @category Arrays\n */\n constructor(in_params) {\n super(in_params);\n }\n\n /**\n * Get the string value\n * @return {string} the JavaScript string primitive value of this StringProperty\n */\n getValue() {\n return this._dataArrayRef;\n }\n\n /**\n * Private helper function to update the internal dirty and pending changes\n *\n * @param {property-properties.SerializedChangeSet} in_changeSet - The changeset to apply\n * @private\n */\n _updateChanges(in_changeSet) {\n // we need to convert the format to allow the application of the changes\n // since _performApplyAfterOnPropertyArray only understands insert/modify/remove commands\n var pendingChangesWereSetBefore = false;\n var pendingChanges = this._getPendingChanges();\n\n if (_.isString(pendingChanges)) {\n pendingChanges = { insert: [[0, pendingChanges]] };\n pendingChangesWereSetBefore = true;\n }\n ChangeSet.prototype._performApplyAfterOnPropertyArray(pendingChanges,\n in_changeSet, this.getFullTypeid(true));\n if (pendingChangesWereSetBefore) {\n pendingChanges = pendingChanges.insert[0][1];\n }\n\n var dirtyChangesWereSetBefore = false;\n var dirtyChanges = this._getDirtyChanges();\n\n if (_.isString(dirtyChanges)) {\n dirtyChanges = { insert: [[0, dirtyChanges]] };\n dirtyChangesWereSetBefore = true;\n }\n ChangeSet.prototype._performApplyAfterOnPropertyArray(dirtyChanges,\n in_changeSet, this.getFullTypeid(true));\n if (dirtyChangesWereSetBefore) {\n dirtyChanges = dirtyChanges.insert[0][1];\n }\n\n this._setChanges(pendingChanges, dirtyChanges);\n }\n\n _getPendingChanges() {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE) {\n return this.getValue();\n }\n\n return (this._dirty && this._dirty.pending) || {};\n }\n\n _getDirtyChanges() {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n return this.getValue();\n } else if (this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE) {\n return {};\n }\n\n return (this._dirty && this._dirty.dirty) || {};\n }\n\n /**\n * inserts a string starting at a position and shifts the rest of\n * the String to the right. Will not overwrite existing values.\n * @param {number} in_position target index\n * @param {string} in_value value to be inserted\n * @throws if in_position is smaller than zero, larger than the length of the string or not a number\n * @throws if in_value is not a string\n */\n insert(in_position, in_value) {\n ConsoleUtils.assert(_.isString(in_value), MSG.IN_VALUE_MUST_BE_STRING + in_value);\n this._insertRange(in_position, in_value);\n }\n\n /**\n * Adds letters to the end of the string\n * @param {string} in_value the string to be pushed\n * @throws if in_value is not a string\n * @return {number} the new length of the string.\n */\n push(in_value) {\n ConsoleUtils.assert(_.isString(in_value), MSG.IN_VALUE_MUST_BE_STRING + in_value);\n this._insertRange(this._dataArrayRef.length, in_value);\n return this.getLength();\n }\n\n /**\n * inserts values\n * @param {number} in_position target index\n * @param {string} in_value the string to be inserted\n */\n _insertRange(in_position, in_value) {\n this._checkIsNotReadOnly(true);\n this._insertRangeWithoutDirtying(in_position, in_value);\n this._setDirty();\n }\n\n /**\n * Returns the full property type identifier for the ChangeSet including the enum type id\n * @param {boolean} [in_hideCollection=false] - if true the collection type (if applicable) will be omitted\n * since that is not aplicable here, this param is ignored\n * @return {string} The typeid\n */\n getFullTypeid(in_hideCollection) {\n return this._typeid;\n }\n\n /**\n * returns the String to an empty string.\n */\n clear() {\n this.setValue('');\n }\n\n /**\n * removes a given number of elements from the array property and shifts\n * remaining values to the left.\n * @param {number} in_offset target start index\n * @param {number} in_deleteCount number of elements to be deleted\n * @throws if in_offset is not a number\n * @throws if in_deleteCount is not a number\n * @throws if trying to remove an item with a parent\n * @throws if in_offset is smaller than zero or if in_offset + in_delete count is larger than the length of the array\n * @return {String} the part of the string that was removed.\n */\n removeRange(in_offset, in_deleteCount) {\n ConsoleUtils.assert(_.isNumber(in_offset),\n MSG.NOT_NUMBER + 'in_offset, method: StringProperty.remove or .removeRange');\n ConsoleUtils.assert(_.isNumber(in_deleteCount),\n MSG.NOT_NUMBER + 'in_deleteCount, method: StringProperty.remove or .removeRange');\n ConsoleUtils.assert(in_offset + in_deleteCount < this.length + 1 && in_offset >= 0 && in_deleteCount > 0,\n MSG.REMOVE_OUT_OF_BOUNDS + 'Cannot remove ' + in_deleteCount + ' items starting at index ' + in_offset);\n var result = '';\n for (var i = in_offset; i < in_offset + in_deleteCount; i++) {\n result += this.get(i);\n }\n this._checkIsNotReadOnly(true);\n this._removeRangeWithoutDirtying(in_offset, in_deleteCount);\n this._setDirty();\n return result;\n }\n\n /**\n * @inheritdoc\n */\n _deserialize(in_serializedObj, in_reportToView,\n in_filteringOptions, in_createChangeSet) {\n if ((in_serializedObj.remove && in_serializedObj.remove.length > 0) ||\n (in_serializedObj.modify && in_serializedObj.modify.length > 0) ||\n (in_serializedObj.insert &&\n (in_serializedObj.insert.length > 1 ||\n (in_serializedObj.insert.length === 1 &&\n (in_serializedObj.insert[0][0] !== 0 ||\n !_.isString(in_serializedObj.insert[0][1])))))) {\n throw new Error(MSG.NO_NORMALIZED_CHANGESET);\n }\n\n var oldStringLength = this._dataArrayRef.length;\n var newStringData;\n if (_.isString(in_serializedObj)) {\n if (this._setValue(in_serializedObj, in_reportToView)) {\n return in_serializedObj;\n } else {\n return {};\n }\n } else {\n if (!in_serializedObj.insert ||\n !in_serializedObj.insert[0]) {\n // we've got an empty object, so we have to wipe everything we've got\n if (oldStringLength > 0) {\n this.removeRange(0, oldStringLength, in_reportToView);\n return {\n remove: [[0, oldStringLength]],\n };\n } else {\n // the string was already empty, nothing has changed\n return {};\n }\n } else {\n newStringData = in_serializedObj.insert[0][1];\n }\n }\n\n if (newStringData === this._dataArrayRef) {\n // nothing changed\n return {};\n }\n\n // check if something was attached (very common case)\n if (newStringData.length > oldStringLength) {\n if (newStringData.substring(0, oldStringLength) === this._dataArrayRef) {\n var appendChanges = {\n insert: [[oldStringLength, newStringData.substring(oldStringLength)]],\n };\n this.insertRange(oldStringLength, newStringData.substring(oldStringLength), in_reportToView);\n return appendChanges;\n }\n }\n\n // most simplistic diff method: Remove all existing data and insert the new data\n var simpleChanges = {\n insert: [[0, newStringData]],\n };\n if (oldStringLength > 0) {\n simpleChanges.remove = [[0, oldStringLength]];\n this._removeRangeWithoutDirtying(0, oldStringLength, in_reportToView);\n }\n this.insertRange(0, newStringData, in_reportToView);\n return simpleChanges;\n }\n\n /**\n * Serialize the property\n *\n * @param {boolean} in_dirtyOnly -\n * Only include dirty entries in the serialization\n * @param {boolean} in_includeRootTypeid -\n * Include the typeid of the root of the hierarchy - has no effect for ArrayProperty\n * @param {property-properties.BaseProperty.MODIFIED_STATE_FLAGS} [in_dirtinessType] -\n * The type of dirtiness to use when reporting dirty changes. By default this is\n * PENDING_CHANGE\n * @param {boolean} [in_includeReferencedRepositories=false] - If this is set to true, the serialize\n * function will descend into referenced repositories. WARNING: if there are loops in the references\n * this can result in an infinite loop\n *\n * @return {Object} The serialized representation of this property\n * @private\n */\n _serialize(in_dirtyOnly, in_includeRootTypeid,\n in_dirtinessType, in_includeReferencedRepositories) {\n if (in_dirtyOnly) {\n return ArrayProperty.prototype._serialize.call(this, in_dirtyOnly, in_includeRootTypeid, in_dirtinessType);\n } else {\n // returns just the current data\n return this._dataArrayRef;\n }\n }\n\n /**\n * @param {string} in_value the new value\n * @throws if string property is read only\n */\n setValue(in_value) {\n this._checkIsNotReadOnly(true);\n this._setValue(in_value, true);\n }\n\n /**\n * @param {string} in_values the new values\n * @param {Bool} in_initial - Whether we are setting default/initial values\n * or if the function is called directly with the values to set.\n * @see {setValues}\n */\n _setValues(in_values, in_initial) {\n throw new Error(MSG.NO_VALUE_PROPERTY_SETVALUES);\n }\n\n /**\n * @param {string} in_values the new values\n * @throws always - cannot use .setValues on a StringProperty. Use .setValue() instead.\n */\n setValues(in_values) {\n StringProperty.prototype._setValues.call(this, in_values, false);\n }\n\n /**\n * @throws always - cannot call .getValues on a string. Use .getValue() instead\n */\n getValues() {\n throw new Error(MSG.NO_VALUE_PROPERTY_GETVALUES);\n }\n\n /**\n * Internal function to update the value of a property\n *\n * @param {string} in_value the new value\n * @param {boolean} [in_reportToView = true] - By default, the dirtying will always be reported to the checkout view\n * and trigger a modified event there. When batching updates, this\n * can be prevented via this flag.\n * @return {boolean} true if the value was actually changed\n */\n _setValue(in_value, in_reportToView) {\n var oldValue = this._dataArrayRef;\n var castedValue = String(in_value);\n var changed = castedValue !== oldValue;\n if (changed) {\n var stringLength = this._dataArrayRef.length;\n if (stringLength > 0) {\n this._dataArrayRemoveRange(0, stringLength);\n }\n this._dataArrayInsertRange(0, castedValue);\n\n this._dirty = PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE;\n\n // The assignment in the line above already set this property to\n // dirty, so we only update the parent (instead of calling\n // setDirty on this property)\n if (this._parent) {\n this._parent._setDirty(in_reportToView, this);\n } else if (in_reportToView === true || in_reportToView === undefined) {\n this._reportDirtinessToView();\n }\n }\n return changed;\n }\n\n /**\n * Sets the pending and dirty changesets\n *\n * @param {property-properties.SerializedChangeSet|undefined|null} in_pending\n * The pending changeset. If null is passed, no change will be\n * applied. undefined indicates that the changes should be reset\n * @param {property-properties.SerializedChangeSet|undefined|null} in_dirty\n * The dirty changeset. If null is passed, no change will be\n * applied. undefined indicates that the changes should be reset\n */\n _setChanges(in_pending, in_dirty) {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n let newFlags = this._dirty.flags;\n if (in_pending === undefined) {\n newFlags &= 0xFFFFFFFF ^ BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE;\n }\n if (in_dirty === undefined) {\n newFlags &= 0xFFFFFFFF ^ BaseProperty.MODIFIED_STATE_FLAGS.DIRTY;\n }\n this._dirty = STRING_PROPERTY_SET_PROPERTY_VALUE_STATE_FLAGS[newFlags];\n } else {\n ArrayProperty.prototype._setChanges.call(this, in_pending, in_dirty);\n }\n }\n\n /**\n * Sets the dirty flags for this property\n * @param {Number} in_flags The dirty flags\n */\n _setDirtyFlags(in_flags) {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n this._dirty = STRING_PROPERTY_SET_PROPERTY_VALUE_STATE_FLAGS[in_flags];\n return;\n }\n\n ArrayProperty.prototype._setDirtyFlags.call(this, in_flags);\n }\n\n /**\n * Gets the dirty flags for this property\n * @return {Number} The dirty flags\n */\n _getDirtyFlags() {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n return this._dirty.flags;\n }\n\n return ArrayProperty.prototype._getDirtyFlags.call(this);\n }\n\n /**\n * @inheritdoc\n */\n _applyChangeset(in_changeSet, in_reportToView) {\n // It is unfortunate, but because StringProperty derives from ArrayProperty, it can happen\n // that we receive here a ChangeSet that is formatted for an Array. We must be able to\n // distinguish it from a reversible changeset and from a simple changeset...\n // TODO: We need a formal way to know what kind of content we are to expect in a ChangeSet,\n // we should never have to guess that.\n if (typeof in_changeSet === 'string') {\n // Let's consider it's a simple changeset.\n this._setValue(in_changeSet, in_reportToView);\n } else if (in_changeSet.value !== undefined) {\n // Let's consider it's a reversible changeset.\n this._setValue(in_changeSet.value, in_reportToView);\n } else {\n // Let's consider it's an ArrayProperty-like changeset\n ArrayProperty.prototype._applyChangeset.call(this, in_changeSet, in_reportToView);\n }\n }\n\n /**\n * Calls back the given function with a human-readable string\n * representation of the property.\n * @param {string} indent - Leading spaces to create the tree representation\n * @param {string} externalId - Name of the current property at the upper level.\n * Used for arrays.\n * @param {function} printFct - Function to call for printing each property\n */\n _prettyPrint(indent, externalId, printFct) {\n printFct(indent + externalId + this.getId() + ' (' + this.getTypeid() + '): \"' + this.value + '\"');\n }\n\n /**\n * Return a JSON representation of the property.\n * @return {object} A JSON representation of the property.\n * @private\n */\n _toJson() {\n return {\n id: this.getId(),\n context: this._context,\n typeid: this.getTypeid(),\n isConstant: this._isConstant,\n value: this.value,\n };\n }\n\n /**\n * Sets the value of a character at a single index.\n * For example, if you have a string of value 'AAAA' and do .set(1, 'a') => 'AaAA'\n * @param {number} in_index the index you wish to set\n * @param {string} in_character the character you wish to set\n * @throws if length of in_character is longer than one character\n */\n set(in_index, in_character) {\n ConsoleUtils.assert(_.isNumber(in_index), MSG.STRING_SET_NEEDS_INDEX + in_index);\n\n if (in_character.length !== 1) {\n throw new Error(MSG.STRING_SET_ONE_CHAR);\n }\n\n this.setRange(in_index, in_character);\n }\n\n /**\n * sets values in a string starting at an index.\n * For example, if you have a string of Value 'AAAA' and do .setRange(1, 'aa') => AaaA\n * It will set as many letters as are in in_string.\n * @param {number} in_index the index at which you wish to start setting\n * @param {string} in_string the string you wish to set\n * @throws if in_index + length of in_string is longer than the original string\n */\n setRange(in_index, in_string) {\n ArrayProperty.prototype.setRange.call(this, in_index, in_string);\n }\n\n /**\n * get a letter at a given index\n * @param {number} in_index the index\n * @return {string} the single letter found at in_index\n */\n get(in_index) {\n return ArrayProperty.prototype.get.call(this, in_index);\n }\n\n /**\n * inserts a string starting at a position and shifts the rest of the String to the right.\n * Will not overwrite existing values.\n * For StringProperty, insert and insertRange work the same, except that .insert\n * checks that in_value is a string and .insertRange will accept an array of strings.\n * @param {number} in_position target index\n * @param {string | array<string>} in_value value to be inserted\n * @throws if in_position is smaller than zero, larger than the length of the string or not a number\n */\n insertRange(in_position, in_value) {\n if (_.isArray(in_value)) {\n in_value = in_value.join('');\n }\n this._insertRange(in_position, in_value);\n }\n\n /**\n * Creates and initializes the data array\n * @param {Number} in_length the initial length of the array\n */\n _dataArrayCreate(in_length) {\n this._dataArrayRef = '';\n }\n\n /**\n * Returns the length of the data array\n * @return {Number} The length\n */\n _dataArrayGetLength() {\n return this._dataArrayRef.length;\n }\n\n /**\n * Returns the data array's internal buffer\n * @return {Array} The buffer\n */\n _dataArrayGetBuffer() {\n return this._dataArrayRef;\n }\n\n /**\n * Returns an entry from the data array\n * @param {Number} in_i - Position in the array\n *\n * @return {*} The value at index in_i\n */\n _dataArrayGetValue(in_i) {\n in_i = in_i === undefined ? 0 : in_i;\n if (in_i >= this._size || in_i < 0) {\n throw new Error('Trying to access out of bounds!');\n }\n\n return this._dataArrayRef[in_i];\n }\n\n /**\n * Set the array to the given new array\n * @param {String} in_newString - The new contents of the array\n */\n _dataArrayDeserialize(in_newString) {\n this._dataArrayRef = in_newString;\n }\n\n /**\n * Inserts a range into the data array\n * @param {Number} in_position - Position at which the insert should be done\n * @param {String} in_range - The array to insert\n */\n _dataArrayInsertRange(in_position, in_range) {\n this._dataArrayRef = this._dataArrayRef.substr(0, in_position) + in_range + this._dataArrayRef.substr(in_position);\n }\n\n /**\n * Removes a range from the data array\n * @param {Number} in_position - Position at which to start the removal\n * @param {Number} in_length - The number of entries to remove\n */\n _dataArrayRemoveRange(in_position, in_length) {\n if (in_position + in_length < this._dataArrayRef.length + 1) {\n this._dataArrayRef = this._dataArrayRef.substr(0, in_position) +\n this._dataArrayRef.substr(in_position + in_length);\n } else {\n throw Error('DataArray removeRange in_offset + in_deleteCount is out of bounds.');\n }\n }\n\n /**\n * Overwrites a range in the data array\n * @param {Number} in_position - Position at which to start the removal\n * @param {String} in_values - The string with which the range is overwritten\n */\n _dataArraySetRange(in_position, in_values) {\n this._dataArrayRef = this._dataArrayRef.substr(0, in_position) + in_values +\n this._dataArrayRef.substr(in_position + in_values.length);\n }\n\n get value() {\n return this.getValue();\n }\n\n set value(val) {\n this.setValue.call(this, val);\n }\n\n /** @inheritdoc */\n _traverse(in_callback, in_pathFromTraversalStart) {\n return undefined;\n }\n\n /** @inheritdoc */\n _traverseStaticProperties(in_callback, in_pathFromTraversalStart) {\n return undefined;\n }\n}\n\nStringProperty.prototype._typeid = 'String';\nStringProperty.prototype._context = 'single';\nStringProperty.prototype._noDirtyInBase = true;\n"]}
1
+ {"version":3,"file":"stringProperty.js","sourceRoot":"","sources":["../../src/properties/stringProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;AAEH,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACxE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACxE,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACrD,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACnD,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAE/D,IAAI,oBAAoB,GAAG,YAAY,CAAC,oBAAoB,CAAC;AAE7D,uEAAuE;AACvE,2EAA2E;AAC3E,8EAA8E;AAC9E,wDAAwD;AACxD,mFAAmF;AACnF,uCAAuC;AACvC,IAAI,uCAAuC,GAAG;IAC1C,OAAO,EAAE,cAAc;IACvB,KAAK,EAAE,cAAc;IACrB,KAAK,EAAE,oBAAoB,CAAC,cAAc,GAAG,oBAAoB,CAAC,KAAK;CAC1E,CAAC;AACF,IAAI,0CAA0C,GAAG;IAC7C,OAAO,EAA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CAAC,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC;AAC5C,cAAc,CAAC,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC7C,cAAc,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Definition of the StringProperty class\n */\n\nconst { ChangeSet } = require('@fluid-experimental/property-changeset');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst { ConsoleUtils } = require('@fluid-experimental/property-common');\nconst _ = require('lodash');\nconst { ArrayProperty } = require('./arrayProperty');\nconst { BaseProperty } = require('./baseProperty');\nconst { ValueArrayProperty } = require('./valueArrayProperty');\n\nvar MODIFIED_STATE_FLAGS = BaseProperty.MODIFIED_STATE_FLAGS;\n\n// Some global constant objects that are used to indicate a few special\n// cases for the dirty object. If the string was directly set to a literal,\n// we don't need to store any ChangeSet, we only need to store the information\n// that it was updated to a literal and the dirty flags.\n// By using these special objects we avoid the memory overhead of having a separate\n// object for each array in this state.\nvar PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE = {\n pending: 'setAsLiteral',\n dirty: 'setAsLiteral',\n flags: MODIFIED_STATE_FLAGS.PENDING_CHANGE | MODIFIED_STATE_FLAGS.DIRTY,\n};\nvar NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE = {\n pending: 'setAsLiteral',\n dirty: undefined,\n flags: MODIFIED_STATE_FLAGS.PENDING_CHANGE,\n};\n\nvar DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE = {\n pending: undefined,\n dirty: 'setAsLiteral',\n _flags: MODIFIED_STATE_FLAGS.DIRTY,\n set flags(flags) {\n this._flags = flags;\n console.log('flags was changed!');\n },\n get flags() {\n return this._flags;\n },\n};\n\nvar STRING_PROPERTY_SET_PROPERTY_VALUE_STATE_FLAGS = [\n undefined,\n NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE,\n DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE,\n PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE,\n];\n\n/**\n * A primitive property for a string value.\n */\nexport class StringProperty extends ValueArrayProperty {\n /**\n * @param {Object=} in_params - the parameters\n * @constructor\n * @protected\n * @extends property-properties.ValueArrayProperty\n * @alias property-properties.StringProperty\n * @category Arrays\n */\n constructor(in_params) {\n super(in_params);\n }\n\n /**\n * Get the string value\n * @return {string} the JavaScript string primitive value of this StringProperty\n */\n getValue() {\n return this._dataArrayRef;\n }\n\n /**\n * Private helper function to update the internal dirty and pending changes\n *\n * @param {property-properties.SerializedChangeSet} in_changeSet - The changeset to apply\n * @private\n */\n _updateChanges(in_changeSet) {\n // we need to convert the format to allow the application of the changes\n // since _performApplyAfterOnPropertyArray only understands insert/modify/remove commands\n var pendingChangesWereSetBefore = false;\n var pendingChanges = this._getPendingChanges();\n\n if (_.isString(pendingChanges)) {\n pendingChanges = { insert: [[0, pendingChanges]] };\n pendingChangesWereSetBefore = true;\n }\n ChangeSet.prototype._performApplyAfterOnPropertyArray(pendingChanges,\n in_changeSet, this.getFullTypeid(true));\n if (pendingChangesWereSetBefore) {\n pendingChanges = pendingChanges.insert[0][1];\n }\n\n var dirtyChangesWereSetBefore = false;\n var dirtyChanges = this._getDirtyChanges();\n\n if (_.isString(dirtyChanges)) {\n dirtyChanges = { insert: [[0, dirtyChanges]] };\n dirtyChangesWereSetBefore = true;\n }\n ChangeSet.prototype._performApplyAfterOnPropertyArray(dirtyChanges,\n in_changeSet, this.getFullTypeid(true));\n if (dirtyChangesWereSetBefore) {\n dirtyChanges = dirtyChanges.insert[0][1];\n }\n\n this._setChanges(pendingChanges, dirtyChanges);\n }\n\n _getPendingChanges() {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE) {\n return this.getValue();\n }\n\n return (this._dirty && this._dirty.pending) || {};\n }\n\n _getDirtyChanges() {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n return this.getValue();\n } else if (this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE) {\n return {};\n }\n\n return (this._dirty && this._dirty.dirty) || {};\n }\n\n /**\n * inserts a string starting at a position and shifts the rest of\n * the String to the right. Will not overwrite existing values.\n * @param {number} in_position target index\n * @param {string} in_value value to be inserted\n * @throws if in_position is smaller than zero, larger than the length of the string or not a number\n * @throws if in_value is not a string\n */\n insert(in_position, in_value) {\n ConsoleUtils.assert(_.isString(in_value), MSG.IN_VALUE_MUST_BE_STRING + in_value);\n this._insertRange(in_position, in_value);\n }\n\n /**\n * Adds letters to the end of the string\n * @param {string} in_value the string to be pushed\n * @throws if in_value is not a string\n * @return {number} the new length of the string.\n */\n push(in_value) {\n ConsoleUtils.assert(_.isString(in_value), MSG.IN_VALUE_MUST_BE_STRING + in_value);\n this._insertRange(this._dataArrayRef.length, in_value);\n return this.getLength();\n }\n\n /**\n * inserts values\n * @param {number} in_position target index\n * @param {string} in_value the string to be inserted\n */\n _insertRange(in_position, in_value) {\n this._checkIsNotReadOnly(true);\n this._insertRangeWithoutDirtying(in_position, in_value);\n this._setDirty();\n }\n\n /**\n * Returns the full property type identifier for the ChangeSet including the enum type id\n * @param {boolean} [in_hideCollection=false] - if true the collection type (if applicable) will be omitted\n * since that is not aplicable here, this param is ignored\n * @return {string} The typeid\n */\n getFullTypeid(in_hideCollection) {\n return this._typeid;\n }\n\n /**\n * returns the String to an empty string.\n */\n clear() {\n this.setValue('');\n }\n\n /**\n * removes a given number of elements from the array property and shifts\n * remaining values to the left.\n * @param {number} in_offset target start index\n * @param {number} in_deleteCount number of elements to be deleted\n * @throws if in_offset is not a number\n * @throws if in_deleteCount is not a number\n * @throws if trying to remove an item with a parent\n * @throws if in_offset is smaller than zero or if in_offset + in_delete count is larger than the length of the array\n * @return {String} the part of the string that was removed.\n */\n removeRange(in_offset, in_deleteCount) {\n ConsoleUtils.assert(_.isNumber(in_offset),\n MSG.NOT_NUMBER + 'in_offset, method: StringProperty.remove or .removeRange');\n ConsoleUtils.assert(_.isNumber(in_deleteCount),\n MSG.NOT_NUMBER + 'in_deleteCount, method: StringProperty.remove or .removeRange');\n ConsoleUtils.assert(in_offset + in_deleteCount < this.length + 1 && in_offset >= 0 && in_deleteCount > 0,\n MSG.REMOVE_OUT_OF_BOUNDS + 'Cannot remove ' + in_deleteCount + ' items starting at index ' + in_offset);\n var result = '';\n for (var i = in_offset; i < in_offset + in_deleteCount; i++) {\n result += this.get(i);\n }\n this._checkIsNotReadOnly(true);\n this._removeRangeWithoutDirtying(in_offset, in_deleteCount);\n this._setDirty();\n return result;\n }\n\n /**\n * @inheritdoc\n */\n _deserialize(in_serializedObj, in_reportToView,\n in_filteringOptions, in_createChangeSet) {\n if ((in_serializedObj.remove && in_serializedObj.remove.length > 0) ||\n (in_serializedObj.modify && in_serializedObj.modify.length > 0) ||\n (in_serializedObj.insert &&\n (in_serializedObj.insert.length > 1 ||\n (in_serializedObj.insert.length === 1 &&\n (in_serializedObj.insert[0][0] !== 0 ||\n !_.isString(in_serializedObj.insert[0][1])))))) {\n throw new Error(MSG.NO_NORMALIZED_CHANGESET);\n }\n\n var oldStringLength = this._dataArrayRef.length;\n var newStringData;\n if (_.isString(in_serializedObj)) {\n if (this._setValue(in_serializedObj, in_reportToView)) {\n return in_serializedObj;\n } else {\n return {};\n }\n } else {\n if (!in_serializedObj.insert ||\n !in_serializedObj.insert[0]) {\n // we've got an empty object, so we have to wipe everything we've got\n if (oldStringLength > 0) {\n this.removeRange(0, oldStringLength, in_reportToView);\n return {\n remove: [[0, oldStringLength]],\n };\n } else {\n // the string was already empty, nothing has changed\n return {};\n }\n } else {\n newStringData = in_serializedObj.insert[0][1];\n }\n }\n\n if (newStringData === this._dataArrayRef) {\n // nothing changed\n return {};\n }\n\n // check if something was attached (very common case)\n if (newStringData.length > oldStringLength) {\n if (newStringData.substring(0, oldStringLength) === this._dataArrayRef) {\n var appendChanges = {\n insert: [[oldStringLength, newStringData.substring(oldStringLength)]],\n };\n this.insertRange(oldStringLength, newStringData.substring(oldStringLength), in_reportToView);\n return appendChanges;\n }\n }\n\n // most simplistic diff method: Remove all existing data and insert the new data\n var simpleChanges = {\n insert: [[0, newStringData]],\n };\n if (oldStringLength > 0) {\n simpleChanges.remove = [[0, oldStringLength]];\n this._removeRangeWithoutDirtying(0, oldStringLength, in_reportToView);\n }\n this.insertRange(0, newStringData, in_reportToView);\n return simpleChanges;\n }\n\n /**\n * Serialize the property\n *\n * @param {boolean} in_dirtyOnly -\n * Only include dirty entries in the serialization\n * @param {boolean} in_includeRootTypeid -\n * Include the typeid of the root of the hierarchy - has no effect for ArrayProperty\n * @param {property-properties.BaseProperty.MODIFIED_STATE_FLAGS} [in_dirtinessType] -\n * The type of dirtiness to use when reporting dirty changes. By default this is\n * PENDING_CHANGE\n * @param {boolean} [in_includeReferencedRepositories=false] - If this is set to true, the serialize\n * function will descend into referenced repositories. WARNING: if there are loops in the references\n * this can result in an infinite loop\n *\n * @return {Object} The serialized representation of this property\n * @private\n */\n _serialize(in_dirtyOnly, in_includeRootTypeid,\n in_dirtinessType, in_includeReferencedRepositories) {\n if (in_dirtyOnly) {\n return ArrayProperty.prototype._serialize.call(this, in_dirtyOnly, in_includeRootTypeid, in_dirtinessType);\n } else {\n // returns just the current data\n return this._dataArrayRef;\n }\n }\n\n /**\n * @param {string} in_value the new value\n * @throws if string property is read only\n */\n setValue(in_value) {\n this._checkIsNotReadOnly(true);\n this._setValue(in_value, true);\n }\n\n /**\n * See {@link StringProperty.setValues}\n * @param {string} in_values the new values\n * @param {Bool} in_initial - Whether we are setting default/initial values\n * or if the function is called directly with the values to set.\n */\n _setValues(in_values, in_initial) {\n throw new Error(MSG.NO_VALUE_PROPERTY_SETVALUES);\n }\n\n /**\n * @param {string} in_values the new values\n * @throws always - cannot use .setValues on a StringProperty. Use .setValue() instead.\n */\n setValues(in_values) {\n StringProperty.prototype._setValues.call(this, in_values, false);\n }\n\n /**\n * @throws always - cannot call .getValues on a string. Use .getValue() instead\n */\n getValues() {\n throw new Error(MSG.NO_VALUE_PROPERTY_GETVALUES);\n }\n\n /**\n * Internal function to update the value of a property\n *\n * @param {string} in_value the new value\n * @param {boolean} [in_reportToView = true] - By default, the dirtying will always be reported to the checkout view\n * and trigger a modified event there. When batching updates, this\n * can be prevented via this flag.\n * @return {boolean} true if the value was actually changed\n */\n _setValue(in_value, in_reportToView) {\n var oldValue = this._dataArrayRef;\n var castedValue = String(in_value);\n var changed = castedValue !== oldValue;\n if (changed) {\n var stringLength = this._dataArrayRef.length;\n if (stringLength > 0) {\n this._dataArrayRemoveRange(0, stringLength);\n }\n this._dataArrayInsertRange(0, castedValue);\n\n this._dirty = PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE;\n\n // The assignment in the line above already set this property to\n // dirty, so we only update the parent (instead of calling\n // setDirty on this property)\n if (this._parent) {\n this._parent._setDirty(in_reportToView, this);\n } else if (in_reportToView === true || in_reportToView === undefined) {\n this._reportDirtinessToView();\n }\n }\n return changed;\n }\n\n /**\n * Sets the pending and dirty changesets\n *\n * @param {property-properties.SerializedChangeSet|undefined|null} in_pending\n * The pending changeset. If null is passed, no change will be\n * applied. undefined indicates that the changes should be reset\n * @param {property-properties.SerializedChangeSet|undefined|null} in_dirty\n * The dirty changeset. If null is passed, no change will be\n * applied. undefined indicates that the changes should be reset\n */\n _setChanges(in_pending, in_dirty) {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n let newFlags = this._dirty.flags;\n if (in_pending === undefined) {\n newFlags &= 0xFFFFFFFF ^ BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE;\n }\n if (in_dirty === undefined) {\n newFlags &= 0xFFFFFFFF ^ BaseProperty.MODIFIED_STATE_FLAGS.DIRTY;\n }\n this._dirty = STRING_PROPERTY_SET_PROPERTY_VALUE_STATE_FLAGS[newFlags];\n } else {\n ArrayProperty.prototype._setChanges.call(this, in_pending, in_dirty);\n }\n }\n\n /**\n * Sets the dirty flags for this property\n * @param {Number} in_flags The dirty flags\n */\n _setDirtyFlags(in_flags) {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n this._dirty = STRING_PROPERTY_SET_PROPERTY_VALUE_STATE_FLAGS[in_flags];\n return;\n }\n\n ArrayProperty.prototype._setDirtyFlags.call(this, in_flags);\n }\n\n /**\n * Gets the dirty flags for this property\n * @return {Number} The dirty flags\n */\n _getDirtyFlags() {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n return this._dirty.flags;\n }\n\n return ArrayProperty.prototype._getDirtyFlags.call(this);\n }\n\n /**\n * @inheritdoc\n */\n _applyChangeset(in_changeSet, in_reportToView) {\n // It is unfortunate, but because StringProperty derives from ArrayProperty, it can happen\n // that we receive here a ChangeSet that is formatted for an Array. We must be able to\n // distinguish it from a reversible changeset and from a simple changeset...\n // TODO: We need a formal way to know what kind of content we are to expect in a ChangeSet,\n // we should never have to guess that.\n if (typeof in_changeSet === 'string') {\n // Let's consider it's a simple changeset.\n this._setValue(in_changeSet, in_reportToView);\n } else if (in_changeSet.value !== undefined) {\n // Let's consider it's a reversible changeset.\n this._setValue(in_changeSet.value, in_reportToView);\n } else {\n // Let's consider it's an ArrayProperty-like changeset\n ArrayProperty.prototype._applyChangeset.call(this, in_changeSet, in_reportToView);\n }\n }\n\n /**\n * Calls back the given function with a human-readable string\n * representation of the property.\n * @param {string} indent - Leading spaces to create the tree representation\n * @param {string} externalId - Name of the current property at the upper level.\n * Used for arrays.\n * @param {function} printFct - Function to call for printing each property\n */\n _prettyPrint(indent, externalId, printFct) {\n printFct(indent + externalId + this.getId() + ' (' + this.getTypeid() + '): \"' + this.value + '\"');\n }\n\n /**\n * Return a JSON representation of the property.\n * @return {object} A JSON representation of the property.\n * @private\n */\n _toJson() {\n return {\n id: this.getId(),\n context: this._context,\n typeid: this.getTypeid(),\n isConstant: this._isConstant,\n value: this.value,\n };\n }\n\n /**\n * Sets the value of a character at a single index.\n * For example, if you have a string of value 'AAAA' and do .set(1, 'a') => 'AaAA'\n * @param {number} in_index the index you wish to set\n * @param {string} in_character the character you wish to set\n * @throws if length of in_character is longer than one character\n */\n set(in_index, in_character) {\n ConsoleUtils.assert(_.isNumber(in_index), MSG.STRING_SET_NEEDS_INDEX + in_index);\n\n if (in_character.length !== 1) {\n throw new Error(MSG.STRING_SET_ONE_CHAR);\n }\n\n this.setRange(in_index, in_character);\n }\n\n /**\n * sets values in a string starting at an index.\n * For example, if you have a string of Value 'AAAA' and do .setRange(1, 'aa') => AaaA\n * It will set as many letters as are in in_string.\n * @param {number} in_index the index at which you wish to start setting\n * @param {string} in_string the string you wish to set\n * @throws if in_index + length of in_string is longer than the original string\n */\n setRange(in_index, in_string) {\n ArrayProperty.prototype.setRange.call(this, in_index, in_string);\n }\n\n /**\n * get a letter at a given index\n * @param {number} in_index the index\n * @return {string} the single letter found at in_index\n */\n get(in_index) {\n return ArrayProperty.prototype.get.call(this, in_index);\n }\n\n /**\n * inserts a string starting at a position and shifts the rest of the String to the right.\n * Will not overwrite existing values.\n * For StringProperty, insert and insertRange work the same, except that .insert\n * checks that in_value is a string and .insertRange will accept an array of strings.\n * @param {number} in_position target index\n * @param {string | array<string>} in_value value to be inserted\n * @throws if in_position is smaller than zero, larger than the length of the string or not a number\n */\n insertRange(in_position, in_value) {\n if (_.isArray(in_value)) {\n in_value = in_value.join('');\n }\n this._insertRange(in_position, in_value);\n }\n\n /**\n * Creates and initializes the data array\n * @param {Number} in_length the initial length of the array\n */\n _dataArrayCreate(in_length) {\n this._dataArrayRef = '';\n }\n\n /**\n * Returns the length of the data array\n * @return {Number} The length\n */\n _dataArrayGetLength() {\n return this._dataArrayRef.length;\n }\n\n /**\n * Returns the data array's internal buffer\n * @return {Array} The buffer\n */\n _dataArrayGetBuffer() {\n return this._dataArrayRef;\n }\n\n /**\n * Returns an entry from the data array\n * @param {Number} in_i - Position in the array\n *\n * @return {*} The value at index in_i\n */\n _dataArrayGetValue(in_i) {\n in_i = in_i === undefined ? 0 : in_i;\n if (in_i >= this._size || in_i < 0) {\n throw new Error('Trying to access out of bounds!');\n }\n\n return this._dataArrayRef[in_i];\n }\n\n /**\n * Set the array to the given new array\n * @param {String} in_newString - The new contents of the array\n */\n _dataArrayDeserialize(in_newString) {\n this._dataArrayRef = in_newString;\n }\n\n /**\n * Inserts a range into the data array\n * @param {Number} in_position - Position at which the insert should be done\n * @param {String} in_range - The array to insert\n */\n _dataArrayInsertRange(in_position, in_range) {\n this._dataArrayRef = this._dataArrayRef.substr(0, in_position) + in_range + this._dataArrayRef.substr(in_position);\n }\n\n /**\n * Removes a range from the data array\n * @param {Number} in_position - Position at which to start the removal\n * @param {Number} in_length - The number of entries to remove\n */\n _dataArrayRemoveRange(in_position, in_length) {\n if (in_position + in_length < this._dataArrayRef.length + 1) {\n this._dataArrayRef = this._dataArrayRef.substr(0, in_position) +\n this._dataArrayRef.substr(in_position + in_length);\n } else {\n throw Error('DataArray removeRange in_offset + in_deleteCount is out of bounds.');\n }\n }\n\n /**\n * Overwrites a range in the data array\n * @param {Number} in_position - Position at which to start the removal\n * @param {String} in_values - The string with which the range is overwritten\n */\n _dataArraySetRange(in_position, in_values) {\n this._dataArrayRef = this._dataArrayRef.substr(0, in_position) + in_values +\n this._dataArrayRef.substr(in_position + in_values.length);\n }\n\n get value() {\n return this.getValue();\n }\n\n set value(val) {\n this.setValue.call(this, val);\n }\n\n /** @inheritdoc */\n _traverse(in_callback, in_pathFromTraversalStart) {\n return undefined;\n }\n\n /** @inheritdoc */\n _traverseStaticProperties(in_callback, in_pathFromTraversalStart) {\n return undefined;\n }\n}\n\nStringProperty.prototype._typeid = 'String';\nStringProperty.prototype._context = 'single';\nStringProperty.prototype._noDirtyInBase = true;\n"]}