@cratis/fundamentals 7.22.1 → 7.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/JsonSerializer.ts CHANGED
@@ -6,7 +6,8 @@ import { DerivedType } from './DerivedType';
6
6
  import { registerModuleInstance } from './duplicateInstanceGuard';
7
7
  import { Field } from './Field';
8
8
  import { Fields } from './Fields';
9
- import { conceptAsTypeKey, declaredTypeKey, typeKeyOf, valueMapTypeKey } from './typeKey';
9
+ import { Guid } from './Guid';
10
+ import { conceptAsTypeKey, declaredTypeKey, guidTypeKey, typeKeyOf, valueMapTypeKey } from './typeKey';
10
11
  import { ValueMap } from './ValueMap';
11
12
  import {
12
13
  JsonConverter,
@@ -203,9 +204,25 @@ const serializeMapKey = (key: any): string => {
203
204
  return key.toISOString();
204
205
  }
205
206
 
207
+ // A Guid key is its plain canonical string, which is what a C# dictionary writes. Serializing it
208
+ // like any other object would wrap it in JSON quotes and no other reader accepts that.
209
+ if (declaredTypeKey(key.constructor) === guidTypeKey) {
210
+ return key.toString();
211
+ }
212
+
206
213
  return JsonSerializer.serialize(key);
207
214
  };
208
215
 
216
+ const readGuidMapKey = (key: string): Guid => {
217
+ // Keys written before the plain form was adopted carry the JSON quotes of an embedded string.
218
+ const text = key.length >= 2 && key.startsWith('"') && key.endsWith('"') ? key.slice(1, -1) : key;
219
+ if (!Guid.isGuid(text)) {
220
+ throw new Error(`The map key '${key}' is not a valid Guid.`);
221
+ }
222
+
223
+ return Guid.parse(text);
224
+ };
225
+
209
226
  const deserializeMapKey = (keyType: Constructor, key: string): any => {
210
227
  if (keyType === String) {
211
228
  return key;
@@ -219,6 +236,10 @@ const deserializeMapKey = (keyType: Constructor, key: string): any => {
219
236
  return key.toLowerCase() === 'true';
220
237
  }
221
238
 
239
+ if (declaredTypeKey(keyType) === guidTypeKey) {
240
+ return readGuidMapKey(key);
241
+ }
242
+
222
243
  // Check if there's a converter for this type
223
244
  const converter = converterFor(keyType);
224
245
  if (converter) {
@@ -333,6 +354,8 @@ export class JsonSerializer {
333
354
  * - A `ValueMap` is read back from the declaring field's generic arguments rather than through a
334
355
  * converter. Note the asymmetry: writing a `ValueMap` *does* go through the registered converter,
335
356
  * so replacing that one changes only the outbound half.
357
+ * - A `Guid` used as a `ValueMap` key always uses the plain canonical string form and bypasses any
358
+ * registered `Guid` converter, so that keys stay compatible with C# dictionaries.
336
359
  */
337
360
  static registerConverter(converter: JsonConverter): void {
338
361
  registerConverterFor(converter);
@@ -1 +1 @@
1
- {"version":3,"file":"JsonSerializer.d.ts","sourceRoot":"","sources":["../JsonSerializer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAO5C,OAAO,EACH,aAAa,EAUhB,MAAM,QAAQ,CAAC;AAuShB,qBAAa,cAAc;IACvB,MAAM,CAAC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAoB;IAmBjE,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI,CAEvD;IAOD,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAGnC;IAQD,MAAM,CAAC,WAAW,CAAC,OAAO,SAAS,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAGlG;IAQD,MAAM,CAAC,gBAAgB,CAAC,OAAO,SAAS,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAGzG;IAQD,MAAM,CAAC,uBAAuB,CAAC,OAAO,SAAS,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,CAyD/G;IAQD,MAAM,CAAC,4BAA4B,CAAC,OAAO,SAAS,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,OAAO,EAAE,CAQvH;CACJ"}
1
+ {"version":3,"file":"JsonSerializer.d.ts","sourceRoot":"","sources":["../JsonSerializer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAQ5C,OAAO,EACH,aAAa,EAUhB,MAAM,QAAQ,CAAC;AA2ThB,qBAAa,cAAc;IACvB,MAAM,CAAC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAoB;IAqBjE,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI,CAEvD;IAOD,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAGnC;IAQD,MAAM,CAAC,WAAW,CAAC,OAAO,SAAS,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAGlG;IAQD,MAAM,CAAC,gBAAgB,CAAC,OAAO,SAAS,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAGzG;IAQD,MAAM,CAAC,uBAAuB,CAAC,OAAO,SAAS,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,CAyD/G;IAQD,MAAM,CAAC,4BAA4B,CAAC,OAAO,SAAS,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,OAAO,EAAE,CAQvH;CACJ"}
@@ -2,7 +2,8 @@ import { DerivedType } from './DerivedType';
2
2
  import { registerModuleInstance } from './duplicateInstanceGuard';
3
3
  import { Field } from './Field';
4
4
  import { Fields } from './Fields';
5
- import { conceptAsTypeKey, declaredTypeKey, typeKeyOf, valueMapTypeKey } from './typeKey';
5
+ import { Guid } from './Guid';
6
+ import { conceptAsTypeKey, declaredTypeKey, guidTypeKey, typeKeyOf, valueMapTypeKey } from './typeKey';
6
7
  import { ValueMap } from './ValueMap';
7
8
  import { DateJsonConverter, DateOnlyJsonConverter, GuidJsonConverter, TimeOnlyJsonConverter, TimeSpanJsonConverter, PointJsonConverter, LineStringJsonConverter, PolygonJsonConverter, ValueMapJsonConverter } from './json';
8
9
  registerModuleInstance();
@@ -111,8 +112,18 @@ const serializeMapKey = (key) => {
111
112
  if (key instanceof Date) {
112
113
  return key.toISOString();
113
114
  }
115
+ if (declaredTypeKey(key.constructor) === guidTypeKey) {
116
+ return key.toString();
117
+ }
114
118
  return JsonSerializer.serialize(key);
115
119
  };
120
+ const readGuidMapKey = (key) => {
121
+ const text = key.length >= 2 && key.startsWith('"') && key.endsWith('"') ? key.slice(1, -1) : key;
122
+ if (!Guid.isGuid(text)) {
123
+ throw new Error(`The map key '${key}' is not a valid Guid.`);
124
+ }
125
+ return Guid.parse(text);
126
+ };
116
127
  const deserializeMapKey = (keyType, key) => {
117
128
  if (keyType === String) {
118
129
  return key;
@@ -123,6 +134,9 @@ const deserializeMapKey = (keyType, key) => {
123
134
  if (keyType === Boolean) {
124
135
  return key.toLowerCase() === 'true';
125
136
  }
137
+ if (declaredTypeKey(keyType) === guidTypeKey) {
138
+ return readGuidMapKey(key);
139
+ }
126
140
  const converter = converterFor(keyType);
127
141
  if (converter) {
128
142
  return converter.read(key);
@@ -1 +1 @@
1
- {"version":3,"file":"JsonSerializer.js","sourceRoot":"","sources":["../JsonSerializer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,W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AW,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,OAAO,EAAE;CAS3H"}
@@ -4,6 +4,7 @@ var DerivedType = require('./DerivedType.js');
4
4
  var duplicateInstanceGuard = require('./duplicateInstanceGuard.js');
5
5
  var Field = require('./Field.js');
6
6
  var Fields = require('./Fields.js');
7
+ var Guid = require('./Guid.js');
7
8
  var typeKey = require('./typeKey.js');
8
9
  var ValueMap = require('./ValueMap.js');
9
10
  var DateJsonConverter = require('./json/DateJsonConverter.js');
@@ -122,8 +123,18 @@ const serializeMapKey = (key) => {
122
123
  if (key instanceof Date) {
123
124
  return key.toISOString();
124
125
  }
126
+ if (typeKey.declaredTypeKey(key.constructor) === typeKey.guidTypeKey) {
127
+ return key.toString();
128
+ }
125
129
  return JsonSerializer.serialize(key);
126
130
  };
131
+ const readGuidMapKey = (key) => {
132
+ const text = key.length >= 2 && key.startsWith('"') && key.endsWith('"') ? key.slice(1, -1) : key;
133
+ if (!Guid.Guid.isGuid(text)) {
134
+ throw new Error(`The map key '${key}' is not a valid Guid.`);
135
+ }
136
+ return Guid.Guid.parse(text);
137
+ };
127
138
  const deserializeMapKey = (keyType, key) => {
128
139
  if (keyType === String) {
129
140
  return key;
@@ -134,6 +145,9 @@ const deserializeMapKey = (keyType, key) => {
134
145
  if (keyType === Boolean) {
135
146
  return key.toLowerCase() === 'true';
136
147
  }
148
+ if (typeKey.declaredTypeKey(keyType) === typeKey.guidTypeKey) {
149
+ return readGuidMapKey(key);
150
+ }
137
151
  const converter = converterFor(keyType);
138
152
  if (converter) {
139
153
  return converter.read(key);
@@ -1 +1 @@
1
- {"version":3,"file":"JsonSerializer.js","sources":["../../JsonSerializer.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Constructor } from './Constructor';\nimport { DerivedType } from './DerivedType';\nimport { registerModuleInstance } from './duplicateInstanceGuard';\nimport { Field } from './Field';\nimport { Fields } from './Fields';\nimport { conceptAsTypeKey, declaredTypeKey, typeKeyOf, valueMapTypeKey } from './typeKey';\nimport { ValueMap } from './ValueMap';\nimport { \n JsonConverter, \n DateJsonConverter, \n DateOnlyJsonConverter,\n GuidJsonConverter, \n TimeOnlyJsonConverter,\n TimeSpanJsonConverter, \n PointJsonConverter,\n LineStringJsonConverter,\n PolygonJsonConverter,\n ValueMapJsonConverter\n} from './json';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\ntype typeSerializer = (value: any) => any;\n\n// A second copy of this package in the same realm builds its own registry here, and brings its own\n// class objects. Convertible values still cross between the copies, because a type is recognized by\n// the key it declares - but a converter registered on one copy reaches only that one, and a version\n// pinned at the top level never reaches a nested copy. Announce it where the state that cannot be\n// shared is built.\nregisterModuleInstance();\n\n// Initialize converters\nconst converters: JsonConverter[] = [\n new DateJsonConverter(),\n new DateOnlyJsonConverter(),\n new GuidJsonConverter(),\n new TimeOnlyJsonConverter(),\n new TimeSpanJsonConverter(),\n new PointJsonConverter(),\n new LineStringJsonConverter(),\n new PolygonJsonConverter(),\n new ValueMapJsonConverter()\n];\n\n// Converters are found by the key a type declares, and only by the constructor when it declares none.\n// Keying on the constructor alone is what made a second copy of this package silently fatal: each copy\n// brings its own Guid, ConceptAs and ValueMap class objects, so neither recognized the other's. A key\n// crosses that boundary; a class object does not. A consumer's own type has no key and is found by\n// constructor, which is exact and needs nothing to cross.\nconst keyedConverters: Map<string, JsonConverter> = new Map<string, JsonConverter>();\nconst typeConverters: Map<Constructor, JsonConverter> = new Map<Constructor, JsonConverter>();\n\nconst registerConverterFor = (converter: JsonConverter) => {\n const key = declaredTypeKey(converter.type);\n if (key !== undefined) {\n keyedConverters.set(key, converter);\n }\n\n typeConverters.set(converter.type, converter);\n};\n\nconverters.forEach(registerConverterFor);\n\n/**\n * Finds the converter registered for a type, if any.\n * @param {Constructor} type The type to convert.\n * @returns {JsonConverter | undefined} The converter, or undefined when the type has none.\n */\nconst converterFor = (type: Constructor | undefined): JsonConverter | undefined => {\n if (!type) return undefined;\n\n const key = declaredTypeKey(type);\n const keyed = key === undefined ? undefined : keyedConverters.get(key);\n return keyed ?? typeConverters.get(type);\n};\n\n/**\n * Checks whether a type is a ValueMap, including one from another copy of this package.\n * @param {Constructor} type The type to check.\n * @returns {boolean} True when the type is a ValueMap.\n */\nconst isValueMap = (type: Constructor | undefined): boolean => declaredTypeKey(type) === valueMapTypeKey;\n\n// Add primitive type converters that don't need a full JsonConverter class\nconst primitiveConverters: Map<Constructor, typeSerializer> = new Map<Constructor, typeSerializer>([\n [Number, (value: number) => value],\n [String, (value: string) => value],\n [Boolean, (value: boolean) => value]\n]);\n\nconst primitiveSerializers: Map<Constructor, typeSerializer> = new Map<Constructor, typeSerializer>([\n [Number, (value: any) => value],\n [String, (value: any) => value],\n [Boolean, (value: any) => value]\n]);\n\n/**\n * Checks if a constructor is a ConceptAs type.\n * @param {Constructor} type The constructor to check.\n * @returns {boolean} True if the type extends ConceptAs.\n * @remarks\n * Reads the key rather than walking the prototype chain looking for this copy's ConceptAs. The key is a\n * static and a static is inherited, so every type deriving from ConceptAs carries it - including one\n * deriving from another copy's ConceptAs, which a prototype walk could never recognize.\n */\nconst isConceptAs = (type: Constructor): boolean => typeKeyOf(type) === conceptAsTypeKey;\n\nconst serializeValueForType = (type: Constructor, value: any) => {\n if (!value) return value;\n\n // If it's a ConceptAs instance, unwrap it and serialize the inner value recursively\n // This follows the C# pattern: recognize as concept, unwrap, then call serializer\n if (isConceptAs(value.constructor)) {\n const innerValue = value.value;\n // Recursively serialize the inner value to handle complex types\n // Use .constructor directly which works reliably for both primitives and objects\n return serializeValueForType(innerValue.constructor, innerValue);\n }\n\n // Check if there's a registered converter\n const converter = converterFor(type);\n if (converter) {\n return converter.write(value);\n }\n \n // Check primitive converters\n if (primitiveConverters.has(type)) {\n return primitiveConverters.get(type)!(value);\n }\n \n return convertTypesOnInstance(value);\n};\n\nconst deserializeValueFromType = (type: Constructor, value: any) => {\n // If it's a ConceptAs type, instantiate it with the value\n if (isConceptAs(type)) {\n const valueType = (type as Constructor & { valueType?: Constructor }).valueType;\n return new type(valueType ? deserializeValueFromType(valueType, value) : value);\n }\n \n // Check if there's a registered converter\n const converter = converterFor(type);\n if (converter) {\n return converter.read(value);\n }\n \n // Check primitive serializers\n if (primitiveSerializers.has(type)) {\n return primitiveSerializers.get(type)!(value);\n }\n \n return JsonSerializer.deserialize(type, JSON.stringify(value));\n};\n\nconst deserializeValueFromField = (field: Field, value: any) => {\n if (isValueMap(field.type)) {\n return deserializeValueMapFromField(field, value);\n }\n\n // If it's a ConceptAs type, instantiate it with the value\n if (isConceptAs(field.type)) {\n return deserializeValueFromType(field.type, value);\n }\n\n // Check if there's a registered converter\n const converter = converterFor(field.type);\n if (converter) {\n return converter.read(value);\n }\n \n // Check primitive serializers\n if (primitiveSerializers.has(field.type)) {\n return primitiveSerializers.get(field.type)!(value);\n }\n \n let type = field.type;\n if (value[JsonSerializer.DerivedTypeIdProperty]) {\n const derivedTypeId = value[JsonSerializer.DerivedTypeIdProperty];\n const candidates = [...field.derivatives, ...DerivedType.getDerivedTypesFor(field.type)];\n type = candidates.find(_ => DerivedType.get(_) == derivedTypeId) || type;\n }\n\n return JsonSerializer.deserialize(type, JSON.stringify(value));\n};\n\nconst serializeMapKey = (key: any): string => {\n if (key === undefined || key === null) {\n return '';\n }\n\n if (typeof key === 'string') {\n return key;\n }\n\n if (typeof key === 'number' || typeof key === 'boolean' || typeof key === 'bigint') {\n return key.toString();\n }\n\n if (key instanceof Date) {\n return key.toISOString();\n }\n\n return JsonSerializer.serialize(key);\n};\n\nconst deserializeMapKey = (keyType: Constructor, key: string): any => {\n if (keyType === String) {\n return key;\n }\n\n if (keyType === Number) {\n return Number(key);\n }\n\n if (keyType === Boolean) {\n return key.toLowerCase() === 'true';\n }\n\n // Check if there's a converter for this type\n const converter = converterFor(keyType);\n if (converter) {\n return converter.read(key);\n }\n\n return JsonSerializer.deserialize(keyType, key);\n};\n\nconst deserializeMapValue = (valueType: Constructor | undefined, value: any): any => {\n if (!valueType) {\n return value;\n }\n\n // A map value is an ordinary value of its declared type, so read it the way any other value of that\n // type is read. Resolving it here instead left out the concept and primitive cases, and the\n // primitive one lost data without a sound: a string value went through JsonSerializer.deserialize,\n // which built an empty String object because a primitive has no fields to populate.\n return deserializeValueFromType(valueType, value);\n};\n\nconst deserializeValueMapFromField = (field: Field, value: any): ValueMap<any, any> => {\n const valueMap = new ValueMap<any, any>();\n const keyType = field.genericArguments[0];\n const valueType = field.genericArguments[1];\n\n if (!value || !keyType) {\n return valueMap;\n }\n\n for (const key of Object.keys(value)) {\n const deserializedKey = deserializeMapKey(keyType, key);\n const deserializedValue = deserializeMapValue(valueType, value[key]);\n valueMap.set(deserializedKey, deserializedValue);\n }\n\n return valueMap;\n};\n\nconst convertTypesOnInstance = (instance: any) => {\n // A concept unwraps to its underlying value wherever it is reached, not only when it is reached\n // through a declared field. An array element and a map value arrive here rather than at\n // serializeValueForType, and without this they were written as the object a concept happens to be -\n // {\"value\": ...} where the receiver declared the underlying type.\n if (isConceptAs(instance.constructor)) {\n return serializeValueForType(instance.constructor as Constructor, instance);\n }\n\n // Check if there's a converter for this type\n if (converterFor(instance.constructor)) {\n return serializeValueForType(instance.constructor, instance);\n }\n \n // Check primitive converters\n if (primitiveConverters.has(instance.constructor)) {\n return primitiveConverters.get(instance.constructor)!(instance);\n }\n\n const properties = Object.getOwnPropertyNames(instance);\n const converted: any = {};\n\n // Emit the polymorphic type discriminator, preferring the registered type for the instance's\n // constructor and falling back to a discriminator preserved on the instance itself (e.g. a value\n // that was deserialized before its concrete type could be resolved). This keeps '_derivedTypeId'\n // flowing through serialization transparently — the caller never has to manage it — and is the\n // mirror of preserving it on deserialization.\n const derivedTypeId = DerivedType.get(instance.constructor) ?? instance[JsonSerializer.DerivedTypeIdProperty];\n if (derivedTypeId) {\n converted[JsonSerializer.DerivedTypeIdProperty] = derivedTypeId;\n }\n properties.forEach(property => {\n // The discriminator is handled above as a meta-property; never treat it as a data field.\n if (property === JsonSerializer.DerivedTypeIdProperty) return;\n let value = instance[property];\n if (value !== undefined) {\n if (Array.isArray(value)) {\n value = value.map(_ => convertTypesOnInstance(_));\n } else {\n value = serializeValueForType(value.__proto__.constructor, value);\n }\n }\n\n converted[property] = value;\n });\n\n return converted;\n};\n\n// Initialize ValueMapJsonConverter with helper functions to avoid circular dependencies\n// Must be done after serializeMapKey and convertTypesOnInstance are defined\nValueMapJsonConverter.setHelpers(serializeMapKey, convertTypesOnInstance);\n\n/**\n * Represents a serializer for JSON.\n */\nexport class JsonSerializer {\n static readonly DerivedTypeIdProperty: string = \"_derivedTypeId\";\n\n /**\n * Register a converter for the type it declares through its `type` property.\n * @param {JsonConverter} converter The converter to register.\n * @remarks\n * The converter is used for both directions - `read` on the way in, `write` on the way out - and\n * takes the place of any converter already registered for the same type, including the built-in\n * ones. Replacing a built-in changes the payloads the application produces and consumes, which is\n * the caller's to decide; nothing here second-guesses it.\n *\n * Two shapes resolve ahead of the converters, so a converter registered for them is not reached:\n *\n * - A type deriving from `ConceptAs` is unwrapped to its underlying value in both directions, and\n * converted as that value's type. Register for the underlying type to reach a concept.\n * - A `ValueMap` is read back from the declaring field's generic arguments rather than through a\n * converter. Note the asymmetry: writing a `ValueMap` *does* go through the registered converter,\n * so replacing that one changes only the outbound half.\n */\n static registerConverter(converter: JsonConverter): void {\n registerConverterFor(converter);\n }\n\n /**\n * Serialize with strong type information.\n * @param {*} value The value to serialize.\n * @returns A JSON string.\n */\n static serialize(value: any): string {\n const converted = convertTypesOnInstance(value);\n return JSON.stringify(converted);\n }\n\n /**\n * Deserialize a JSON string to the specific type.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {string} json Actual JSON to deserialize.\n * @returns An instance of the target type.\n */\n static deserialize<TResult extends object>(targetType: Constructor<TResult>, json: string): TResult {\n const parsed = JSON.parse(json);\n return this.deserializeFromInstance<TResult>(targetType, parsed);\n }\n\n /**\n * Deserialize a array JSON string to an array of the specific instance type.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {string} json Actual JSON to deserialize.\n * @returns An array of instances of the target type.\n */\n static deserializeArray<TResult extends object>(targetType: Constructor<TResult>, json: string): TResult[] {\n const parsed = JSON.parse(json);\n return this.deserializeArrayFromInstance(targetType, parsed);\n }\n\n /**\n * Deserialize an any instance to a specific instance type.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {*} instance Actual instance to deserialize.\n * @returns An instance of the target type.\n */\n static deserializeFromInstance<TResult extends object>(targetType: Constructor<TResult>, instance: any): TResult {\n const fields = Fields.getFieldsForType(targetType as Constructor);\n\n if (converterFor(targetType) || isConceptAs(targetType)) {\n return deserializeValueFromType(targetType, instance);\n }\n\n const deserialized = new targetType();\n for (const field of fields) {\n let value = instance[field.name];\n if (value !== undefined && value !== null) {\n if (field.type === Array) {\n const elementType = field.genericArguments[0];\n if (elementType) {\n const elementField = new Field(field.name, elementType, false, field.derivatives, []);\n value = value.map(_ => deserializeValueFromField(elementField, _));\n }\n } else if (field.enumerable) {\n value = value.map(_ => deserializeValueFromField(field, _));\n } else {\n value = deserializeValueFromField(field, value);\n }\n } else if ((field.enumerable || field.type === Array) && value === undefined) {\n // A collection that is absent from the payload deserializes to an empty one rather than to\n // undefined. The declared type says the field is an array, and a producer that leaves an\n // empty collection out - which the Chronicle sink does deliberately, so that a parallel\n // replay cannot overwrite children a sibling event already wrote - would otherwise hand back\n // a value contradicting its own type, putting a null guard on every reader of every\n // collection. An explicit null is left alone: that is the producer saying \"no collection\"\n // rather than \"an empty one\".\n value = [];\n }\n\n deserialized[field.name] = value;\n }\n\n // Preserve the polymorphic type discriminator so it is never lost across (de)serialization\n // layers. '_derivedTypeId' is not a declared field, so it is otherwise dropped here — and a\n // derived value whose concrete type could not be resolved (e.g. its type was not yet\n // registered) would then have no discriminator left to re-resolve or round-trip with, and\n // would serialize back with no type information at all.\n const derivedTypeId = instance[JsonSerializer.DerivedTypeIdProperty];\n if (derivedTypeId !== undefined && derivedTypeId !== null) {\n (deserialized as Record<string, unknown>)[JsonSerializer.DerivedTypeIdProperty] = derivedTypeId;\n }\n\n if ((targetType as Constructor) == Object) {\n const objectFields = Object.keys(instance).filter((value) => {\n return !fields.some(_ => _.name == value);\n });\n\n for (const field of objectFields) {\n deserialized[field] = instance[field];\n }\n }\n\n return deserialized;\n }\n\n /**\n * Deserialize an array of any instances to an array of specific instance types.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {instances} instances Actual instances to deserialize.\n * @returns An array of instances of the target type.\n */\n static deserializeArrayFromInstance<TResult extends object>(targetType: Constructor<TResult>, instances: any): TResult[] {\n const deserialized: TResult[] = [];\n\n for (const instance of instances) {\n deserialized.push(this.deserializeFromInstance<TResult>(targetType, instance));\n }\n\n return deserialized;\n }\n}\n"],"names":["registerModuleInstance","DateJsonConverter","DateOnlyJsonConverter","GuidJsonConverter","TimeOnlyJsonConverter","TimeSpanJsonConverter","PointJsonConverter","LineStringJsonConverter","PolygonJsonConverter","ValueMapJsonConverter","declaredTypeKey","valueMapTypeKey","typeKeyOf","conceptAsTypeKey","DerivedType","ValueMap","Fields","Field"],"mappings":";;;;;;;;;;;;;;;;;;AAgCAA,6CAAsB,EAAE;AAGxB,MAAM,UAAU,GAAoB;AAChC,IAAA,IAAIC,mCAAiB,EAAE;AACvB,IAAA,IAAIC,2CAAqB,EAAE;AAC3B,IAAA,IAAIC,mCAAiB,EAAE;AACvB,IAAA,IAAIC,2CAAqB,EAAE;AAC3B,IAAA,IAAIC,2CAAqB,EAAE;AAC3B,IAAA,IAAIC,qCAAkB,EAAE;AACxB,IAAA,IAAIC,+CAAuB,EAAE;AAC7B,IAAA,IAAIC,yCAAoB,EAAE;AAC1B,IAAA,IAAIC,2CAAqB;CAC5B;AAOD,MAAM,eAAe,GAA+B,IAAI,GAAG,EAAyB;AACpF,MAAM,cAAc,GAAoC,IAAI,GAAG,EAA8B;AAE7F,MAAM,oBAAoB,GAAG,CAAC,SAAwB,KAAI;IACtD,MAAM,GAAG,GA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}
1
+ {"version":3,"file":"JsonSerializer.js","sources":["../../JsonSerializer.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Constructor } from './Constructor';\nimport { DerivedType } from './DerivedType';\nimport { registerModuleInstance } from './duplicateInstanceGuard';\nimport { Field } from './Field';\nimport { Fields } from './Fields';\nimport { Guid } from './Guid';\nimport { conceptAsTypeKey, declaredTypeKey, guidTypeKey, typeKeyOf, valueMapTypeKey } from './typeKey';\nimport { ValueMap } from './ValueMap';\nimport { \n JsonConverter, \n DateJsonConverter, \n DateOnlyJsonConverter,\n GuidJsonConverter, \n TimeOnlyJsonConverter,\n TimeSpanJsonConverter, \n PointJsonConverter,\n LineStringJsonConverter,\n PolygonJsonConverter,\n ValueMapJsonConverter\n} from './json';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\ntype typeSerializer = (value: any) => any;\n\n// A second copy of this package in the same realm builds its own registry here, and brings its own\n// class objects. Convertible values still cross between the copies, because a type is recognized by\n// the key it declares - but a converter registered on one copy reaches only that one, and a version\n// pinned at the top level never reaches a nested copy. Announce it where the state that cannot be\n// shared is built.\nregisterModuleInstance();\n\n// Initialize converters\nconst converters: JsonConverter[] = [\n new DateJsonConverter(),\n new DateOnlyJsonConverter(),\n new GuidJsonConverter(),\n new TimeOnlyJsonConverter(),\n new TimeSpanJsonConverter(),\n new PointJsonConverter(),\n new LineStringJsonConverter(),\n new PolygonJsonConverter(),\n new ValueMapJsonConverter()\n];\n\n// Converters are found by the key a type declares, and only by the constructor when it declares none.\n// Keying on the constructor alone is what made a second copy of this package silently fatal: each copy\n// brings its own Guid, ConceptAs and ValueMap class objects, so neither recognized the other's. A key\n// crosses that boundary; a class object does not. A consumer's own type has no key and is found by\n// constructor, which is exact and needs nothing to cross.\nconst keyedConverters: Map<string, JsonConverter> = new Map<string, JsonConverter>();\nconst typeConverters: Map<Constructor, JsonConverter> = new Map<Constructor, JsonConverter>();\n\nconst registerConverterFor = (converter: JsonConverter) => {\n const key = declaredTypeKey(converter.type);\n if (key !== undefined) {\n keyedConverters.set(key, converter);\n }\n\n typeConverters.set(converter.type, converter);\n};\n\nconverters.forEach(registerConverterFor);\n\n/**\n * Finds the converter registered for a type, if any.\n * @param {Constructor} type The type to convert.\n * @returns {JsonConverter | undefined} The converter, or undefined when the type has none.\n */\nconst converterFor = (type: Constructor | undefined): JsonConverter | undefined => {\n if (!type) return undefined;\n\n const key = declaredTypeKey(type);\n const keyed = key === undefined ? undefined : keyedConverters.get(key);\n return keyed ?? typeConverters.get(type);\n};\n\n/**\n * Checks whether a type is a ValueMap, including one from another copy of this package.\n * @param {Constructor} type The type to check.\n * @returns {boolean} True when the type is a ValueMap.\n */\nconst isValueMap = (type: Constructor | undefined): boolean => declaredTypeKey(type) === valueMapTypeKey;\n\n// Add primitive type converters that don't need a full JsonConverter class\nconst primitiveConverters: Map<Constructor, typeSerializer> = new Map<Constructor, typeSerializer>([\n [Number, (value: number) => value],\n [String, (value: string) => value],\n [Boolean, (value: boolean) => value]\n]);\n\nconst primitiveSerializers: Map<Constructor, typeSerializer> = new Map<Constructor, typeSerializer>([\n [Number, (value: any) => value],\n [String, (value: any) => value],\n [Boolean, (value: any) => value]\n]);\n\n/**\n * Checks if a constructor is a ConceptAs type.\n * @param {Constructor} type The constructor to check.\n * @returns {boolean} True if the type extends ConceptAs.\n * @remarks\n * Reads the key rather than walking the prototype chain looking for this copy's ConceptAs. The key is a\n * static and a static is inherited, so every type deriving from ConceptAs carries it - including one\n * deriving from another copy's ConceptAs, which a prototype walk could never recognize.\n */\nconst isConceptAs = (type: Constructor): boolean => typeKeyOf(type) === conceptAsTypeKey;\n\nconst serializeValueForType = (type: Constructor, value: any) => {\n if (!value) return value;\n\n // If it's a ConceptAs instance, unwrap it and serialize the inner value recursively\n // This follows the C# pattern: recognize as concept, unwrap, then call serializer\n if (isConceptAs(value.constructor)) {\n const innerValue = value.value;\n // Recursively serialize the inner value to handle complex types\n // Use .constructor directly which works reliably for both primitives and objects\n return serializeValueForType(innerValue.constructor, innerValue);\n }\n\n // Check if there's a registered converter\n const converter = converterFor(type);\n if (converter) {\n return converter.write(value);\n }\n \n // Check primitive converters\n if (primitiveConverters.has(type)) {\n return primitiveConverters.get(type)!(value);\n }\n \n return convertTypesOnInstance(value);\n};\n\nconst deserializeValueFromType = (type: Constructor, value: any) => {\n // If it's a ConceptAs type, instantiate it with the value\n if (isConceptAs(type)) {\n const valueType = (type as Constructor & { valueType?: Constructor }).valueType;\n return new type(valueType ? deserializeValueFromType(valueType, value) : value);\n }\n \n // Check if there's a registered converter\n const converter = converterFor(type);\n if (converter) {\n return converter.read(value);\n }\n \n // Check primitive serializers\n if (primitiveSerializers.has(type)) {\n return primitiveSerializers.get(type)!(value);\n }\n \n return JsonSerializer.deserialize(type, JSON.stringify(value));\n};\n\nconst deserializeValueFromField = (field: Field, value: any) => {\n if (isValueMap(field.type)) {\n return deserializeValueMapFromField(field, value);\n }\n\n // If it's a ConceptAs type, instantiate it with the value\n if (isConceptAs(field.type)) {\n return deserializeValueFromType(field.type, value);\n }\n\n // Check if there's a registered converter\n const converter = converterFor(field.type);\n if (converter) {\n return converter.read(value);\n }\n \n // Check primitive serializers\n if (primitiveSerializers.has(field.type)) {\n return primitiveSerializers.get(field.type)!(value);\n }\n \n let type = field.type;\n if (value[JsonSerializer.DerivedTypeIdProperty]) {\n const derivedTypeId = value[JsonSerializer.DerivedTypeIdProperty];\n const candidates = [...field.derivatives, ...DerivedType.getDerivedTypesFor(field.type)];\n type = candidates.find(_ => DerivedType.get(_) == derivedTypeId) || type;\n }\n\n return JsonSerializer.deserialize(type, JSON.stringify(value));\n};\n\nconst serializeMapKey = (key: any): string => {\n if (key === undefined || key === null) {\n return '';\n }\n\n if (typeof key === 'string') {\n return key;\n }\n\n if (typeof key === 'number' || typeof key === 'boolean' || typeof key === 'bigint') {\n return key.toString();\n }\n\n if (key instanceof Date) {\n return key.toISOString();\n }\n\n // A Guid key is its plain canonical string, which is what a C# dictionary writes. Serializing it\n // like any other object would wrap it in JSON quotes and no other reader accepts that.\n if (declaredTypeKey(key.constructor) === guidTypeKey) {\n return key.toString();\n }\n\n return JsonSerializer.serialize(key);\n};\n\nconst readGuidMapKey = (key: string): Guid => {\n // Keys written before the plain form was adopted carry the JSON quotes of an embedded string.\n const text = key.length >= 2 && key.startsWith('\"') && key.endsWith('\"') ? key.slice(1, -1) : key;\n if (!Guid.isGuid(text)) {\n throw new Error(`The map key '${key}' is not a valid Guid.`);\n }\n\n return Guid.parse(text);\n};\n\nconst deserializeMapKey = (keyType: Constructor, key: string): any => {\n if (keyType === String) {\n return key;\n }\n\n if (keyType === Number) {\n return Number(key);\n }\n\n if (keyType === Boolean) {\n return key.toLowerCase() === 'true';\n }\n\n if (declaredTypeKey(keyType) === guidTypeKey) {\n return readGuidMapKey(key);\n }\n\n // Check if there's a converter for this type\n const converter = converterFor(keyType);\n if (converter) {\n return converter.read(key);\n }\n\n return JsonSerializer.deserialize(keyType, key);\n};\n\nconst deserializeMapValue = (valueType: Constructor | undefined, value: any): any => {\n if (!valueType) {\n return value;\n }\n\n // A map value is an ordinary value of its declared type, so read it the way any other value of that\n // type is read. Resolving it here instead left out the concept and primitive cases, and the\n // primitive one lost data without a sound: a string value went through JsonSerializer.deserialize,\n // which built an empty String object because a primitive has no fields to populate.\n return deserializeValueFromType(valueType, value);\n};\n\nconst deserializeValueMapFromField = (field: Field, value: any): ValueMap<any, any> => {\n const valueMap = new ValueMap<any, any>();\n const keyType = field.genericArguments[0];\n const valueType = field.genericArguments[1];\n\n if (!value || !keyType) {\n return valueMap;\n }\n\n for (const key of Object.keys(value)) {\n const deserializedKey = deserializeMapKey(keyType, key);\n const deserializedValue = deserializeMapValue(valueType, value[key]);\n valueMap.set(deserializedKey, deserializedValue);\n }\n\n return valueMap;\n};\n\nconst convertTypesOnInstance = (instance: any) => {\n // A concept unwraps to its underlying value wherever it is reached, not only when it is reached\n // through a declared field. An array element and a map value arrive here rather than at\n // serializeValueForType, and without this they were written as the object a concept happens to be -\n // {\"value\": ...} where the receiver declared the underlying type.\n if (isConceptAs(instance.constructor)) {\n return serializeValueForType(instance.constructor as Constructor, instance);\n }\n\n // Check if there's a converter for this type\n if (converterFor(instance.constructor)) {\n return serializeValueForType(instance.constructor, instance);\n }\n \n // Check primitive converters\n if (primitiveConverters.has(instance.constructor)) {\n return primitiveConverters.get(instance.constructor)!(instance);\n }\n\n const properties = Object.getOwnPropertyNames(instance);\n const converted: any = {};\n\n // Emit the polymorphic type discriminator, preferring the registered type for the instance's\n // constructor and falling back to a discriminator preserved on the instance itself (e.g. a value\n // that was deserialized before its concrete type could be resolved). This keeps '_derivedTypeId'\n // flowing through serialization transparently — the caller never has to manage it — and is the\n // mirror of preserving it on deserialization.\n const derivedTypeId = DerivedType.get(instance.constructor) ?? instance[JsonSerializer.DerivedTypeIdProperty];\n if (derivedTypeId) {\n converted[JsonSerializer.DerivedTypeIdProperty] = derivedTypeId;\n }\n properties.forEach(property => {\n // The discriminator is handled above as a meta-property; never treat it as a data field.\n if (property === JsonSerializer.DerivedTypeIdProperty) return;\n let value = instance[property];\n if (value !== undefined) {\n if (Array.isArray(value)) {\n value = value.map(_ => convertTypesOnInstance(_));\n } else {\n value = serializeValueForType(value.__proto__.constructor, value);\n }\n }\n\n converted[property] = value;\n });\n\n return converted;\n};\n\n// Initialize ValueMapJsonConverter with helper functions to avoid circular dependencies\n// Must be done after serializeMapKey and convertTypesOnInstance are defined\nValueMapJsonConverter.setHelpers(serializeMapKey, convertTypesOnInstance);\n\n/**\n * Represents a serializer for JSON.\n */\nexport class JsonSerializer {\n static readonly DerivedTypeIdProperty: string = \"_derivedTypeId\";\n\n /**\n * Register a converter for the type it declares through its `type` property.\n * @param {JsonConverter} converter The converter to register.\n * @remarks\n * The converter is used for both directions - `read` on the way in, `write` on the way out - and\n * takes the place of any converter already registered for the same type, including the built-in\n * ones. Replacing a built-in changes the payloads the application produces and consumes, which is\n * the caller's to decide; nothing here second-guesses it.\n *\n * Two shapes resolve ahead of the converters, so a converter registered for them is not reached:\n *\n * - A type deriving from `ConceptAs` is unwrapped to its underlying value in both directions, and\n * converted as that value's type. Register for the underlying type to reach a concept.\n * - A `ValueMap` is read back from the declaring field's generic arguments rather than through a\n * converter. Note the asymmetry: writing a `ValueMap` *does* go through the registered converter,\n * so replacing that one changes only the outbound half.\n * - A `Guid` used as a `ValueMap` key always uses the plain canonical string form and bypasses any\n * registered `Guid` converter, so that keys stay compatible with C# dictionaries.\n */\n static registerConverter(converter: JsonConverter): void {\n registerConverterFor(converter);\n }\n\n /**\n * Serialize with strong type information.\n * @param {*} value The value to serialize.\n * @returns A JSON string.\n */\n static serialize(value: any): string {\n const converted = convertTypesOnInstance(value);\n return JSON.stringify(converted);\n }\n\n /**\n * Deserialize a JSON string to the specific type.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {string} json Actual JSON to deserialize.\n * @returns An instance of the target type.\n */\n static deserialize<TResult extends object>(targetType: Constructor<TResult>, json: string): TResult {\n const parsed = JSON.parse(json);\n return this.deserializeFromInstance<TResult>(targetType, parsed);\n }\n\n /**\n * Deserialize a array JSON string to an array of the specific instance type.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {string} json Actual JSON to deserialize.\n * @returns An array of instances of the target type.\n */\n static deserializeArray<TResult extends object>(targetType: Constructor<TResult>, json: string): TResult[] {\n const parsed = JSON.parse(json);\n return this.deserializeArrayFromInstance(targetType, parsed);\n }\n\n /**\n * Deserialize an any instance to a specific instance type.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {*} instance Actual instance to deserialize.\n * @returns An instance of the target type.\n */\n static deserializeFromInstance<TResult extends object>(targetType: Constructor<TResult>, instance: any): TResult {\n const fields = Fields.getFieldsForType(targetType as Constructor);\n\n if (converterFor(targetType) || isConceptAs(targetType)) {\n return deserializeValueFromType(targetType, instance);\n }\n\n const deserialized = new targetType();\n for (const field of fields) {\n let value = instance[field.name];\n if (value !== undefined && value !== null) {\n if (field.type === Array) {\n const elementType = field.genericArguments[0];\n if (elementType) {\n const elementField = new Field(field.name, elementType, false, field.derivatives, []);\n value = value.map(_ => deserializeValueFromField(elementField, _));\n }\n } else if (field.enumerable) {\n value = value.map(_ => deserializeValueFromField(field, _));\n } else {\n value = deserializeValueFromField(field, value);\n }\n } else if ((field.enumerable || field.type === Array) && value === undefined) {\n // A collection that is absent from the payload deserializes to an empty one rather than to\n // undefined. The declared type says the field is an array, and a producer that leaves an\n // empty collection out - which the Chronicle sink does deliberately, so that a parallel\n // replay cannot overwrite children a sibling event already wrote - would otherwise hand back\n // a value contradicting its own type, putting a null guard on every reader of every\n // collection. An explicit null is left alone: that is the producer saying \"no collection\"\n // rather than \"an empty one\".\n value = [];\n }\n\n deserialized[field.name] = value;\n }\n\n // Preserve the polymorphic type discriminator so it is never lost across (de)serialization\n // layers. '_derivedTypeId' is not a declared field, so it is otherwise dropped here — and a\n // derived value whose concrete type could not be resolved (e.g. its type was not yet\n // registered) would then have no discriminator left to re-resolve or round-trip with, and\n // would serialize back with no type information at all.\n const derivedTypeId = instance[JsonSerializer.DerivedTypeIdProperty];\n if (derivedTypeId !== undefined && derivedTypeId !== null) {\n (deserialized as Record<string, unknown>)[JsonSerializer.DerivedTypeIdProperty] = derivedTypeId;\n }\n\n if ((targetType as Constructor) == Object) {\n const objectFields = Object.keys(instance).filter((value) => {\n return !fields.some(_ => _.name == value);\n });\n\n for (const field of objectFields) {\n deserialized[field] = instance[field];\n }\n }\n\n return deserialized;\n }\n\n /**\n * Deserialize an array of any instances to an array of specific instance types.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {instances} instances Actual instances to deserialize.\n * @returns An array of instances of the target type.\n */\n static deserializeArrayFromInstance<TResult extends object>(targetType: Constructor<TResult>, instances: any): TResult[] {\n const deserialized: TResult[] = [];\n\n for (const instance of instances) {\n deserialized.push(this.deserializeFromInstance<TResult>(targetType, instance));\n }\n\n return deserialized;\n }\n}\n"],"names":["registerModuleInstance","DateJsonConverter","DateOnlyJsonConverter","GuidJsonConverter","TimeOnlyJsonConverter","TimeSpanJsonConverter","PointJsonConverter","LineStringJsonConverter","PolygonJsonConverter","ValueMapJsonConverter","declaredTypeKey","valueMapTypeKey","typeKeyOf","conceptAsTypeKey","DerivedType","guidTypeKey","Guid","ValueMap","Fields","Field"],"mappings":";;;;;;;;;;;;;;;;;;;AAiCAA,6CAAsB,EAAE;AAGxB,MAAM,UAAU,GAAoB;AAChC,IAAA,IAAIC,mCAAiB,EAAE;AACvB,IAAA,IAAIC,2CAAqB,EAAE;AAC3B,IAAA,IAAIC,mCAAiB,EAAE;AACvB,IAAA,IAAIC,2CAAqB,EAAE;AAC3B,IAAA,IAAIC,2CAAqB,EAAE;AAC3B,IAAA,IAAIC,qCAAkB,EAAE;AACxB,IAAA,IAAIC,+CAAuB,EAAE;AAC7B,IAAA,IAAIC,yCAAoB,EAAE;AAC1B,IAAA,IAAIC,2CAAqB;CAC5B;AAOD,MAAM,eAAe,GAA+B,IAAI,GAAG,EAAyB;AACpF,MAAM,cAAc,GAAoC,IAAI,GAAG,EAA8B;AAE7F,MAAM,oBAAoB,GAAG,CAAC,SAAwB,KAAI;IACtD,MAAM,GAAG,GAAGC,uBAAe,CAAC,SAAS,CAAC,IAAI,CAAC;AAC3C,IAAA,IAAI,GAAG,KAAK,SAAS,EAAE;AACnB,QAAA,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC;IACvC;IAEA,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC;AACjD,CAAC;AAED,UAAU,CAAC,OAAO,CAAC,oBAAoB,CAAC;AAOxC,MAAM,YAAY,GAAG,CAAC,IAA6B,KAA+B;AAC9E,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,SAAS;AAE3B,IAAA,MAAM,GAAG,GAAGA,uBAAe,CAAC,IAAI,CAAC;AACjC,IAAA,MAAM,KAAK,GAAG,GAAG,KAAK,SAAS,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c,EAAA;QACxG,MAAM,YAAY,GAAc,EAAE;AAElC,QAAA,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;AAC9B,YAAA,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAU,UAAU,EAAE,QAAQ,CAAC,CAAC;QAClF;AAEA,QAAA,OAAO,YAAY;IACvB;;;"}
package/dist/cjs/index.js CHANGED
@@ -58,6 +58,7 @@ exports.TimeSpan = TimeSpan.TimeSpan;
58
58
  exports.ValueMap = ValueMap.ValueMap;
59
59
  exports.conceptAsTypeKey = typeKey.conceptAsTypeKey;
60
60
  exports.declaredTypeKey = typeKey.declaredTypeKey;
61
+ exports.guidTypeKey = typeKey.guidTypeKey;
61
62
  exports.typeKey = typeKey.typeKey;
62
63
  exports.typeKeyOf = typeKey.typeKeyOf;
63
64
  exports.valueMapTypeKey = typeKey.valueMapTypeKey;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -4,4 +4,5 @@ export declare const declaredTypeKey: (type: Constructor | undefined) => string
4
4
  export declare const typeKeyOf: (type: Constructor | undefined) => string | undefined;
5
5
  export declare const conceptAsTypeKey = "ConceptAs";
6
6
  export declare const valueMapTypeKey = "ValueMap";
7
+ export declare const guidTypeKey = "Guid";
7
8
  //# sourceMappingURL=typeKey.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typeKey.d.ts","sourceRoot":"","sources":["../../typeKey.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAiB5C,eAAO,MAAM,OAAO,EAAE,OAAO,MAAmD,CAAC;AAcjF,eAAO,MAAM,eAAe,GAAI,MAAM,WAAW,GAAG,SAAS,KAAG,MAAM,GAAG,SACiC,CAAC;AAW3G,eAAO,MAAM,SAAS,GAAI,MAAM,WAAW,GAAG,SAAS,KAAG,MAAM,GAAG,SAChB,CAAC;AAGpD,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAG5C,eAAO,MAAM,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"typeKey.d.ts","sourceRoot":"","sources":["../../typeKey.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAiB5C,eAAO,MAAM,OAAO,EAAE,OAAO,MAAmD,CAAC;AAcjF,eAAO,MAAM,eAAe,GAAI,MAAM,WAAW,GAAG,SAAS,KAAG,MAAM,GAAG,SACiC,CAAC;AAW3G,eAAO,MAAM,SAAS,GAAI,MAAM,WAAW,GAAG,SAAS,KAAG,MAAM,GAAG,SAChB,CAAC;AAGpD,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAG5C,eAAO,MAAM,eAAe,aAAa,CAAC;AAG1C,eAAO,MAAM,WAAW,SAAS,CAAC"}
@@ -5,9 +5,11 @@ const declaredTypeKey = (type) => type && Object.prototype.hasOwnProperty.call(t
5
5
  const typeKeyOf = (type) => type ? type[typeKey] : undefined;
6
6
  const conceptAsTypeKey = 'ConceptAs';
7
7
  const valueMapTypeKey = 'ValueMap';
8
+ const guidTypeKey = 'Guid';
8
9
 
9
10
  exports.conceptAsTypeKey = conceptAsTypeKey;
10
11
  exports.declaredTypeKey = declaredTypeKey;
12
+ exports.guidTypeKey = guidTypeKey;
11
13
  exports.typeKey = typeKey;
12
14
  exports.typeKeyOf = typeKeyOf;
13
15
  exports.valueMapTypeKey = valueMapTypeKey;
@@ -1 +1 @@
1
- {"version":3,"file":"typeKey.js","sources":["../../typeKey.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Constructor } from './Constructor';\n\n/**\n * Identifies a type this package converts, by name rather than by the class object itself.\n *\n * `JsonSerializer` recognized a type by comparing constructors, which holds until a second copy of this\n * package is loaded into the same realm - a nested install, or one install reached as both ESM and\n * CommonJS. Each copy then had its own `Guid`, `ConceptAs` and `ValueMap` class objects and neither\n * recognized the other's, so a `Guid` crossing that boundary was written as an object rather than a\n * string, and a concept as `{\"value\": ...}` rather than its underlying value. Both silently.\n *\n * A name survives the boundary where a class object does not: the key is a registered symbol, so every\n * copy resolves the same one, and the values are plain strings.\n *\n * The key is deliberately a symbol rather than a plain static: a string static would appear in\n * `Object.keys(Guid)` and could be shadowed by an unrelated member of the same name.\n */\nexport const typeKey: unique symbol = Symbol.for('@cratis/fundamentals.typeKey');\n\n/** A type carrying the key. Only this package's own convertible types declare one. */\ntype KeyedType = Constructor & { readonly [typeKey]?: string };\n\n/**\n * Gets the key a type declares itself, ignoring any inherited from a base type.\n *\n * Converter lookup uses this, because a key is inherited: a consumer's `class CustomerId extends\n * ConceptAs<string>` reports `ConceptAs`, and registering a converter under that would take the place\n * of concept handling for every concept in the application.\n * @param {Constructor} type The type to read the key from.\n * @returns {string | undefined} The declared key, or undefined when the type declares none.\n */\nexport const declaredTypeKey = (type: Constructor | undefined): string | undefined =>\n type && Object.prototype.hasOwnProperty.call(type, typeKey) ? (type as KeyedType)[typeKey] : undefined;\n\n/**\n * Gets the key a type carries, whether it declares the key or inherits it from a base type.\n *\n * This is what makes a concept recognizable across copies: the key is a static, and a static is\n * inherited through the constructor's prototype chain, so every type deriving from `ConceptAs` reports\n * `ConceptAs` without anything having to compare class objects.\n * @param {Constructor} type The type to read the key from.\n * @returns {string | undefined} The key carried, or undefined when the type carries none.\n */\nexport const typeKeyOf = (type: Constructor | undefined): string | undefined =>\n type ? (type as KeyedType)[typeKey] : undefined;\n\n/** The key every type deriving from `ConceptAs` carries. */\nexport const conceptAsTypeKey = 'ConceptAs';\n\n/** The key `ValueMap` declares. */\nexport const valueMapTypeKey = 'ValueMap';\n"],"names":[],"mappings":";;AAoBO,MAAM,OAAO,GAAkB,MAAM,CAAC,GAAG,CAAC,8BAA8B;AAcxE,MAAM,eAAe,GAAG,CAAC,IAA6B,KACzD,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,GAAI,IAAkB,CAAC,OAAO,CAAC,GAAG;MAWpF,SAAS,GAAG,CAAC,IAA6B,KACnD,IAAI,GAAI,IAAkB,CAAC,OAAO,CAAC,GAAG;AAGnC,MAAM,gBAAgB,GAAG;AAGzB,MAAM,eAAe,GAAG;;;;;;"}
1
+ {"version":3,"file":"typeKey.js","sources":["../../typeKey.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Constructor } from './Constructor';\n\n/**\n * Identifies a type this package converts, by name rather than by the class object itself.\n *\n * `JsonSerializer` recognized a type by comparing constructors, which holds until a second copy of this\n * package is loaded into the same realm - a nested install, or one install reached as both ESM and\n * CommonJS. Each copy then had its own `Guid`, `ConceptAs` and `ValueMap` class objects and neither\n * recognized the other's, so a `Guid` crossing that boundary was written as an object rather than a\n * string, and a concept as `{\"value\": ...}` rather than its underlying value. Both silently.\n *\n * A name survives the boundary where a class object does not: the key is a registered symbol, so every\n * copy resolves the same one, and the values are plain strings.\n *\n * The key is deliberately a symbol rather than a plain static: a string static would appear in\n * `Object.keys(Guid)` and could be shadowed by an unrelated member of the same name.\n */\nexport const typeKey: unique symbol = Symbol.for('@cratis/fundamentals.typeKey');\n\n/** A type carrying the key. Only this package's own convertible types declare one. */\ntype KeyedType = Constructor & { readonly [typeKey]?: string };\n\n/**\n * Gets the key a type declares itself, ignoring any inherited from a base type.\n *\n * Converter lookup uses this, because a key is inherited: a consumer's `class CustomerId extends\n * ConceptAs<string>` reports `ConceptAs`, and registering a converter under that would take the place\n * of concept handling for every concept in the application.\n * @param {Constructor} type The type to read the key from.\n * @returns {string | undefined} The declared key, or undefined when the type declares none.\n */\nexport const declaredTypeKey = (type: Constructor | undefined): string | undefined =>\n type && Object.prototype.hasOwnProperty.call(type, typeKey) ? (type as KeyedType)[typeKey] : undefined;\n\n/**\n * Gets the key a type carries, whether it declares the key or inherits it from a base type.\n *\n * This is what makes a concept recognizable across copies: the key is a static, and a static is\n * inherited through the constructor's prototype chain, so every type deriving from `ConceptAs` reports\n * `ConceptAs` without anything having to compare class objects.\n * @param {Constructor} type The type to read the key from.\n * @returns {string | undefined} The key carried, or undefined when the type carries none.\n */\nexport const typeKeyOf = (type: Constructor | undefined): string | undefined =>\n type ? (type as KeyedType)[typeKey] : undefined;\n\n/** The key every type deriving from `ConceptAs` carries. */\nexport const conceptAsTypeKey = 'ConceptAs';\n\n/** The key `ValueMap` declares. */\nexport const valueMapTypeKey = 'ValueMap';\n\n/** The key `Guid` declares. */\nexport const guidTypeKey = 'Guid';\n"],"names":[],"mappings":";;AAoBO,MAAM,OAAO,GAAkB,MAAM,CAAC,GAAG,CAAC,8BAA8B;AAcxE,MAAM,eAAe,GAAG,CAAC,IAA6B,KACzD,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,GAAI,IAAkB,CAAC,OAAO,CAAC,GAAG;MAWpF,SAAS,GAAG,CAAC,IAA6B,KACnD,IAAI,GAAI,IAAkB,CAAC,OAAO,CAAC,GAAG;AAGnC,MAAM,gBAAgB,GAAG;AAGzB,MAAM,eAAe,GAAG;AAGxB,MAAM,WAAW,GAAG;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"JsonSerializer.d.ts","sourceRoot":"","sources":["../../JsonSerializer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAO5C,OAAO,EACH,aAAa,EAUhB,MAAM,QAAQ,CAAC;AAuShB,qBAAa,cAAc;IACvB,MAAM,CAAC,QAAQ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gBAAgB,CAAC,OAAO,SAAS,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE;IAW1G,MAAM,CAAC,uBAAuB,CAAC,OAAO,SAAS,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO;IAiEhH,MAAM,CAAC,4BAA4B,CAAC,OAAO,SAAS,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,OAAO,EAAE;CAS3H"}
@@ -2,7 +2,8 @@ import { DerivedType } from './DerivedType.js';
2
2
  import { registerModuleInstance } from './duplicateInstanceGuard.js';
3
3
  import { Field } from './Field.js';
4
4
  import { Fields } from './Fields.js';
5
- import { declaredTypeKey, typeKeyOf, conceptAsTypeKey, valueMapTypeKey } from './typeKey.js';
5
+ import { Guid } from './Guid.js';
6
+ import { declaredTypeKey, guidTypeKey, typeKeyOf, conceptAsTypeKey, valueMapTypeKey } from './typeKey.js';
6
7
  import { ValueMap } from './ValueMap.js';
7
8
  import { DateJsonConverter } from './json/DateJsonConverter.js';
8
9
  import { DateOnlyJsonConverter } from './json/DateOnlyJsonConverter.js';
@@ -120,8 +121,18 @@ const serializeMapKey = (key) => {
120
121
  if (key instanceof Date) {
121
122
  return key.toISOString();
122
123
  }
124
+ if (declaredTypeKey(key.constructor) === guidTypeKey) {
125
+ return key.toString();
126
+ }
123
127
  return JsonSerializer.serialize(key);
124
128
  };
129
+ const readGuidMapKey = (key) => {
130
+ const text = key.length >= 2 && key.startsWith('"') && key.endsWith('"') ? key.slice(1, -1) : key;
131
+ if (!Guid.isGuid(text)) {
132
+ throw new Error(`The map key '${key}' is not a valid Guid.`);
133
+ }
134
+ return Guid.parse(text);
135
+ };
125
136
  const deserializeMapKey = (keyType, key) => {
126
137
  if (keyType === String) {
127
138
  return key;
@@ -132,6 +143,9 @@ const deserializeMapKey = (keyType, key) => {
132
143
  if (keyType === Boolean) {
133
144
  return key.toLowerCase() === 'true';
134
145
  }
146
+ if (declaredTypeKey(keyType) === guidTypeKey) {
147
+ return readGuidMapKey(key);
148
+ }
135
149
  const converter = converterFor(keyType);
136
150
  if (converter) {
137
151
  return converter.read(key);
@@ -1 +1 @@
1
- {"version":3,"file":"JsonSerializer.js","sources":["../../JsonSerializer.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Constructor } from './Constructor';\nimport { DerivedType } from './DerivedType';\nimport { registerModuleInstance } from './duplicateInstanceGuard';\nimport { Field } from './Field';\nimport { Fields } from './Fields';\nimport { conceptAsTypeKey, declaredTypeKey, typeKeyOf, valueMapTypeKey } from './typeKey';\nimport { ValueMap } from './ValueMap';\nimport { \n JsonConverter, \n DateJsonConverter, \n DateOnlyJsonConverter,\n GuidJsonConverter, \n TimeOnlyJsonConverter,\n TimeSpanJsonConverter, \n PointJsonConverter,\n LineStringJsonConverter,\n PolygonJsonConverter,\n ValueMapJsonConverter\n} from './json';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\ntype typeSerializer = (value: any) => any;\n\n// A second copy of this package in the same realm builds its own registry here, and brings its own\n// class objects. Convertible values still cross between the copies, because a type is recognized by\n// the key it declares - but a converter registered on one copy reaches only that one, and a version\n// pinned at the top level never reaches a nested copy. Announce it where the state that cannot be\n// shared is built.\nregisterModuleInstance();\n\n// Initialize converters\nconst converters: JsonConverter[] = [\n new DateJsonConverter(),\n new DateOnlyJsonConverter(),\n new GuidJsonConverter(),\n new TimeOnlyJsonConverter(),\n new TimeSpanJsonConverter(),\n new PointJsonConverter(),\n new LineStringJsonConverter(),\n new PolygonJsonConverter(),\n new ValueMapJsonConverter()\n];\n\n// Converters are found by the key a type declares, and only by the constructor when it declares none.\n// Keying on the constructor alone is what made a second copy of this package silently fatal: each copy\n// brings its own Guid, ConceptAs and ValueMap class objects, so neither recognized the other's. A key\n// crosses that boundary; a class object does not. A consumer's own type has no key and is found by\n// constructor, which is exact and needs nothing to cross.\nconst keyedConverters: Map<string, JsonConverter> = new Map<string, JsonConverter>();\nconst typeConverters: Map<Constructor, JsonConverter> = new Map<Constructor, JsonConverter>();\n\nconst registerConverterFor = (converter: JsonConverter) => {\n const key = declaredTypeKey(converter.type);\n if (key !== undefined) {\n keyedConverters.set(key, converter);\n }\n\n typeConverters.set(converter.type, converter);\n};\n\nconverters.forEach(registerConverterFor);\n\n/**\n * Finds the converter registered for a type, if any.\n * @param {Constructor} type The type to convert.\n * @returns {JsonConverter | undefined} The converter, or undefined when the type has none.\n */\nconst converterFor = (type: Constructor | undefined): JsonConverter | undefined => {\n if (!type) return undefined;\n\n const key = declaredTypeKey(type);\n const keyed = key === undefined ? undefined : keyedConverters.get(key);\n return keyed ?? typeConverters.get(type);\n};\n\n/**\n * Checks whether a type is a ValueMap, including one from another copy of this package.\n * @param {Constructor} type The type to check.\n * @returns {boolean} True when the type is a ValueMap.\n */\nconst isValueMap = (type: Constructor | undefined): boolean => declaredTypeKey(type) === valueMapTypeKey;\n\n// Add primitive type converters that don't need a full JsonConverter class\nconst primitiveConverters: Map<Constructor, typeSerializer> = new Map<Constructor, typeSerializer>([\n [Number, (value: number) => value],\n [String, (value: string) => value],\n [Boolean, (value: boolean) => value]\n]);\n\nconst primitiveSerializers: Map<Constructor, typeSerializer> = new Map<Constructor, typeSerializer>([\n [Number, (value: any) => value],\n [String, (value: any) => value],\n [Boolean, (value: any) => value]\n]);\n\n/**\n * Checks if a constructor is a ConceptAs type.\n * @param {Constructor} type The constructor to check.\n * @returns {boolean} True if the type extends ConceptAs.\n * @remarks\n * Reads the key rather than walking the prototype chain looking for this copy's ConceptAs. The key is a\n * static and a static is inherited, so every type deriving from ConceptAs carries it - including one\n * deriving from another copy's ConceptAs, which a prototype walk could never recognize.\n */\nconst isConceptAs = (type: Constructor): boolean => typeKeyOf(type) === conceptAsTypeKey;\n\nconst serializeValueForType = (type: Constructor, value: any) => {\n if (!value) return value;\n\n // If it's a ConceptAs instance, unwrap it and serialize the inner value recursively\n // This follows the C# pattern: recognize as concept, unwrap, then call serializer\n if (isConceptAs(value.constructor)) {\n const innerValue = value.value;\n // Recursively serialize the inner value to handle complex types\n // Use .constructor directly which works reliably for both primitives and objects\n return serializeValueForType(innerValue.constructor, innerValue);\n }\n\n // Check if there's a registered converter\n const converter = converterFor(type);\n if (converter) {\n return converter.write(value);\n }\n \n // Check primitive converters\n if (primitiveConverters.has(type)) {\n return primitiveConverters.get(type)!(value);\n }\n \n return convertTypesOnInstance(value);\n};\n\nconst deserializeValueFromType = (type: Constructor, value: any) => {\n // If it's a ConceptAs type, instantiate it with the value\n if (isConceptAs(type)) {\n const valueType = (type as Constructor & { valueType?: Constructor }).valueType;\n return new type(valueType ? deserializeValueFromType(valueType, value) : value);\n }\n \n // Check if there's a registered converter\n const converter = converterFor(type);\n if (converter) {\n return converter.read(value);\n }\n \n // Check primitive serializers\n if (primitiveSerializers.has(type)) {\n return primitiveSerializers.get(type)!(value);\n }\n \n return JsonSerializer.deserialize(type, JSON.stringify(value));\n};\n\nconst deserializeValueFromField = (field: Field, value: any) => {\n if (isValueMap(field.type)) {\n return deserializeValueMapFromField(field, value);\n }\n\n // If it's a ConceptAs type, instantiate it with the value\n if (isConceptAs(field.type)) {\n return deserializeValueFromType(field.type, value);\n }\n\n // Check if there's a registered converter\n const converter = converterFor(field.type);\n if (converter) {\n return converter.read(value);\n }\n \n // Check primitive serializers\n if (primitiveSerializers.has(field.type)) {\n return primitiveSerializers.get(field.type)!(value);\n }\n \n let type = field.type;\n if (value[JsonSerializer.DerivedTypeIdProperty]) {\n const derivedTypeId = value[JsonSerializer.DerivedTypeIdProperty];\n const candidates = [...field.derivatives, ...DerivedType.getDerivedTypesFor(field.type)];\n type = candidates.find(_ => DerivedType.get(_) == derivedTypeId) || type;\n }\n\n return JsonSerializer.deserialize(type, JSON.stringify(value));\n};\n\nconst serializeMapKey = (key: any): string => {\n if (key === undefined || key === null) {\n return '';\n }\n\n if (typeof key === 'string') {\n return key;\n }\n\n if (typeof key === 'number' || typeof key === 'boolean' || typeof key === 'bigint') {\n return key.toString();\n }\n\n if (key instanceof Date) {\n return key.toISOString();\n }\n\n return JsonSerializer.serialize(key);\n};\n\nconst deserializeMapKey = (keyType: Constructor, key: string): any => {\n if (keyType === String) {\n return key;\n }\n\n if (keyType === Number) {\n return Number(key);\n }\n\n if (keyType === Boolean) {\n return key.toLowerCase() === 'true';\n }\n\n // Check if there's a converter for this type\n const converter = converterFor(keyType);\n if (converter) {\n return converter.read(key);\n }\n\n return JsonSerializer.deserialize(keyType, key);\n};\n\nconst deserializeMapValue = (valueType: Constructor | undefined, value: any): any => {\n if (!valueType) {\n return value;\n }\n\n // A map value is an ordinary value of its declared type, so read it the way any other value of that\n // type is read. Resolving it here instead left out the concept and primitive cases, and the\n // primitive one lost data without a sound: a string value went through JsonSerializer.deserialize,\n // which built an empty String object because a primitive has no fields to populate.\n return deserializeValueFromType(valueType, value);\n};\n\nconst deserializeValueMapFromField = (field: Field, value: any): ValueMap<any, any> => {\n const valueMap = new ValueMap<any, any>();\n const keyType = field.genericArguments[0];\n const valueType = field.genericArguments[1];\n\n if (!value || !keyType) {\n return valueMap;\n }\n\n for (const key of Object.keys(value)) {\n const deserializedKey = deserializeMapKey(keyType, key);\n const deserializedValue = deserializeMapValue(valueType, value[key]);\n valueMap.set(deserializedKey, deserializedValue);\n }\n\n return valueMap;\n};\n\nconst convertTypesOnInstance = (instance: any) => {\n // A concept unwraps to its underlying value wherever it is reached, not only when it is reached\n // through a declared field. An array element and a map value arrive here rather than at\n // serializeValueForType, and without this they were written as the object a concept happens to be -\n // {\"value\": ...} where the receiver declared the underlying type.\n if (isConceptAs(instance.constructor)) {\n return serializeValueForType(instance.constructor as Constructor, instance);\n }\n\n // Check if there's a converter for this type\n if (converterFor(instance.constructor)) {\n return serializeValueForType(instance.constructor, instance);\n }\n \n // Check primitive converters\n if (primitiveConverters.has(instance.constructor)) {\n return primitiveConverters.get(instance.constructor)!(instance);\n }\n\n const properties = Object.getOwnPropertyNames(instance);\n const converted: any = {};\n\n // Emit the polymorphic type discriminator, preferring the registered type for the instance's\n // constructor and falling back to a discriminator preserved on the instance itself (e.g. a value\n // that was deserialized before its concrete type could be resolved). This keeps '_derivedTypeId'\n // flowing through serialization transparently — the caller never has to manage it — and is the\n // mirror of preserving it on deserialization.\n const derivedTypeId = DerivedType.get(instance.constructor) ?? instance[JsonSerializer.DerivedTypeIdProperty];\n if (derivedTypeId) {\n converted[JsonSerializer.DerivedTypeIdProperty] = derivedTypeId;\n }\n properties.forEach(property => {\n // The discriminator is handled above as a meta-property; never treat it as a data field.\n if (property === JsonSerializer.DerivedTypeIdProperty) return;\n let value = instance[property];\n if (value !== undefined) {\n if (Array.isArray(value)) {\n value = value.map(_ => convertTypesOnInstance(_));\n } else {\n value = serializeValueForType(value.__proto__.constructor, value);\n }\n }\n\n converted[property] = value;\n });\n\n return converted;\n};\n\n// Initialize ValueMapJsonConverter with helper functions to avoid circular dependencies\n// Must be done after serializeMapKey and convertTypesOnInstance are defined\nValueMapJsonConverter.setHelpers(serializeMapKey, convertTypesOnInstance);\n\n/**\n * Represents a serializer for JSON.\n */\nexport class JsonSerializer {\n static readonly DerivedTypeIdProperty: string = \"_derivedTypeId\";\n\n /**\n * Register a converter for the type it declares through its `type` property.\n * @param {JsonConverter} converter The converter to register.\n * @remarks\n * The converter is used for both directions - `read` on the way in, `write` on the way out - and\n * takes the place of any converter already registered for the same type, including the built-in\n * ones. Replacing a built-in changes the payloads the application produces and consumes, which is\n * the caller's to decide; nothing here second-guesses it.\n *\n * Two shapes resolve ahead of the converters, so a converter registered for them is not reached:\n *\n * - A type deriving from `ConceptAs` is unwrapped to its underlying value in both directions, and\n * converted as that value's type. Register for the underlying type to reach a concept.\n * - A `ValueMap` is read back from the declaring field's generic arguments rather than through a\n * converter. Note the asymmetry: writing a `ValueMap` *does* go through the registered converter,\n * so replacing that one changes only the outbound half.\n */\n static registerConverter(converter: JsonConverter): void {\n registerConverterFor(converter);\n }\n\n /**\n * Serialize with strong type information.\n * @param {*} value The value to serialize.\n * @returns A JSON string.\n */\n static serialize(value: any): string {\n const converted = convertTypesOnInstance(value);\n return JSON.stringify(converted);\n }\n\n /**\n * Deserialize a JSON string to the specific type.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {string} json Actual JSON to deserialize.\n * @returns An instance of the target type.\n */\n static deserialize<TResult extends object>(targetType: Constructor<TResult>, json: string): TResult {\n const parsed = JSON.parse(json);\n return this.deserializeFromInstance<TResult>(targetType, parsed);\n }\n\n /**\n * Deserialize a array JSON string to an array of the specific instance type.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {string} json Actual JSON to deserialize.\n * @returns An array of instances of the target type.\n */\n static deserializeArray<TResult extends object>(targetType: Constructor<TResult>, json: string): TResult[] {\n const parsed = JSON.parse(json);\n return this.deserializeArrayFromInstance(targetType, parsed);\n }\n\n /**\n * Deserialize an any instance to a specific instance type.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {*} instance Actual instance to deserialize.\n * @returns An instance of the target type.\n */\n static deserializeFromInstance<TResult extends object>(targetType: Constructor<TResult>, instance: any): TResult {\n const fields = Fields.getFieldsForType(targetType as Constructor);\n\n if (converterFor(targetType) || isConceptAs(targetType)) {\n return deserializeValueFromType(targetType, instance);\n }\n\n const deserialized = new targetType();\n for (const field of fields) {\n let value = instance[field.name];\n if (value !== undefined && value !== null) {\n if (field.type === Array) {\n const elementType = field.genericArguments[0];\n if (elementType) {\n const elementField = new Field(field.name, elementType, false, field.derivatives, []);\n value = value.map(_ => deserializeValueFromField(elementField, _));\n }\n } else if (field.enumerable) {\n value = value.map(_ => deserializeValueFromField(field, _));\n } else {\n value = deserializeValueFromField(field, value);\n }\n } else if ((field.enumerable || field.type === Array) && value === undefined) {\n // A collection that is absent from the payload deserializes to an empty one rather than to\n // undefined. The declared type says the field is an array, and a producer that leaves an\n // empty collection out - which the Chronicle sink does deliberately, so that a parallel\n // replay cannot overwrite children a sibling event already wrote - would otherwise hand back\n // a value contradicting its own type, putting a null guard on every reader of every\n // collection. An explicit null is left alone: that is the producer saying \"no collection\"\n // rather than \"an empty one\".\n value = [];\n }\n\n deserialized[field.name] = value;\n }\n\n // Preserve the polymorphic type discriminator so it is never lost across (de)serialization\n // layers. '_derivedTypeId' is not a declared field, so it is otherwise dropped here — and a\n // derived value whose concrete type could not be resolved (e.g. its type was not yet\n // registered) would then have no discriminator left to re-resolve or round-trip with, and\n // would serialize back with no type information at all.\n const derivedTypeId = instance[JsonSerializer.DerivedTypeIdProperty];\n if (derivedTypeId !== undefined && derivedTypeId !== null) {\n (deserialized as Record<string, unknown>)[JsonSerializer.DerivedTypeIdProperty] = derivedTypeId;\n }\n\n if ((targetType as Constructor) == Object) {\n const objectFields = Object.keys(instance).filter((value) => {\n return !fields.some(_ => _.name == value);\n });\n\n for (const field of objectFields) {\n deserialized[field] = instance[field];\n }\n }\n\n return deserialized;\n }\n\n /**\n * Deserialize an array of any instances to an array of specific instance types.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {instances} instances Actual instances to deserialize.\n * @returns An array of instances of the target type.\n */\n static deserializeArrayFromInstance<TResult extends object>(targetType: Constructor<TResult>, instances: any): TResult[] {\n const deserialized: TResult[] = [];\n\n for (const instance of instances) {\n deserialized.push(this.deserializeFromInstance<TResult>(targetType, instance));\n }\n\n return deserialized;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgCA,sBAAsB,EAAE;AAGxB,MAAM,UAAU,GAAoB;AAChC,IAAA,IAAI,iBAAiB,EAAE;AACvB,IAAA,IAAI,qBAAqB,EAAE;AAC3B,IAAA,IAAI,iBAAiB,EAAE;AACvB,IAAA,IAAI,qBAAqB,EAAE;AAC3B,IAAA,IAAI,qBAAqB,EAAE;AAC3B,IAAA,IAAI,kBAAkB,EAAE;AACxB,IAAA,IAAI,uBAAuB,EAA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AY,GAAc,EAAE;AAElC,QAAA,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;AAC9B,YAAA,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAU,UAAU,EAAE,QAAQ,CAAC,CAAC;QAClF;AAEA,QAAA,OAAO,YAAY;IACvB;;;"}
1
+ {"version":3,"file":"JsonSerializer.js","sources":["../../JsonSerializer.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Constructor } from './Constructor';\nimport { DerivedType } from './DerivedType';\nimport { registerModuleInstance } from './duplicateInstanceGuard';\nimport { Field } from './Field';\nimport { Fields } from './Fields';\nimport { Guid } from './Guid';\nimport { conceptAsTypeKey, declaredTypeKey, guidTypeKey, typeKeyOf, valueMapTypeKey } from './typeKey';\nimport { ValueMap } from './ValueMap';\nimport { \n JsonConverter, \n DateJsonConverter, \n DateOnlyJsonConverter,\n GuidJsonConverter, \n TimeOnlyJsonConverter,\n TimeSpanJsonConverter, \n PointJsonConverter,\n LineStringJsonConverter,\n PolygonJsonConverter,\n ValueMapJsonConverter\n} from './json';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\ntype typeSerializer = (value: any) => any;\n\n// A second copy of this package in the same realm builds its own registry here, and brings its own\n// class objects. Convertible values still cross between the copies, because a type is recognized by\n// the key it declares - but a converter registered on one copy reaches only that one, and a version\n// pinned at the top level never reaches a nested copy. Announce it where the state that cannot be\n// shared is built.\nregisterModuleInstance();\n\n// Initialize converters\nconst converters: JsonConverter[] = [\n new DateJsonConverter(),\n new DateOnlyJsonConverter(),\n new GuidJsonConverter(),\n new TimeOnlyJsonConverter(),\n new TimeSpanJsonConverter(),\n new PointJsonConverter(),\n new LineStringJsonConverter(),\n new PolygonJsonConverter(),\n new ValueMapJsonConverter()\n];\n\n// Converters are found by the key a type declares, and only by the constructor when it declares none.\n// Keying on the constructor alone is what made a second copy of this package silently fatal: each copy\n// brings its own Guid, ConceptAs and ValueMap class objects, so neither recognized the other's. A key\n// crosses that boundary; a class object does not. A consumer's own type has no key and is found by\n// constructor, which is exact and needs nothing to cross.\nconst keyedConverters: Map<string, JsonConverter> = new Map<string, JsonConverter>();\nconst typeConverters: Map<Constructor, JsonConverter> = new Map<Constructor, JsonConverter>();\n\nconst registerConverterFor = (converter: JsonConverter) => {\n const key = declaredTypeKey(converter.type);\n if (key !== undefined) {\n keyedConverters.set(key, converter);\n }\n\n typeConverters.set(converter.type, converter);\n};\n\nconverters.forEach(registerConverterFor);\n\n/**\n * Finds the converter registered for a type, if any.\n * @param {Constructor} type The type to convert.\n * @returns {JsonConverter | undefined} The converter, or undefined when the type has none.\n */\nconst converterFor = (type: Constructor | undefined): JsonConverter | undefined => {\n if (!type) return undefined;\n\n const key = declaredTypeKey(type);\n const keyed = key === undefined ? undefined : keyedConverters.get(key);\n return keyed ?? typeConverters.get(type);\n};\n\n/**\n * Checks whether a type is a ValueMap, including one from another copy of this package.\n * @param {Constructor} type The type to check.\n * @returns {boolean} True when the type is a ValueMap.\n */\nconst isValueMap = (type: Constructor | undefined): boolean => declaredTypeKey(type) === valueMapTypeKey;\n\n// Add primitive type converters that don't need a full JsonConverter class\nconst primitiveConverters: Map<Constructor, typeSerializer> = new Map<Constructor, typeSerializer>([\n [Number, (value: number) => value],\n [String, (value: string) => value],\n [Boolean, (value: boolean) => value]\n]);\n\nconst primitiveSerializers: Map<Constructor, typeSerializer> = new Map<Constructor, typeSerializer>([\n [Number, (value: any) => value],\n [String, (value: any) => value],\n [Boolean, (value: any) => value]\n]);\n\n/**\n * Checks if a constructor is a ConceptAs type.\n * @param {Constructor} type The constructor to check.\n * @returns {boolean} True if the type extends ConceptAs.\n * @remarks\n * Reads the key rather than walking the prototype chain looking for this copy's ConceptAs. The key is a\n * static and a static is inherited, so every type deriving from ConceptAs carries it - including one\n * deriving from another copy's ConceptAs, which a prototype walk could never recognize.\n */\nconst isConceptAs = (type: Constructor): boolean => typeKeyOf(type) === conceptAsTypeKey;\n\nconst serializeValueForType = (type: Constructor, value: any) => {\n if (!value) return value;\n\n // If it's a ConceptAs instance, unwrap it and serialize the inner value recursively\n // This follows the C# pattern: recognize as concept, unwrap, then call serializer\n if (isConceptAs(value.constructor)) {\n const innerValue = value.value;\n // Recursively serialize the inner value to handle complex types\n // Use .constructor directly which works reliably for both primitives and objects\n return serializeValueForType(innerValue.constructor, innerValue);\n }\n\n // Check if there's a registered converter\n const converter = converterFor(type);\n if (converter) {\n return converter.write(value);\n }\n \n // Check primitive converters\n if (primitiveConverters.has(type)) {\n return primitiveConverters.get(type)!(value);\n }\n \n return convertTypesOnInstance(value);\n};\n\nconst deserializeValueFromType = (type: Constructor, value: any) => {\n // If it's a ConceptAs type, instantiate it with the value\n if (isConceptAs(type)) {\n const valueType = (type as Constructor & { valueType?: Constructor }).valueType;\n return new type(valueType ? deserializeValueFromType(valueType, value) : value);\n }\n \n // Check if there's a registered converter\n const converter = converterFor(type);\n if (converter) {\n return converter.read(value);\n }\n \n // Check primitive serializers\n if (primitiveSerializers.has(type)) {\n return primitiveSerializers.get(type)!(value);\n }\n \n return JsonSerializer.deserialize(type, JSON.stringify(value));\n};\n\nconst deserializeValueFromField = (field: Field, value: any) => {\n if (isValueMap(field.type)) {\n return deserializeValueMapFromField(field, value);\n }\n\n // If it's a ConceptAs type, instantiate it with the value\n if (isConceptAs(field.type)) {\n return deserializeValueFromType(field.type, value);\n }\n\n // Check if there's a registered converter\n const converter = converterFor(field.type);\n if (converter) {\n return converter.read(value);\n }\n \n // Check primitive serializers\n if (primitiveSerializers.has(field.type)) {\n return primitiveSerializers.get(field.type)!(value);\n }\n \n let type = field.type;\n if (value[JsonSerializer.DerivedTypeIdProperty]) {\n const derivedTypeId = value[JsonSerializer.DerivedTypeIdProperty];\n const candidates = [...field.derivatives, ...DerivedType.getDerivedTypesFor(field.type)];\n type = candidates.find(_ => DerivedType.get(_) == derivedTypeId) || type;\n }\n\n return JsonSerializer.deserialize(type, JSON.stringify(value));\n};\n\nconst serializeMapKey = (key: any): string => {\n if (key === undefined || key === null) {\n return '';\n }\n\n if (typeof key === 'string') {\n return key;\n }\n\n if (typeof key === 'number' || typeof key === 'boolean' || typeof key === 'bigint') {\n return key.toString();\n }\n\n if (key instanceof Date) {\n return key.toISOString();\n }\n\n // A Guid key is its plain canonical string, which is what a C# dictionary writes. Serializing it\n // like any other object would wrap it in JSON quotes and no other reader accepts that.\n if (declaredTypeKey(key.constructor) === guidTypeKey) {\n return key.toString();\n }\n\n return JsonSerializer.serialize(key);\n};\n\nconst readGuidMapKey = (key: string): Guid => {\n // Keys written before the plain form was adopted carry the JSON quotes of an embedded string.\n const text = key.length >= 2 && key.startsWith('\"') && key.endsWith('\"') ? key.slice(1, -1) : key;\n if (!Guid.isGuid(text)) {\n throw new Error(`The map key '${key}' is not a valid Guid.`);\n }\n\n return Guid.parse(text);\n};\n\nconst deserializeMapKey = (keyType: Constructor, key: string): any => {\n if (keyType === String) {\n return key;\n }\n\n if (keyType === Number) {\n return Number(key);\n }\n\n if (keyType === Boolean) {\n return key.toLowerCase() === 'true';\n }\n\n if (declaredTypeKey(keyType) === guidTypeKey) {\n return readGuidMapKey(key);\n }\n\n // Check if there's a converter for this type\n const converter = converterFor(keyType);\n if (converter) {\n return converter.read(key);\n }\n\n return JsonSerializer.deserialize(keyType, key);\n};\n\nconst deserializeMapValue = (valueType: Constructor | undefined, value: any): any => {\n if (!valueType) {\n return value;\n }\n\n // A map value is an ordinary value of its declared type, so read it the way any other value of that\n // type is read. Resolving it here instead left out the concept and primitive cases, and the\n // primitive one lost data without a sound: a string value went through JsonSerializer.deserialize,\n // which built an empty String object because a primitive has no fields to populate.\n return deserializeValueFromType(valueType, value);\n};\n\nconst deserializeValueMapFromField = (field: Field, value: any): ValueMap<any, any> => {\n const valueMap = new ValueMap<any, any>();\n const keyType = field.genericArguments[0];\n const valueType = field.genericArguments[1];\n\n if (!value || !keyType) {\n return valueMap;\n }\n\n for (const key of Object.keys(value)) {\n const deserializedKey = deserializeMapKey(keyType, key);\n const deserializedValue = deserializeMapValue(valueType, value[key]);\n valueMap.set(deserializedKey, deserializedValue);\n }\n\n return valueMap;\n};\n\nconst convertTypesOnInstance = (instance: any) => {\n // A concept unwraps to its underlying value wherever it is reached, not only when it is reached\n // through a declared field. An array element and a map value arrive here rather than at\n // serializeValueForType, and without this they were written as the object a concept happens to be -\n // {\"value\": ...} where the receiver declared the underlying type.\n if (isConceptAs(instance.constructor)) {\n return serializeValueForType(instance.constructor as Constructor, instance);\n }\n\n // Check if there's a converter for this type\n if (converterFor(instance.constructor)) {\n return serializeValueForType(instance.constructor, instance);\n }\n \n // Check primitive converters\n if (primitiveConverters.has(instance.constructor)) {\n return primitiveConverters.get(instance.constructor)!(instance);\n }\n\n const properties = Object.getOwnPropertyNames(instance);\n const converted: any = {};\n\n // Emit the polymorphic type discriminator, preferring the registered type for the instance's\n // constructor and falling back to a discriminator preserved on the instance itself (e.g. a value\n // that was deserialized before its concrete type could be resolved). This keeps '_derivedTypeId'\n // flowing through serialization transparently — the caller never has to manage it — and is the\n // mirror of preserving it on deserialization.\n const derivedTypeId = DerivedType.get(instance.constructor) ?? instance[JsonSerializer.DerivedTypeIdProperty];\n if (derivedTypeId) {\n converted[JsonSerializer.DerivedTypeIdProperty] = derivedTypeId;\n }\n properties.forEach(property => {\n // The discriminator is handled above as a meta-property; never treat it as a data field.\n if (property === JsonSerializer.DerivedTypeIdProperty) return;\n let value = instance[property];\n if (value !== undefined) {\n if (Array.isArray(value)) {\n value = value.map(_ => convertTypesOnInstance(_));\n } else {\n value = serializeValueForType(value.__proto__.constructor, value);\n }\n }\n\n converted[property] = value;\n });\n\n return converted;\n};\n\n// Initialize ValueMapJsonConverter with helper functions to avoid circular dependencies\n// Must be done after serializeMapKey and convertTypesOnInstance are defined\nValueMapJsonConverter.setHelpers(serializeMapKey, convertTypesOnInstance);\n\n/**\n * Represents a serializer for JSON.\n */\nexport class JsonSerializer {\n static readonly DerivedTypeIdProperty: string = \"_derivedTypeId\";\n\n /**\n * Register a converter for the type it declares through its `type` property.\n * @param {JsonConverter} converter The converter to register.\n * @remarks\n * The converter is used for both directions - `read` on the way in, `write` on the way out - and\n * takes the place of any converter already registered for the same type, including the built-in\n * ones. Replacing a built-in changes the payloads the application produces and consumes, which is\n * the caller's to decide; nothing here second-guesses it.\n *\n * Two shapes resolve ahead of the converters, so a converter registered for them is not reached:\n *\n * - A type deriving from `ConceptAs` is unwrapped to its underlying value in both directions, and\n * converted as that value's type. Register for the underlying type to reach a concept.\n * - A `ValueMap` is read back from the declaring field's generic arguments rather than through a\n * converter. Note the asymmetry: writing a `ValueMap` *does* go through the registered converter,\n * so replacing that one changes only the outbound half.\n * - A `Guid` used as a `ValueMap` key always uses the plain canonical string form and bypasses any\n * registered `Guid` converter, so that keys stay compatible with C# dictionaries.\n */\n static registerConverter(converter: JsonConverter): void {\n registerConverterFor(converter);\n }\n\n /**\n * Serialize with strong type information.\n * @param {*} value The value to serialize.\n * @returns A JSON string.\n */\n static serialize(value: any): string {\n const converted = convertTypesOnInstance(value);\n return JSON.stringify(converted);\n }\n\n /**\n * Deserialize a JSON string to the specific type.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {string} json Actual JSON to deserialize.\n * @returns An instance of the target type.\n */\n static deserialize<TResult extends object>(targetType: Constructor<TResult>, json: string): TResult {\n const parsed = JSON.parse(json);\n return this.deserializeFromInstance<TResult>(targetType, parsed);\n }\n\n /**\n * Deserialize a array JSON string to an array of the specific instance type.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {string} json Actual JSON to deserialize.\n * @returns An array of instances of the target type.\n */\n static deserializeArray<TResult extends object>(targetType: Constructor<TResult>, json: string): TResult[] {\n const parsed = JSON.parse(json);\n return this.deserializeArrayFromInstance(targetType, parsed);\n }\n\n /**\n * Deserialize an any instance to a specific instance type.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {*} instance Actual instance to deserialize.\n * @returns An instance of the target type.\n */\n static deserializeFromInstance<TResult extends object>(targetType: Constructor<TResult>, instance: any): TResult {\n const fields = Fields.getFieldsForType(targetType as Constructor);\n\n if (converterFor(targetType) || isConceptAs(targetType)) {\n return deserializeValueFromType(targetType, instance);\n }\n\n const deserialized = new targetType();\n for (const field of fields) {\n let value = instance[field.name];\n if (value !== undefined && value !== null) {\n if (field.type === Array) {\n const elementType = field.genericArguments[0];\n if (elementType) {\n const elementField = new Field(field.name, elementType, false, field.derivatives, []);\n value = value.map(_ => deserializeValueFromField(elementField, _));\n }\n } else if (field.enumerable) {\n value = value.map(_ => deserializeValueFromField(field, _));\n } else {\n value = deserializeValueFromField(field, value);\n }\n } else if ((field.enumerable || field.type === Array) && value === undefined) {\n // A collection that is absent from the payload deserializes to an empty one rather than to\n // undefined. The declared type says the field is an array, and a producer that leaves an\n // empty collection out - which the Chronicle sink does deliberately, so that a parallel\n // replay cannot overwrite children a sibling event already wrote - would otherwise hand back\n // a value contradicting its own type, putting a null guard on every reader of every\n // collection. An explicit null is left alone: that is the producer saying \"no collection\"\n // rather than \"an empty one\".\n value = [];\n }\n\n deserialized[field.name] = value;\n }\n\n // Preserve the polymorphic type discriminator so it is never lost across (de)serialization\n // layers. '_derivedTypeId' is not a declared field, so it is otherwise dropped here — and a\n // derived value whose concrete type could not be resolved (e.g. its type was not yet\n // registered) would then have no discriminator left to re-resolve or round-trip with, and\n // would serialize back with no type information at all.\n const derivedTypeId = instance[JsonSerializer.DerivedTypeIdProperty];\n if (derivedTypeId !== undefined && derivedTypeId !== null) {\n (deserialized as Record<string, unknown>)[JsonSerializer.DerivedTypeIdProperty] = derivedTypeId;\n }\n\n if ((targetType as Constructor) == Object) {\n const objectFields = Object.keys(instance).filter((value) => {\n return !fields.some(_ => _.name == value);\n });\n\n for (const field of objectFields) {\n deserialized[field] = instance[field];\n }\n }\n\n return deserialized;\n }\n\n /**\n * Deserialize an array of any instances to an array of specific instance types.\n * @param {Constructor} targetType Type to deserialize to.\n * @param {instances} instances Actual instances to deserialize.\n * @returns An array of instances of the target type.\n */\n static deserializeArrayFromInstance<TResult extends object>(targetType: Constructor<TResult>, instances: any): TResult[] {\n const deserialized: TResult[] = [];\n\n for (const instance of instances) {\n deserialized.push(this.deserializeFromInstance<TResult>(targetType, instance));\n }\n\n return deserialized;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAiCA,sBAAsB,EAAE;AAGxB,MAAM,UAAU,GAAoB;AAChC,IAAA,IAAI,iBAAiB,EAAE;AACvB,IAAA,IAAI,qBAAqB,EAAE;AAC3B,IAAA,IAAI,iBAAiB,EAAE;AACvB,IAAA,IAAI,qBAAqB,EAAE;AAC3B,IAAA,IAAI,qBAAqB,EAAE;AAC3B,IAAA,IAAI,kBAAkB,EAAE;AACxB,IAAA,IAAI,uBAAuB,EAAE;AAC7B,IAAA,IAAI,oBAAoB,EAAE;AAC1B,IAAA,IAAI,qBAAqB;CAC5B;AAOD,MAAM,eAAe,GAA+B,IAAI,GAAG,EAAyB;AACpF,MAAM,cAAc,GAAoC,IAAI,GAAG,EAA8B;AAE7F,MAAM,oBAAoB,GAAG,CAAC,SAAwB,KAAI;IACtD,MAAM,GAAG,GAAG,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC;AAC3C,IAAA,IAAI,GAAG,KAAK,SAAS,EAAE;AACnB,QAAA,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC;IACvC;IAEA,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC;AACjD,CAAC;AAED,UAAU,CAAC,OAAO,CAAC,oBAAoB,CAAC;AAOxC,MAAM,YAAY,GAAG,CAAC,IAA6B,KAA+B;AAC9E,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,SAAS;AAE3B,IAAA,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,CAAC;AACjC,IAAA,MAAM,KAAK,GAAG,GAAG,KAAK,SAAS,GAAG,SAAS,GAAG,eAAe,CAAC,GAAG,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AAI,SAAS,EAAE;AAC9B,YAAA,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAU,UAAU,EAAE,QAAQ,CAAC,CAAC;QAClF;AAEA,QAAA,OAAO,YAAY;IACvB;;;"}
package/dist/esm/index.js CHANGED
@@ -22,7 +22,7 @@ export { PropertyPathResolverProxyHandler } from './PropertyPathResolverProxyHan
22
22
  export { TimeOnly } from './TimeOnly.js';
23
23
  export { TimeSpan } from './TimeSpan.js';
24
24
  export { ValueMap } from './ValueMap.js';
25
- export { conceptAsTypeKey, declaredTypeKey, typeKey, typeKeyOf, valueMapTypeKey } from './typeKey.js';
25
+ export { conceptAsTypeKey, declaredTypeKey, guidTypeKey, typeKey, typeKeyOf, valueMapTypeKey } from './typeKey.js';
26
26
  export { field } from './fieldDecorator.js';
27
27
  export { derivedType } from './derivedTypeDecorator.js';
28
28
  export { JsonSerializer } from './JsonSerializer.js';
@@ -4,4 +4,5 @@ export declare const declaredTypeKey: (type: Constructor | undefined) => string
4
4
  export declare const typeKeyOf: (type: Constructor | undefined) => string | undefined;
5
5
  export declare const conceptAsTypeKey = "ConceptAs";
6
6
  export declare const valueMapTypeKey = "ValueMap";
7
+ export declare const guidTypeKey = "Guid";
7
8
  //# sourceMappingURL=typeKey.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typeKey.d.ts","sourceRoot":"","sources":["../../typeKey.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAiB5C,eAAO,MAAM,OAAO,EAAE,OAAO,MAAmD,CAAC;AAcjF,eAAO,MAAM,eAAe,GAAI,MAAM,WAAW,GAAG,SAAS,KAAG,MAAM,GAAG,SACiC,CAAC;AAW3G,eAAO,MAAM,SAAS,GAAI,MAAM,WAAW,GAAG,SAAS,KAAG,MAAM,GAAG,SAChB,CAAC;AAGpD,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAG5C,eAAO,MAAM,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"typeKey.d.ts","sourceRoot":"","sources":["../../typeKey.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAiB5C,eAAO,MAAM,OAAO,EAAE,OAAO,MAAmD,CAAC;AAcjF,eAAO,MAAM,eAAe,GAAI,MAAM,WAAW,GAAG,SAAS,KAAG,MAAM,GAAG,SACiC,CAAC;AAW3G,eAAO,MAAM,SAAS,GAAI,MAAM,WAAW,GAAG,SAAS,KAAG,MAAM,GAAG,SAChB,CAAC;AAGpD,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAG5C,eAAO,MAAM,eAAe,aAAa,CAAC;AAG1C,eAAO,MAAM,WAAW,SAAS,CAAC"}
@@ -3,6 +3,7 @@ const declaredTypeKey = (type) => type && Object.prototype.hasOwnProperty.call(t
3
3
  const typeKeyOf = (type) => type ? type[typeKey] : undefined;
4
4
  const conceptAsTypeKey = 'ConceptAs';
5
5
  const valueMapTypeKey = 'ValueMap';
6
+ const guidTypeKey = 'Guid';
6
7
 
7
- export { conceptAsTypeKey, declaredTypeKey, typeKey, typeKeyOf, valueMapTypeKey };
8
+ export { conceptAsTypeKey, declaredTypeKey, guidTypeKey, typeKey, typeKeyOf, valueMapTypeKey };
8
9
  //# sourceMappingURL=typeKey.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"typeKey.js","sources":["../../typeKey.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Constructor } from './Constructor';\n\n/**\n * Identifies a type this package converts, by name rather than by the class object itself.\n *\n * `JsonSerializer` recognized a type by comparing constructors, which holds until a second copy of this\n * package is loaded into the same realm - a nested install, or one install reached as both ESM and\n * CommonJS. Each copy then had its own `Guid`, `ConceptAs` and `ValueMap` class objects and neither\n * recognized the other's, so a `Guid` crossing that boundary was written as an object rather than a\n * string, and a concept as `{\"value\": ...}` rather than its underlying value. Both silently.\n *\n * A name survives the boundary where a class object does not: the key is a registered symbol, so every\n * copy resolves the same one, and the values are plain strings.\n *\n * The key is deliberately a symbol rather than a plain static: a string static would appear in\n * `Object.keys(Guid)` and could be shadowed by an unrelated member of the same name.\n */\nexport const typeKey: unique symbol = Symbol.for('@cratis/fundamentals.typeKey');\n\n/** A type carrying the key. Only this package's own convertible types declare one. */\ntype KeyedType = Constructor & { readonly [typeKey]?: string };\n\n/**\n * Gets the key a type declares itself, ignoring any inherited from a base type.\n *\n * Converter lookup uses this, because a key is inherited: a consumer's `class CustomerId extends\n * ConceptAs<string>` reports `ConceptAs`, and registering a converter under that would take the place\n * of concept handling for every concept in the application.\n * @param {Constructor} type The type to read the key from.\n * @returns {string | undefined} The declared key, or undefined when the type declares none.\n */\nexport const declaredTypeKey = (type: Constructor | undefined): string | undefined =>\n type && Object.prototype.hasOwnProperty.call(type, typeKey) ? (type as KeyedType)[typeKey] : undefined;\n\n/**\n * Gets the key a type carries, whether it declares the key or inherits it from a base type.\n *\n * This is what makes a concept recognizable across copies: the key is a static, and a static is\n * inherited through the constructor's prototype chain, so every type deriving from `ConceptAs` reports\n * `ConceptAs` without anything having to compare class objects.\n * @param {Constructor} type The type to read the key from.\n * @returns {string | undefined} The key carried, or undefined when the type carries none.\n */\nexport const typeKeyOf = (type: Constructor | undefined): string | undefined =>\n type ? (type as KeyedType)[typeKey] : undefined;\n\n/** The key every type deriving from `ConceptAs` carries. */\nexport const conceptAsTypeKey = 'ConceptAs';\n\n/** The key `ValueMap` declares. */\nexport const valueMapTypeKey = 'ValueMap';\n"],"names":[],"mappings":"AAoBO,MAAM,OAAO,GAAkB,MAAM,CAAC,GAAG,CAAC,8BAA8B;AAcxE,MAAM,eAAe,GAAG,CAAC,IAA6B,KACzD,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,GAAI,IAAkB,CAAC,OAAO,CAAC,GAAG;MAWpF,SAAS,GAAG,CAAC,IAA6B,KACnD,IAAI,GAAI,IAAkB,CAAC,OAAO,CAAC,GAAG;AAGnC,MAAM,gBAAgB,GAAG;AAGzB,MAAM,eAAe,GAAG;;"}
1
+ {"version":3,"file":"typeKey.js","sources":["../../typeKey.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Constructor } from './Constructor';\n\n/**\n * Identifies a type this package converts, by name rather than by the class object itself.\n *\n * `JsonSerializer` recognized a type by comparing constructors, which holds until a second copy of this\n * package is loaded into the same realm - a nested install, or one install reached as both ESM and\n * CommonJS. Each copy then had its own `Guid`, `ConceptAs` and `ValueMap` class objects and neither\n * recognized the other's, so a `Guid` crossing that boundary was written as an object rather than a\n * string, and a concept as `{\"value\": ...}` rather than its underlying value. Both silently.\n *\n * A name survives the boundary where a class object does not: the key is a registered symbol, so every\n * copy resolves the same one, and the values are plain strings.\n *\n * The key is deliberately a symbol rather than a plain static: a string static would appear in\n * `Object.keys(Guid)` and could be shadowed by an unrelated member of the same name.\n */\nexport const typeKey: unique symbol = Symbol.for('@cratis/fundamentals.typeKey');\n\n/** A type carrying the key. Only this package's own convertible types declare one. */\ntype KeyedType = Constructor & { readonly [typeKey]?: string };\n\n/**\n * Gets the key a type declares itself, ignoring any inherited from a base type.\n *\n * Converter lookup uses this, because a key is inherited: a consumer's `class CustomerId extends\n * ConceptAs<string>` reports `ConceptAs`, and registering a converter under that would take the place\n * of concept handling for every concept in the application.\n * @param {Constructor} type The type to read the key from.\n * @returns {string | undefined} The declared key, or undefined when the type declares none.\n */\nexport const declaredTypeKey = (type: Constructor | undefined): string | undefined =>\n type && Object.prototype.hasOwnProperty.call(type, typeKey) ? (type as KeyedType)[typeKey] : undefined;\n\n/**\n * Gets the key a type carries, whether it declares the key or inherits it from a base type.\n *\n * This is what makes a concept recognizable across copies: the key is a static, and a static is\n * inherited through the constructor's prototype chain, so every type deriving from `ConceptAs` reports\n * `ConceptAs` without anything having to compare class objects.\n * @param {Constructor} type The type to read the key from.\n * @returns {string | undefined} The key carried, or undefined when the type carries none.\n */\nexport const typeKeyOf = (type: Constructor | undefined): string | undefined =>\n type ? (type as KeyedType)[typeKey] : undefined;\n\n/** The key every type deriving from `ConceptAs` carries. */\nexport const conceptAsTypeKey = 'ConceptAs';\n\n/** The key `ValueMap` declares. */\nexport const valueMapTypeKey = 'ValueMap';\n\n/** The key `Guid` declares. */\nexport const guidTypeKey = 'Guid';\n"],"names":[],"mappings":"AAoBO,MAAM,OAAO,GAAkB,MAAM,CAAC,GAAG,CAAC,8BAA8B;AAcxE,MAAM,eAAe,GAAG,CAAC,IAA6B,KACzD,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,GAAI,IAAkB,CAAC,OAAO,CAAC,GAAG;MAWpF,SAAS,GAAG,CAAC,IAA6B,KACnD,IAAI,GAAI,IAAkB,CAAC,OAAO,CAAC,GAAG;AAGnC,MAAM,gBAAgB,GAAG;AAGzB,MAAM,eAAe,GAAG;AAGxB,MAAM,WAAW,GAAG;;"}
@@ -1 +1 @@
1
- {"version":"7.0.2","root":[[92,131]],"packageJsons":["../node_modules/tslib/modules/package.json","../node_modules/tslib/package.json","../package.json"],"fileNames":["lib.es5.d.ts","lib.es2015.d.ts","lib.es2016.d.ts","lib.es2017.d.ts","lib.es2018.d.ts","lib.es2019.d.ts","lib.es2020.d.ts","lib.es2021.d.ts","lib.es2022.d.ts","lib.es2023.d.ts","lib.es2024.d.ts","lib.es2025.d.ts","lib.esnext.d.ts","lib.dom.d.ts","lib.dom.iterable.d.ts","lib.es2015.core.d.ts","lib.es2015.collection.d.ts","lib.es2015.generator.d.ts","lib.es2015.iterable.d.ts","lib.es2015.promise.d.ts","lib.es2015.proxy.d.ts","lib.es2015.reflect.d.ts","lib.es2015.symbol.d.ts","lib.es2015.symbol.wellknown.d.ts","lib.es2016.array.include.d.ts","lib.es2016.intl.d.ts","lib.es2017.arraybuffer.d.ts","lib.es2017.date.d.ts","lib.es2017.object.d.ts","lib.es2017.sharedmemory.d.ts","lib.es2017.string.d.ts","lib.es2017.intl.d.ts","lib.es2017.typedarrays.d.ts","lib.es2018.asyncgenerator.d.ts","lib.es2018.asynciterable.d.ts","lib.es2018.intl.d.ts","lib.es2018.promise.d.ts","lib.es2018.regexp.d.ts","lib.es2019.array.d.ts","lib.es2019.object.d.ts","lib.es2019.string.d.ts","lib.es2019.symbol.d.ts","lib.es2019.intl.d.ts","lib.es2020.bigint.d.ts","lib.es2020.date.d.ts","lib.es2020.promise.d.ts","lib.es2020.sharedmemory.d.ts","lib.es2020.string.d.ts","lib.es2020.symbol.wellknown.d.ts","lib.es2020.intl.d.ts","lib.es2020.number.d.ts","lib.es2021.promise.d.ts","lib.es2021.string.d.ts","lib.es2021.weakref.d.ts","lib.es2021.intl.d.ts","lib.es2022.array.d.ts","lib.es2022.error.d.ts","lib.es2022.intl.d.ts","lib.es2022.object.d.ts","lib.es2022.string.d.ts","lib.es2022.regexp.d.ts","lib.es2023.array.d.ts","lib.es2023.collection.d.ts","lib.es2023.intl.d.ts","lib.es2024.arraybuffer.d.ts","lib.es2024.collection.d.ts","lib.es2024.object.d.ts","lib.es2024.promise.d.ts","lib.es2024.regexp.d.ts","lib.es2024.sharedmemory.d.ts","lib.es2024.string.d.ts","lib.es2025.collection.d.ts","lib.es2025.float16.d.ts","lib.es2025.intl.d.ts","lib.es2025.iterator.d.ts","lib.es2025.promise.d.ts","lib.es2025.regexp.d.ts","lib.esnext.array.d.ts","lib.esnext.collection.d.ts","lib.esnext.date.d.ts","lib.esnext.decorators.d.ts","lib.esnext.disposable.d.ts","lib.esnext.error.d.ts","lib.esnext.intl.d.ts","lib.esnext.sharedmemory.d.ts","lib.esnext.temporal.d.ts","lib.esnext.typedarrays.d.ts","lib.decorators.d.ts","lib.decorators.legacy.d.ts","../node_modules/tslib/tslib.d.ts","../node_modules/tslib/modules/index.d.ts","../Constructor.ts","../typeKey.ts","../ConceptAs.ts","../Field.ts","../reflection.ts","../fieldDecoratorMetadata.ts","../Fields.ts","../StandardFieldDecoratorContext.ts","../fieldDecorator.ts","../DateOnly.ts","../DerivedType.ts","../IEquatable.ts","../Guid.ts","../duplicateInstanceGuard.ts","../ValueMap.ts","../json/JsonConverter.ts","../json/DateJsonConverter.ts","../json/DateOnlyJsonConverter.ts","../json/GuidJsonConverter.ts","../TimeOnly.ts","../json/TimeOnlyJsonConverter.ts","../TimeSpan.ts","../json/TimeSpanJsonConverter.ts","../geospatial/Point.ts","../geospatial/LinearRing.ts","../geospatial/LineString.ts","../geospatial/Polygon.ts","../geospatial/index.ts","../json/PointJsonConverter.ts","../json/LineStringJsonConverter.ts","../json/PolygonJsonConverter.ts","../json/ValueMapJsonConverter.ts","../json/index.ts","../JsonSerializer.ts","../PropertyAccessor.ts","../PropertyAccessorDescriptor.ts","../PropertyPathResolverProxyHandler.ts","../StandardClassDecoratorContext.ts","../derivedTypeDecorator.ts","../index.ts"],"fileInfos":[{"version":"16934abaab7026ac114da441aabea1a0","affectsGlobalScope":true,"impliedNodeFormat":1},"d4306fb2e47f74835e8674ffac07d76f","e437c5c1302869326c3bb93da85bbbcf","e4324975a566567b21d350615f1fc6ac","333b1b9a2a9ac3b8497dba5c63b5ba50","6cffacd662b6eb5fa7a36aa2ea366bfa","b4c34f9c23304dbef2d23698637ed638","e5cb86a5fc491796ecd1d2dd348d208f","feb6c6fb19cdb246a5d8acb36a6901c7","9443a7f109277ffaa79d893ed2549995","793cee405385076e27c24f409659dccd","09f69c6610266eaee1ac9e3e30df2c71","62bad718844246b8e17547f37bad6085",{"version":"aae8996e8b5684814785a42cbbefcd79","affectsGlobalScope":true,"impliedNodeFormat":1},"abad6dd56cc8caf095c165df8124d237",{"version":"926204c28cd3d073865348473ae28d2e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f25e42c801b2cb3cf2b39792006a9beb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6344b55f26a4e81d9608777dbfb877dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3c0ed28e53d3695b363e256ec1c023fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4c2761daba7f17141c25baa0821ac5da","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b87656acabd63e69379ff6ffcfe52fc7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"597469522da047a5af5222cc6989f405","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1708ea4d34dc37fadadc63ca01127e80","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"55d97a8c6fbf34a30450a7b1e5f7a298","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0ee05eb59426d33e374226d8dcfa708b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e347c14030993906efcfbb88915b6a05","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b0231263857c9b6a03641acdc9280ceb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3b15c4a83b598cacb4067676e6f0abed","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b417d97b7934cef63b1889abec0bbfbf","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"09a6cf4032ebba60ce22a501e663f881","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2b056277dd138e8f5650fc04e20eaa8d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e22cc07e3f3cc242ba52fa3f8ea1fc58","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2c45da767a1bfbb220848df1bc4029e4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b44c3e0fbaf2130cdcf6ac38b120ffa1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b612fb5cf8e5d964b92063a75207632a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"02705151a5e1551b9162a9ed8ab763f7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"41025e398be9215d32e4337335da8f0b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52684c2b1f353a5538e4f275182a54cd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6dedb6a4f90d1df3a6fbe5693e44886c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ca3f36fe3562c07e0f0d71c2bebd3f6d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"409974d6129befbb8226ddd1c6558568","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4d9cfde2a1ae1b4925f1f9bc10848e5d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7e1daecc66dd564144e3bb1a0266b5fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a8e1d9bb35fd0637f2f9fd2b2a54f2ec","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4f168501772a6543182765bfd5f2fbfe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a19c80aad1b2162103496f5ba293a732","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b69afa63cd5d059851c78adb2856ee09","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ae2fc5d954e9b0f5feee3d481b953c27","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1cfd3091a071d8b6feec15277643bafe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1da2c1f258970fd3cc91184f69e91a9d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a0d87491913d843139e0c993650a3235","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ef72aa378127e7b7abba915b0110b1e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3ec74c6a7d4463f0254db3a74cf75646","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"84c2bdfa470d075526cce6322d81b0b6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0b3844c2b8c73e4e1ab91431411cad11","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4fc71cf4a15b8d99675a31df77f26e07","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d1b49564ddaeca3df5b6dbae925d2242","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6a25be566d60ccfc2d6e8b7bfdeefa83","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8a20e27646985dfd58c57ca6566553dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9969f02ad3cdcbf4f709405cda44167f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9c9be4792a7a4f42c15ae7360bf28779","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8cf777fe00349b71ee9c4b6f3fe7fd19","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f96bc192530c9723f572bfff3d3078","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1df91c56b25955c56387426f378173c5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"38856f70edcd2115c355d96ec77cc09e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"de8700156c1275465bcd473c28b359aa","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d47cfdb6ede40518357bb5a4cd7cd9fb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6e5773860cd9e5b15e683113f642ab47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"30ff5fe1682f7fcd629880476ca3c2e0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"bf23d7d1b40b9015b694ddc2f011752f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2cc585d42e2c548f9f24a30a1989fd33","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"713906ce9d332d2242b7f05ed9304be3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0219894bfe5042c7e1aa2d22e4a91ed0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6009ffff7e43c93318804d2d28e37fe3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"03be89b227587594fbb50509fc1c2e45","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b30df52dc24740c0bad7c55c3511df7d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8d3c9b5ed5c2ab8f383607eef439f0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d950ec671d0a8e07f3c1a31e94abed86","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1abef2ace5eccb02d60dd73cd5a5ee4c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f5f0a3044029d1cc081b5887eb4deb07","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d57c697f1446940ec4bfe669c962e2c4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"be41035d7b941482a1e1ae6a5c5dcca5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"10f7d9da7564f27f8ddf4a162b6da6d3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1d0520af549e0c3581f15173cc713ca1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d65083f97fd741cff028472563eddb79","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"da7f24f00653ebac660ac1c0821ed33d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7cb5ae9e65516ea2235f0721f6aac43c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f64453cbf9671f28158677fa5c43967a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"33f317af5428801f944a478d2c1e38e5","affectsGlobalScope":true,"impliedNodeFormat":1},"68565f078f6cbaa18bac7ac1aee706a4",{"version":"6df9988546b1b8e15cb137c4ed46c629","impliedNodeFormat":99},{"version":"04bfab517bef8ec649195900a112645a","signature":"0aa13ceea7e7c3f53c785d7ca09fc461","impliedNodeFormat":1},{"version":"4be4109ece9fb3a502363e428d4b9d09","signature":"05d855d5235efc2be94c1a4393c609e4","impliedNodeFormat":1},{"version":"a7ffa0f207e5e558300b989f56e10ed8","signature":"dee26c2062ab4d0c96825cd9f06fc8ec","impliedNodeFormat":1},{"version":"30572a6c021fe02cf36ded539f81c4ab","signature":"86f3667a6b4bdf2ea2cb1b3d22824431","impliedNodeFormat":1},{"version":"d6444c005923a0e29b164735b3faf628","signature":"3ebc9c537c34634924dad5f75a5e826d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"eed8a4269d54d1b794fc93932726b39a","signature":"4c5307b1c87b22bd7862ce9245df2355","impliedNodeFormat":1},{"version":"4dad3ba63dfa4906aa5d59f3b088a12a","signature":"0c843f46bbfeb9f4f5e2f551ac701e71","impliedNodeFormat":1},{"version":"2a26f729ac58a50a4af8ae4cb949113b","signature":"56e1e5e440c94e1e1d7f6e87e79ad79a","impliedNodeFormat":1},{"version":"1a5c6baa45b220f4318f3265c59548eb","signature":"613a934507b0cfd0950cb8e6973dfedf","impliedNodeFormat":1},{"version":"485c2c85724ef7b3927b680aea8a91f9","signature":"bad057a4b4ea4af9b6014d316293750a","impliedNodeFormat":1},{"version":"b361021d3d18d13aac63b35d4b0ef1d1","signature":"e574772f7137c7acb41b9b4cf9df058d","impliedNodeFormat":1},{"version":"10bacfe190f9fe270633c42af70386a1","signature":"38aed49039f4cd461d25f012f97b8c39","impliedNodeFormat":1},{"version":"cc34701bb2e1462b45d017a6fe2f141f","signature":"719dfec5f3283ec85710adbba78e6365","impliedNodeFormat":1},{"version":"4824fb9728966ca9f9ce17b9ce75f05c","signature":"c2020050bac2e38d3fa0a6b493982137","impliedNodeFormat":1},{"version":"a1749f74fd525e58a163f183940e7e09","signature":"6aa3c11249f9aaa1ac65d937ead30969","impliedNodeFormat":1},{"version":"351814ccfa1ba58ef45ec89a4aeb404c","signature":"f98eec2170a99869483d3eca900d0cc0","impliedNodeFormat":1},{"version":"5184ac9b0d8991786893fe84aa78d6b9","signature":"b5ebd566a1965c6a14cd722344ce6f6e","impliedNodeFormat":1},{"version":"c7735481ae825eb6bbcfd4a9805ba6c1","signature":"a7d694b86b36ce7df89de40ffc9402aa","impliedNodeFormat":1},{"version":"908d0f661e9c957f8aa06d19d4ab330d","signature":"6417e5a1c83740dd726339c7dcb25e00","impliedNodeFormat":1},{"version":"7ac4e2073efabc8a9b3ffd50e858f616","signature":"a45a1270e3bec3c20dfc71dbd1f4c873","impliedNodeFormat":1},{"version":"9e48231dbfedcc7214ebef6ea6286a23","signature":"6fbd3fb27221371a80b8e5096ab64669","impliedNodeFormat":1},{"version":"dbf142eb5e53d886df2e7093c459d38a","signature":"819455b7d09613669008590152f72bfb","impliedNodeFormat":1},{"version":"458e81f3aa2be4dce8b9c74ea9501bbb","signature":"cb18508ff8bbf75a7e3ab6a4326d04bc","impliedNodeFormat":1},{"version":"27ff541c8e95725471b6b63deda1cee5","signature":"58b7f36019024977c58e8f9578061940","impliedNodeFormat":1},{"version":"5a1c99c1b8aee61fe81f2c24580f964a","signature":"f54113fe7e33138fa6bef35633d9c756","impliedNodeFormat":1},{"version":"640a86079ef069627d498d92042be3fd","signature":"9ebee2bd622814352f911c1123c777bb","impliedNodeFormat":1},{"version":"c61a48c85d6c125ca9883e4b050cdca7","signature":"1c1616eb4a9ee2509a326a00d2bb66f7","impliedNodeFormat":1},{"version":"422db4edf8c3ce6cf7e553ebd6fb9d67","signature":"9cb1145b2a3893442ee4af6d07a433a1","impliedNodeFormat":1},{"version":"f5389e83dd9ce8454cf4c529c3f27303","signature":"f39ebf82376bef22974827fb45fc2868","impliedNodeFormat":1},{"version":"aa02a24e6da8595f2ddf20291c42af9f","signature":"1fb32a9a54778e35701953fde7d6a644","impliedNodeFormat":1},{"version":"5565dbac2a69a59c1fcba503a6e50586","signature":"5faf589f6dca05637ace1b1e2b65a5d9","impliedNodeFormat":1},{"version":"8e1e86bc20e3c61f979e2567130c7842","signature":"b862c86ba994a1012909a9193bf8fccb","impliedNodeFormat":1},{"version":"11d4a6190e2dfd54e76be78ac56a83d2","signature":"c008349de6f254aab2ea421ab4467148","impliedNodeFormat":1},{"version":"e428199a69f1b0f1eae01bcc82cf6f0e","signature":"619e7562793b95efc8e4045b345c2958","impliedNodeFormat":1},{"version":"90afd3587a9a35670427e6961c843453","signature":"5c86fabce3450c64974c38377a4c7e78","impliedNodeFormat":1},{"version":"88e8ac668c482d4adea78be66563f1df","signature":"44105eab8a75458fcab12433d5d313c3","impliedNodeFormat":1},{"version":"975510ec28b104338b0200ad7da6681a","signature":"94ffea549c13e56a8cf4c04a811cbc75","impliedNodeFormat":1},{"version":"4233f8df71c1590dc418143794641f46","signature":"5c8de80b459b0cbf43397cfb4b8ff0d3","impliedNodeFormat":1},{"version":"77ef4441645eb9547648b763c0e124d6","signature":"d42cb94635f66e63be4724c41308e9c7","impliedNodeFormat":1},{"version":"22ac9c87f6f69a0d5e058def48f6029e","signature":"58604a62d80d6df338da00a0caafddb6","impliedNodeFormat":1}],"fileIdsList":[[93],[93,100],[92,96],[92],[92,95,96,97],[93,103],[92,93,95,98,102,105,106,124],[126],[92,96,102,129],[92,95,97,98,99],[92,95,96],[93,115],[115],[93,116],[115,116,117,118],[92,93,94,95,98,100,101,102,103,104,106,111,113,119,124,125,126,127,128,130],[92,107],[92,101,107],[92,104,107],[92,107,119],[92,107,111],[92,107,113],[92,106,107],[107,108,109,110,112,114,120,121,122,123],[90]],"options":{"allowJs":false,"assumeChangesOnlyAffectDirectDependencies":true,"checkJs":false,"composite":true,"emitDecoratorMetadata":true,"declaration":true,"declarationMap":true,"experimentalDecorators":true,"importHelpers":true,"jsx":4,"module":7,"newLine":2,"noFallthroughCasesInSwitch":true,"noImplicitAny":false,"noImplicitReturns":true,"outDir":"./","preserveConstEnums":true,"removeComments":true,"rootDir":"..","skipLibCheck":true,"strict":true,"strictNullChecks":true,"stripInternal":true,"sourceMap":true,"target":9,"allowSyntheticDefaultImports":true,"alwaysStrict":true,"esModuleInterop":true},"referencedMap":[[94,1],[101,2],[102,3],[95,4],[98,5],[104,6],[125,7],[127,8],[129,4],[111,2],[113,2],[106,1],[130,9],[100,10],[97,11],[117,12],[116,13],[115,2],[118,14],[119,15],[131,16],[108,17],[109,18],[110,19],[107,4],[121,20],[120,20],[122,20],[112,21],[114,22],[123,23],[124,24],[91,25],[93,4]],"latestChangedDtsFile":"./index.d.ts"}
1
+ {"version":"7.0.2","root":[[92,131]],"packageJsons":["../node_modules/tslib/modules/package.json","../node_modules/tslib/package.json","../package.json"],"fileNames":["lib.es5.d.ts","lib.es2015.d.ts","lib.es2016.d.ts","lib.es2017.d.ts","lib.es2018.d.ts","lib.es2019.d.ts","lib.es2020.d.ts","lib.es2021.d.ts","lib.es2022.d.ts","lib.es2023.d.ts","lib.es2024.d.ts","lib.es2025.d.ts","lib.esnext.d.ts","lib.dom.d.ts","lib.dom.iterable.d.ts","lib.es2015.core.d.ts","lib.es2015.collection.d.ts","lib.es2015.generator.d.ts","lib.es2015.iterable.d.ts","lib.es2015.promise.d.ts","lib.es2015.proxy.d.ts","lib.es2015.reflect.d.ts","lib.es2015.symbol.d.ts","lib.es2015.symbol.wellknown.d.ts","lib.es2016.array.include.d.ts","lib.es2016.intl.d.ts","lib.es2017.arraybuffer.d.ts","lib.es2017.date.d.ts","lib.es2017.object.d.ts","lib.es2017.sharedmemory.d.ts","lib.es2017.string.d.ts","lib.es2017.intl.d.ts","lib.es2017.typedarrays.d.ts","lib.es2018.asyncgenerator.d.ts","lib.es2018.asynciterable.d.ts","lib.es2018.intl.d.ts","lib.es2018.promise.d.ts","lib.es2018.regexp.d.ts","lib.es2019.array.d.ts","lib.es2019.object.d.ts","lib.es2019.string.d.ts","lib.es2019.symbol.d.ts","lib.es2019.intl.d.ts","lib.es2020.bigint.d.ts","lib.es2020.date.d.ts","lib.es2020.promise.d.ts","lib.es2020.sharedmemory.d.ts","lib.es2020.string.d.ts","lib.es2020.symbol.wellknown.d.ts","lib.es2020.intl.d.ts","lib.es2020.number.d.ts","lib.es2021.promise.d.ts","lib.es2021.string.d.ts","lib.es2021.weakref.d.ts","lib.es2021.intl.d.ts","lib.es2022.array.d.ts","lib.es2022.error.d.ts","lib.es2022.intl.d.ts","lib.es2022.object.d.ts","lib.es2022.string.d.ts","lib.es2022.regexp.d.ts","lib.es2023.array.d.ts","lib.es2023.collection.d.ts","lib.es2023.intl.d.ts","lib.es2024.arraybuffer.d.ts","lib.es2024.collection.d.ts","lib.es2024.object.d.ts","lib.es2024.promise.d.ts","lib.es2024.regexp.d.ts","lib.es2024.sharedmemory.d.ts","lib.es2024.string.d.ts","lib.es2025.collection.d.ts","lib.es2025.float16.d.ts","lib.es2025.intl.d.ts","lib.es2025.iterator.d.ts","lib.es2025.promise.d.ts","lib.es2025.regexp.d.ts","lib.esnext.array.d.ts","lib.esnext.collection.d.ts","lib.esnext.date.d.ts","lib.esnext.decorators.d.ts","lib.esnext.disposable.d.ts","lib.esnext.error.d.ts","lib.esnext.intl.d.ts","lib.esnext.sharedmemory.d.ts","lib.esnext.temporal.d.ts","lib.esnext.typedarrays.d.ts","lib.decorators.d.ts","lib.decorators.legacy.d.ts","../node_modules/tslib/tslib.d.ts","../node_modules/tslib/modules/index.d.ts","../Constructor.ts","../typeKey.ts","../ConceptAs.ts","../Field.ts","../reflection.ts","../fieldDecoratorMetadata.ts","../Fields.ts","../StandardFieldDecoratorContext.ts","../fieldDecorator.ts","../DateOnly.ts","../DerivedType.ts","../IEquatable.ts","../Guid.ts","../duplicateInstanceGuard.ts","../ValueMap.ts","../json/JsonConverter.ts","../json/DateJsonConverter.ts","../json/DateOnlyJsonConverter.ts","../json/GuidJsonConverter.ts","../TimeOnly.ts","../json/TimeOnlyJsonConverter.ts","../TimeSpan.ts","../json/TimeSpanJsonConverter.ts","../geospatial/Point.ts","../geospatial/LinearRing.ts","../geospatial/LineString.ts","../geospatial/Polygon.ts","../geospatial/index.ts","../json/PointJsonConverter.ts","../json/LineStringJsonConverter.ts","../json/PolygonJsonConverter.ts","../json/ValueMapJsonConverter.ts","../json/index.ts","../JsonSerializer.ts","../PropertyAccessor.ts","../PropertyAccessorDescriptor.ts","../PropertyPathResolverProxyHandler.ts","../StandardClassDecoratorContext.ts","../derivedTypeDecorator.ts","../index.ts"],"fileInfos":[{"version":"16934abaab7026ac114da441aabea1a0","affectsGlobalScope":true,"impliedNodeFormat":1},"d4306fb2e47f74835e8674ffac07d76f","e437c5c1302869326c3bb93da85bbbcf","e4324975a566567b21d350615f1fc6ac","333b1b9a2a9ac3b8497dba5c63b5ba50","6cffacd662b6eb5fa7a36aa2ea366bfa","b4c34f9c23304dbef2d23698637ed638","e5cb86a5fc491796ecd1d2dd348d208f","feb6c6fb19cdb246a5d8acb36a6901c7","9443a7f109277ffaa79d893ed2549995","793cee405385076e27c24f409659dccd","09f69c6610266eaee1ac9e3e30df2c71","62bad718844246b8e17547f37bad6085",{"version":"aae8996e8b5684814785a42cbbefcd79","affectsGlobalScope":true,"impliedNodeFormat":1},"abad6dd56cc8caf095c165df8124d237",{"version":"926204c28cd3d073865348473ae28d2e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f25e42c801b2cb3cf2b39792006a9beb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6344b55f26a4e81d9608777dbfb877dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3c0ed28e53d3695b363e256ec1c023fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4c2761daba7f17141c25baa0821ac5da","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b87656acabd63e69379ff6ffcfe52fc7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"597469522da047a5af5222cc6989f405","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1708ea4d34dc37fadadc63ca01127e80","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"55d97a8c6fbf34a30450a7b1e5f7a298","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0ee05eb59426d33e374226d8dcfa708b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e347c14030993906efcfbb88915b6a05","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b0231263857c9b6a03641acdc9280ceb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3b15c4a83b598cacb4067676e6f0abed","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b417d97b7934cef63b1889abec0bbfbf","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"09a6cf4032ebba60ce22a501e663f881","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2b056277dd138e8f5650fc04e20eaa8d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e22cc07e3f3cc242ba52fa3f8ea1fc58","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2c45da767a1bfbb220848df1bc4029e4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b44c3e0fbaf2130cdcf6ac38b120ffa1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b612fb5cf8e5d964b92063a75207632a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"02705151a5e1551b9162a9ed8ab763f7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"41025e398be9215d32e4337335da8f0b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52684c2b1f353a5538e4f275182a54cd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6dedb6a4f90d1df3a6fbe5693e44886c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ca3f36fe3562c07e0f0d71c2bebd3f6d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"409974d6129befbb8226ddd1c6558568","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4d9cfde2a1ae1b4925f1f9bc10848e5d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7e1daecc66dd564144e3bb1a0266b5fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a8e1d9bb35fd0637f2f9fd2b2a54f2ec","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4f168501772a6543182765bfd5f2fbfe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a19c80aad1b2162103496f5ba293a732","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b69afa63cd5d059851c78adb2856ee09","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ae2fc5d954e9b0f5feee3d481b953c27","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1cfd3091a071d8b6feec15277643bafe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1da2c1f258970fd3cc91184f69e91a9d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a0d87491913d843139e0c993650a3235","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ef72aa378127e7b7abba915b0110b1e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3ec74c6a7d4463f0254db3a74cf75646","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"84c2bdfa470d075526cce6322d81b0b6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0b3844c2b8c73e4e1ab91431411cad11","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4fc71cf4a15b8d99675a31df77f26e07","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d1b49564ddaeca3df5b6dbae925d2242","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6a25be566d60ccfc2d6e8b7bfdeefa83","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8a20e27646985dfd58c57ca6566553dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9969f02ad3cdcbf4f709405cda44167f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9c9be4792a7a4f42c15ae7360bf28779","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8cf777fe00349b71ee9c4b6f3fe7fd19","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f96bc192530c9723f572bfff3d3078","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1df91c56b25955c56387426f378173c5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"38856f70edcd2115c355d96ec77cc09e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"de8700156c1275465bcd473c28b359aa","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d47cfdb6ede40518357bb5a4cd7cd9fb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6e5773860cd9e5b15e683113f642ab47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"30ff5fe1682f7fcd629880476ca3c2e0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"bf23d7d1b40b9015b694ddc2f011752f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2cc585d42e2c548f9f24a30a1989fd33","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"713906ce9d332d2242b7f05ed9304be3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0219894bfe5042c7e1aa2d22e4a91ed0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6009ffff7e43c93318804d2d28e37fe3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"03be89b227587594fbb50509fc1c2e45","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b30df52dc24740c0bad7c55c3511df7d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8d3c9b5ed5c2ab8f383607eef439f0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d950ec671d0a8e07f3c1a31e94abed86","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1abef2ace5eccb02d60dd73cd5a5ee4c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f5f0a3044029d1cc081b5887eb4deb07","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d57c697f1446940ec4bfe669c962e2c4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"be41035d7b941482a1e1ae6a5c5dcca5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"10f7d9da7564f27f8ddf4a162b6da6d3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1d0520af549e0c3581f15173cc713ca1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d65083f97fd741cff028472563eddb79","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"da7f24f00653ebac660ac1c0821ed33d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7cb5ae9e65516ea2235f0721f6aac43c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f64453cbf9671f28158677fa5c43967a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"33f317af5428801f944a478d2c1e38e5","affectsGlobalScope":true,"impliedNodeFormat":1},"68565f078f6cbaa18bac7ac1aee706a4",{"version":"6df9988546b1b8e15cb137c4ed46c629","impliedNodeFormat":99},{"version":"04bfab517bef8ec649195900a112645a","signature":"0aa13ceea7e7c3f53c785d7ca09fc461","impliedNodeFormat":1},{"version":"d55806511032bffc887528ffc98bee9f","signature":"c2f6baeb9792f6582a4c97ed3f1041cf","impliedNodeFormat":1},{"version":"a7ffa0f207e5e558300b989f56e10ed8","signature":"dee26c2062ab4d0c96825cd9f06fc8ec","impliedNodeFormat":1},{"version":"30572a6c021fe02cf36ded539f81c4ab","signature":"86f3667a6b4bdf2ea2cb1b3d22824431","impliedNodeFormat":1},{"version":"d6444c005923a0e29b164735b3faf628","signature":"3ebc9c537c34634924dad5f75a5e826d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"eed8a4269d54d1b794fc93932726b39a","signature":"4c5307b1c87b22bd7862ce9245df2355","impliedNodeFormat":1},{"version":"4dad3ba63dfa4906aa5d59f3b088a12a","signature":"0c843f46bbfeb9f4f5e2f551ac701e71","impliedNodeFormat":1},{"version":"2a26f729ac58a50a4af8ae4cb949113b","signature":"56e1e5e440c94e1e1d7f6e87e79ad79a","impliedNodeFormat":1},{"version":"1a5c6baa45b220f4318f3265c59548eb","signature":"613a934507b0cfd0950cb8e6973dfedf","impliedNodeFormat":1},{"version":"485c2c85724ef7b3927b680aea8a91f9","signature":"bad057a4b4ea4af9b6014d316293750a","impliedNodeFormat":1},{"version":"b361021d3d18d13aac63b35d4b0ef1d1","signature":"e574772f7137c7acb41b9b4cf9df058d","impliedNodeFormat":1},{"version":"10bacfe190f9fe270633c42af70386a1","signature":"38aed49039f4cd461d25f012f97b8c39","impliedNodeFormat":1},{"version":"cc34701bb2e1462b45d017a6fe2f141f","signature":"719dfec5f3283ec85710adbba78e6365","impliedNodeFormat":1},{"version":"4824fb9728966ca9f9ce17b9ce75f05c","signature":"c2020050bac2e38d3fa0a6b493982137","impliedNodeFormat":1},{"version":"a1749f74fd525e58a163f183940e7e09","signature":"6aa3c11249f9aaa1ac65d937ead30969","impliedNodeFormat":1},{"version":"351814ccfa1ba58ef45ec89a4aeb404c","signature":"f98eec2170a99869483d3eca900d0cc0","impliedNodeFormat":1},{"version":"5184ac9b0d8991786893fe84aa78d6b9","signature":"b5ebd566a1965c6a14cd722344ce6f6e","impliedNodeFormat":1},{"version":"c7735481ae825eb6bbcfd4a9805ba6c1","signature":"a7d694b86b36ce7df89de40ffc9402aa","impliedNodeFormat":1},{"version":"908d0f661e9c957f8aa06d19d4ab330d","signature":"6417e5a1c83740dd726339c7dcb25e00","impliedNodeFormat":1},{"version":"7ac4e2073efabc8a9b3ffd50e858f616","signature":"a45a1270e3bec3c20dfc71dbd1f4c873","impliedNodeFormat":1},{"version":"9e48231dbfedcc7214ebef6ea6286a23","signature":"6fbd3fb27221371a80b8e5096ab64669","impliedNodeFormat":1},{"version":"dbf142eb5e53d886df2e7093c459d38a","signature":"819455b7d09613669008590152f72bfb","impliedNodeFormat":1},{"version":"458e81f3aa2be4dce8b9c74ea9501bbb","signature":"cb18508ff8bbf75a7e3ab6a4326d04bc","impliedNodeFormat":1},{"version":"27ff541c8e95725471b6b63deda1cee5","signature":"58b7f36019024977c58e8f9578061940","impliedNodeFormat":1},{"version":"5a1c99c1b8aee61fe81f2c24580f964a","signature":"f54113fe7e33138fa6bef35633d9c756","impliedNodeFormat":1},{"version":"640a86079ef069627d498d92042be3fd","signature":"9ebee2bd622814352f911c1123c777bb","impliedNodeFormat":1},{"version":"c61a48c85d6c125ca9883e4b050cdca7","signature":"1c1616eb4a9ee2509a326a00d2bb66f7","impliedNodeFormat":1},{"version":"422db4edf8c3ce6cf7e553ebd6fb9d67","signature":"9cb1145b2a3893442ee4af6d07a433a1","impliedNodeFormat":1},{"version":"f5389e83dd9ce8454cf4c529c3f27303","signature":"f39ebf82376bef22974827fb45fc2868","impliedNodeFormat":1},{"version":"aa02a24e6da8595f2ddf20291c42af9f","signature":"1fb32a9a54778e35701953fde7d6a644","impliedNodeFormat":1},{"version":"5565dbac2a69a59c1fcba503a6e50586","signature":"5faf589f6dca05637ace1b1e2b65a5d9","impliedNodeFormat":1},{"version":"8e1e86bc20e3c61f979e2567130c7842","signature":"b862c86ba994a1012909a9193bf8fccb","impliedNodeFormat":1},{"version":"11d4a6190e2dfd54e76be78ac56a83d2","signature":"c008349de6f254aab2ea421ab4467148","impliedNodeFormat":1},{"version":"153eb030a0af1896fa9f01694f42f98c","signature":"619e7562793b95efc8e4045b345c2958","impliedNodeFormat":1},{"version":"90afd3587a9a35670427e6961c843453","signature":"5c86fabce3450c64974c38377a4c7e78","impliedNodeFormat":1},{"version":"88e8ac668c482d4adea78be66563f1df","signature":"44105eab8a75458fcab12433d5d313c3","impliedNodeFormat":1},{"version":"975510ec28b104338b0200ad7da6681a","signature":"94ffea549c13e56a8cf4c04a811cbc75","impliedNodeFormat":1},{"version":"4233f8df71c1590dc418143794641f46","signature":"5c8de80b459b0cbf43397cfb4b8ff0d3","impliedNodeFormat":1},{"version":"77ef4441645eb9547648b763c0e124d6","signature":"d42cb94635f66e63be4724c41308e9c7","impliedNodeFormat":1},{"version":"22ac9c87f6f69a0d5e058def48f6029e","signature":"58604a62d80d6df338da00a0caafddb6","impliedNodeFormat":1}],"fileIdsList":[[93],[93,100],[92,96],[92],[92,95,96,97],[93,103],[92,93,95,98,102,104,105,106,124],[126],[92,96,102,129],[92,95,97,98,99],[92,95,96],[93,115],[115],[93,116],[115,116,117,118],[92,93,94,95,98,100,101,102,103,104,106,111,113,119,124,125,126,127,128,130],[92,107],[92,101,107],[92,104,107],[92,107,119],[92,107,111],[92,107,113],[92,106,107],[107,108,109,110,112,114,120,121,122,123],[90]],"options":{"allowJs":false,"assumeChangesOnlyAffectDirectDependencies":true,"checkJs":false,"composite":true,"emitDecoratorMetadata":true,"declaration":true,"declarationMap":true,"experimentalDecorators":true,"importHelpers":true,"jsx":4,"module":7,"newLine":2,"noFallthroughCasesInSwitch":true,"noImplicitAny":false,"noImplicitReturns":true,"outDir":"./","preserveConstEnums":true,"removeComments":true,"rootDir":"..","skipLibCheck":true,"strict":true,"strictNullChecks":true,"stripInternal":true,"sourceMap":true,"target":9,"allowSyntheticDefaultImports":true,"alwaysStrict":true,"esModuleInterop":true},"referencedMap":[[94,1],[101,2],[102,3],[95,4],[98,5],[104,6],[125,7],[127,8],[129,4],[111,2],[113,2],[106,1],[130,9],[100,10],[97,11],[117,12],[116,13],[115,2],[118,14],[119,15],[131,16],[108,17],[109,18],[110,19],[107,4],[121,20],[120,20],[122,20],[112,21],[114,22],[123,23],[124,24],[91,25],[93,4]],"latestChangedDtsFile":"./index.d.ts"}
package/dist/typeKey.d.ts CHANGED
@@ -4,4 +4,5 @@ export declare const declaredTypeKey: (type: Constructor | undefined) => string
4
4
  export declare const typeKeyOf: (type: Constructor | undefined) => string | undefined;
5
5
  export declare const conceptAsTypeKey = "ConceptAs";
6
6
  export declare const valueMapTypeKey = "ValueMap";
7
+ export declare const guidTypeKey = "Guid";
7
8
  //# sourceMappingURL=typeKey.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typeKey.d.ts","sourceRoot":"","sources":["../typeKey.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAiB5C,eAAO,MAAM,OAAO,EAAE,OAAO,MAAmD,CAAC;AAcjF,eAAO,MAAM,eAAe,SAAU,WAAW,GAAG,SAAS,KAAG,MAAM,GAAG,SACiC,CAAC;AAW3G,eAAO,MAAM,SAAS,SAAU,WAAW,GAAG,SAAS,KAAG,MAAM,GAAG,SAChB,CAAC;AAGpD,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAG5C,eAAO,MAAM,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"typeKey.d.ts","sourceRoot":"","sources":["../typeKey.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAiB5C,eAAO,MAAM,OAAO,EAAE,OAAO,MAAmD,CAAC;AAcjF,eAAO,MAAM,eAAe,SAAU,WAAW,GAAG,SAAS,KAAG,MAAM,GAAG,SACiC,CAAC;AAW3G,eAAO,MAAM,SAAS,SAAU,WAAW,GAAG,SAAS,KAAG,MAAM,GAAG,SAChB,CAAC;AAGpD,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAG5C,eAAO,MAAM,eAAe,aAAa,CAAC;AAG1C,eAAO,MAAM,WAAW,SAAS,CAAC"}
package/dist/typeKey.js CHANGED
@@ -3,4 +3,5 @@ export const declaredTypeKey = (type) => type && Object.prototype.hasOwnProperty
3
3
  export const typeKeyOf = (type) => type ? type[typeKey] : undefined;
4
4
  export const conceptAsTypeKey = 'ConceptAs';
5
5
  export const valueMapTypeKey = 'ValueMap';
6
+ export const guidTypeKey = 'Guid';
6
7
  //# sourceMappingURL=typeKey.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"typeKey.js","sourceRoot":"","sources":["../typeKey.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,OAAO,GAAkB,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAcjF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAA6B,EAAsB,EAAE,CACjF,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAE,IAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAW3G,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAA6B,EAAsB,EAAE,CAC3E,IAAI,CAAC,CAAC,CAAE,IAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAGpD,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAG5C,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC"}
1
+ {"version":3,"file":"typeKey.js","sourceRoot":"","sources":["../typeKey.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,OAAO,GAAkB,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAcjF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAA6B,EAAsB,EAAE,CACjF,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAE,IAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAW3G,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAA6B,EAAsB,EAAE,CAC3E,IAAI,CAAC,CAAC,CAAE,IAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAGpD,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAG5C,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;AAG1C,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC"}
@@ -0,0 +1,20 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+
4
+ import { Guid } from '../Guid';
5
+ import { JsonSerializer } from '../JsonSerializer';
6
+ import { ValueMap } from '../ValueMap';
7
+ import { field } from '../fieldDecorator';
8
+
9
+ class Totals {
10
+ @field(ValueMap, { genericArguments: [Guid, Number] })
11
+ byIdentifier!: ValueMap<Guid, number>;
12
+ }
13
+
14
+ describe('when deserializing a value map with legacy quoted guid keys', () => {
15
+ const guid = Guid.parse('f0fa7c5e-9f7b-4688-8851-e0b6eeebe28b');
16
+ const result = JsonSerializer.deserialize(Totals, JSON.stringify({ byIdentifier: { [`"${guid}"`]: 7 } }));
17
+
18
+ it('should read the key as the original guid', () => [...result.byIdentifier.entries()][0][0].toString().should.equal(guid.toString()));
19
+ it('should find the value by the original key', () => result.byIdentifier.get(guid)!.should.equal(7));
20
+ });
@@ -0,0 +1,20 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+
4
+ import { Guid } from '../Guid';
5
+ import { JsonSerializer } from '../JsonSerializer';
6
+ import { ValueMap } from '../ValueMap';
7
+ import { field } from '../fieldDecorator';
8
+
9
+ class Totals {
10
+ @field(ValueMap, { genericArguments: [Guid, Number] })
11
+ byIdentifier!: ValueMap<Guid, number>;
12
+ }
13
+
14
+ describe('when deserializing a value map with malformed guid keys', () => {
15
+ const plain = () => JsonSerializer.deserialize(Totals, '{"byIdentifier":{"not-a-guid":1}}');
16
+ const quoted = () => JsonSerializer.deserialize(Totals, JSON.stringify({ byIdentifier: { '"not-a-guid"': 1 } }));
17
+
18
+ it('should reject a malformed plain key', () => plain.should.throw('not a valid Guid'));
19
+ it('should reject a malformed quoted key', () => quoted.should.throw('not a valid Guid'));
20
+ });
@@ -0,0 +1,26 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+
4
+ import { Guid } from '../Guid';
5
+ import { JsonSerializer } from '../JsonSerializer';
6
+ import { ValueMap } from '../ValueMap';
7
+ import { field } from '../fieldDecorator';
8
+
9
+ class Totals {
10
+ @field(ValueMap, { genericArguments: [Guid, Number] })
11
+ byIdentifier!: ValueMap<Guid, number>;
12
+ }
13
+
14
+ describe('when round tripping a value map with guid keys', () => {
15
+ const guid = Guid.parse('f0fa7c5e-9f7b-4688-8851-e0b6eeebe28b');
16
+ const totals = new Totals();
17
+ totals.byIdentifier = new ValueMap<Guid, number>().set(guid, 42);
18
+
19
+ const written = JsonSerializer.serialize(totals);
20
+ const read = JsonSerializer.deserialize(Totals, written);
21
+
22
+ it('should write the key as the plain guid string', () => written.should.equal(`{"byIdentifier":{"${guid}":42}}`));
23
+ it('should read the key back as a guid', () => [...read.byIdentifier.entries()][0][0].should.be.instanceof(Guid));
24
+ it('should read the key back as the original guid', () => [...read.byIdentifier.entries()][0][0].toString().should.equal(guid.toString()));
25
+ it('should find the value by the original key', () => read.byIdentifier.get(guid)!.should.equal(42));
26
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/fundamentals",
3
- "version": "7.22.1",
3
+ "version": "7.22.2",
4
4
  "description": "The shared building blocks beneath the Cratis stack — GUIDs, concepts, derived-type serialization, property-path proxies, and decorators for TypeScript",
5
5
  "keywords": [
6
6
  "cratis",
package/typeKey.ts CHANGED
@@ -52,3 +52,6 @@ export const conceptAsTypeKey = 'ConceptAs';
52
52
 
53
53
  /** The key `ValueMap` declares. */
54
54
  export const valueMapTypeKey = 'ValueMap';
55
+
56
+ /** The key `Guid` declares. */
57
+ export const guidTypeKey = 'Guid';