@cratis/fundamentals 7.18.3 → 7.18.4

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 (112) hide show
  1. package/dist/ConceptAs.d.ts.map +1 -1
  2. package/dist/ConceptAs.js.map +1 -1
  3. package/dist/DateOnly.d.ts.map +1 -1
  4. package/dist/DateOnly.js.map +1 -1
  5. package/dist/DerivedType.d.ts.map +1 -1
  6. package/dist/Field.d.ts.map +1 -1
  7. package/dist/Field.js.map +1 -1
  8. package/dist/Fields.d.ts.map +1 -1
  9. package/dist/Guid.d.ts.map +1 -1
  10. package/dist/Guid.js.map +1 -1
  11. package/dist/JsonSerializer.d.ts.map +1 -1
  12. package/dist/JsonSerializer.js.map +1 -1
  13. package/dist/PropertyAccessorDescriptor.d.ts.map +1 -1
  14. package/dist/PropertyAccessorDescriptor.js.map +1 -1
  15. package/dist/PropertyPathResolverProxyHandler.d.ts.map +1 -1
  16. package/dist/PropertyPathResolverProxyHandler.js.map +1 -1
  17. package/dist/TimeOnly.d.ts.map +1 -1
  18. package/dist/TimeOnly.js.map +1 -1
  19. package/dist/TimeSpan.d.ts.map +1 -1
  20. package/dist/TimeSpan.js.map +1 -1
  21. package/dist/ValueMap.d.ts.map +1 -1
  22. package/dist/ValueMap.js.map +1 -1
  23. package/dist/cjs/ConceptAs.js.map +1 -1
  24. package/dist/cjs/DateOnly.js.map +1 -1
  25. package/dist/cjs/DerivedType.js.map +1 -1
  26. package/dist/cjs/Field.js.map +1 -1
  27. package/dist/cjs/Fields.js.map +1 -1
  28. package/dist/cjs/Guid.js.map +1 -1
  29. package/dist/cjs/JsonSerializer.js.map +1 -1
  30. package/dist/cjs/PropertyAccessorDescriptor.js.map +1 -1
  31. package/dist/cjs/PropertyPathResolverProxyHandler.js.map +1 -1
  32. package/dist/cjs/TimeOnly.js.map +1 -1
  33. package/dist/cjs/TimeSpan.js.map +1 -1
  34. package/dist/cjs/ValueMap.js.map +1 -1
  35. package/dist/cjs/_virtual/_tslib.js.map +1 -1
  36. package/dist/cjs/derivedTypeDecorator.js.map +1 -1
  37. package/dist/cjs/duplicateInstanceGuard.js.map +1 -1
  38. package/dist/cjs/fieldDecorator.js.map +1 -1
  39. package/dist/cjs/fieldDecoratorMetadata.js.map +1 -1
  40. package/dist/cjs/geospatial/LineString.js.map +1 -1
  41. package/dist/cjs/geospatial/LinearRing.js.map +1 -1
  42. package/dist/cjs/geospatial/Point.js.map +1 -1
  43. package/dist/cjs/geospatial/Polygon.js.map +1 -1
  44. package/dist/cjs/json/DateJsonConverter.js.map +1 -1
  45. package/dist/cjs/json/DateOnlyJsonConverter.js.map +1 -1
  46. package/dist/cjs/json/GuidJsonConverter.js.map +1 -1
  47. package/dist/cjs/json/JsonConverter.js.map +1 -1
  48. package/dist/cjs/json/LineStringJsonConverter.js.map +1 -1
  49. package/dist/cjs/json/PointJsonConverter.js.map +1 -1
  50. package/dist/cjs/json/PolygonJsonConverter.js.map +1 -1
  51. package/dist/cjs/json/TimeOnlyJsonConverter.js.map +1 -1
  52. package/dist/cjs/json/TimeSpanJsonConverter.js.map +1 -1
  53. package/dist/cjs/json/ValueMapJsonConverter.js.map +1 -1
  54. package/dist/cjs/reflection.js.map +1 -1
  55. package/dist/cjs/typeKey.js.map +1 -1
  56. package/dist/esm/ConceptAs.js.map +1 -1
  57. package/dist/esm/DateOnly.js.map +1 -1
  58. package/dist/esm/DerivedType.js.map +1 -1
  59. package/dist/esm/Field.js.map +1 -1
  60. package/dist/esm/Fields.js.map +1 -1
  61. package/dist/esm/Guid.js.map +1 -1
  62. package/dist/esm/JsonSerializer.js.map +1 -1
  63. package/dist/esm/PropertyAccessorDescriptor.js.map +1 -1
  64. package/dist/esm/PropertyPathResolverProxyHandler.js.map +1 -1
  65. package/dist/esm/TimeOnly.js.map +1 -1
  66. package/dist/esm/TimeSpan.js.map +1 -1
  67. package/dist/esm/ValueMap.js.map +1 -1
  68. package/dist/esm/_virtual/_tslib.js.map +1 -1
  69. package/dist/esm/derivedTypeDecorator.js.map +1 -1
  70. package/dist/esm/duplicateInstanceGuard.js.map +1 -1
  71. package/dist/esm/fieldDecorator.js.map +1 -1
  72. package/dist/esm/fieldDecoratorMetadata.js.map +1 -1
  73. package/dist/esm/geospatial/LineString.js.map +1 -1
  74. package/dist/esm/geospatial/LinearRing.js.map +1 -1
  75. package/dist/esm/geospatial/Point.js.map +1 -1
  76. package/dist/esm/geospatial/Polygon.js.map +1 -1
  77. package/dist/esm/json/DateJsonConverter.js.map +1 -1
  78. package/dist/esm/json/DateOnlyJsonConverter.js.map +1 -1
  79. package/dist/esm/json/GuidJsonConverter.js.map +1 -1
  80. package/dist/esm/json/JsonConverter.js.map +1 -1
  81. package/dist/esm/json/LineStringJsonConverter.js.map +1 -1
  82. package/dist/esm/json/PointJsonConverter.js.map +1 -1
  83. package/dist/esm/json/PolygonJsonConverter.js.map +1 -1
  84. package/dist/esm/json/TimeOnlyJsonConverter.js.map +1 -1
  85. package/dist/esm/json/TimeSpanJsonConverter.js.map +1 -1
  86. package/dist/esm/json/ValueMapJsonConverter.js.map +1 -1
  87. package/dist/esm/typeKey.js.map +1 -1
  88. package/dist/geospatial/LineString.d.ts.map +1 -1
  89. package/dist/geospatial/LineString.js.map +1 -1
  90. package/dist/geospatial/LinearRing.d.ts.map +1 -1
  91. package/dist/geospatial/Point.d.ts.map +1 -1
  92. package/dist/geospatial/Point.js.map +1 -1
  93. package/dist/geospatial/Polygon.d.ts.map +1 -1
  94. package/dist/geospatial/Polygon.js.map +1 -1
  95. package/dist/json/DateJsonConverter.d.ts.map +1 -1
  96. package/dist/json/DateOnlyJsonConverter.d.ts.map +1 -1
  97. package/dist/json/GuidJsonConverter.d.ts.map +1 -1
  98. package/dist/json/JsonConverter.d.ts.map +1 -1
  99. package/dist/json/LineStringJsonConverter.d.ts.map +1 -1
  100. package/dist/json/PointJsonConverter.d.ts.map +1 -1
  101. package/dist/json/PolygonJsonConverter.d.ts.map +1 -1
  102. package/dist/json/TimeOnlyJsonConverter.d.ts.map +1 -1
  103. package/dist/json/TimeSpanJsonConverter.d.ts.map +1 -1
  104. package/dist/json/ValueMapJsonConverter.d.ts.map +1 -1
  105. package/dist/json/ValueMapJsonConverter.js.map +1 -1
  106. package/dist/tsconfig.tsbuildinfo +1 -1
  107. package/dist/typeKey.d.ts.map +1 -1
  108. package/package.json +5 -2
  109. package/dist/vite.config.d.mts +0 -3
  110. package/dist/vite.config.d.mts.map +0 -1
  111. package/dist/vite.config.mjs +0 -5
  112. package/dist/vite.config.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TimeSpan.js","sources":["../../TimeSpan.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 { typeKey } from './typeKey';\n\nimport { field } from './fieldDecorator';\n\nconst timeSpanRegex = /^(-)?(?:(\\d+)\\.)?(\\d{1,2}):(\\d{2}):(\\d{2})(?:\\.(\\d{1,7}))?$/;\n\n/**\n * Represents a time interval.\n */\nexport class TimeSpan {\n static readonly [typeKey] = 'TimeSpan';\n\n \n @field(Number)\n ticks!: number;\n\n @field(Number)\n days!: number;\n\n @field(Number)\n hours!: number;\n\n @field(Number)\n milliseconds!: number;\n\n @field(Number)\n microseconds!: number;\n\n @field(Number)\n nanoseconds!: number;\n\n @field(Number)\n minutes!: number;\n\n @field(Number)\n seconds!: number;\n\n @field(Number)\n totalDays!: number;\n\n @field(Number)\n totalHours!: number;\n\n @field(Number)\n totalMilliseconds!: number;\n\n @field(Number)\n totalMicroseconds!: number;\n\n @field(Number)\n totalNanoseconds!: number;\n\n @field(Number)\n totalMinutes!: number;\n\n @field(Number)\n totalSeconds!: number;\n\n /**\n * Parses a C# compatible TimeSpan string and returns a TimeSpan instance.\n * The string format should match: [-][d.]hh:mm:ss[.fffffff]\n * @param {string} value String representation of TimeSpan.\n * @returns {TimeSpan} A TimeSpan instance with all properties populated.\n * @throws {Error} If the string format is invalid.\n */\n static parse(value: string): TimeSpan {\n const match = timeSpanRegex.exec(value);\n if (match === null) {\n throw new Error(`Invalid TimeSpan format: ${value}`);\n }\n\n const isNegative = match[1] === '-';\n const days = match[2] ? parseInt(match[2], 10) : 0;\n const hours = parseInt(match[3], 10);\n const minutes = parseInt(match[4], 10);\n const seconds = parseInt(match[5], 10);\n const fractionalSeconds = match[6] ? match[6].padEnd(7, '0') : '0000000';\n\n const ticksPerDay = 864000000000;\n const ticksPerHour = 36000000000;\n const ticksPerMinute = 600000000;\n const ticksPerSecond = 10000000;\n\n const ticks =\n days * ticksPerDay +\n hours * ticksPerHour +\n minutes * ticksPerMinute +\n seconds * ticksPerSecond +\n parseInt(fractionalSeconds, 10);\n\n const finalTicks = isNegative ? -ticks : ticks;\n\n const timeSpan = new TimeSpan();\n timeSpan.ticks = finalTicks;\n timeSpan.days = Math.floor(Math.abs(finalTicks) / ticksPerDay) * (isNegative ? -1 : 1);\n timeSpan.hours = Math.floor((Math.abs(finalTicks) / ticksPerHour) % 24);\n timeSpan.minutes = Math.floor((Math.abs(finalTicks) / ticksPerMinute) % 60);\n timeSpan.seconds = Math.floor((Math.abs(finalTicks) / ticksPerSecond) % 60);\n timeSpan.milliseconds = Math.floor((Math.abs(finalTicks) / 10000) % 1000);\n timeSpan.microseconds = Math.floor((Math.abs(finalTicks) / 10) % 1000);\n timeSpan.nanoseconds = Math.floor((Math.abs(finalTicks) % 10) * 100);\n timeSpan.totalDays = finalTicks / ticksPerDay;\n timeSpan.totalHours = finalTicks / ticksPerHour;\n timeSpan.totalMinutes = finalTicks / ticksPerMinute;\n timeSpan.totalSeconds = finalTicks / ticksPerSecond;\n timeSpan.totalMilliseconds = finalTicks / 10000;\n timeSpan.totalMicroseconds = finalTicks / 10;\n timeSpan.totalNanoseconds = finalTicks * 100;\n\n return timeSpan;\n }\n\n /**\n * Converts the TimeSpan to a C# compatible string format.\n * Returns the TimeSpan in format: [-][d.]hh:mm:ss[.fffffff]\n * @returns {string} C# compatible TimeSpan string representation.\n */\n toString(): string {\n const isNegative = this.ticks < 0;\n const absTicks = Math.abs(this.ticks);\n\n const ticksPerDay = 864000000000;\n const ticksPerHour = 36000000000;\n const ticksPerMinute = 600000000;\n const ticksPerSecond = 10000000;\n\n const days = Math.floor(absTicks / ticksPerDay);\n const hours = Math.floor((absTicks / ticksPerHour) % 24);\n const minutes = Math.floor((absTicks / ticksPerMinute) % 60);\n const seconds = Math.floor((absTicks / ticksPerSecond) % 60);\n const fractionalTicks = absTicks % ticksPerSecond;\n\n const parts: string[] = [];\n\n if (isNegative) {\n parts.push('-');\n }\n\n if (days > 0) {\n parts.push(`${days}.`);\n }\n\n parts.push(`${hours.toString().padStart(2, '0')}:`);\n parts.push(`${minutes.toString().padStart(2, '0')}:`);\n parts.push(`${seconds.toString().padStart(2, '0')}`);\n\n if (fractionalTicks > 0) {\n const fractionalStr = fractionalTicks.toString().padStart(7, '0').replace(/0+$/, '');\n parts.push(`.${fractionalStr}`);\n }\n\n return parts.join('');\n }\n\n /**\n * Converts the TimeSpan to a JSON string that works in JSON serialization.\n * Returns the TimeSpan in C# compatible format: [-][d.]hh:mm:ss[.fffffff]\n * @returns {string} C# compatible TimeSpan string representation.\n */\n toJSON(): string {\n return this.toString();\n }\n}\n"],"names":["typeKey","__decorate","field"],"mappings":";;;;;;AAOA,MAAM,aAAa,GAAG,6DAA6D;MAKtE,QAAQ,CAAA;AACjB,IAAA,QAAiBA,eAAO,IAAI,UAAU;AAItC,IAAA,KAAK;AAGL,IAAA,IAAI;AAGJ,IAAA,KAAK;AAGL,IAAA,YAAY;AAGZ,IAAA,YAAY;AAGZ,IAAA,WAAW;AAGX,IAAA,OAAO;AAGP,IAAA,OAAO;AAGP,IAAA,SAAS;AAGT,IAAA,UAAU;AAGV,IAAA,iBAAiB;AAGjB,IAAA,iBAAiB;AAGjB,IAAA,gBAAgB;AAGhB,IAAA,YAAY;AAGZ,IAAA,YAAY;IASZ,OAAO,KAAK,CAAC,KAAa,EAAA;Q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ights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { typeKey } from './typeKey';\n\nimport { field } from './fieldDecorator';\n\nconst timeSpanRegex = /^(-)?(?:(\\d+)\\.)?(\\d{1,2}):(\\d{2}):(\\d{2})(?:\\.(\\d{1,7}))?$/;\n\n/**\n * Represents a time interval.\n */\nexport class TimeSpan {\n static readonly [typeKey] = 'TimeSpan';\n\n \n @field(Number)\n ticks!: number;\n\n @field(Number)\n days!: number;\n\n @field(Number)\n hours!: number;\n\n @field(Number)\n milliseconds!: number;\n\n @field(Number)\n microseconds!: number;\n\n @field(Number)\n nanoseconds!: number;\n\n @field(Number)\n minutes!: number;\n\n @field(Number)\n seconds!: number;\n\n @field(Number)\n totalDays!: number;\n\n @field(Number)\n totalHours!: number;\n\n @field(Number)\n totalMilliseconds!: number;\n\n @field(Number)\n totalMicroseconds!: number;\n\n @field(Number)\n totalNanoseconds!: number;\n\n @field(Number)\n totalMinutes!: number;\n\n @field(Number)\n totalSeconds!: number;\n\n /**\n * Parses a C# compatible TimeSpan string and returns a TimeSpan instance.\n * The string format should match: [-][d.]hh:mm:ss[.fffffff]\n * @param {string} value String representation of TimeSpan.\n * @returns {TimeSpan} A TimeSpan instance with all properties populated.\n * @throws {Error} If the string format is invalid.\n */\n static parse(value: string): TimeSpan {\n const match = timeSpanRegex.exec(value);\n if (match === null) {\n throw new Error(`Invalid TimeSpan format: ${value}`);\n }\n\n const isNegative = match[1] === '-';\n const days = match[2] ? parseInt(match[2], 10) : 0;\n const hours = parseInt(match[3], 10);\n const minutes = parseInt(match[4], 10);\n const seconds = parseInt(match[5], 10);\n const fractionalSeconds = match[6] ? match[6].padEnd(7, '0') : '0000000';\n\n const ticksPerDay = 864000000000;\n const ticksPerHour = 36000000000;\n const ticksPerMinute = 600000000;\n const ticksPerSecond = 10000000;\n\n const ticks =\n days * ticksPerDay +\n hours * ticksPerHour +\n minutes * ticksPerMinute +\n seconds * ticksPerSecond +\n parseInt(fractionalSeconds, 10);\n\n const finalTicks = isNegative ? -ticks : ticks;\n\n const timeSpan = new TimeSpan();\n timeSpan.ticks = finalTicks;\n timeSpan.days = Math.floor(Math.abs(finalTicks) / ticksPerDay) * (isNegative ? -1 : 1);\n timeSpan.hours = Math.floor((Math.abs(finalTicks) / ticksPerHour) % 24);\n timeSpan.minutes = Math.floor((Math.abs(finalTicks) / ticksPerMinute) % 60);\n timeSpan.seconds = Math.floor((Math.abs(finalTicks) / ticksPerSecond) % 60);\n timeSpan.milliseconds = Math.floor((Math.abs(finalTicks) / 10000) % 1000);\n timeSpan.microseconds = Math.floor((Math.abs(finalTicks) / 10) % 1000);\n timeSpan.nanoseconds = Math.floor((Math.abs(finalTicks) % 10) * 100);\n timeSpan.totalDays = finalTicks / ticksPerDay;\n timeSpan.totalHours = finalTicks / ticksPerHour;\n timeSpan.totalMinutes = finalTicks / ticksPerMinute;\n timeSpan.totalSeconds = finalTicks / ticksPerSecond;\n timeSpan.totalMilliseconds = finalTicks / 10000;\n timeSpan.totalMicroseconds = finalTicks / 10;\n timeSpan.totalNanoseconds = finalTicks * 100;\n\n return timeSpan;\n }\n\n /**\n * Converts the TimeSpan to a C# compatible string format.\n * Returns the TimeSpan in format: [-][d.]hh:mm:ss[.fffffff]\n * @returns {string} C# compatible TimeSpan string representation.\n */\n toString(): string {\n const isNegative = this.ticks < 0;\n const absTicks = Math.abs(this.ticks);\n\n const ticksPerDay = 864000000000;\n const ticksPerHour = 36000000000;\n const ticksPerMinute = 600000000;\n const ticksPerSecond = 10000000;\n\n const days = Math.floor(absTicks / ticksPerDay);\n const hours = Math.floor((absTicks / ticksPerHour) % 24);\n const minutes = Math.floor((absTicks / ticksPerMinute) % 60);\n const seconds = Math.floor((absTicks / ticksPerSecond) % 60);\n const fractionalTicks = absTicks % ticksPerSecond;\n\n const parts: string[] = [];\n\n if (isNegative) {\n parts.push('-');\n }\n\n if (days > 0) {\n parts.push(`${days}.`);\n }\n\n parts.push(`${hours.toString().padStart(2, '0')}:`);\n parts.push(`${minutes.toString().padStart(2, '0')}:`);\n parts.push(`${seconds.toString().padStart(2, '0')}`);\n\n if (fractionalTicks > 0) {\n const fractionalStr = fractionalTicks.toString().padStart(7, '0').replace(/0+$/, '');\n parts.push(`.${fractionalStr}`);\n }\n\n return parts.join('');\n }\n\n /**\n * Converts the TimeSpan to a JSON string that works in JSON serialization.\n * Returns the TimeSpan in C# compatible format: [-][d.]hh:mm:ss[.fffffff]\n * @returns {string} C# compatible TimeSpan string representation.\n */\n toJSON(): string {\n return this.toString();\n }\n}\n"],"names":["typeKey","__decorate","field"],"mappings":";;;;;;AAOA,MAAM,aAAa,GAAG,6DAA6D;MAKtE,QAAQ,CAAA;AACjB,IAAA,QAAiBA,eAAO,IAAI,UAAU;AAItC,IAAA,KAAK;AAGL,IAAA,IAAI;AAGJ,IAAA,KAAK;AAGL,IAAA,YAAY;AAGZ,IAAA,YAAY;AAGZ,IAAA,WAAW;AAGX,IAAA,OAAO;AAGP,IAAA,OAAO;AAGP,IAAA,SAAS;AAGT,IAAA,UAAU;AAGV,IAAA,iBAAiB;AAGjB,IAAA,iBAAiB;AAGjB,IAAA,gBAAgB;AAGhB,IAAA,YAAY;AAGZ,IAAA,YAAY;IASZ,OAAO,KAAK,CAAC,KAAa,EAAA;QACtB,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC;AACvC,QAAA,IAAI,KAAK,KAAK,IAAI,EAAE;AAChB,YAAA,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,CAAA,CAAE,CAAC;QACxD;QAEA,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG;QACnC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC;QAClD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACp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A,CAAA;IADCC,oBAAK,CAAC,MAAM,CAAC;;AACM,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAGpBD,iBAAA,CAAA;IADCC,oBAAK,CAAC,MAAM,CAAC;;AACa,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,mBAAA,EAAA,MAAA,CAAA;AAG3BD,iBAAA,CAAA;IADCC,oBAAK,CAAC,MAAM,CAAC;;AACa,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,mBAAA,EAAA,MAAA,CAAA;AAG3BD,iBAAA,CAAA;IADCC,oBAAK,CAAC,MAAM,CAAC;;AACY,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,kBAAA,EAAA,MAAA,CAAA;AAG1BD,iBAAA,CAAA;IADCC,oBAAK,CAAC,MAAM,CAAC;;AACQ,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;AAGtBD,iBAAA,CAAA;IADCC,oBAAK,CAAC,MAAM,CAAC;;AACQ,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ValueMap.js","sources":["../../ValueMap.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.\nimport { typeKey } from './typeKey';\n\n/**\n * Represents a map that compares object keys by value.\n */\nexport class ValueMap<TKey, TValue> {\n static readonly [typeKey] = 'ValueMap';\n\n private readonly _entries: Array<[TKey, TValue]> = [];\n\n /**\n * Adds a new entry or updates an existing entry for the provided key.\n *\n * @param key Key to add or update.\n * @param value Value to associate with the key.\n * @returns The current map instance for chaining.\n */\n set(key: TKey, value: TValue): this {\n const index = this._entries.findIndex(([existingKey]) => this.equals(existingKey, key));\n if (index >= 0) {\n this._entries[index][1] = value;\n } else {\n this._entries.push([key, value]);\n }\n\n return this;\n }\n\n /**\n * Gets the value associated with the provided key.\n *\n * @param key Key to look up.\n * @returns The matching value, or undefined when no entry matches.\n */\n get(key: TKey): TValue | undefined {\n return this._entries.find(([existingKey]) => this.equals(existingKey, key))?.[1];\n }\n\n /**\n * Gets an iterator over all key-value entries in insertion order.\n *\n * @returns Iterator for the map entries.\n */\n entries(): IterableIterator<[TKey, TValue]> {\n return this._entries.values();\n }\n\n private equals(first: TKey, second: TKey): boolean {\n if (first === second) {\n return true;\n }\n\n if (first === undefined || first === null || second === undefined || second === null) {\n return false;\n }\n\n if (typeof first === 'object' && typeof second === 'object') {\n return JSON.stringify(first) === JSON.stringify(second);\n }\n\n return false;\n }\n}"],"names":["typeKey"],"mappings":";;;;MAOa,QAAQ,CAAA;AACjB,IAAA,QAAiBA,eAAO,IAAI,UAAU;IAErB,QAAQ,GAA0B,EAAE;IASrD,GAAG,CAAC,GAAS,EAAE,KAAa,EAAA;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AACvF,QAAA,IAAI,KAAK,IAAI,CAAC,EAAE;YACZ,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK;QACnC;aAAO;YACH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACpC;AAEA,QAAA,OAAO,IAAI;IACf;AAQA,IAAA,GAAG,CAAC,GAAS,EAAA;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACpF;IAOA,OAAO,GAAA;AACH,QAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;IACjC;IAEQ,MAAM,CAAC,KAAW,EAAE,MAAY,EAAA;AACpC,QAAA,IAAI,KAAK,KAAK,MAAM,EAAE;AAClB,YAAA,OAAO,IAAI;QACf;AAEA,QAAA,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,EAAE;AAClF,YAAA,OAAO,KAAK;QAChB;QAEA,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AACzD,YAAA,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAC3D;AAEA,QAAA,OAAO,KAAK;IAChB;;;;;"}
1
+ {"version":3,"file":"ValueMap.js","sources":["../../ValueMap.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.\nimport { typeKey } from './typeKey';\n\n/**\n * Represents a map that compares object keys by value.\n */\nexport class ValueMap<TKey, TValue> {\n static readonly [typeKey] = 'ValueMap';\n\n private readonly _entries: Array<[TKey, TValue]> = [];\n\n /**\n * Adds a new entry or updates an existing entry for the provided key.\n *\n * @param key Key to add or update.\n * @param value Value to associate with the key.\n * @returns The current map instance for chaining.\n */\n set(key: TKey, value: TValue): this {\n const index = this._entries.findIndex(([existingKey]) => this.equals(existingKey, key));\n if (index >= 0) {\n this._entries[index][1] = value;\n } else {\n this._entries.push([key, value]);\n }\n\n return this;\n }\n\n /**\n * Gets the value associated with the provided key.\n *\n * @param key Key to look up.\n * @returns The matching value, or undefined when no entry matches.\n */\n get(key: TKey): TValue | undefined {\n return this._entries.find(([existingKey]) => this.equals(existingKey, key))?.[1];\n }\n\n /**\n * Gets an iterator over all key-value entries in insertion order.\n *\n * @returns Iterator for the map entries.\n */\n entries(): IterableIterator<[TKey, TValue]> {\n return this._entries.values();\n }\n\n private equals(first: TKey, second: TKey): boolean {\n if (first === second) {\n return true;\n }\n\n if (first === undefined || first === null || second === undefined || second === null) {\n return false;\n }\n\n if (typeof first === 'object' && typeof second === 'object') {\n return JSON.stringify(first) === JSON.stringify(second);\n }\n\n return false;\n }\n}"],"names":["typeKey"],"mappings":";;;;MAOa,QAAQ,CAAA;AACjB,IAAA,QAAiBA,eAAO,IAAI,UAAU;IAErB,QAAQ,GAA0B,EAAE;IASrD,GAAG,CAAC,GAAS,EAAE,KAAa,EAAA;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AACvF,QAAA,IAAI,KAAK,IAAI,CAAC,EAAE;YACZ,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK;QACnC;aAAO;YACH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACpC;AAEA,QAAA,OAAO,IAAI;IACf;AAQA,IAAA,GAAG,CAAC,GAAS,EAAA;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACpF;IAOA,OAAO,GAAA;AACH,QAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;IACjC;IAEQ,MAAM,CAAC,KAAW,EAAE,MAAY,EAAA;AACpC,QAAA,IAAI,KAAK,KAAK,MAAM,EAAE;AAClB,YAAA,OAAO,IAAI;QACf;AAEA,QAAA,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,EAAE;AAClF,YAAA,OAAO,KAAK;QAChB;QAEA,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AACzD,YAAA,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAC3D;AAEA,QAAA,OAAO,KAAK;IAChB;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"_tslib.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"_tslib.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"derivedTypeDecorator.js","sources":["../../derivedTypeDecorator.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 './reflection';\nimport { Constructor } from './Constructor';\nimport { DerivedType } from './DerivedType';\nimport { StandardClassDecoratorContext } from './StandardClassDecoratorContext';\n\nexport function derivedType(identifier: string, targetType?: Constructor) {\n function decorator<Target extends Constructor>(target: Target): void;\n function decorator<Target extends Constructor>(target: Target, context: StandardClassDecoratorContext<Target>): void;\n function decorator(target: Constructor, context?: StandardClassDecoratorContext<Constructor>): void {\n if (typeof target !== 'function') throw new TypeError('@derivedType can only decorate classes');\n if (context && context.kind !== 'class') throw new TypeError('@derivedType can only decorate classes');\n if (context && typeof context.addInitializer !== 'function') throw new TypeError('@derivedType requires a standard class decorator context');\n\n if (context) {\n context.addInitializer(function (this: Constructor): void {\n register(this);\n });\n return;\n }\n\n register(target);\n }\n\n function register(target: Constructor): void {\n DerivedType.set(target, identifier, targetType);\n\n // Auto-register with every class in the prototype chain so that JsonSerializer\n // can discover all derived types via DerivedType.getDerivedTypesFor() at runtime,\n // without requiring the parent type to import each subtype (which causes circular deps).\n let proto = Object.getPrototypeOf(target.prototype);\n while (proto && proto.constructor && proto.constructor !== Object) {\n DerivedType.set(target, identifier, proto.constructor);\n proto = Object.getPrototypeOf(proto);\n }\n }\n\n return decorator;\n}\n"],"names":["DerivedType"],"mappings":";;;;;AAQM,SAAU,WAAW,CAAC,UAAkB,EAAE,UAAwB,EAAA;AAGpE,IAAA,SAAS,SAAS,CAAC,MAAmB,EAAE,OAAoD,EAAA;QACxF,IAAI,OAAO,MAAM,KAAK,UAAU;AAAE,YAAA,MAAM,IAAI,SAAS,CAAC,wCAAwC,CAAC;AAC/F,QAAA,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO;AAAE,YAAA,MAAM,IAAI,SAAS,CAAC,wCAAwC,CAAC;AACtG,QAAA,IAAI,OAAO,IAAI,OAAO,OAAO,CAAC,cAAc,KAAK,UAAU;AAAE,YAAA,MAAM,IAAI,SAAS,CAAC,0DAA0D,CAAC;QAE5I,IAAI,OAAO,EAAE;YACT,OAAO,CAAC,cAAc,CAAC,YAAA;gBACnB,QAAQ,CAAC,IAAI,CAAC;AAClB,YAAA,CAAC,CAAC;YACF;QACJ;QAEA,QAAQ,CAAC,MAAM,CAAC;IACpB;IAEA,SAAS,QAAQ,CAAC,MAAmB,EAAA;QACjCA,uBAAW,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC;QAK/C,IAAI,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC;AACnD,QAAA,OAAO,KAAK,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,KAAK,MAAM,EAAE;YAC/DA,uBAAW,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,WAAW,CAAC;AACtD,YAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC;QACxC;IACJ;AAEA,IAAA,OAAO,SAAS;AACpB;;;;"}
1
+ {"version":3,"file":"derivedTypeDecorator.js","sources":["../../derivedTypeDecorator.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 './reflection';\nimport { Constructor } from './Constructor';\nimport { DerivedType } from './DerivedType';\nimport { StandardClassDecoratorContext } from './StandardClassDecoratorContext';\n\nexport function derivedType(identifier: string, targetType?: Constructor) {\n function decorator<Target extends Constructor>(target: Target): void;\n function decorator<Target extends Constructor>(target: Target, context: StandardClassDecoratorContext<Target>): void;\n function decorator(target: Constructor, context?: StandardClassDecoratorContext<Constructor>): void {\n if (typeof target !== 'function') throw new TypeError('@derivedType can only decorate classes');\n if (context && context.kind !== 'class') throw new TypeError('@derivedType can only decorate classes');\n if (context && typeof context.addInitializer !== 'function') throw new TypeError('@derivedType requires a standard class decorator context');\n\n if (context) {\n context.addInitializer(function (this: Constructor): void {\n register(this);\n });\n return;\n }\n\n register(target);\n }\n\n function register(target: Constructor): void {\n DerivedType.set(target, identifier, targetType);\n\n // Auto-register with every class in the prototype chain so that JsonSerializer\n // can discover all derived types via DerivedType.getDerivedTypesFor() at runtime,\n // without requiring the parent type to import each subtype (which causes circular deps).\n let proto = Object.getPrototypeOf(target.prototype);\n while (proto && proto.constructor && proto.constructor !== Object) {\n DerivedType.set(target, identifier, proto.constructor);\n proto = Object.getPrototypeOf(proto);\n }\n }\n\n return decorator;\n}\n"],"names":["DerivedType"],"mappings":";;;;;AAQM,SAAU,WAAW,CAAC,UAAkB,EAAE,UAAwB,EAAA;AAGpE,IAAA,SAAS,SAAS,CAAC,MAAmB,EAAE,OAAoD,EAAA;QACxF,IAAI,OAAO,MAAM,KAAK,UAAU;AAAE,YAAA,MAAM,IAAI,SAAS,CAAC,wCAAwC,CAAC;AAC/F,QAAA,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO;AAAE,YAAA,MAAM,IAAI,SAAS,CAAC,wCAAwC,CAAC;AACtG,QAAA,IAAI,OAAO,IAAI,OAAO,OAAO,CAAC,cAAc,KAAK,UAAU;AAAE,YAAA,MAAM,IAAI,SAAS,CAAC,0DAA0D,CAAC;QAE5I,IAAI,OAAO,EAAE;YACT,OAAO,CAAC,cAAc,CAAC,YAAA;gBACnB,QAAQ,CAAC,IAAI,CAAC;AAClB,YAAA,CAAC,CAAC;YACF;QACJ;QAEA,QAAQ,CAAC,MAAM,CAAC;IACpB;IAEA,SAAS,QAAQ,CAAC,MAAmB,EAAA;QACjCA,uBAAW,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC;QAK/C,IAAI,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC;AACnD,QAAA,OAAO,KAAK,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,KAAK,MAAM,EAAE;YAC/DA,uBAAW,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,WAAW,CAAC;AACtD,YAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC;QACxC;IACJ;AAEA,IAAA,OAAO,SAAS;AACpB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"duplicateInstanceGuard.js","sources":["../../duplicateInstanceGuard.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\n/**\n * Detects that more than one copy of this package has been loaded into the same JavaScript\n * realm and reports it, once.\n *\n * A second copy brings its own converter registry and its own `Guid` and `ConceptAs` class\n * objects. Values themselves survive the boundary - a convertible type is recognized by the key\n * it declares rather than by its class object - but three things do not, all of them silent:\n * a converter registered through `JsonSerializer.registerConverter` reaches only the copy it was\n * registered on, an `instanceof` against the other copy's class is false, and a version pinned at\n * the top level never reaches a copy nested under a dependency, so an adopted fix can reach\n * nothing at all.\n *\n * A package manager is free to produce that second copy, and this module does not try to stop\n * it. It makes it visible. Two installs is the usual cause, but one install reached as both ESM\n * and CommonJS is the same failure with no version mismatch anywhere to find it by - so the\n * report names where each load came from rather than only how many there were.\n *\n * A copy older than this guard does not register itself and leaves nothing behind for a newer\n * copy to find, so duplication is reported only once every copy in the realm carries the guard.\n * That is inherent to the approach, not a gap left to close.\n *\n * The bookkeeping lives on `globalThis`, because module scope is the very thing being\n * duplicated. Its two keys are a cross-version contract - a copy of a *different* version of\n * this package may have written them first - so the shapes are deliberately primitive: an\n * array of strings and a boolean.\n *\n * The registration is a load-bearing side effect. Do not declare `\"sideEffects\": false` in the\n * package manifest; a bundler would then be free to drop it, and the duplicate would go back\n * to being silent.\n */\n\n/** Holds one entry per loaded copy of this package, in load order. */\nconst loadedInstancesKey = Symbol.for('@cratis/fundamentals.loadedInstances');\n\n/** Records that the duplicate has been reported, so it is reported exactly once per realm. */\nconst duplicateReportedKey = Symbol.for('@cratis/fundamentals.duplicateReported');\n\nconst globals = globalThis as Record<symbol, unknown>;\n\n/** Placeholder used when the runtime offers no usable stack trace. */\nconst unknownOrigin = 'unknown location';\n\n/** Set once this copy has registered itself, so repeated calls count it only once. */\nlet registered = false;\n\n/**\n * Resolves where this copy of the package was loaded from, so the report can name the copies\n * rather than only their number.\n * @returns {string} A source location, or a placeholder when no stack trace is available.\n */\nconst resolveOrigin = (): string => {\n try {\n // The first frame is this function, which lives in this copy of the package - exactly\n // the location worth naming. V8 prefixes the stack with a bare `Error` line that other\n // engines omit, so drop it rather than indexing past it.\n const frames = (new Error().stack ?? '')\n .split('\\n')\n .map(line => line.trim())\n .filter(line => line.length > 0 && line !== 'Error');\n\n const frame = frames[0];\n if (!frame) return unknownOrigin;\n\n return frame.match(/\\((.+)\\)$/)?.[1] ?? frame.replace(/^at\\s+/, '');\n } catch {\n // A runtime that refuses stack traces is not a reason to skip the registration.\n return unknownOrigin;\n }\n};\n\n/**\n * Writes the diagnostic as a single console entry naming the problem, its consequence and the\n * way out.\n * @param {string[]} origins Where each loaded copy was loaded from, in load order.\n */\nconst reportDuplicate = (origins: string[]): void => {\n if (typeof console === 'undefined' || typeof console.warn !== 'function') return;\n\n const locations = origins.map((origin, index) => ` ${index + 1}. ${origin}`).join('\\n');\n\n console.warn(\n `[@cratis/fundamentals] Loaded ${origins.length} times into the same JavaScript realm, and it has to be loaded once.\\n` +\n 'Each load builds its own converter registry and its own Guid and ConceptAs class objects. A converter registered through ' +\n 'JsonSerializer.registerConverter reaches only the copy it was registered on, an instanceof against the other copy\\'s ' +\n 'class is false, and a version pinned at the top level does not reach a copy nested under a dependency - so an adopted ' +\n `fix can reach nothing at all.\\nLoaded from:\\n${locations}\\n` +\n 'If those are separate installs, collapse them with `yarn dedupe @cratis/fundamentals` (or `npm dedupe`) and confirm with ' +\n '`yarn why @cratis/fundamentals`. If they differ only in dist/esm against dist/cjs it is one install reached as both ESM ' +\n 'and CommonJS, which no dedupe will fix - make every importer resolve the same one.');\n};\n\n/**\n * Registers this copy of the package and reports, once per realm, when it is not the only one.\n * Calling this more than once from the same copy registers that copy once.\n */\nexport const registerModuleInstance = (): void => {\n if (registered) return;\n registered = true;\n\n const existing = globals[loadedInstancesKey];\n const origins: string[] = Array.isArray(existing) ? existing : [];\n if (origins !== existing) {\n globals[loadedInstancesKey] = origins;\n }\n origins.push(resolveOrigin());\n\n if (origins.length < 2 || globals[duplicateReportedKey] === true) return;\n\n globals[duplicateReportedKey] = true;\n reportDuplicate(origins);\n};\n"],"names":[],"mappings":";;AAmCA,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,sCAAsC,CAAC;AAG7E,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,wCAAwC,CAAC;AAEjF,MAAM,OAAO,GAAG,UAAqC;AAGrD,MAAM,aAAa,GAAG,kBAAkB;AAGxC,IAAI,UAAU,GAAG,KAAK;AAOtB,MAAM,aAAa,GAAG,MAAa;AAC/B,IAAA,IAAI;QAIA,MAAM,MAAM,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC,KAAK,IAAI,EAAE;aAClC,KAAK,CAAC,IAAI;aACV,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE;AACvB,aAAA,MAAM,CAAC,IAAI,IAAI,I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AAkB,CAAC,GAAG,OAAO;IACzC;AACA,IAAA,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;IAE7B,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,oBAAoB,CAAC,KAAK,IAAI;QAAE;AAElE,IAAA,OAAO,CAAC,oBAAoB,CAAC,GAAG,IAAI;IACpC,eAAe,CAAC,OAAO,CAAC;AAC5B;;;;"}
1
+ {"version":3,"file":"duplicateInstanceGuard.js","sources":["../../duplicateInstanceGuard.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\n/**\n * Detects that more than one copy of this package has been loaded into the same JavaScript\n * realm and reports it, once.\n *\n * A second copy brings its own converter registry and its own `Guid` and `ConceptAs` class\n * objects. Values themselves survive the boundary - a convertible type is recognized by the key\n * it declares rather than by its class object - but three things do not, all of them silent:\n * a converter registered through `JsonSerializer.registerConverter` reaches only the copy it was\n * registered on, an `instanceof` against the other copy's class is false, and a version pinned at\n * the top level never reaches a copy nested under a dependency, so an adopted fix can reach\n * nothing at all.\n *\n * A package manager is free to produce that second copy, and this module does not try to stop\n * it. It makes it visible. Two installs is the usual cause, but one install reached as both ESM\n * and CommonJS is the same failure with no version mismatch anywhere to find it by - so the\n * report names where each load came from rather than only how many there were.\n *\n * A copy older than this guard does not register itself and leaves nothing behind for a newer\n * copy to find, so duplication is reported only once every copy in the realm carries the guard.\n * That is inherent to the approach, not a gap left to close.\n *\n * The bookkeeping lives on `globalThis`, because module scope is the very thing being\n * duplicated. Its two keys are a cross-version contract - a copy of a *different* version of\n * this package may have written them first - so the shapes are deliberately primitive: an\n * array of strings and a boolean.\n *\n * The registration is a load-bearing side effect. Do not declare `\"sideEffects\": false` in the\n * package manifest; a bundler would then be free to drop it, and the duplicate would go back\n * to being silent.\n */\n\n/** Holds one entry per loaded copy of this package, in load order. */\nconst loadedInstancesKey = Symbol.for('@cratis/fundamentals.loadedInstances');\n\n/** Records that the duplicate has been reported, so it is reported exactly once per realm. */\nconst duplicateReportedKey = Symbol.for('@cratis/fundamentals.duplicateReported');\n\nconst globals = globalThis as Record<symbol, unknown>;\n\n/** Placeholder used when the runtime offers no usable stack trace. */\nconst unknownOrigin = 'unknown location';\n\n/** Set once this copy has registered itself, so repeated calls count it only once. */\nlet registered = false;\n\n/**\n * Resolves where this copy of the package was loaded from, so the report can name the copies\n * rather than only their number.\n * @returns {string} A source location, or a placeholder when no stack trace is available.\n */\nconst resolveOrigin = (): string => {\n try {\n // The first frame is this function, which lives in this copy of the package - exactly\n // the location worth naming. V8 prefixes the stack with a bare `Error` line that other\n // engines omit, so drop it rather than indexing past it.\n const frames = (new Error().stack ?? '')\n .split('\\n')\n .map(line => line.trim())\n .filter(line => line.length > 0 && line !== 'Error');\n\n const frame = frames[0];\n if (!frame) return unknownOrigin;\n\n return frame.match(/\\((.+)\\)$/)?.[1] ?? frame.replace(/^at\\s+/, '');\n } catch {\n // A runtime that refuses stack traces is not a reason to skip the registration.\n return unknownOrigin;\n }\n};\n\n/**\n * Writes the diagnostic as a single console entry naming the problem, its consequence and the\n * way out.\n * @param {string[]} origins Where each loaded copy was loaded from, in load order.\n */\nconst reportDuplicate = (origins: string[]): void => {\n if (typeof console === 'undefined' || typeof console.warn !== 'function') return;\n\n const locations = origins.map((origin, index) => ` ${index + 1}. ${origin}`).join('\\n');\n\n console.warn(\n `[@cratis/fundamentals] Loaded ${origins.length} times into the same JavaScript realm, and it has to be loaded once.\\n` +\n 'Each load builds its own converter registry and its own Guid and ConceptAs class objects. A converter registered through ' +\n 'JsonSerializer.registerConverter reaches only the copy it was registered on, an instanceof against the other copy\\'s ' +\n 'class is false, and a version pinned at the top level does not reach a copy nested under a dependency - so an adopted ' +\n `fix can reach nothing at all.\\nLoaded from:\\n${locations}\\n` +\n 'If those are separate installs, collapse them with `yarn dedupe @cratis/fundamentals` (or `npm dedupe`) and confirm with ' +\n '`yarn why @cratis/fundamentals`. If they differ only in dist/esm against dist/cjs it is one install reached as both ESM ' +\n 'and CommonJS, which no dedupe will fix - make every importer resolve the same one.');\n};\n\n/**\n * Registers this copy of the package and reports, once per realm, when it is not the only one.\n * Calling this more than once from the same copy registers that copy once.\n */\nexport const registerModuleInstance = (): void => {\n if (registered) return;\n registered = true;\n\n const existing = globals[loadedInstancesKey];\n const origins: string[] = Array.isArray(existing) ? existing : [];\n if (origins !== existing) {\n globals[loadedInstancesKey] = origins;\n }\n origins.push(resolveOrigin());\n\n if (origins.length < 2 || globals[duplicateReportedKey] === true) return;\n\n globals[duplicateReportedKey] = true;\n reportDuplicate(origins);\n};\n"],"names":[],"mappings":";;AAmCA,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,sCAAsC,CAAC;AAG7E,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,wCAAwC,CAAC;AAEjF,MAAM,OAAO,GAAG,UAAqC;AAGrD,MAAM,aAAa,GAAG,kBAAkB;AAGxC,IAAI,UAAU,GAAG,KAAK;AAOtB,MAAM,aAAa,GAAG,MAAa;AAC/B,IAAA,IAAI;QAIA,MAAM,MAAM,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC,KAAK,IAAI,EAAE;aAClC,KAAK,CAAC,IAAI;aACV,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE;AACvB,aAAA,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,KAAK,OAAO,CAAC;AAExD,QAAA,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC;AACvB,QAAA,IAAI,CAAC,KAAK;AAAE,YAAA,OAAO,aAAa;AAEhC,QAAA,OAAO,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;IACvE;AAAE,IAAA,MAAM;AAEJ,QAAA,OAAO,aAAa;IACxB;AACJ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ratis. 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 { Field } from './Field';\nimport { Fields } from './Fields';\nimport { addFieldToDecoratorMetadata } from './fieldDecoratorMetadata';\nimport { StandardFieldDecoratorContext } from './StandardFieldDecoratorContext';\n\ntype fieldOptions = {\n enumerable?: boolean;\n derivatives?: Constructor[];\n genericArguments?: Constructor[];\n};\n\nconst isFieldOptions = (value: boolean | fieldOptions | undefined): value is fieldOptions => {\n return typeof value === 'object' && value !== null;\n};\n\nexport function field(targetType: Constructor, enumerableOrOptions?: boolean | fieldOptions, derivatives?: Constructor[], genericArguments?: Constructor[]) {\n const enumerable = isFieldOptions(enumerableOrOptions) ? (enumerableOrOptions.enumerable || false) : (enumerableOrOptions || false);\n const actualDerivatives = isFieldOptions(enumerableOrOptions) ? (enumerableOrOptions.derivatives || []) : (derivatives || []);\n const actualGenericArguments = isFieldOptions(enumerableOrOptions) ? (enumerableOrOptions.genericArguments || []) : (genericArguments || []);\n\n function decorator(target: object, propertyKey: string): void;\n function decorator(initialValue: undefined, context: StandardFieldDecoratorContext): void;\n function decorator(targetOrInitialValue: object | undefined, propertyKeyOrContext: string | symbol | StandardFieldDecoratorContext): void {\n if (typeof propertyKeyOrContext === 'object' && propertyKeyOrContext !== null) {\n if (targetOrInitialValue !== undefined) throw new TypeError('@field received an invalid standard field value');\n addStandardField(propertyKeyOrContext);\n return;\n }\n\n addLegacyField(targetOrInitialValue, propertyKeyOrContext);\n }\n\n function addStandardField(context: StandardFieldDecoratorContext): void {\n if (context.kind !== 'field') throw new TypeError('@field can only decorate fields');\n if (context.static) throw new TypeError('@field cannot decorate static fields');\n if (context.private) throw new TypeError('@field cannot decorate private fields');\n if (typeof context.name !== 'string') throw new TypeError('@field cannot decorate symbol-named fields');\n if (!context.metadata) throw new TypeError('@field requires standard decorator metadata support');\n\n addFieldToDecoratorMetadata(\n context.metadata,\n new Field(context.name, targetType, enumerable, actualDerivatives, actualGenericArguments));\n }\n\n function addLegacyField(target: object | undefined, propertyKey: string | symbol): void {\n if (typeof propertyKey === 'symbol') throw new TypeError('@field cannot decorate symbol-named fields');\n if (typeof propertyKey !== 'string') throw new TypeError('@field received an invalid legacy decorator invocation');\n if (!target || typeof target === 'function') throw new TypeError('@field cannot decorate static fields');\n\n Fields.addFieldToType(target.constructor as Constructor, propertyKey, targetType, enumerable, actualDerivatives, actualGenericArguments);\n }\n\n return decorator;\n}\n"],"names":["addFieldToDecoratorMetadata","Field","Fields"],"mappings":";;;;;;AAeA,MAAM,cAAc,GAAG,CAAC,KAAyC,KAA2B;IACxF,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;AACtD,CAAC;AAEK,SAAU,KAAK,CAAC,UAAuB,EAAE,mBAA4C,EAAE,WAA2B,EAAE,gBAAgC,EAAA;IACtJ,MAAM,UAAU,GAAG,cAAc,CAAC,mBAAmB,CAAC,IAAI,mBAAmB,CAAC,UAAU,IAAI,KAAK,KAAK,mBAAmB,IAAI,KAAK,CAAC;IACnI,MAAM,iBAAiB,GAAG,cAAc,CAAC,mBAAmB,CAAC,IAAI,mBAAmB,CAAC,WAAW,IAAI,EAAE,KAAK,WAAW,IAAI,EAAE,CAAC;IAC7H,MAAM,sBAAsB,GAAG,cAAc,CAAC,mBAAmB,CAAC,IAAI,mBAAmB,CAAC,gBAAgB,IAAI,EAAE,KAAK,gBAAgB,IAAI,EAAE,CAAC;AAI5I,IAAA,SAAS,SAAS,CAAC,oBAAwC,EAAE,oBAAqE,EAAA;QAC9H,IAAI,OAAO,oBAAoB,KAAK,QAAQ,IAAI,oBAAoB,KAAK,IAAI,EAAE;YAC3E,IAAI,oBAAoB,KAAK,SAAS;AAAE,gBAAA,MAAM,IAAI,SAAS,CAAC,iDAAiD,CAAC;YAC9G,gBAAgB,CAAC,oBAAoB,CAAC;YACtC;QACJ;AAEA,QAAA,cAAc,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IAC9D;I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yright (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 { Field } from './Field';\nimport { Fields } from './Fields';\nimport { addFieldToDecoratorMetadata } from './fieldDecoratorMetadata';\nimport { StandardFieldDecoratorContext } from './StandardFieldDecoratorContext';\n\ntype fieldOptions = {\n enumerable?: boolean;\n derivatives?: Constructor[];\n genericArguments?: Constructor[];\n};\n\nconst isFieldOptions = (value: boolean | fieldOptions | undefined): value is fieldOptions => {\n return typeof value === 'object' && value !== null;\n};\n\nexport function field(targetType: Constructor, enumerableOrOptions?: boolean | fieldOptions, derivatives?: Constructor[], genericArguments?: Constructor[]) {\n const enumerable = isFieldOptions(enumerableOrOptions) ? (enumerableOrOptions.enumerable || false) : (enumerableOrOptions || false);\n const actualDerivatives = isFieldOptions(enumerableOrOptions) ? (enumerableOrOptions.derivatives || []) : (derivatives || []);\n const actualGenericArguments = isFieldOptions(enumerableOrOptions) ? (enumerableOrOptions.genericArguments || []) : (genericArguments || []);\n\n function decorator(target: object, propertyKey: string): void;\n function decorator(initialValue: undefined, context: StandardFieldDecoratorContext): void;\n function decorator(targetOrInitialValue: object | undefined, propertyKeyOrContext: string | symbol | StandardFieldDecoratorContext): void {\n if (typeof propertyKeyOrContext === 'object' && propertyKeyOrContext !== null) {\n if (targetOrInitialValue !== undefined) throw new TypeError('@field received an invalid standard field value');\n addStandardField(propertyKeyOrContext);\n return;\n }\n\n addLegacyField(targetOrInitialValue, propertyKeyOrContext);\n }\n\n function addStandardField(context: StandardFieldDecoratorContext): void {\n if (context.kind !== 'field') throw new TypeError('@field can only decorate fields');\n if (context.static) throw new TypeError('@field cannot decorate static fields');\n if (context.private) throw new TypeError('@field cannot decorate private fields');\n if (typeof context.name !== 'string') throw new TypeError('@field cannot decorate symbol-named fields');\n if (!context.metadata) throw new TypeError('@field requires standard decorator metadata support');\n\n addFieldToDecoratorMetadata(\n context.metadata,\n new Field(context.name, targetType, enumerable, actualDerivatives, actualGenericArguments));\n }\n\n function addLegacyField(target: object | undefined, propertyKey: string | symbol): void {\n if (typeof propertyKey === 'symbol') throw new TypeError('@field cannot decorate symbol-named fields');\n if (typeof propertyKey !== 'string') throw new TypeError('@field received an invalid legacy decorator invocation');\n if (!target || typeof target === 'function') throw new TypeError('@field cannot decorate static fields');\n\n Fields.addFieldToType(target.constructor as Constructor, propertyKey, targetType, enumerable, actualDerivatives, actualGenericArguments);\n }\n\n return decorator;\n}\n"],"names":["addFieldToDecoratorMetadata","Field","Fields"],"mappings":";;;;;;AAeA,MAAM,cAAc,GAAG,CAAC,KAAyC,KAA2B;IACxF,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;AACtD,CAAC;AAEK,SAAU,KAAK,CAAC,UAAuB,EAAE,mBAA4C,EAAE,WAA2B,EAAE,gBAAgC,EAAA;IACtJ,MAAM,UAAU,GAAG,cAAc,CAAC,mBAAmB,CAAC,IAAI,mBAAmB,CAAC,UAAU,IAAI,KAAK,KAAK,mBAAmB,IAAI,KAAK,CAAC;IACnI,MAAM,iBAAiB,GAAG,cAAc,CAAC,mBAAmB,CAAC,IAAI,mBAAmB,CAAC,WAAW,IAAI,EAAE,KAAK,WAAW,IAAI,EAAE,CAAC;IAC7H,MAAM,sBAAsB,GAAG,cAAc,CAAC,mBAAmB,CAAC,IAAI,mBAAmB,CAAC,gBAAgB,IAAI,EAAE,KAAK,gBAAgB,IAAI,EAAE,CAAC;AAI5I,IAAA,SAAS,SAAS,CAAC,oBAAwC,EAAE,oBAAqE,EAAA;QAC9H,IAAI,OAAO,oBAAoB,KAAK,QAAQ,IAAI,oBAAoB,KAAK,IAAI,EAAE;YAC3E,IAAI,oBAAoB,KAAK,SAAS;AAAE,gBAAA,MAAM,IAAI,SAAS,CAAC,iDAAiD,CAAC;YAC9G,gBAAgB,CAAC,oBAAoB,CAAC;YACtC;QACJ;AAEA,QAAA,cAAc,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;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DecoratorMetadata.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 './reflection';\nimport { Constructor } from './Constructor';\nimport { Field } from './Field';\n\nconst fieldsMetadataKey = Symbol.for('@cratis/fundamentals.fields');\n\n/**\n * Adds a field to the metadata object supplied to a standard decorator.\n * @param metadata The class metadata object supplied by the decorator runtime.\n * @param field The field to add.\n */\nexport function addFieldToDecoratorMetadata(metadata: Record<PropertyKey, unknown>, field: Field): void {\n const fields = Reflect.getOwnMetadata(fieldsMetadataKey, metadata) as Map<string, Field> | undefined ?? new Map<string, Field>();\n fields.set(field.name, field);\n Reflect.defineMetadata(fieldsMetadataKey, fields, metadata);\n}\n\n/**\n * Gets the fields stored in the standard decorator metadata owned by a type.\n * @param target The type to read metadata from.\n * @returns The fields declared by the type through standard decorators.\n */\nexport function getOwnDecoratorFieldsForType(target: Constructor): Field[] {\n if (!Object.prototype.hasOwnProperty.call(target, Symbol.metadata)) return [];\n\n const metadata = (target as Constructor & { [Symbol.metadata]?: Record<PropertyKey, unknown> | null })[Symbol.metadata];\n if (!metadata) return [];\n\n const fields = Reflect.getOwnMetadata(fieldsMetadataKey, metadata) as Map<string, Field> | undefined;\n return fields ? [...fields.values()] : [];\n}\n"],"names":[],"mappings":";;;;AAOA,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC;AAO7D,SAAU,2BAA2B,CAAC,QAAsC,EAAE,KAAY,EAAA;AAC5F,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,QAAQ,CAAmC,IAAI,IAAI,GAAG,EAAiB;IAChI,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;IAC7B,OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,MAAM,EAAE,QAAQ,CAAC;AAC/D;AAOM,SAAU,4BAA4B,CAAC,MAAmB,EAAA;AAC5D,IAAA,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC;AAAE,QAAA,OAAO,EAAE;IAE7E,MAAM,QAAQ,GAAI,MAAoF,CAAC,MAAM,CAAC,QAAQ,CAAC;AACvH,IAAA,IAAI,CAAC,QAAQ;AAAE,QAAA,OAAO,EAAE;IAExB,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,QAAQ,CAAmC;AACpG,IAAA,OAAO,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;AAC7C;;;;;"}
1
+ {"version":3,"file":"fieldDecoratorMetadata.js","sources":["../../fieldDecoratorMetadata.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 './reflection';\nimport { Constructor } from './Constructor';\nimport { Field } from './Field';\n\nconst fieldsMetadataKey = Symbol.for('@cratis/fundamentals.fields');\n\n/**\n * Adds a field to the metadata object supplied to a standard decorator.\n * @param metadata The class metadata object supplied by the decorator runtime.\n * @param field The field to add.\n */\nexport function addFieldToDecoratorMetadata(metadata: Record<PropertyKey, unknown>, field: Field): void {\n const fields = Reflect.getOwnMetadata(fieldsMetadataKey, metadata) as Map<string, Field> | undefined ?? new Map<string, Field>();\n fields.set(field.name, field);\n Reflect.defineMetadata(fieldsMetadataKey, fields, metadata);\n}\n\n/**\n * Gets the fields stored in the standard decorator metadata owned by a type.\n * @param target The type to read metadata from.\n * @returns The fields declared by the type through standard decorators.\n */\nexport function getOwnDecoratorFieldsForType(target: Constructor): Field[] {\n if (!Object.prototype.hasOwnProperty.call(target, Symbol.metadata)) return [];\n\n const metadata = (target as Constructor & { [Symbol.metadata]?: Record<PropertyKey, unknown> | null })[Symbol.metadata];\n if (!metadata) return [];\n\n const fields = Reflect.getOwnMetadata(fieldsMetadataKey, metadata) as Map<string, Field> | undefined;\n return fields ? [...fields.values()] : [];\n}\n"],"names":[],"mappings":";;;;AAOA,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC;AAO7D,SAAU,2BAA2B,CAAC,QAAsC,EAAE,KAAY,EAAA;AAC5F,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,QAAQ,CAAmC,IAAI,IAAI,GAAG,EAAiB;IAChI,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;IAC7B,OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,MAAM,EAAE,QAAQ,CAAC;AAC/D;AAOM,SAAU,4BAA4B,CAAC,MAAmB,EAAA;AAC5D,IAAA,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC;AAAE,QAAA,OAAO,EAAE;IAE7E,MAAM,QAAQ,GAAI,MAAoF,CAAC,MAAM,CAAC,QAAQ,CAAC;AACvH,IAAA,IAAI,CAAC,QAAQ;AAAE,QAAA,OAAO,EAAE;IAExB,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,QAAQ,CAAmC;AACpG,IAAA,OAAO,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;AAC7C;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LineString.js","sources":["../../../geospatial/LineString.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 { Point } from './Point';\nimport { typeKey } from '../typeKey';\n\n/**\n * Represents a line string composed of two or more points.\n */\nexport class LineString {\n static readonly [typeKey] = 'LineString';\n\n coordinates!: Point[];\n\n /**\n * Creates a new LineString instance.\n * @param {Point[]} coordinates - The points that make up the line string (minimum 2 points).\n */\n constructor(coordinates: Point[]) {\n if (coordinates.length < 2) {\n throw new Error('LineString must have at least 2 points');\n }\n this.coordinates = coordinates;\n }\n\n /**\n * Converts the LineString to a GeoJSON representation.\n * @returns {object} GeoJSON representation.\n */\n toJSON(): object {\n return {\n type: 'LineString',\n coordinates: this.coordinates.map(p => [p.longitude, p.latitude])\n };\n }\n}\n"],"names":["typeKey"],"mappings":";;;;MASa,UAAU,CAAA;AACnB,IAAA,QAAiBA,eAAO,IAAI,YAAY;AAExC,IAAA,WAAW;AAMX,IAAA,WAAA,CAAY,WAAoB,EAAA;AAC5B,QAAA,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;AACxB,YAAA,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC;QAC7D;AACA,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW;IAClC;IAMA,MAAM,GAAA;QACF,OAAO;AACH,YAAA,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC;SACnE;IACL;;;;;"}
1
+ {"version":3,"file":"LineString.js","sources":["../../../geospatial/LineString.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 { Point } from './Point';\nimport { typeKey } from '../typeKey';\n\n/**\n * Represents a line string composed of two or more points.\n */\nexport class LineString {\n static readonly [typeKey] = 'LineString';\n\n coordinates!: Point[];\n\n /**\n * Creates a new LineString instance.\n * @param {Point[]} coordinates - The points that make up the line string (minimum 2 points).\n */\n constructor(coordinates: Point[]) {\n if (coordinates.length < 2) {\n throw new Error('LineString must have at least 2 points');\n }\n this.coordinates = coordinates;\n }\n\n /**\n * Converts the LineString to a GeoJSON representation.\n * @returns {object} GeoJSON representation.\n */\n toJSON(): object {\n return {\n type: 'LineString',\n coordinates: this.coordinates.map(p => [p.longitude, p.latitude])\n };\n }\n}\n"],"names":["typeKey"],"mappings":";;;;MASa,UAAU,CAAA;AACnB,IAAA,QAAiBA,eAAO,IAAI,YAAY;AAExC,IAAA,WAAW;AAMX,IAAA,WAAA,CAAY,WAAoB,EAAA;AAC5B,QAAA,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;AACxB,YAAA,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC;QAC7D;AACA,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW;IAClC;IAMA,MAAM,GAAA;QACF,OAAO;AACH,YAAA,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC;SACnE;IACL;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LinearRing.js","sources":["../../../geospatial/LinearRing.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 { Point } from './Point';\n\n/**\n * Represents a closed linear ring (polygon boundary).\n */\nexport class LinearRing {\n coordinates!: Point[];\n\n /**\n * Creates a new LinearRing instance.\n * @param {Point[]} coordinates - The points that make up the linear ring (minimum 4 points, first must equal last).\n */\n constructor(coordinates: Point[]) {\n if (coordinates.length < 4) {\n throw new Error('LinearRing must have at least 4 points to form a closed ring');\n }\n this.coordinates = coordinates;\n }\n\n /**\n * Converts the LinearRing to a GeoJSON coordinate array.\n * @returns {number[][]} GeoJSON coordinate array.\n */\n toJSON(): number[][] {\n return this.coordinates.map(p => [p.longitude, p.latitude]);\n }\n}\n"],"names":[],"mappings":";;MAQa,UAAU,CAAA;AACnB,IAAA,WAAW;AAMX,IAAA,WAAA,CAAY,WAAoB,EAAA;AAC5B,QAAA,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;AACxB,YAAA,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC;QACnF;AACA,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW;IAClC;IAMA,MAAM,GAAA;QACF,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC/D;AACH;;;;"}
1
+ {"version":3,"file":"LinearRing.js","sources":["../../../geospatial/LinearRing.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 { Point } from './Point';\n\n/**\n * Represents a closed linear ring (polygon boundary).\n */\nexport class LinearRing {\n coordinates!: Point[];\n\n /**\n * Creates a new LinearRing instance.\n * @param {Point[]} coordinates - The points that make up the linear ring (minimum 4 points, first must equal last).\n */\n constructor(coordinates: Point[]) {\n if (coordinates.length < 4) {\n throw new Error('LinearRing must have at least 4 points to form a closed ring');\n }\n this.coordinates = coordinates;\n }\n\n /**\n * Converts the LinearRing to a GeoJSON coordinate array.\n * @returns {number[][]} GeoJSON coordinate array.\n */\n toJSON(): number[][] {\n return this.coordinates.map(p => [p.longitude, p.latitude]);\n }\n}\n"],"names":[],"mappings":";;MAQa,UAAU,CAAA;AACnB,IAAA,WAAW;AAMX,IAAA,WAAA,CAAY,WAAoB,EAAA;AAC5B,QAAA,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;AACxB,YAAA,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC;QACnF;AACA,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW;IAClC;IAMA,MAAM,GAAA;QACF,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC/D;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Point.js","sources":["../../../geospatial/Point.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 { field } from '../fieldDecorator';\nimport { typeKey } from '../typeKey';\n\n/**\n * Represents a geographic point with longitude and latitude.\n */\nexport class Point {\n static readonly [typeKey] = 'Point';\n\n @field(Number)\n longitude!: number;\n\n @field(Number)\n latitude!: number;\n\n /**\n * Creates a new Point instance.\n * @param {number} longitude - The longitude of the point.\n * @param {number} latitude - The latitude of the point.\n */\n constructor(longitude: number, latitude: number) {\n this.longitude = longitude;\n this.latitude = latitude;\n }\n\n /**\n * Converts the Point to a GeoJSON representation.\n * @returns {object} GeoJSON representation.\n */\n toJSON(): object {\n return {\n type: 'Point',\n coordinates: [this.longitude, this.latitude]\n };\n }\n}\n"],"names":["typeKey","__decorate","field"],"mappings":";;;;;;MASa,KAAK,CAAA;AACd,IAAA,QAAiBA,eAAO,IAAI,OAAO;AAGnC,IAAA,SAAS;AAGT,IAAA,QAAQ;IAOR,WAAA,CAAY,SAAiB,EAAE,QAAgB,EAAA;AAC3C,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS;AAC1B,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ;IAC5B;IAMA,MAAM,GAAA;QACF,OAAO;AACH,YAAA,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ;SAC9C;IACL;;AAxBAC,iBAAA,CAAA;IADCC,oBAAK,CAAC,MAAM,CAAC;;AACK,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAGnBD,iBAAA,CAAA;IADCC,oBAAK,CAAC,MAAM,CAAC;;AACI,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;;;;"}
1
+ {"version":3,"file":"Point.js","sources":["../../../geospatial/Point.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 { field } from '../fieldDecorator';\nimport { typeKey } from '../typeKey';\n\n/**\n * Represents a geographic point with longitude and latitude.\n */\nexport class Point {\n static readonly [typeKey] = 'Point';\n\n @field(Number)\n longitude!: number;\n\n @field(Number)\n latitude!: number;\n\n /**\n * Creates a new Point instance.\n * @param {number} longitude - The longitude of the point.\n * @param {number} latitude - The latitude of the point.\n */\n constructor(longitude: number, latitude: number) {\n this.longitude = longitude;\n this.latitude = latitude;\n }\n\n /**\n * Converts the Point to a GeoJSON representation.\n * @returns {object} GeoJSON representation.\n */\n toJSON(): object {\n return {\n type: 'Point',\n coordinates: [this.longitude, this.latitude]\n };\n }\n}\n"],"names":["typeKey","__decorate","field"],"mappings":";;;;;;MASa,KAAK,CAAA;AACd,IAAA,QAAiBA,eAAO,IAAI,OAAO;AAGnC,IAAA,SAAS;AAGT,IAAA,QAAQ;IAOR,WAAA,CAAY,SAAiB,EAAE,QAAgB,EAAA;AAC3C,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS;AAC1B,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ;IAC5B;IAMA,MAAM,GAAA;QACF,OAAO;AACH,YAAA,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ;SAC9C;IACL;;AAxBAC,iBAAA,CAAA;IADCC,oBAAK,CAAC,MAAM,CAAC;;AACK,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAGnBD,iBAAA,CAAA;IADCC,oBAAK,CAAC,MAAM,CAAC;;AACI,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Polygon.js","sources":["../../../geospatial/Polygon.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 { LinearRing } from './LinearRing';\nimport { typeKey } from '../typeKey';\n\n/**\n * Represents a polygon with an outer shell and optional holes.\n */\nexport class Polygon {\n static readonly [typeKey] = 'Polygon';\n\n shell!: LinearRing;\n holes!: LinearRing[];\n\n /**\n * Creates a new Polygon instance.\n * @param {LinearRing} shell - The outer boundary of the polygon.\n * @param {LinearRing[]} holes - Optional inner boundaries (holes) within the polygon.\n */\n constructor(shell: LinearRing, holes?: LinearRing[]) {\n this.shell = shell;\n this.holes = holes || [];\n }\n\n /**\n * Converts the Polygon to a GeoJSON representation.\n * @returns {object} GeoJSON representation.\n */\n toJSON(): object {\n const rings = [this.shell.toJSON()];\n if (this.holes && this.holes.length > 0) {\n rings.push(...this.holes.map(h => h.toJSON()));\n }\n return {\n type: 'Polygon',\n coordinates: rings\n };\n }\n}\n"],"names":["typeKey"],"mappings":";;;;MASa,OAAO,CAAA;AAChB,IAAA,QAAiBA,eAAO,IAAI,SAAS;AAErC,IAAA,KAAK;AACL,IAAA,KAAK;IAOL,WAAA,CAAY,KAAiB,EAAE,KAAoB,EAAA;AAC/C,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;AAClB,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,EAAE;IAC5B;IAMA,MAAM,GAAA;QACF,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;AACnC,QAAA,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;YACrC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QAClD;QACA,OAAO;AACH,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,WAAW,EAAE;SAChB;IACL;;;;;"}
1
+ {"version":3,"file":"Polygon.js","sources":["../../../geospatial/Polygon.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 { LinearRing } from './LinearRing';\nimport { typeKey } from '../typeKey';\n\n/**\n * Represents a polygon with an outer shell and optional holes.\n */\nexport class Polygon {\n static readonly [typeKey] = 'Polygon';\n\n shell!: LinearRing;\n holes!: LinearRing[];\n\n /**\n * Creates a new Polygon instance.\n * @param {LinearRing} shell - The outer boundary of the polygon.\n * @param {LinearRing[]} holes - Optional inner boundaries (holes) within the polygon.\n */\n constructor(shell: LinearRing, holes?: LinearRing[]) {\n this.shell = shell;\n this.holes = holes || [];\n }\n\n /**\n * Converts the Polygon to a GeoJSON representation.\n * @returns {object} GeoJSON representation.\n */\n toJSON(): object {\n const rings = [this.shell.toJSON()];\n if (this.holes && this.holes.length > 0) {\n rings.push(...this.holes.map(h => h.toJSON()));\n }\n return {\n type: 'Polygon',\n coordinates: rings\n };\n }\n}\n"],"names":["typeKey"],"mappings":";;;;MASa,OAAO,CAAA;AAChB,IAAA,QAAiBA,eAAO,IAAI,SAAS;AAErC,IAAA,KAAK;AACL,IAAA,KAAK;IAOL,WAAA,CAAY,KAAiB,EAAE,KAAoB,EAAA;AAC/C,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;AAClB,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,EAAE;IAC5B;IAMA,MAAM,GAAA;QACF,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;AACnC,QAAA,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;YACrC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QAClD;QACA,OAAO;AACH,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,WAAW,EAAE;SAChB;IACL;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DateJsonConverter.js","sources":["../../../json/DateJsonConverter.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 { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for Date type.\n */\nexport class DateJsonConverter extends JsonConverter<Date> {\n /** @inheritdoc */\n get type(): Constructor<Date> {\n return Date;\n }\n\n /** @inheritdoc */\n read(value: any): Date {\n return new Date(value);\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value.toISOString();\n }\n}\n"],"names":["JsonConverter"],"mappings":";;;;AAWM,MAAO,iBAAkB,SAAQA,2BAAmB,CAAA;AAEtD,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,IAAI;IACf;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;AACX,QAAA,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC;IAC1B;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,CAAC,WAAW,EAAE;IAC9B;AACH;;;;"}
1
+ {"version":3,"file":"DateJsonConverter.js","sources":["../../../json/DateJsonConverter.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 { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for Date type.\n */\nexport class DateJsonConverter extends JsonConverter<Date> {\n /** @inheritdoc */\n get type(): Constructor<Date> {\n return Date;\n }\n\n /** @inheritdoc */\n read(value: any): Date {\n return new Date(value);\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value.toISOString();\n }\n}\n"],"names":["JsonConverter"],"mappings":";;;;AAWM,MAAO,iBAAkB,SAAQA,2BAAmB,CAAA;AAEtD,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,IAAI;IACf;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;AACX,QAAA,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC;IAC1B;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,CAAC,WAAW,EAAE;IAC9B;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DateOnlyJsonConverter.js","sources":["../../../json/DateOnlyJsonConverter.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 { DateOnly } from '../DateOnly';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for DateOnly type.\n */\nexport class DateOnlyJsonConverter extends JsonConverter<DateOnly> {\n /** @inheritdoc */\n get type(): Constructor<DateOnly> {\n return DateOnly;\n }\n\n /** @inheritdoc */\n read(value: any): DateOnly {\n return DateOnly.parse(value.toString());\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value?.toString() ?? '';\n }\n}\n"],"names":["JsonConverter","DateOnly"],"mappings":";;;;;AAYM,MAAO,qBAAsB,SAAQA,2BAAuB,CAAA;AAE9D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,iBAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAOA,iBAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC3C;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;IAClC;AACH;;;;"}
1
+ {"version":3,"file":"DateOnlyJsonConverter.js","sources":["../../../json/DateOnlyJsonConverter.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 { DateOnly } from '../DateOnly';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for DateOnly type.\n */\nexport class DateOnlyJsonConverter extends JsonConverter<DateOnly> {\n /** @inheritdoc */\n get type(): Constructor<DateOnly> {\n return DateOnly;\n }\n\n /** @inheritdoc */\n read(value: any): DateOnly {\n return DateOnly.parse(value.toString());\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value?.toString() ?? '';\n }\n}\n"],"names":["JsonConverter","DateOnly"],"mappings":";;;;;AAYM,MAAO,qBAAsB,SAAQA,2BAAuB,CAAA;AAE9D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,iBAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAOA,iBAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC3C;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;IAClC;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"GuidJsonConverter.js","sources":["../../../json/GuidJsonConverter.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 { Guid } from '../Guid';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for Guid type.\n */\nexport class GuidJsonConverter extends JsonConverter<Guid> {\n /** @inheritdoc */\n get type(): Constructor<Guid> {\n return Guid;\n }\n\n /** @inheritdoc */\n read(value: any): Guid {\n return Guid.parse(value.toString());\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value?.toString() ?? '';\n }\n}\n"],"names":["JsonConverter","Guid"],"mappings":";;;;;AAYM,MAAO,iBAAkB,SAAQA,2BAAmB,CAAA;AAEtD,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,SAAI;IACf;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAOA,SAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACvC;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;IAClC;AACH;;;;"}
1
+ {"version":3,"file":"GuidJsonConverter.js","sources":["../../../json/GuidJsonConverter.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 { Guid } from '../Guid';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for Guid type.\n */\nexport class GuidJsonConverter extends JsonConverter<Guid> {\n /** @inheritdoc */\n get type(): Constructor<Guid> {\n return Guid;\n }\n\n /** @inheritdoc */\n read(value: any): Guid {\n return Guid.parse(value.toString());\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value?.toString() ?? '';\n }\n}\n"],"names":["JsonConverter","Guid"],"mappings":";;;;;AAYM,MAAO,iBAAkB,SAAQA,2BAAmB,CAAA;AAEtD,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,SAAI;IACf;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAOA,SAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACvC;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;IAClC;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"JsonConverter.js","sources":["../../../json/JsonConverter.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/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Base class for JSON converters that handle serialization and deserialization of specific types.\n * Similar to System.Text.Json.Serialization.JsonConverter<T>.\n */\nexport abstract class JsonConverter<T = any> {\n /**\n * Gets the type that this converter handles.\n */\n abstract get type(): Constructor<T>;\n\n /**\n * Determines whether the converter can convert the specified type.\n * @param {Constructor} typeToConvert - The type to check.\n * @returns {boolean} True if the converter can convert the type; otherwise, false.\n * @deprecated Not called by `JsonSerializer` and scheduled for removal in the next major version.\n * A converter is resolved by the type it declares through {@link type}, which is what this would\n * answer anyway, so overriding it has no effect - register a converter per type instead. Wiring it\n * into the lookup is not the plan either: it would force a scan of every converter on the path\n * taken by every plain object, to serve a case a second registration already covers.\n */\n canConvert(typeToConvert: Constructor): boolean {\n return typeToConvert === this.type;\n }\n\n /**\n * Reads and converts the JSON to the target type.\n * @param {any} value - The value to deserialize.\n * @returns {T} The deserialized value.\n */\n abstract read(value: any): T;\n\n /**\n * Writes the value as JSON.\n * @param {T} value - The value to serialize.\n * @returns {any} The serialized value.\n */\n abstract write(value: T): any;\n}\n"],"names":[],"mappings":";;MAWsB,aAAa,CAAA;AAgB/B,IAAA,UAAU,CAAC,aAA0B,EAAA;AACjC,QAAA,OAAO,aAAa,KAAK,IAAI,CAAC,IAAI;IACtC;AAeH;;;;"}
1
+ {"version":3,"file":"JsonConverter.js","sources":["../../../json/JsonConverter.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/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Base class for JSON converters that handle serialization and deserialization of specific types.\n * Similar to System.Text.Json.Serialization.JsonConverter<T>.\n */\nexport abstract class JsonConverter<T = any> {\n /**\n * Gets the type that this converter handles.\n */\n abstract get type(): Constructor<T>;\n\n /**\n * Determines whether the converter can convert the specified type.\n * @param {Constructor} typeToConvert - The type to check.\n * @returns {boolean} True if the converter can convert the type; otherwise, false.\n * @deprecated Not called by `JsonSerializer` and scheduled for removal in the next major version.\n * A converter is resolved by the type it declares through {@link type}, which is what this would\n * answer anyway, so overriding it has no effect - register a converter per type instead. Wiring it\n * into the lookup is not the plan either: it would force a scan of every converter on the path\n * taken by every plain object, to serve a case a second registration already covers.\n */\n canConvert(typeToConvert: Constructor): boolean {\n return typeToConvert === this.type;\n }\n\n /**\n * Reads and converts the JSON to the target type.\n * @param {any} value - The value to deserialize.\n * @returns {T} The deserialized value.\n */\n abstract read(value: any): T;\n\n /**\n * Writes the value as JSON.\n * @param {T} value - The value to serialize.\n * @returns {any} The serialized value.\n */\n abstract write(value: T): any;\n}\n"],"names":[],"mappings":";;MAWsB,aAAa,CAAA;AAgB/B,IAAA,UAAU,CAAC,aAA0B,EAAA;AACjC,QAAA,OAAO,aAAa,KAAK,IAAI,CAAC,IAAI;IACtC;AAeH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LineStringJsonConverter.js","sources":["../../../json/LineStringJsonConverter.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 { Point, LineString } from '../geospatial';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for LineString type (GeoJSON format).\n */\nexport class LineStringJsonConverter extends JsonConverter<LineString> {\n /** @inheritdoc */\n get type(): Constructor<LineString> {\n return LineString;\n }\n\n /** @inheritdoc */\n read(value: any): LineString {\n if (value === null || value === undefined) {\n throw new Error('Cannot deserialize null or undefined to LineString');\n }\n if (value.type !== 'LineString' || !value.coordinates || value.coordinates.length < 2) {\n throw new Error('Cannot deserialize LineString: invalid GeoJSON format');\n }\n const points = value.coordinates.map((coord: number[]) => new Point(coord[0], coord[1]));\n return new LineString(points);\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value?.toJSON() ?? null;\n }\n}\n"],"names":["JsonConverter","LineString","Point"],"mappings":";;;;;;AAYM,MAAO,uBAAwB,SAAQA,2BAAyB,CAAA;AAElE,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,qBAAU;IACrB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;AACvC,YAAA,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC;QACzE;AACA,QAAA,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;AACnF,YAAA,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC;QAC5E;QACA,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,KAAe,KAAK,IAAIC,WAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACxF,QAAA,OAAO,IAAID,qBAAU,CAAC,MAAM,CAAC;IACjC;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,IAAI;IAClC;AACH;;;;"}
1
+ {"version":3,"file":"LineStringJsonConverter.js","sources":["../../../json/LineStringJsonConverter.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 { Point, LineString } from '../geospatial';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for LineString type (GeoJSON format).\n */\nexport class LineStringJsonConverter extends JsonConverter<LineString> {\n /** @inheritdoc */\n get type(): Constructor<LineString> {\n return LineString;\n }\n\n /** @inheritdoc */\n read(value: any): LineString {\n if (value === null || value === undefined) {\n throw new Error('Cannot deserialize null or undefined to LineString');\n }\n if (value.type !== 'LineString' || !value.coordinates || value.coordinates.length < 2) {\n throw new Error('Cannot deserialize LineString: invalid GeoJSON format');\n }\n const points = value.coordinates.map((coord: number[]) => new Point(coord[0], coord[1]));\n return new LineString(points);\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value?.toJSON() ?? null;\n }\n}\n"],"names":["JsonConverter","LineString","Point"],"mappings":";;;;;;AAYM,MAAO,uBAAwB,SAAQA,2BAAyB,CAAA;AAElE,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,qBAAU;IACrB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;AACvC,YAAA,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC;QACzE;AACA,QAAA,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;AACnF,YAAA,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC;QAC5E;QACA,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,KAAe,KAAK,IAAIC,WAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACxF,QAAA,OAAO,IAAID,qBAAU,CAAC,MAAM,CAAC;IACjC;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,IAAI;IAClC;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PointJsonConverter.js","sources":["../../../json/PointJsonConverter.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 { Point } from '../geospatial';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for Point type (GeoJSON format).\n */\nexport class PointJsonConverter extends JsonConverter<Point> {\n /** @inheritdoc */\n get type(): Constructor<Point> {\n return Point;\n }\n\n /** @inheritdoc */\n read(value: any): Point {\n if (value === null || value === undefined) {\n throw new Error('Cannot deserialize null or undefined to Point');\n }\n if (value.type !== 'Point' || !value.coordinates || value.coordinates.length !== 2) {\n throw new Error('Cannot deserialize Point: invalid GeoJSON format');\n }\n return new Point(value.coordinates[0], value.coordinates[1]);\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value?.toJSON() ?? null;\n }\n}\n"],"names":["JsonConverter","Point"],"mappings":";;;;;AAYM,MAAO,kBAAmB,SAAQA,2BAAoB,CAAA;AAExD,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,WAAK;IAChB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;AACvC,YAAA,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC;QACpE;AACA,QAAA,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;AAChF,YAAA,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC;QACvE;AACA,QAAA,OAAO,IAAIA,WAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAChE;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,IAAI;IAClC;AACH;;;;"}
1
+ {"version":3,"file":"PointJsonConverter.js","sources":["../../../json/PointJsonConverter.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 { Point } from '../geospatial';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for Point type (GeoJSON format).\n */\nexport class PointJsonConverter extends JsonConverter<Point> {\n /** @inheritdoc */\n get type(): Constructor<Point> {\n return Point;\n }\n\n /** @inheritdoc */\n read(value: any): Point {\n if (value === null || value === undefined) {\n throw new Error('Cannot deserialize null or undefined to Point');\n }\n if (value.type !== 'Point' || !value.coordinates || value.coordinates.length !== 2) {\n throw new Error('Cannot deserialize Point: invalid GeoJSON format');\n }\n return new Point(value.coordinates[0], value.coordinates[1]);\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value?.toJSON() ?? null;\n }\n}\n"],"names":["JsonConverter","Point"],"mappings":";;;;;AAYM,MAAO,kBAAmB,SAAQA,2BAAoB,CAAA;AAExD,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,WAAK;IAChB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;AACvC,YAAA,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC;QACpE;AACA,QAAA,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;AAChF,YAAA,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC;QACvE;AACA,QAAA,OAAO,IAAIA,WAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAChE;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,IAAI;IAClC;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PolygonJsonConverter.js","sources":["../../../json/PolygonJsonConverter.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 { Point, LinearRing, Polygon } from '../geospatial';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for Polygon type (GeoJSON format).\n */\nexport class PolygonJsonConverter extends JsonConverter<Polygon> {\n /** @inheritdoc */\n get type(): Constructor<Polygon> {\n return Polygon;\n }\n\n /** @inheritdoc */\n read(value: any): Polygon {\n if (value === null || value === undefined) {\n throw new Error('Cannot deserialize null or undefined to Polygon');\n }\n if (value.type !== 'Polygon' || !value.coordinates || value.coordinates.length === 0) {\n throw new Error('Cannot deserialize Polygon: invalid GeoJSON format');\n }\n const shell = new LinearRing(value.coordinates[0].map((coord: number[]) => new Point(coord[0], coord[1])));\n const holes = value.coordinates.slice(1).map((ring: number[][]) => \n new LinearRing(ring.map((coord: number[]) => new Point(coord[0], coord[1])))\n );\n return new Polygon(shell, holes);\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value?.toJSON() ?? null;\n }\n}\n"],"names":["JsonConverter","Polygon","LinearRing","Point"],"mappings":";;;;;;;AAYM,MAAO,oBAAqB,SAAQA,2BAAsB,CAAA;AAE5D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,eAAO;IAClB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;AACvC,YAAA,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC;QACtE;AACA,QAAA,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;AAClF,YAAA,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC;QACzE;AACA,QAAA,MAAM,KAAK,GAAG,IAAIC,qBAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAe,KAAK,IAAIC,WAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1G,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAgB,KAC1D,IAAID,qBAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAe,KAAK,IAAIC,WAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/E;AACD,QAAA,OAAO,IAAIF,eAAO,CAAC,KAAK,EAAE,KAAK,CAAC;IACpC;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,IAAI;IAClC;AACH;;;;"}
1
+ {"version":3,"file":"PolygonJsonConverter.js","sources":["../../../json/PolygonJsonConverter.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 { Point, LinearRing, Polygon } from '../geospatial';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for Polygon type (GeoJSON format).\n */\nexport class PolygonJsonConverter extends JsonConverter<Polygon> {\n /** @inheritdoc */\n get type(): Constructor<Polygon> {\n return Polygon;\n }\n\n /** @inheritdoc */\n read(value: any): Polygon {\n if (value === null || value === undefined) {\n throw new Error('Cannot deserialize null or undefined to Polygon');\n }\n if (value.type !== 'Polygon' || !value.coordinates || value.coordinates.length === 0) {\n throw new Error('Cannot deserialize Polygon: invalid GeoJSON format');\n }\n const shell = new LinearRing(value.coordinates[0].map((coord: number[]) => new Point(coord[0], coord[1])));\n const holes = value.coordinates.slice(1).map((ring: number[][]) => \n new LinearRing(ring.map((coord: number[]) => new Point(coord[0], coord[1])))\n );\n return new Polygon(shell, holes);\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value?.toJSON() ?? null;\n }\n}\n"],"names":["JsonConverter","Polygon","LinearRing","Point"],"mappings":";;;;;;;AAYM,MAAO,oBAAqB,SAAQA,2BAAsB,CAAA;AAE5D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,eAAO;IAClB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;AACvC,YAAA,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC;QACtE;AACA,QAAA,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;AAClF,YAAA,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC;QACzE;AACA,QAAA,MAAM,KAAK,GAAG,IAAIC,qBAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAe,KAAK,IAAIC,WAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1G,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAgB,KAC1D,IAAID,qBAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAe,KAAK,IAAIC,WAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/E;AACD,QAAA,OAAO,IAAIF,eAAO,CAAC,KAAK,EAAE,KAAK,CAAC;IACpC;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,IAAI;IAClC;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TimeOnlyJsonConverter.js","sources":["../../../json/TimeOnlyJsonConverter.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 { TimeOnly } from '../TimeOnly';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for TimeOnly type.\n */\nexport class TimeOnlyJsonConverter extends JsonConverter<TimeOnly> {\n /** @inheritdoc */\n get type(): Constructor<TimeOnly> {\n return TimeOnly;\n }\n\n /** @inheritdoc */\n read(value: any): TimeOnly {\n return TimeOnly.parse(value.toString());\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value?.toString() ?? '';\n }\n}\n"],"names":["JsonConverter","TimeOnly"],"mappings":";;;;;AAYM,MAAO,qBAAsB,SAAQA,2BAAuB,CAAA;AAE9D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,iBAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAOA,iBAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC3C;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;IAClC;AACH;;;;"}
1
+ {"version":3,"file":"TimeOnlyJsonConverter.js","sources":["../../../json/TimeOnlyJsonConverter.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 { TimeOnly } from '../TimeOnly';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for TimeOnly type.\n */\nexport class TimeOnlyJsonConverter extends JsonConverter<TimeOnly> {\n /** @inheritdoc */\n get type(): Constructor<TimeOnly> {\n return TimeOnly;\n }\n\n /** @inheritdoc */\n read(value: any): TimeOnly {\n return TimeOnly.parse(value.toString());\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value?.toString() ?? '';\n }\n}\n"],"names":["JsonConverter","TimeOnly"],"mappings":";;;;;AAYM,MAAO,qBAAsB,SAAQA,2BAAuB,CAAA;AAE9D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,iBAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAOA,iBAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC3C;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;IAClC;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TimeSpanJsonConverter.js","sources":["../../../json/TimeSpanJsonConverter.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 { TimeSpan } from '../TimeSpan';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for TimeSpan type.\n */\nexport class TimeSpanJsonConverter extends JsonConverter<TimeSpan> {\n /** @inheritdoc */\n get type(): Constructor<TimeSpan> {\n return TimeSpan;\n }\n\n /** @inheritdoc */\n read(value: any): TimeSpan {\n return TimeSpan.parse(value.toString());\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value?.toString() ?? '';\n }\n}\n"],"names":["JsonConverter","TimeSpan"],"mappings":";;;;;AAYM,MAAO,qBAAsB,SAAQA,2BAAuB,CAAA;AAE9D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,iBAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAOA,iBAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC3C;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;IAClC;AACH;;;;"}
1
+ {"version":3,"file":"TimeSpanJsonConverter.js","sources":["../../../json/TimeSpanJsonConverter.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 { TimeSpan } from '../TimeSpan';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * JSON converter for TimeSpan type.\n */\nexport class TimeSpanJsonConverter extends JsonConverter<TimeSpan> {\n /** @inheritdoc */\n get type(): Constructor<TimeSpan> {\n return TimeSpan;\n }\n\n /** @inheritdoc */\n read(value: any): TimeSpan {\n return TimeSpan.parse(value.toString());\n }\n\n /** @inheritdoc */\n write(value: any): any {\n return value?.toString() ?? '';\n }\n}\n"],"names":["JsonConverter","TimeSpan"],"mappings":";;;;;AAYM,MAAO,qBAAsB,SAAQA,2BAAuB,CAAA;AAE9D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,iBAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAOA,iBAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC3C;AAGA,IAAA,KAAK,CAAC,KAAU,EAAA;AACZ,QAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;IAClC;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ValueMapJsonConverter.js","sources":["../../../json/ValueMapJsonConverter.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 { ValueMap } from '../ValueMap';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/**\n * JSON converter for ValueMap type.\n * \n * Note: ValueMap deserialization is handled separately by JsonSerializer.deserializeValueMapFromField\n * based on field metadata to properly deserialize keys and values according to their types.\n * The read() method is not used directly during normal deserialization.\n */\nexport class ValueMapJsonConverter extends JsonConverter<ValueMap<any, any>> {\n // Circular dependency workaround - these will be injected by JsonSerializer\n private static serializeMapKey: ((key: any) => string) | null = null;\n private static convertTypesOnInstance: ((instance: any) => any) | null = null;\n\n /**\n * Sets the required helper functions from JsonSerializer to avoid circular dependencies.\n */\n static setHelpers(serializeMapKey: (key: any) => string, convertTypesOnInstance: (instance: any) => any): void {\n ValueMapJsonConverter.serializeMapKey = serializeMapKey;\n ValueMapJsonConverter.convertTypesOnInstance = convertTypesOnInstance;\n }\n\n /** @inheritdoc */\n get type(): Constructor<ValueMap<any, any>> {\n return ValueMap;\n }\n\n /** @inheritdoc */\n read(_value: any): ValueMap<any, any> {\n // ValueMap deserialization is handled separately by JsonSerializer.deserializeValueMapFromField\n // based on field metadata to properly deserialize keys and values according to their types.\n // This method should not be called directly during normal deserialization.\n const valueMap = new ValueMap<any, any>();\n return valueMap;\n }\n\n /** @inheritdoc */\n write(value: ValueMap<any, any>): any {\n if (!ValueMapJsonConverter.serializeMapKey || !ValueMapJsonConverter.convertTypesOnInstance) {\n throw new Error('ValueMapJsonConverter helpers not initialized. Call setHelpers() first.');\n }\n\n const converted: any = {};\n for (const [key, mapValue] of value.entries()) {\n converted[ValueMapJsonConverter.serializeMapKey(key)] = ValueMapJsonConverter.convertTypesOnInstance(mapValue);\n }\n return converted;\n }\n}\n"],"names":["JsonConverter","ValueMap"],"mappings":";;;;;AAiBM,MAAO,qBAAsB,SAAQA,2BAAiC,CAAA;AAEhE,IAAA,OAAO,eAAe,GAAkC,IAAI;AAC5D,IAAA,OAAO,sBAAsB,GAAoC,IAAI;AAK7E,IAAA,OAAO,UAAU,CAAC,eAAqC,EAAE,sBAA8C,EAAA;AACnG,QAAA,qBAAqB,CAAC,eAAe,GAAG,eAAe;AACvD,QAAA,qBAAqB,CAAC,sBAAsB,GAAG,sBAAsB;IACzE;AAGA,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,iBAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,MAAW,EAAA;AAIZ,QAAA,MAAM,QAAQ,GAAG,IAAIA,iBAAQ,EAAY;AACzC,QAAA,OAAO,QAAQ;IACnB;AAGA,IAAA,KAAK,CAAC,KAAyB,EAAA;QAC3B,IAAI,CAAC,qBAAqB,CAAC,eAAe,IAAI,CAAC,qBAAqB,CAAC,sBAAsB,EAAE;AACzF,YAAA,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC;QAC9F;QAEA,MAAM,SAAS,GAAQ,EAAE;AACzB,QAAA,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE;AAC3C,YAAA,SAAS,CAAC,qBAAqB,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,qBAAqB,CAAC,sBAAsB,CAAC,QAAQ,CAAC;QAClH;AACA,QAAA,OAAO,SAAS;IACpB;;;;;"}
1
+ {"version":3,"file":"ValueMapJsonConverter.js","sources":["../../../json/ValueMapJsonConverter.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 { ValueMap } from '../ValueMap';\nimport { JsonConverter } from './JsonConverter';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/**\n * JSON converter for ValueMap type.\n * \n * Note: ValueMap deserialization is handled separately by JsonSerializer.deserializeValueMapFromField\n * based on field metadata to properly deserialize keys and values according to their types.\n * The read() method is not used directly during normal deserialization.\n */\nexport class ValueMapJsonConverter extends JsonConverter<ValueMap<any, any>> {\n // Circular dependency workaround - these will be injected by JsonSerializer\n private static serializeMapKey: ((key: any) => string) | null = null;\n private static convertTypesOnInstance: ((instance: any) => any) | null = null;\n\n /**\n * Sets the required helper functions from JsonSerializer to avoid circular dependencies.\n */\n static setHelpers(serializeMapKey: (key: any) => string, convertTypesOnInstance: (instance: any) => any): void {\n ValueMapJsonConverter.serializeMapKey = serializeMapKey;\n ValueMapJsonConverter.convertTypesOnInstance = convertTypesOnInstance;\n }\n\n /** @inheritdoc */\n get type(): Constructor<ValueMap<any, any>> {\n return ValueMap;\n }\n\n /** @inheritdoc */\n read(_value: any): ValueMap<any, any> {\n // ValueMap deserialization is handled separately by JsonSerializer.deserializeValueMapFromField\n // based on field metadata to properly deserialize keys and values according to their types.\n // This method should not be called directly during normal deserialization.\n const valueMap = new ValueMap<any, any>();\n return valueMap;\n }\n\n /** @inheritdoc */\n write(value: ValueMap<any, any>): any {\n if (!ValueMapJsonConverter.serializeMapKey || !ValueMapJsonConverter.convertTypesOnInstance) {\n throw new Error('ValueMapJsonConverter helpers not initialized. Call setHelpers() first.');\n }\n\n const converted: any = {};\n for (const [key, mapValue] of value.entries()) {\n converted[ValueMapJsonConverter.serializeMapKey(key)] = ValueMapJsonConverter.convertTypesOnInstance(mapValue);\n }\n return converted;\n }\n}\n"],"names":["JsonConverter","ValueMap"],"mappings":";;;;;AAiBM,MAAO,qBAAsB,SAAQA,2BAAiC,CAAA;AAEhE,IAAA,OAAO,eAAe,GAAkC,IAAI;AAC5D,IAAA,OAAO,sBAAsB,GAAoC,IAAI;AAK7E,IAAA,OAAO,UAAU,CAAC,eAAqC,EAAE,sBAA8C,EAAA;AACnG,QAAA,qBAAqB,CAAC,eAAe,GAAG,eAAe;AACvD,QAAA,qBAAqB,CAAC,sBAAsB,GAAG,sBAAsB;IACzE;AAGA,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAOC,iBAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,MAAW,EAAA;AAIZ,QAAA,MAAM,QAAQ,GAAG,IAAIA,iBAAQ,EAAY;AACzC,QAAA,OAAO,QAAQ;IACnB;AAGA,IAAA,KAAK,CAAC,KAAyB,EAAA;QAC3B,IAAI,CAAC,qBAAqB,CAAC,eAAe,IAAI,CAAC,qBAAqB,CAAC,sBAAsB,EAAE;AACzF,YAAA,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC;QAC9F;QAEA,MAAM,SAAS,GAAQ,EAAE;AACzB,QAAA,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE;AAC3C,YAAA,SAAS,CAAC,qBAAqB,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,qBAAqB,CAAC,sBAAsB,CAAC,QAAQ,CAAC;QAClH;AACA,QAAA,OAAO,SAAS;IACpB;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"reflection.js","sources":["../../reflection.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\n/**\n * Reflect metadata polyfill\n * Provides a minimal implementation of the reflect-metadata API using WeakMap.\n * If native Reflect metadata API is already available, this is a no-op.\n *\n * Limitations:\n * - Only supports object targets (not primitives)\n * - Property-level metadata uses a secondary Map structure keyed by property\n * - Does not support all advanced reflect-metadata features\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-namespace */\n\ndeclare global {\n namespace Reflect {\n function defineMetadata(metadataKey: string | symbol, metadataValue: any, target: any, propertyKey?: string | symbol): void;\n function getMetadata(metadataKey: string | symbol, target: any, propertyKey?: string | symbol): any;\n function getOwnMetadata(metadataKey: string | symbol, target: any, propertyKey?: string | symbol): any;\n function hasMetadata(metadataKey: string | symbol, target: any, propertyKey?: string | symbol): boolean;\n function hasOwnMetadata(metadataKey: string | symbol, target: any, propertyKey?: string | symbol): boolean;\n function getMetadataKeys(target: any, propertyKey?: string | symbol): (string | symbol)[];\n function getOwnMetadataKeys(target: any, propertyKey?: string | symbol): (string | symbol)[];\n function deleteMetadata(metadataKey: string | symbol, target: any, propertyKey?: string | symbol): boolean;\n function metadata(metadataKey: string | symbol, metadataValue: any): (target: any, propertyKey?: string | symbol) => void;\n }\n}\n\n// Standard decorators expose their class metadata through Symbol.metadata. Define it before any\n// decorated class is evaluated on runtimes that do not provide it yet. Symbol.for keeps the value\n// stable if more than one copy of this package is loaded in the same realm.\nconst symbolConstructor = Symbol as unknown as { metadata?: unknown };\nif (symbolConstructor.metadata === undefined || symbolConstructor.metadata === null) {\n Object.defineProperty(Symbol, 'metadata', {\n configurable: true,\n enumerable: false,\n value: Symbol.for('Symbol.metadata'),\n writable: false\n });\n}\n\n// Check if native metadata API is available by testing for multiple methods\nif (typeof Reflect.defineMetadata !== 'function' || typeof Reflect.getOwnMetadata !== 'function') {\n const metadataMap = new WeakMap<any, Map<string | symbol, any>>();\n const propertyMetadataMap = new WeakMap<any, Map<string | symbol, Map<string | symbol, any>>>();\n\n function getMetadataStore(target: any, propertyKey?: string | symbol): Map<string | symbol, any> {\n if (propertyKey != null) {\n let propMap = propertyMetadataMap.get(target);\n if (!propMap) {\n propMap = new Map();\n propertyMetadataMap.set(target, propMap);\n }\n if (!propMap.has(propertyKey)) {\n propMap.set(propertyKey, new Map());\n }\n return propMap.get(propertyKey)!;\n } else {\n if (!metadataMap.has(target)) {\n metadataMap.set(target, new Map());\n }\n return metadataMap.get(target)!;\n }\n }\n\n function getMetadataStoreIfExists(target: any, propertyKey?: string | symbol): Map<string | symbol, any> | undefined {\n if (propertyKey != null) {\n const propMap = propertyMetadataMap.get(target);\n return propMap?.get(propertyKey);\n } else {\n return metadataMap.get(target);\n }\n }\n\n Reflect.defineMetadata = function (metadataKey: string | symbol, metadataValue: any, target: any, propertyKey?: string | symbol): void {\n const store = getMetadataStore(target, propertyKey);\n store.set(metadataKey, metadataValue);\n };\n\n Reflect.getMetadata = function (metadataKey: string | symbol, target: any, propertyKey?: string | symbol): any {\n let currentTarget = target;\n while (currentTarget !== null && currentTarget !== undefined) {\n const store = getMetadataStoreIfExists(currentTarget, propertyKey);\n if (store && store.has(metadataKey)) {\n return store.get(metadataKey);\n }\n currentTarget = Object.getPrototypeOf(currentTarget);\n }\n return undefined;\n };\n\n Reflect.getOwnMetadata = function (metadataKey: string | symbol, target: any, propertyKey?: string | symbol): any {\n const store = getMetadataStoreIfExists(target, propertyKey);\n return store?.get(metadataKey);\n };\n\n Reflect.hasMetadata = function (metadataKey: string | symbol, target: any, propertyKey?: string | symbol): boolean {\n let currentTarget = target;\n while (currentTarget !== null && currentTarget !== undefined) {\n const store = getMetadataStoreIfExists(currentTarget, propertyKey);\n if (store && store.has(metadataKey)) {\n return true;\n }\n currentTarget = Object.getPrototypeOf(currentTarget);\n }\n return false;\n };\n\n Reflect.hasOwnMetadata = function (metadataKey: string | symbol, target: any, propertyKey?: string | symbol): boolean {\n const store = getMetadataStoreIfExists(target, propertyKey);\n return store ? store.has(metadataKey) : false;\n };\n\n Reflect.getMetadataKeys = function (target: any, propertyKey?: string | symbol): (string | symbol)[] {\n const keys = new Set<string | symbol>();\n let currentTarget = target;\n while (currentTarget !== null && currentTarget !== undefined) {\n const store = getMetadataStoreIfExists(currentTarget, propertyKey);\n if (store) {\n for (const key of store.keys()) {\n keys.add(key);\n }\n }\n currentTarget = Object.getPrototypeOf(currentTarget);\n }\n return Array.from(keys);\n };\n\n Reflect.getOwnMetadataKeys = function (target: any, propertyKey?: string | symbol): (string | symbol)[] {\n const store = getMetadataStoreIfExists(target, propertyKey);\n return store ? Array.from(store.keys()) : [];\n };\n\n Reflect.deleteMetadata = function (metadataKey: string | symbol, target: any, propertyKey?: string | symbol): boolean {\n const store = getMetadataStoreIfExists(target, propertyKey);\n return store ? store.delete(metadataKey) : false;\n };\n\n // Decorator factory used by TypeScript's emitDecoratorMetadata output (the tslib\n // __metadata helper). Without this, 'design:type'/'design:paramtypes'/'design:returntype'\n // metadata is never recorded, which breaks constructor parameter type reflection.\n Reflect.metadata = function (metadataKey: string | symbol, metadataValue: any): (target: any, propertyKey?: string | symbol) => void {\n return function (target: any, propertyKey?: string | symbol): void {\n Reflect.defineMetadata(metadataKey, metadataValue, target, propertyKey);\n };\n };\n}\n\nexport {};\n"],"names":[],"mappings":";;AAkCA,MAAM,iBAAiB,GAAG,MAA2C;AACrE,IAAI,iBAAiB,CAAC,QAAQ,KAAK,SAAS,IAAI,iBAAiB,CAAC,QAAQ,KAAK,IAAI,EAAE;AACjF,IAAA,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE;AACtC,QAAA,YAAY,EAAE,IAAI;AAClB,QAAA,UAAU,EAAE,KAAK;AACjB,QAAA,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC;AACpC,QAAA,QAAQ,EAAE;AACb,KAAA,CAAC;AACN;AAGA,IAAI,OAAO,OAAO,CAAC,cAAc,KAAK,UAAU,IAAI,OAAO,OAAO,CAAC,cAAc,KAAK,UAAU,EAAE;AAC9F,IAAA,MAAM,WAAW,GAAG,IAAI,OAAO,EAAkC;AACjE,IAAA,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAAwD;AAE/F,IAAA,SAAS,gBAAgB,CAAC,MAAW,EAAE,WAA6B,EAAA;AAChE,QAAA,IAAI,WAAW,IAAI,IAAI,EAAE;YACrB,IAAI,OAAO,GAAG,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC;YAC7C,IAAI,CAAC,OAAO,EAAE;AACV,gBAAA,OAAO,GAAG,IAAI,GAAG,EAAE;AACnB,gBAAA,mBAAmB,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;YAC5C;YACA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;gBAC3B,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,GAAG,EAAE,CAAC;YACvC;AACA,YAAA,OAAO,OAAO,CAAC,GAAG,CAA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AC,GAAG,CAAC,GAAG,CAAC;gBACjB;YACJ;AACA,YAAA,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC;QACxD;AACA,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;AAC3B,IAAA,CAAC;AAED,IAAA,OAAO,CAAC,kBAAkB,GAAG,UAAU,MAAW,EAAE,WAA6B,EAAA;QAC7E,MAAM,KAAK,GAAG,wBAAwB,CAAC,MAAM,EAAE,WAAW,CAAC;AAC3D,QAAA,OAAO,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE;AAChD,IAAA,CAAC;IAED,OAAO,CAAC,cAAc,GAAG,UAAU,WAA4B,EAAE,MAAW,EAAE,WAA6B,EAAA;QACvG,MAAM,KAAK,GAAG,wBAAwB,CAAC,MAAM,EAAE,WAAW,CAAC;AAC3D,QAAA,OAAO,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,KAAK;AACpD,IAAA,CAAC;AAKD,IAAA,OAAO,CAAC,QAAQ,GAAG,UAAU,WAA4B,EAAE,aAAkB,EAAA;QACzE,OAAO,UAAU,MAAW,EAAE,WAA6B,EAAA;YACvD,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,CAAC;AAC3E,QAAA,CAAC;AACL,IAAA,CAAC;AACL;;"}
1
+ {"version":3,"file":"reflection.js","sources":["../../reflection.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\n/**\n * Reflect metadata polyfill\n * Provides a minimal implementation of the reflect-metadata API using WeakMap.\n * If native Reflect metadata API is already available, this is a no-op.\n *\n * Limitations:\n * - Only supports object targets (not primitives)\n * - Property-level metadata uses a secondary Map structure keyed by property\n * - Does not support all advanced reflect-metadata features\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-namespace */\n\ndeclare global {\n namespace Reflect {\n function defineMetadata(metadataKey: string | symbol, metadataValue: any, target: any, propertyKey?: string | symbol): void;\n function getMetadata(metadataKey: string | symbol, target: any, propertyKey?: string | symbol): any;\n function getOwnMetadata(metadataKey: string | symbol, target: any, propertyKey?: string | symbol): any;\n function hasMetadata(metadataKey: string | symbol, target: any, propertyKey?: string | symbol): boolean;\n function hasOwnMetadata(metadataKey: string | symbol, target: any, propertyKey?: string | symbol): boolean;\n function getMetadataKeys(target: any, propertyKey?: string | symbol): (string | symbol)[];\n function getOwnMetadataKeys(target: any, propertyKey?: string | symbol): (string | symbol)[];\n function deleteMetadata(metadataKey: string | symbol, target: any, propertyKey?: string | symbol): boolean;\n function metadata(metadataKey: string | symbol, metadataValue: any): (target: any, propertyKey?: string | symbol) => void;\n }\n}\n\n// Standard decorators expose their class metadata through Symbol.metadata. Define it before any\n// decorated class is evaluated on runtimes that do not provide it yet. Symbol.for keeps the value\n// stable if more than one copy of this package is loaded in the same realm.\nconst symbolConstructor = Symbol as unknown as { metadata?: unknown };\nif (symbolConstructor.metadata === undefined || symbolConstructor.metadata === null) {\n Object.defineProperty(Symbol, 'metadata', {\n configurable: true,\n enumerable: false,\n value: Symbol.for('Symbol.metadata'),\n writable: false\n });\n}\n\n// Check if native metadata API is available by testing for multiple methods\nif (typeof Reflect.defineMetadata !== 'function' || typeof Reflect.getOwnMetadata !== 'function') {\n const metadataMap = new WeakMap<any, Map<string | symbol, any>>();\n const propertyMetadataMap = new WeakMap<any, Map<string | symbol, Map<string | symbol, any>>>();\n\n function getMetadataStore(target: any, propertyKey?: string | symbol): Map<string | symbol, any> {\n if (propertyKey != null) {\n let propMap = propertyMetadataMap.get(target);\n if (!propMap) {\n propMap = new Map();\n propertyMetadataMap.set(target, propMap);\n }\n if (!propMap.has(propertyKey)) {\n propMap.set(propertyKey, new Map());\n }\n return propMap.get(propertyKey)!;\n } else {\n if (!metadataMap.has(target)) {\n metadataMap.set(target, new Map());\n }\n return metadataMap.get(target)!;\n }\n }\n\n function getMetadataStoreIfExists(target: any, propertyKey?: string | symbol): Map<string | symbol, any> | undefined {\n if (propertyKey != null) {\n const propMap = propertyMetadataMap.get(target);\n return propMap?.get(propertyKey);\n } else {\n return metadataMap.get(target);\n }\n }\n\n Reflect.defineMetadata = function (metadataKey: string | symbol, metadataValue: any, target: any, propertyKey?: string | symbol): void {\n const store = getMetadataStore(target, propertyKey);\n store.set(metadataKey, metadataValue);\n };\n\n Reflect.getMetadata = function (metadataKey: string | symbol, target: any, propertyKey?: string | symbol): any {\n let currentTarget = target;\n while (currentTarget !== null && currentTarget !== undefined) {\n const store = getMetadataStoreIfExists(currentTarget, propertyKey);\n if (store && store.has(metadataKey)) {\n return store.get(metadataKey);\n }\n currentTarget = Object.getPrototypeOf(currentTarget);\n }\n return undefined;\n };\n\n Reflect.getOwnMetadata = function (metadataKey: string | symbol, target: any, propertyKey?: string | symbol): any {\n const store = getMetadataStoreIfExists(target, propertyKey);\n return store?.get(metadataKey);\n };\n\n Reflect.hasMetadata = function (metadataKey: string | symbol, target: any, propertyKey?: string | symbol): boolean {\n let currentTarget = target;\n while (currentTarget !== null && currentTarget !== undefined) {\n const store = getMetadataStoreIfExists(currentTarget, propertyKey);\n if (store && store.has(metadataKey)) {\n return true;\n }\n currentTarget = Object.getPrototypeOf(currentTarget);\n }\n return false;\n };\n\n Reflect.hasOwnMetadata = function (metadataKey: string | symbol, target: any, propertyKey?: string | symbol): boolean {\n const store = getMetadataStoreIfExists(target, propertyKey);\n return store ? store.has(metadataKey) : false;\n };\n\n Reflect.getMetadataKeys = function (target: any, propertyKey?: string | symbol): (string | symbol)[] {\n const keys = new Set<string | symbol>();\n let currentTarget = target;\n while (currentTarget !== null && currentTarget !== undefined) {\n const store = getMetadataStoreIfExists(currentTarget, propertyKey);\n if (store) {\n for (const key of store.keys()) {\n keys.add(key);\n }\n }\n currentTarget = Object.getPrototypeOf(currentTarget);\n }\n return Array.from(keys);\n };\n\n Reflect.getOwnMetadataKeys = function (target: any, propertyKey?: string | symbol): (string | symbol)[] {\n const store = getMetadataStoreIfExists(target, propertyKey);\n return store ? Array.from(store.keys()) : [];\n };\n\n Reflect.deleteMetadata = function (metadataKey: string | symbol, target: any, propertyKey?: string | symbol): boolean {\n const store = getMetadataStoreIfExists(target, propertyKey);\n return store ? store.delete(metadataKey) : false;\n };\n\n // Decorator factory used by TypeScript's emitDecoratorMetadata output (the tslib\n // __metadata helper). Without this, 'design:type'/'design:paramtypes'/'design:returntype'\n // metadata is never recorded, which breaks constructor parameter type reflection.\n Reflect.metadata = function (metadataKey: string | symbol, metadataValue: any): (target: any, propertyKey?: string | symbol) => void {\n return function (target: any, propertyKey?: string | symbol): void {\n Reflect.defineMetadata(metadataKey, metadataValue, target, propertyKey);\n };\n };\n}\n\nexport {};\n"],"names":[],"mappings":";;AAkCA,MAAM,iBAAiB,GAAG,MAA2C;AACrE,IAAI,iBAAiB,CAAC,QAAQ,KAAK,SAAS,IAAI,iBAAiB,CAAC,QAAQ,KAAK,IAAI,EAAE;AACjF,IAAA,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE;AACtC,QAAA,YAAY,EAAE,IAAI;AAClB,QAAA,UAAU,EAAE,KAAK;AACjB,QAAA,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC;AACpC,QAAA,QAAQ,EAAE;AACb,KAAA,CAAC;AACN;AAGA,IAAI,OAAO,OAAO,CAAC,cAAc,KAAK,UAAU,IAAI,OAAO,OAAO,CAAC,cAAc,KAAK,UAAU,EAAE;AAC9F,IAAA,MAAM,WAAW,GAAG,IAAI,OAAO,EAAkC;AACjE,IAAA,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAAwD;AAE/F,IAAA,SAAS,gBAAgB,CAAC,MAAW,EAAE,WAA6B,EAAA;AAChE,QAAA,IAAI,WAAW,IAAI,IAAI,EAAE;YACrB,IAAI,OAAO,GAAG,mBAAmB,CA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ACL"}
@@ -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"],"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 +1 @@
1
- {"version":3,"file":"ConceptAs.js","sources":["../../ConceptAs.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.\nimport { typeKey } from './typeKey';\n\n/**\n * Expresses a Concept as another type, usually a primitive such as string or number.\n * @template T The type of the underlying value.\n */\nexport abstract class ConceptAs<T> {\n static readonly [typeKey] = 'ConceptAs';\n\n /**\n * Initializes a new instance of ConceptAs.\n * @param {T} value The value to initialize the concept with.\n */\n constructor(readonly value: T) {}\n\n /**\n * Returns the primitive value of the concept.\n * @returns {T} The underlying value.\n */\n valueOf(): T {\n return this.value;\n }\n\n /**\n * Returns the string representation of the concept.\n * @returns {string} String representation of the underlying value.\n */\n toString(): string {\n return String(this.value);\n }\n}\n"],"names":[],"mappings":";;MAQsB,SAAS,CAAA;AAON,IAAA,KAAA;AANrB,IAAA,QAAiB,OAAO,IAAI,WAAW;AAMvC,IAAA,WAAA,CAAqB,KAAQ,EAAA;QAAR,IAAA,CAAA,KAAK,GAAL,KAAK;IAAM;IAMhC,OAAO,GAAA;QACH,OAAO,IAAI,CAAC,KAAK;IACrB;IAMA,QAAQ,GAAA;AACJ,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;IAC7B;;;;;"}
1
+ {"version":3,"file":"ConceptAs.js","sources":["../../ConceptAs.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.\nimport { typeKey } from './typeKey';\n\n/**\n * Expresses a Concept as another type, usually a primitive such as string or number.\n * @template T The type of the underlying value.\n */\nexport abstract class ConceptAs<T> {\n static readonly [typeKey] = 'ConceptAs';\n\n /**\n * Initializes a new instance of ConceptAs.\n * @param {T} value The value to initialize the concept with.\n */\n constructor(readonly value: T) {}\n\n /**\n * Returns the primitive value of the concept.\n * @returns {T} The underlying value.\n */\n valueOf(): T {\n return this.value;\n }\n\n /**\n * Returns the string representation of the concept.\n * @returns {string} String representation of the underlying value.\n */\n toString(): string {\n return String(this.value);\n }\n}\n"],"names":[],"mappings":";;MAQsB,SAAS,CAAA;AAON,IAAA,KAAA;AANrB,IAAA,QAAiB,OAAO,IAAI,WAAW;AAMvC,IAAA,WAAA,CAAqB,KAAQ,EAAA;QAAR,IAAA,CAAA,KAAK,GAAL,KAAK;IAAM;IAMhC,OAAO,GAAA;QACH,OAAO,IAAI,CAAC,KAAK;IACrB;IAMA,QAAQ,GAAA;AACJ,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;IAC7B;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DateOnly.js","sources":["../../DateOnly.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 { field } from './fieldDecorator';\nimport { typeKey } from './typeKey';\n\nconst dateOnlyRegex = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\n/**\n * Represents a date with no time and no time zone - a day on a calendar.\n * @remarks\n * Deliberately not a JavaScript `Date`. A `Date` is an instant, and a calendar date is not one: turning\n * `2026-05-12` into a `Date` produces UTC midnight, which every browser-local getter west of UTC reads back as\n * the 11th. That is a wrong answer that looks right, and it is only wrong for users in some time zones - which is\n * how it survives development in others.\n *\n * Holding the three parts the server sent means there is no instant to convert and nothing to shift. Where a\n * `Date` is genuinely wanted - to feed a date picker, or to do arithmetic - {@link toDate} constructs one in the\n * local time zone, and the choice is then visible at the call site making it.\n */\nexport class DateOnly {\n static readonly [typeKey] = 'DateOnly';\n\n /**\n * The year.\n */\n @field(Number)\n year!: number;\n\n /**\n * The month, 1 through 12.\n */\n @field(Number)\n month!: number;\n\n /**\n * The day of the month, 1 through 31.\n */\n @field(Number)\n day!: number;\n\n /**\n * Creates a {@link DateOnly} from its parts.\n * @param year The year.\n * @param month The month, 1 through 12.\n * @param day The day of the month.\n * @returns The {@link DateOnly}.\n */\n static from(year: number, month: number, day: number): DateOnly {\n const dateOnly = new DateOnly();\n dateOnly.year = year;\n dateOnly.month = month;\n dateOnly.day = day;\n return dateOnly;\n }\n\n /**\n * Parses the ISO-8601 calendar date the server sends, `yyyy-MM-dd`.\n * @param value The value to parse.\n * @returns The {@link DateOnly}.\n */\n static parse(value: string): DateOnly {\n const match = dateOnlyRegex.exec(value);\n if (match === null) {\n throw new Error(`Invalid DateOnly format: ${value}`);\n }\n\n return DateOnly.from(parseInt(match[1], 10), parseInt(match[2], 10), parseInt(match[3], 10));\n }\n\n /**\n * Creates a {@link DateOnly} for the calendar date a {@link Date} falls on in the local time zone.\n * @param date The date to take the calendar date of.\n * @returns The {@link DateOnly}.\n * @remarks\n * Reads the local parts rather than the UTC ones, because the calendar date a moment falls on is a question\n * only a time zone can answer, and the local one is the one the person looking at the screen is in.\n */\n static fromDate(date: Date): DateOnly {\n return DateOnly.from(date.getFullYear(), date.getMonth() + 1, date.getDate());\n }\n\n /**\n * Converts to a {@link Date} at midnight in the local time zone.\n * @returns The {@link Date}.\n * @remarks\n * Local rather than UTC, so the date a caller reads back with `getDate()` is the one they started with. This\n * invents a time that was never sent, which is why it is a method to call rather than what the value is.\n */\n toDate(): Date {\n return new Date(this.year, this.month - 1, this.day);\n }\n\n /**\n * Gets the ISO-8601 representation, `yyyy-MM-dd` - the same form the server sent.\n * @returns The string.\n */\n toString(): string {\n const month = this.month.toString().padStart(2, '0');\n const day = this.day.toString().padStart(2, '0');\n return `${this.year.toString().padStart(4, '0')}-${month}-${day}`;\n }\n\n /**\n * Determines whether this is the same calendar date as another.\n * @param other The other date.\n * @returns True when they are the same date.\n */\n equals(other: DateOnly | undefined | null): boolean {\n return !!other && this.year === other.year && this.month === other.month && this.day === other.day;\n }\n}\n"],"names":[],"mappings":";;;;AAMA,MAAM,aAAa,GAAG,2BAA2B;MAcpC,QAAQ,CAAA;AACjB,IAAA,QAAiB,OAAO,IAAI,UAAU;AAMtC,IAAA,IAAI;AAMJ,IAAA,KAAK;AAML,IAAA,GAAG;AASH,IAAA,OAAO,IAAI,CAAC,IAAY,EAAE,KAAa,EAAE,GAAW,EAAA;AAChD,QAAA,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE;AAC/B,QAAA,QAAQ,CAAC,IAAI,GAAG,IAAI;AACpB,QAAA,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AA,EAAI,KAAK,CAAA,CAAA,EAAI,GAAG,EAAE;IACrE;AAOA,IAAA,MAAM,CAAC,KAAkC,EAAA;QACrC,OAAO,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG;IACtG;;AAnFA,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACA,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAMd,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACC,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAMf,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACD,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,KAAA,EAAA,MAAA,CAAA;;;;"}
1
+ {"version":3,"file":"DateOnly.js","sources":["../../DateOnly.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 { field } from './fieldDecorator';\nimport { typeKey } from './typeKey';\n\nconst dateOnlyRegex = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\n/**\n * Represents a date with no time and no time zone - a day on a calendar.\n * @remarks\n * Deliberately not a JavaScript `Date`. A `Date` is an instant, and a calendar date is not one: turning\n * `2026-05-12` into a `Date` produces UTC midnight, which every browser-local getter west of UTC reads back as\n * the 11th. That is a wrong answer that looks right, and it is only wrong for users in some time zones - which is\n * how it survives development in others.\n *\n * Holding the three parts the server sent means there is no instant to convert and nothing to shift. Where a\n * `Date` is genuinely wanted - to feed a date picker, or to do arithmetic - {@link toDate} constructs one in the\n * local time zone, and the choice is then visible at the call site making it.\n */\nexport class DateOnly {\n static readonly [typeKey] = 'DateOnly';\n\n /**\n * The year.\n */\n @field(Number)\n year!: number;\n\n /**\n * The month, 1 through 12.\n */\n @field(Number)\n month!: number;\n\n /**\n * The day of the month, 1 through 31.\n */\n @field(Number)\n day!: number;\n\n /**\n * Creates a {@link DateOnly} from its parts.\n * @param year The year.\n * @param month The month, 1 through 12.\n * @param day The day of the month.\n * @returns The {@link DateOnly}.\n */\n static from(year: number, month: number, day: number): DateOnly {\n const dateOnly = new DateOnly();\n dateOnly.year = year;\n dateOnly.month = month;\n dateOnly.day = day;\n return dateOnly;\n }\n\n /**\n * Parses the ISO-8601 calendar date the server sends, `yyyy-MM-dd`.\n * @param value The value to parse.\n * @returns The {@link DateOnly}.\n */\n static parse(value: string): DateOnly {\n const match = dateOnlyRegex.exec(value);\n if (match === null) {\n throw new Error(`Invalid DateOnly format: ${value}`);\n }\n\n return DateOnly.from(parseInt(match[1], 10), parseInt(match[2], 10), parseInt(match[3], 10));\n }\n\n /**\n * Creates a {@link DateOnly} for the calendar date a {@link Date} falls on in the local time zone.\n * @param date The date to take the calendar date of.\n * @returns The {@link DateOnly}.\n * @remarks\n * Reads the local parts rather than the UTC ones, because the calendar date a moment falls on is a question\n * only a time zone can answer, and the local one is the one the person looking at the screen is in.\n */\n static fromDate(date: Date): DateOnly {\n return DateOnly.from(date.getFullYear(), date.getMonth() + 1, date.getDate());\n }\n\n /**\n * Converts to a {@link Date} at midnight in the local time zone.\n * @returns The {@link Date}.\n * @remarks\n * Local rather than UTC, so the date a caller reads back with `getDate()` is the one they started with. This\n * invents a time that was never sent, which is why it is a method to call rather than what the value is.\n */\n toDate(): Date {\n return new Date(this.year, this.month - 1, this.day);\n }\n\n /**\n * Gets the ISO-8601 representation, `yyyy-MM-dd` - the same form the server sent.\n * @returns The string.\n */\n toString(): string {\n const month = this.month.toString().padStart(2, '0');\n const day = this.day.toString().padStart(2, '0');\n return `${this.year.toString().padStart(4, '0')}-${month}-${day}`;\n }\n\n /**\n * Determines whether this is the same calendar date as another.\n * @param other The other date.\n * @returns True when they are the same date.\n */\n equals(other: DateOnly | undefined | null): boolean {\n return !!other && this.year === other.year && this.month === other.month && this.day === other.day;\n }\n}\n"],"names":[],"mappings":";;;;AAMA,MAAM,aAAa,GAAG,2BAA2B;MAcpC,QAAQ,CAAA;AACjB,IAAA,QAAiB,OAAO,IAAI,UAAU;AAMtC,IAAA,IAAI;AAMJ,IAAA,KAAK;AAML,IAAA,GAAG;AASH,IAAA,OAAO,IAAI,CAAC,IAAY,EAAE,KAAa,EAAE,GAAW,EAAA;AAChD,QAAA,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE;AAC/B,QAAA,QAAQ,CAAC,IAAI,GAAG,IAAI;AACpB,QAAA,QAAQ,CAAC,KAAK,GAAG,KAAK;AACtB,QAAA,QAAQ,CAAC,GAAG,GAAG,GAAG;AAClB,QAAA,OAAO,QAAQ;IACnB;IAOA,OAAO,KAAK,CAAC,KAAa,EAAA;QACtB,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC;AACvC,QAAA,IAAI,KAAK,KAAK,IAAI,EAAE;AAChB,YAAA,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,CAAA,CAAE,CAAC;QACxD;AAEA,QAAA,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChG;IAUA,OAAO,QAAQ,CAAC,IAAU,EAAA;QACtB,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;IACjF;IASA,MAAM,GAAA;AACF,QAAA,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC;IACxD;IAMA,QAAQ,GAAA;AACJ,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AACpD,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAChD,QAAA,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA,CAAA,EAAI,KAAK,CAAA,CAAA,EAAI,GAAG,EAAE;IACrE;AAOA,IAAA,MAAM,CAAC,KAAkC,EAAA;QACrC,OAAO,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG;IACtG;;AAnFA,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACA,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAMd,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACC,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAMf,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACD,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,KAAA,EAAA,MAAA,CAAA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DerivedType.js","sources":["../../DerivedType.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 './reflection';\nimport { Constructor } from './Constructor';\n\nexport class DerivedType {\n static set(target: Constructor, identifier: string, targetType?: Constructor) {\n Reflect.defineMetadata('derivedType', identifier, target);\n if (targetType) {\n const existing: Constructor[] = Reflect.getOwnMetadata('derivedTypes', targetType) ?? [];\n if (!existing.includes(target)) {\n existing.push(target);\n Reflect.defineMetadata('derivedTypes', existing, targetType);\n }\n }\n }\n\n static get(target: Constructor): string {\n return Reflect.getOwnMetadata('derivedType', target);\n }\n\n static getDerivedTypesFor(targetType: Constructor): Constructor[] {\n return Reflect.getOwnMetadata('derivedTypes', targetType) ?? [];\n }\n}\n"],"names":[],"mappings":";;MAMa,WAAW,CAAA;AACpB,IAAA,OAAO,GAAG,CAAC,MAAmB,EAAE,UAAkB,EAAE,UAAwB,EAAA;QACxE,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,UAAU,EAAE,MAAM,CAAC;QACzD,IAAI,UAAU,EAAE;AACZ,YAAA,MAAM,QAAQ,GAAkB,OAAO,CAAC,cAAc,CAAC,cAAc,EAAE,UAAU,CAAC,IAAI,EAAE;YACxF,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;AAC5B,gBAAA,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;gBACrB,OAAO,CAAC,cAAc,CAAC,cAAc,EAAE,QAAQ,EAAE,UAAU,CAAC;YAChE;QACJ;IACJ;IAEA,OAAO,GAAG,CAAC,MAAmB,EAAA;QAC1B,OAAO,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,MAAM,CAAC;IACxD;IAEA,OAAO,kBAAkB,CAAC,UAAuB,EAAA;QAC7C,OAAO,OAAO,CAAC,cAAc,CAAC,cAAc,EAAE,UAAU,CAAC,IAAI,EAAE;IACnE;AACH;;;;"}
1
+ {"version":3,"file":"DerivedType.js","sources":["../../DerivedType.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 './reflection';\nimport { Constructor } from './Constructor';\n\nexport class DerivedType {\n static set(target: Constructor, identifier: string, targetType?: Constructor) {\n Reflect.defineMetadata('derivedType', identifier, target);\n if (targetType) {\n const existing: Constructor[] = Reflect.getOwnMetadata('derivedTypes', targetType) ?? [];\n if (!existing.includes(target)) {\n existing.push(target);\n Reflect.defineMetadata('derivedTypes', existing, targetType);\n }\n }\n }\n\n static get(target: Constructor): string {\n return Reflect.getOwnMetadata('derivedType', target);\n }\n\n static getDerivedTypesFor(targetType: Constructor): Constructor[] {\n return Reflect.getOwnMetadata('derivedTypes', targetType) ?? [];\n }\n}\n"],"names":[],"mappings":";;MAMa,WAAW,CAAA;AACpB,IAAA,OAAO,GAAG,CAAC,MAAmB,EAAE,UAAkB,EAAE,UAAwB,EAAA;QACxE,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,UAAU,EAAE,MAAM,CAAC;QACzD,IAAI,UAAU,EAAE;AACZ,YAAA,MAAM,QAAQ,GAAkB,OAAO,CAAC,cAAc,CAAC,cAAc,EAAE,UAAU,CAAC,IAAI,EAAE;YACxF,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;AAC5B,gBAAA,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;gBACrB,OAAO,CAAC,cAAc,CAAC,cAAc,EAAE,QAAQ,EAAE,UAAU,CAAC;YAChE;QACJ;IACJ;IAEA,OAAO,GAAG,CAAC,MAAmB,EAAA;QAC1B,OAAO,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,MAAM,CAAC;IACxD;IAEA,OAAO,kBAAkB,CAAC,UAAuB,EAAA;QAC7C,OAAO,OAAO,CAAC,cAAc,CAAC,cAAc,EAAE,UAAU,CAAC,IAAI,EAAE;IACnE;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sources":["../../Field.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 * Represents a field on a type.\n */\n export class Field {\n constructor(\n readonly name: string,\n readonly type: Constructor,\n readonly enumerable: boolean,\n readonly derivatives: Constructor[],\n readonly genericArguments: Constructor[]) {\n }\n}\n"],"names":[],"mappings":"MAQc,KAAK,CAAA;AAEF,IAAA,IAAA;AACA,IAAA,IAAA;AACA,IAAA,UAAA;AACA,IAAA,WAAA;AACA,IAAA,gBAAA;IALb,WAAA,CACa,IAAY,EACZ,IAAiB,EACjB,UAAmB,EACnB,WAA0B,EAC1B,gBAA+B,EAAA;QAJ/B,IAAA,CAAA,IAAI,GAAJ,IAAI;QACJ,IAAA,CAAA,IAAI,GAAJ,IAAI;QACJ,IAAA,CAAA,UAAU,GAAV,UAAU;QACV,IAAA,CAAA,WAAW,GAAX,WAAW;QACX,IAAA,CAAA,gBAAgB,GAAhB,gBAAgB;IAC7B;AACH;;;;"}
1
+ {"version":3,"file":"Field.js","sources":["../../Field.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 * Represents a field on a type.\n */\n export class Field {\n constructor(\n readonly name: string,\n readonly type: Constructor,\n readonly enumerable: boolean,\n readonly derivatives: Constructor[],\n readonly genericArguments: Constructor[]) {\n }\n}\n"],"names":[],"mappings":"MAQc,KAAK,CAAA;AAEF,IAAA,IAAA;AACA,IAAA,IAAA;AACA,IAAA,UAAA;AACA,IAAA,WAAA;AACA,IAAA,gBAAA;IALb,WAAA,CACa,IAAY,EACZ,IAAiB,EACjB,UAAmB,EACnB,WAA0B,EAC1B,gBAA+B,EAAA;QAJ/B,IAAA,CAAA,IAAI,GAAJ,IAAI;QACJ,IAAA,CAAA,IAAI,GAAJ,IAAI;QACJ,IAAA,CAAA,UAAU,GAAV,UAAU;QACV,IAAA,CAAA,WAAW,GAAX,WAAW;QACX,IAAA,CAAA,gBAAgB,GAAhB,gBAAgB;IAC7B;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Fields.js","sources":["../../Fields.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 './reflection';\nimport { Constructor } from './Constructor';\nimport { Field } from './Field';\nimport { getOwnDecoratorFieldsForType } from './fieldDecoratorMetadata';\n\n/**\n * Represents a system working with fields on types.\n */\nexport class Fields {\n static addFieldToType(target: Constructor, field: string, fieldType: Constructor, enumerable: boolean, derivatives: Constructor[], genericArguments: Constructor[]) {\n let fields: Map<string, Field> = new Map<string, Field>();\n if (Reflect.hasOwnMetadata('fields', target)) {\n fields = Reflect.getOwnMetadata('fields', target);\n }\n fields.set(field, new Field(field, fieldType, enumerable, derivatives, genericArguments));\n Reflect.defineMetadata('fields', fields, target);\n }\n\n static getFieldsForType(target: Constructor): Field[] {\n // Fields are stored as legacy own metadata on the constructor or as standard own metadata on\n // its Symbol.metadata object, so a derived type only carries the fields it declares itself.\n // Walk the prototype (inheritance) chain and merge every ancestor's fields so that deserializing\n // a derived type also populates the fields inherited from its base types.\n // Process from the base type down to the target so a derived field overrides a base field of the\n // same name.\n const chain: Constructor[] = [];\n let current: Constructor | undefined = target;\n while (current && current !== Function.prototype && current !== Object) {\n chain.push(current);\n current = Object.getPrototypeOf(current) as Constructor | undefined;\n }\n\n const fieldsByName = new Map<string, Field>();\n for (let index = chain.length - 1; index >= 0; index--) {\n const type = chain[index];\n if (Reflect.hasOwnMetadata('fields', type)) {\n const fieldsMap = Reflect.getOwnMetadata('fields', type) as Map<string, Field>;\n for (const [name, field] of fieldsMap.entries()) {\n fieldsByName.set(name, field);\n }\n }\n\n for (const field of getOwnDecoratorFieldsForType(type)) {\n fieldsByName.set(field.name, field);\n }\n }\n\n return [...fieldsByName.values()];\n }\n}\n"],"names":[],"mappings":";;;;MAWa,MAAM,CAAA;AACf,IAAA,OAAO,cAAc,CAAC,MAAmB,EAAE,KAAa,EAAE,SAAsB,EAAE,UAAmB,EAAE,WAA0B,EAAE,gBAA+B,EAAA;AAC9J,QAAA,IAAI,MAAM,GAAuB,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AK,IAAI,4BAA4B,CAAC,IAAI,CAAC,EAAE;gBACpD,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;YACvC;QACJ;AAEA,QAAA,OAAO,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;IACrC;AACH;;;;"}
1
+ {"version":3,"file":"Fields.js","sources":["../../Fields.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 './reflection';\nimport { Constructor } from './Constructor';\nimport { Field } from './Field';\nimport { getOwnDecoratorFieldsForType } from './fieldDecoratorMetadata';\n\n/**\n * Represents a system working with fields on types.\n */\nexport class Fields {\n static addFieldToType(target: Constructor, field: string, fieldType: Constructor, enumerable: boolean, derivatives: Constructor[], genericArguments: Constructor[]) {\n let fields: Map<string, Field> = new Map<string, Field>();\n if (Reflect.hasOwnMetadata('fields', target)) {\n fields = Reflect.getOwnMetadata('fields', target);\n }\n fields.set(field, new Field(field, fieldType, enumerable, derivatives, genericArguments));\n Reflect.defineMetadata('fields', fields, target);\n }\n\n static getFieldsForType(target: Constructor): Field[] {\n // Fields are stored as legacy own metadata on the constructor or as standard own metadata on\n // its Symbol.metadata object, so a derived type only carries the fields it declares itself.\n // Walk the prototype (inheritance) chain and merge every ancestor's fields so that deserializing\n // a derived type also populates the fields inherited from its base types.\n // Process from the base type down to the target so a derived field overrides a base field of the\n // same name.\n const chain: Constructor[] = [];\n let current: Constructor | undefined = target;\n while (current && current !== Function.prototype && current !== Object) {\n chain.push(current);\n current = Object.getPrototypeOf(current) as Constructor | undefined;\n }\n\n const fieldsByName = new Map<string, Field>();\n for (let index = chain.length - 1; index >= 0; index--) {\n const type = chain[index];\n if (Reflect.hasOwnMetadata('fields', type)) {\n const fieldsMap = Reflect.getOwnMetadata('fields', type) as Map<string, Field>;\n for (const [name, field] of fieldsMap.entries()) {\n fieldsByName.set(name, field);\n }\n }\n\n for (const field of getOwnDeco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