@cratis/fundamentals 7.19.4 → 7.19.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/JsonSerializer.ts +13 -6
  2. package/dist/JsonSerializer.d.ts.map +1 -1
  3. package/dist/JsonSerializer.js +15 -6
  4. package/dist/JsonSerializer.js.map +1 -1
  5. package/dist/cjs/ConceptAs.d.ts +1 -1
  6. package/dist/cjs/DateOnly.d.ts +1 -1
  7. package/dist/cjs/DerivedType.d.ts +2 -2
  8. package/dist/cjs/Field.d.ts +1 -1
  9. package/dist/cjs/Fields.d.ts +3 -3
  10. package/dist/cjs/Guid.d.ts +2 -2
  11. package/dist/cjs/JsonSerializer.d.ts +2 -2
  12. package/dist/cjs/JsonSerializer.d.ts.map +1 -1
  13. package/dist/cjs/JsonSerializer.js +15 -6
  14. package/dist/cjs/JsonSerializer.js.map +1 -1
  15. package/dist/cjs/PropertyAccessorDescriptor.d.ts +1 -1
  16. package/dist/cjs/StandardClassDecoratorContext.d.ts +1 -1
  17. package/dist/cjs/TimeOnly.d.ts +1 -1
  18. package/dist/cjs/TimeSpan.d.ts +1 -1
  19. package/dist/cjs/ValueMap.d.ts +1 -1
  20. package/dist/cjs/derivedTypeDecorator.d.ts +3 -3
  21. package/dist/cjs/fieldDecorator.d.ts +2 -2
  22. package/dist/cjs/fieldDecoratorMetadata.d.ts +3 -3
  23. package/dist/cjs/geospatial/LineString.d.ts +2 -2
  24. package/dist/cjs/geospatial/LinearRing.d.ts +1 -1
  25. package/dist/cjs/geospatial/Point.d.ts +1 -1
  26. package/dist/cjs/geospatial/Polygon.d.ts +2 -2
  27. package/dist/cjs/geospatial/index.d.ts +4 -4
  28. package/dist/cjs/index.d.ts +20 -20
  29. package/dist/cjs/json/DateJsonConverter.d.ts +2 -2
  30. package/dist/cjs/json/DateOnlyJsonConverter.d.ts +3 -3
  31. package/dist/cjs/json/GuidJsonConverter.d.ts +3 -3
  32. package/dist/cjs/json/JsonConverter.d.ts +1 -1
  33. package/dist/cjs/json/LineStringJsonConverter.d.ts +3 -3
  34. package/dist/cjs/json/PointJsonConverter.d.ts +3 -3
  35. package/dist/cjs/json/PolygonJsonConverter.d.ts +3 -3
  36. package/dist/cjs/json/TimeOnlyJsonConverter.d.ts +3 -3
  37. package/dist/cjs/json/TimeSpanJsonConverter.d.ts +3 -3
  38. package/dist/cjs/json/ValueMapJsonConverter.d.ts +3 -3
  39. package/dist/cjs/json/index.d.ts +10 -10
  40. package/dist/cjs/typeKey.d.ts +1 -1
  41. package/dist/esm/ConceptAs.d.ts +1 -1
  42. package/dist/esm/DateOnly.d.ts +1 -1
  43. package/dist/esm/DerivedType.d.ts +2 -2
  44. package/dist/esm/Field.d.ts +1 -1
  45. package/dist/esm/Fields.d.ts +3 -3
  46. package/dist/esm/Guid.d.ts +2 -2
  47. package/dist/esm/JsonSerializer.d.ts +2 -2
  48. package/dist/esm/JsonSerializer.d.ts.map +1 -1
  49. package/dist/esm/JsonSerializer.js +15 -6
  50. package/dist/esm/JsonSerializer.js.map +1 -1
  51. package/dist/esm/PropertyAccessorDescriptor.d.ts +1 -1
  52. package/dist/esm/StandardClassDecoratorContext.d.ts +1 -1
  53. package/dist/esm/TimeOnly.d.ts +1 -1
  54. package/dist/esm/TimeSpan.d.ts +1 -1
  55. package/dist/esm/ValueMap.d.ts +1 -1
  56. package/dist/esm/derivedTypeDecorator.d.ts +3 -3
  57. package/dist/esm/fieldDecorator.d.ts +2 -2
  58. package/dist/esm/fieldDecoratorMetadata.d.ts +3 -3
  59. package/dist/esm/geospatial/LineString.d.ts +2 -2
  60. package/dist/esm/geospatial/LinearRing.d.ts +1 -1
  61. package/dist/esm/geospatial/Point.d.ts +1 -1
  62. package/dist/esm/geospatial/Polygon.d.ts +2 -2
  63. package/dist/esm/geospatial/index.d.ts +4 -4
  64. package/dist/esm/index.d.ts +20 -20
  65. package/dist/esm/json/DateJsonConverter.d.ts +2 -2
  66. package/dist/esm/json/DateOnlyJsonConverter.d.ts +3 -3
  67. package/dist/esm/json/GuidJsonConverter.d.ts +3 -3
  68. package/dist/esm/json/JsonConverter.d.ts +1 -1
  69. package/dist/esm/json/LineStringJsonConverter.d.ts +3 -3
  70. package/dist/esm/json/PointJsonConverter.d.ts +3 -3
  71. package/dist/esm/json/PolygonJsonConverter.d.ts +3 -3
  72. package/dist/esm/json/TimeOnlyJsonConverter.d.ts +3 -3
  73. package/dist/esm/json/TimeSpanJsonConverter.d.ts +3 -3
  74. package/dist/esm/json/ValueMapJsonConverter.d.ts +3 -3
  75. package/dist/esm/json/index.d.ts +10 -10
  76. package/dist/esm/typeKey.d.ts +1 -1
  77. package/dist/tsconfig.tsbuildinfo +1 -1
  78. package/for_JsonSerializer/given/a_model_with_field_metadata.ts +63 -0
  79. package/for_JsonSerializer/given/given.ts +6 -0
  80. package/for_JsonSerializer/when_deserializing_fields_with_legacy_decorators.ts +41 -0
  81. package/for_JsonSerializer/when_deserializing_generic_array_without_a_value.ts +10 -0
  82. package/for_JsonSerializer/when_round_tripping_fields_with_legacy_decorators.ts +31 -0
  83. package/for_fieldDecorator/fixtures/standard_decorated_types.ts +53 -2
  84. package/for_fieldDecorator/when_executing_standard_typescript_decorator_emit.ts +46 -1
  85. package/package.json +37 -16
@@ -1,4 +1,4 @@
1
- import { Constructor } from '../Constructor';
1
+ import { Constructor } from '../Constructor.js';
2
2
  export declare abstract class JsonConverter<T = any> {
3
3
  abstract get type(): Constructor<T>;
4
4
  canConvert(typeToConvert: Constructor): boolean;
@@ -1,6 +1,6 @@
1
- import { Constructor } from '../Constructor';
2
- import { LineString } from '../geospatial';
3
- import { JsonConverter } from './JsonConverter';
1
+ import { Constructor } from '../Constructor.js';
2
+ import { LineString } from '../geospatial/index.js';
3
+ import { JsonConverter } from './JsonConverter.js';
4
4
  export declare class LineStringJsonConverter extends JsonConverter<LineString> {
5
5
  get type(): Constructor<LineString>;
6
6
  read(value: any): LineString;
@@ -1,6 +1,6 @@
1
- import { Constructor } from '../Constructor';
2
- import { Point } from '../geospatial';
3
- import { JsonConverter } from './JsonConverter';
1
+ import { Constructor } from '../Constructor.js';
2
+ import { Point } from '../geospatial/index.js';
3
+ import { JsonConverter } from './JsonConverter.js';
4
4
  export declare class PointJsonConverter extends JsonConverter<Point> {
5
5
  get type(): Constructor<Point>;
6
6
  read(value: any): Point;
@@ -1,6 +1,6 @@
1
- import { Constructor } from '../Constructor';
2
- import { Polygon } from '../geospatial';
3
- import { JsonConverter } from './JsonConverter';
1
+ import { Constructor } from '../Constructor.js';
2
+ import { Polygon } from '../geospatial/index.js';
3
+ import { JsonConverter } from './JsonConverter.js';
4
4
  export declare class PolygonJsonConverter extends JsonConverter<Polygon> {
5
5
  get type(): Constructor<Polygon>;
6
6
  read(value: any): Polygon;
@@ -1,6 +1,6 @@
1
- import { Constructor } from '../Constructor';
2
- import { TimeOnly } from '../TimeOnly';
3
- import { JsonConverter } from './JsonConverter';
1
+ import { Constructor } from '../Constructor.js';
2
+ import { TimeOnly } from '../TimeOnly.js';
3
+ import { JsonConverter } from './JsonConverter.js';
4
4
  export declare class TimeOnlyJsonConverter extends JsonConverter<TimeOnly> {
5
5
  get type(): Constructor<TimeOnly>;
6
6
  read(value: any): TimeOnly;
@@ -1,6 +1,6 @@
1
- import { Constructor } from '../Constructor';
2
- import { TimeSpan } from '../TimeSpan';
3
- import { JsonConverter } from './JsonConverter';
1
+ import { Constructor } from '../Constructor.js';
2
+ import { TimeSpan } from '../TimeSpan.js';
3
+ import { JsonConverter } from './JsonConverter.js';
4
4
  export declare class TimeSpanJsonConverter extends JsonConverter<TimeSpan> {
5
5
  get type(): Constructor<TimeSpan>;
6
6
  read(value: any): TimeSpan;
@@ -1,6 +1,6 @@
1
- import { Constructor } from '../Constructor';
2
- import { ValueMap } from '../ValueMap';
3
- import { JsonConverter } from './JsonConverter';
1
+ import { Constructor } from '../Constructor.js';
2
+ import { ValueMap } from '../ValueMap.js';
3
+ import { JsonConverter } from './JsonConverter.js';
4
4
  export declare class ValueMapJsonConverter extends JsonConverter<ValueMap<any, any>> {
5
5
  private static serializeMapKey;
6
6
  private static convertTypesOnInstance;
@@ -1,11 +1,11 @@
1
- export * from './JsonConverter';
2
- export * from './DateJsonConverter';
3
- export * from './DateOnlyJsonConverter';
4
- export * from './GuidJsonConverter';
5
- export * from './TimeOnlyJsonConverter';
6
- export * from './TimeSpanJsonConverter';
7
- export * from './PointJsonConverter';
8
- export * from './LineStringJsonConverter';
9
- export * from './PolygonJsonConverter';
10
- export * from './ValueMapJsonConverter';
1
+ export * from './JsonConverter.js';
2
+ export * from './DateJsonConverter.js';
3
+ export * from './DateOnlyJsonConverter.js';
4
+ export * from './GuidJsonConverter.js';
5
+ export * from './TimeOnlyJsonConverter.js';
6
+ export * from './TimeSpanJsonConverter.js';
7
+ export * from './PointJsonConverter.js';
8
+ export * from './LineStringJsonConverter.js';
9
+ export * from './PolygonJsonConverter.js';
10
+ export * from './ValueMapJsonConverter.js';
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { Constructor } from './Constructor';
1
+ import { Constructor } from './Constructor.js';
2
2
  export declare const typeKey: unique symbol;
3
3
  export declare const declaredTypeKey: (type: Constructor | undefined) => string | undefined;
4
4
  export declare const typeKeyOf: (type: Constructor | undefined) => string | undefined;
@@ -1,4 +1,4 @@
1
- import { typeKey } from './typeKey';
1
+ import { typeKey } from './typeKey.js';
2
2
  export declare abstract class ConceptAs<T> {
3
3
  readonly value: T;
4
4
  static readonly [typeKey] = "ConceptAs";
@@ -1,4 +1,4 @@
1
- import { typeKey } from './typeKey';
1
+ import { typeKey } from './typeKey.js';
2
2
  export declare class DateOnly {
3
3
  static readonly [typeKey] = "DateOnly";
4
4
  year: number;
@@ -1,5 +1,5 @@
1
- import './reflection';
2
- import { Constructor } from './Constructor';
1
+ import './reflection.js';
2
+ import { Constructor } from './Constructor.js';
3
3
  export declare class DerivedType {
4
4
  static set(target: Constructor, identifier: string, targetType?: Constructor): void;
5
5
  static get(target: Constructor): string;
@@ -1,4 +1,4 @@
1
- import { Constructor } from './Constructor';
1
+ import { Constructor } from './Constructor.js';
2
2
  export declare class Field {
3
3
  readonly name: string;
4
4
  readonly type: Constructor;
@@ -1,6 +1,6 @@
1
- import './reflection';
2
- import { Constructor } from './Constructor';
3
- import { Field } from './Field';
1
+ import './reflection.js';
2
+ import { Constructor } from './Constructor.js';
3
+ import { Field } from './Field.js';
4
4
  export declare class Fields {
5
5
  static addFieldToType(target: Constructor, field: string, fieldType: Constructor, enumerable: boolean, derivatives: Constructor[], genericArguments: Constructor[]): void;
6
6
  static getFieldsForType(target: Constructor): Field[];
@@ -1,5 +1,5 @@
1
- import { IEquatable } from './IEquatable';
2
- import { typeKey } from './typeKey';
1
+ import { IEquatable } from './IEquatable.js';
2
+ import { typeKey } from './typeKey.js';
3
3
  export declare class Guid implements IEquatable {
4
4
  readonly bytes: number[] | Uint8Array | undefined;
5
5
  static readonly [typeKey] = "Guid";
@@ -1,5 +1,5 @@
1
- import { Constructor } from './Constructor';
2
- import { JsonConverter } from './json';
1
+ import { Constructor } from './Constructor.js';
2
+ import { JsonConverter } from './json/index.js';
3
3
  export declare class JsonSerializer {
4
4
  static readonly DerivedTypeIdProperty: string;
5
5
  static registerConverter(converter: JsonConverter): void;
@@ -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;AAsShB,qBAAa,cAAc;IACvB,MAAM,CAAC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAoB;IAmBjE,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI;IASxD,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM;IAWpC,MAAM,CAAC,WAAW,CA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W,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"}
@@ -1,5 +1,6 @@
1
1
  import { DerivedType } from './DerivedType.js';
2
2
  import { registerModuleInstance } from './duplicateInstanceGuard.js';
3
+ import { Field } from './Field.js';
3
4
  import { Fields } from './Fields.js';
4
5
  import { declaredTypeKey, typeKeyOf, conceptAsTypeKey, valueMapTypeKey } from './typeKey.js';
5
6
  import { ValueMap } from './ValueMap.js';
@@ -72,7 +73,8 @@ const serializeValueForType = (type, value) => {
72
73
  };
73
74
  const deserializeValueFromType = (type, value) => {
74
75
  if (isConceptAs(type)) {
75
- return new type(value);
76
+ const valueType = type.valueType;
77
+ return new type(valueType ? deserializeValueFromType(valueType, value) : value);
76
78
  }
77
79
  const converter = converterFor(type);
78
80
  if (converter) {
@@ -88,7 +90,7 @@ const deserializeValueFromField = (field, value) => {
88
90
  return deserializeValueMapFromField(field, value);
89
91
  }
90
92
  if (isConceptAs(field.type)) {
91
- return new field.type(value);
93
+ return deserializeValueFromType(field.type, value);
92
94
  }
93
95
  const converter = converterFor(field.type);
94
96
  if (converter) {
@@ -208,21 +210,28 @@ class JsonSerializer {
208
210
  }
209
211
  static deserializeFromInstance(targetType, instance) {
210
212
  const fields = Fields.getFieldsForType(targetType);
211
- if (converterFor(targetType)) {
213
+ if (converterFor(targetType) || isConceptAs(targetType)) {
212
214
  return deserializeValueFromType(targetType, instance);
213
215
  }
214
216
  const deserialized = new targetType();
215
217
  for (const field of fields) {
216
218
  let value = instance[field.name];
217
- if (value) {
218
- if (field.enumerable) {
219
+ if (value !== undefined && value !== null) {
220
+ if (field.type === Array) {
221
+ const elementType = field.genericArguments[0];
222
+ if (elementType) {
223
+ const elementField = new Field(field.name, elementType, false, field.derivatives, []);
224
+ value = value.map(_ => deserializeValueFromField(elementField, _));
225
+ }
226
+ }
227
+ else if (field.enumerable) {
219
228
  value = value.map(_ => deserializeValueFromField(field, _));
220
229
  }
221
230
  else {
222
231
  value = deserializeValueFromField(field, value);
223
232
  }
224
233
  }
225
- else if (field.enumerable && value === undefined) {
234
+ else if ((field.enumerable || field.type === Array) && value === undefined) {
226
235
  value = [];
227
236
  }
228
237
  deserialized[field.name] = value;
@@ -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 return new type(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 new 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)) {\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) {\n if (field.enumerable) {\n value = value.map(_ => deserializeValueFromField(field, _));\n } else {\n value = deserializeValueFromField(field, value);\n }\n } else if (field.enumerable && 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,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,EAA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EAAE;AACvC,YAAA,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,KAAI;AACxD,gBAAA,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC;AAC7C,YAAA,CAAC,CAAC;AAEF,YAAA,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;gBAC9B,YAAY,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;YACzC;QACJ;AAEA,QAAA,OAAO,YAAY;IACvB;AAQA,IAAA,OAAO,4BAA4B,CAAyB,UAAgC,EAAE,SAAc,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;;;"}
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,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,CAAC,GAAG,CAAC;IACtE,OAAO,KAAK,IAAI,c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C,YAAA,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,KAAI;AACxD,gBAAA,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC;AAC7C,YAAA,CAAC,CAAC;AAEF,YAAA,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;gBAC9B,YAAY,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;YACzC;QACJ;AAEA,QAAA,OAAO,YAAY;IACvB;AAQA,IAAA,OAAO,4BAA4B,CAAyB,UAAgC,EAAE,SAAc,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;;;"}
@@ -1,4 +1,4 @@
1
- import { PropertyAccessor } from './PropertyAccessor';
1
+ import { PropertyAccessor } from './PropertyAccessor.js';
2
2
  export declare class PropertyAccessorDescriptor {
3
3
  private readonly _accessor;
4
4
  private readonly _segments;
@@ -1,4 +1,4 @@
1
- import { Constructor } from './Constructor';
1
+ import { Constructor } from './Constructor.js';
2
2
  export type StandardClassDecoratorContext<Target extends Constructor> = {
3
3
  readonly kind: 'class';
4
4
  readonly name: string | undefined;
@@ -1,4 +1,4 @@
1
- import { typeKey } from './typeKey';
1
+ import { typeKey } from './typeKey.js';
2
2
  export declare class TimeOnly {
3
3
  static readonly [typeKey] = "TimeOnly";
4
4
  hour: number;
@@ -1,4 +1,4 @@
1
- import { typeKey } from './typeKey';
1
+ import { typeKey } from './typeKey.js';
2
2
  export declare class TimeSpan {
3
3
  static readonly [typeKey] = "TimeSpan";
4
4
  ticks: number;
@@ -1,4 +1,4 @@
1
- import { typeKey } from './typeKey';
1
+ import { typeKey } from './typeKey.js';
2
2
  export declare class ValueMap<TKey, TValue> {
3
3
  static readonly [typeKey] = "ValueMap";
4
4
  private readonly _entries;
@@ -1,6 +1,6 @@
1
- import './reflection';
2
- import { Constructor } from './Constructor';
3
- import { StandardClassDecoratorContext } from './StandardClassDecoratorContext';
1
+ import './reflection.js';
2
+ import { Constructor } from './Constructor.js';
3
+ import { StandardClassDecoratorContext } from './StandardClassDecoratorContext.js';
4
4
  export declare function derivedType(identifier: string, targetType?: Constructor): {
5
5
  <Target extends Constructor>(target: Target): void;
6
6
  <Target extends Constructor>(target: Target, context: StandardClassDecoratorContext<Target>): void;
@@ -1,5 +1,5 @@
1
- import { Constructor } from './Constructor';
2
- import { StandardFieldDecoratorContext } from './StandardFieldDecoratorContext';
1
+ import { Constructor } from './Constructor.js';
2
+ import { StandardFieldDecoratorContext } from './StandardFieldDecoratorContext.js';
3
3
  type fieldOptions = {
4
4
  enumerable?: boolean;
5
5
  derivatives?: Constructor[];
@@ -1,6 +1,6 @@
1
- import './reflection';
2
- import { Constructor } from './Constructor';
3
- import { Field } from './Field';
1
+ import './reflection.js';
2
+ import { Constructor } from './Constructor.js';
3
+ import { Field } from './Field.js';
4
4
  export declare function addFieldToDecoratorMetadata(metadata: Record<PropertyKey, unknown>, field: Field): void;
5
5
  export declare function getOwnDecoratorFieldsForType(target: Constructor): Field[];
6
6
  //# sourceMappingURL=fieldDecoratorMetadata.d.ts.map
@@ -1,5 +1,5 @@
1
- import { Point } from './Point';
2
- import { typeKey } from '../typeKey';
1
+ import { Point } from './Point.js';
2
+ import { typeKey } from '../typeKey.js';
3
3
  export declare class LineString {
4
4
  static readonly [typeKey] = "LineString";
5
5
  coordinates: Point[];
@@ -1,4 +1,4 @@
1
- import { Point } from './Point';
1
+ import { Point } from './Point.js';
2
2
  export declare class LinearRing {
3
3
  coordinates: Point[];
4
4
  constructor(coordinates: Point[]);
@@ -1,4 +1,4 @@
1
- import { typeKey } from '../typeKey';
1
+ import { typeKey } from '../typeKey.js';
2
2
  export declare class Point {
3
3
  static readonly [typeKey] = "Point";
4
4
  longitude: number;
@@ -1,5 +1,5 @@
1
- import { LinearRing } from './LinearRing';
2
- import { typeKey } from '../typeKey';
1
+ import { LinearRing } from './LinearRing.js';
2
+ import { typeKey } from '../typeKey.js';
3
3
  export declare class Polygon {
4
4
  static readonly [typeKey] = "Polygon";
5
5
  shell: LinearRing;
@@ -1,5 +1,5 @@
1
- export * from './Point';
2
- export * from './LinearRing';
3
- export * from './LineString';
4
- export * from './Polygon';
1
+ export * from './Point.js';
2
+ export * from './LinearRing.js';
3
+ export * from './LineString.js';
4
+ export * from './Polygon.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,21 +1,21 @@
1
- export * from './ConceptAs';
2
- export * from './Constructor';
3
- export * from './geospatial';
4
- export * from './json';
5
- export * from './Field';
6
- export * from './Fields';
7
- export * from './DateOnly';
8
- export * from './Guid';
9
- export * from './IEquatable';
10
- export * from './PropertyAccessor';
11
- export * from './PropertyAccessorDescriptor';
12
- export * from './PropertyPathResolverProxyHandler';
13
- export * from './TimeOnly';
14
- export * from './TimeSpan';
15
- export * from './ValueMap';
16
- export * from './typeKey';
17
- export * from './fieldDecorator';
18
- export * from './derivedTypeDecorator';
19
- export * from './JsonSerializer';
20
- export * from './DerivedType';
1
+ export * from './ConceptAs.js';
2
+ export * from './Constructor.js';
3
+ export * from './geospatial/index.js';
4
+ export * from './json/index.js';
5
+ export * from './Field.js';
6
+ export * from './Fields.js';
7
+ export * from './DateOnly.js';
8
+ export * from './Guid.js';
9
+ export * from './IEquatable.js';
10
+ export * from './PropertyAccessor.js';
11
+ export * from './PropertyAccessorDescriptor.js';
12
+ export * from './PropertyPathResolverProxyHandler.js';
13
+ export * from './TimeOnly.js';
14
+ export * from './TimeSpan.js';
15
+ export * from './ValueMap.js';
16
+ export * from './typeKey.js';
17
+ export * from './fieldDecorator.js';
18
+ export * from './derivedTypeDecorator.js';
19
+ export * from './JsonSerializer.js';
20
+ export * from './DerivedType.js';
21
21
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
- import { Constructor } from '../Constructor';
2
- import { JsonConverter } from './JsonConverter';
1
+ import { Constructor } from '../Constructor.js';
2
+ import { JsonConverter } from './JsonConverter.js';
3
3
  export declare class DateJsonConverter extends JsonConverter<Date> {
4
4
  get type(): Constructor<Date>;
5
5
  read(value: any): Date;
@@ -1,6 +1,6 @@
1
- import { Constructor } from '../Constructor';
2
- import { DateOnly } from '../DateOnly';
3
- import { JsonConverter } from './JsonConverter';
1
+ import { Constructor } from '../Constructor.js';
2
+ import { DateOnly } from '../DateOnly.js';
3
+ import { JsonConverter } from './JsonConverter.js';
4
4
  export declare class DateOnlyJsonConverter extends JsonConverter<DateOnly> {
5
5
  get type(): Constructor<DateOnly>;
6
6
  read(value: any): DateOnly;
@@ -1,6 +1,6 @@
1
- import { Constructor } from '../Constructor';
2
- import { Guid } from '../Guid';
3
- import { JsonConverter } from './JsonConverter';
1
+ import { Constructor } from '../Constructor.js';
2
+ import { Guid } from '../Guid.js';
3
+ import { JsonConverter } from './JsonConverter.js';
4
4
  export declare class GuidJsonConverter extends JsonConverter<Guid> {
5
5
  get type(): Constructor<Guid>;
6
6
  read(value: any): Guid;
@@ -1,4 +1,4 @@
1
- import { Constructor } from '../Constructor';
1
+ import { Constructor } from '../Constructor.js';
2
2
  export declare abstract class JsonConverter<T = any> {
3
3
  abstract get type(): Constructor<T>;
4
4
  canConvert(typeToConvert: Constructor): boolean;
@@ -1,6 +1,6 @@
1
- import { Constructor } from '../Constructor';
2
- import { LineString } from '../geospatial';
3
- import { JsonConverter } from './JsonConverter';
1
+ import { Constructor } from '../Constructor.js';
2
+ import { LineString } from '../geospatial/index.js';
3
+ import { JsonConverter } from './JsonConverter.js';
4
4
  export declare class LineStringJsonConverter extends JsonConverter<LineString> {
5
5
  get type(): Constructor<LineString>;
6
6
  read(value: any): LineString;
@@ -1,6 +1,6 @@
1
- import { Constructor } from '../Constructor';
2
- import { Point } from '../geospatial';
3
- import { JsonConverter } from './JsonConverter';
1
+ import { Constructor } from '../Constructor.js';
2
+ import { Point } from '../geospatial/index.js';
3
+ import { JsonConverter } from './JsonConverter.js';
4
4
  export declare class PointJsonConverter extends JsonConverter<Point> {
5
5
  get type(): Constructor<Point>;
6
6
  read(value: any): Point;
@@ -1,6 +1,6 @@
1
- import { Constructor } from '../Constructor';
2
- import { Polygon } from '../geospatial';
3
- import { JsonConverter } from './JsonConverter';
1
+ import { Constructor } from '../Constructor.js';
2
+ import { Polygon } from '../geospatial/index.js';
3
+ import { JsonConverter } from './JsonConverter.js';
4
4
  export declare class PolygonJsonConverter extends JsonConverter<Polygon> {
5
5
  get type(): Constructor<Polygon>;
6
6
  read(value: any): Polygon;
@@ -1,6 +1,6 @@
1
- import { Constructor } from '../Constructor';
2
- import { TimeOnly } from '../TimeOnly';
3
- import { JsonConverter } from './JsonConverter';
1
+ import { Constructor } from '../Constructor.js';
2
+ import { TimeOnly } from '../TimeOnly.js';
3
+ import { JsonConverter } from './JsonConverter.js';
4
4
  export declare class TimeOnlyJsonConverter extends JsonConverter<TimeOnly> {
5
5
  get type(): Constructor<TimeOnly>;
6
6
  read(value: any): TimeOnly;