@cratis/fundamentals 7.18.2 → 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.
- package/README.md +26 -2
- package/dist/cjs/ConceptAs.js.map +1 -1
- package/dist/cjs/DateOnly.js.map +1 -1
- package/dist/cjs/DerivedType.js.map +1 -1
- package/dist/cjs/Field.js.map +1 -1
- package/dist/cjs/Fields.js.map +1 -1
- package/dist/cjs/Guid.js.map +1 -1
- package/dist/cjs/JsonSerializer.js.map +1 -1
- package/dist/cjs/PropertyAccessorDescriptor.js.map +1 -1
- package/dist/cjs/PropertyPathResolverProxyHandler.js.map +1 -1
- package/dist/cjs/TimeOnly.js.map +1 -1
- package/dist/cjs/TimeSpan.js.map +1 -1
- package/dist/cjs/ValueMap.js.map +1 -1
- package/dist/cjs/_virtual/_tslib.js.map +1 -1
- package/dist/cjs/derivedTypeDecorator.js.map +1 -1
- package/dist/cjs/duplicateInstanceGuard.js.map +1 -1
- package/dist/cjs/fieldDecorator.js.map +1 -1
- package/dist/cjs/fieldDecoratorMetadata.js.map +1 -1
- package/dist/cjs/geospatial/LineString.js.map +1 -1
- package/dist/cjs/geospatial/LinearRing.js.map +1 -1
- package/dist/cjs/geospatial/Point.js.map +1 -1
- package/dist/cjs/geospatial/Polygon.js.map +1 -1
- package/dist/cjs/json/DateJsonConverter.js.map +1 -1
- package/dist/cjs/json/DateOnlyJsonConverter.js.map +1 -1
- package/dist/cjs/json/GuidJsonConverter.js.map +1 -1
- package/dist/cjs/json/JsonConverter.js.map +1 -1
- package/dist/cjs/json/LineStringJsonConverter.js.map +1 -1
- package/dist/cjs/json/PointJsonConverter.js.map +1 -1
- package/dist/cjs/json/PolygonJsonConverter.js.map +1 -1
- package/dist/cjs/json/TimeOnlyJsonConverter.js.map +1 -1
- package/dist/cjs/json/TimeSpanJsonConverter.js.map +1 -1
- package/dist/cjs/json/ValueMapJsonConverter.js.map +1 -1
- package/dist/cjs/reflection.js.map +1 -1
- package/dist/cjs/typeKey.js.map +1 -1
- package/dist/esm/ConceptAs.js.map +1 -1
- package/dist/esm/DateOnly.js.map +1 -1
- package/dist/esm/DerivedType.js.map +1 -1
- package/dist/esm/Field.js.map +1 -1
- package/dist/esm/Fields.js.map +1 -1
- package/dist/esm/Guid.js.map +1 -1
- package/dist/esm/JsonSerializer.js.map +1 -1
- package/dist/esm/PropertyAccessorDescriptor.js.map +1 -1
- package/dist/esm/PropertyPathResolverProxyHandler.js.map +1 -1
- package/dist/esm/TimeOnly.js.map +1 -1
- package/dist/esm/TimeSpan.js.map +1 -1
- package/dist/esm/ValueMap.js.map +1 -1
- package/dist/esm/_virtual/_tslib.js.map +1 -1
- package/dist/esm/derivedTypeDecorator.js.map +1 -1
- package/dist/esm/duplicateInstanceGuard.js.map +1 -1
- package/dist/esm/fieldDecorator.js.map +1 -1
- package/dist/esm/fieldDecoratorMetadata.js.map +1 -1
- package/dist/esm/geospatial/LineString.js.map +1 -1
- package/dist/esm/geospatial/LinearRing.js.map +1 -1
- package/dist/esm/geospatial/Point.js.map +1 -1
- package/dist/esm/geospatial/Polygon.js.map +1 -1
- package/dist/esm/json/DateJsonConverter.js.map +1 -1
- package/dist/esm/json/DateOnlyJsonConverter.js.map +1 -1
- package/dist/esm/json/GuidJsonConverter.js.map +1 -1
- package/dist/esm/json/JsonConverter.js.map +1 -1
- package/dist/esm/json/LineStringJsonConverter.js.map +1 -1
- package/dist/esm/json/PointJsonConverter.js.map +1 -1
- package/dist/esm/json/PolygonJsonConverter.js.map +1 -1
- package/dist/esm/json/TimeOnlyJsonConverter.js.map +1 -1
- package/dist/esm/json/TimeSpanJsonConverter.js.map +1 -1
- package/dist/esm/json/ValueMapJsonConverter.js.map +1 -1
- package/dist/esm/typeKey.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -3
- package/dist/vite.config.d.mts +0 -3
- package/dist/vite.config.d.mts.map +0 -1
- package/dist/vite.config.mjs +0 -5
- package/dist/vite.config.mjs.map +0 -1
package/dist/esm/TimeSpan.js.map
CHANGED
|
@@ -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":[],"mappings":";;;;AAOA,MAAM,aAAa,GAAG,6DAA6D;MAKtE,QAAQ,CAAA;AACjB,IAAA,QAAiB,OAAO,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,K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,MAAM,CAAC;;AACK,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAGnB,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACM,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAGpB,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACa,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,mBAAA,EAAA,MAAA,CAAA;AAG3B,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACa,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,mBAAA,EAAA,MAAA,CAAA;AAG3B,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACY,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,kBAAA,EAAA,MAAA,CAAA;AAG1B,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACQ,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;AAGtB,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACQ,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;;;;"}
|
|
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":[],"mappings":";;;;AAOA,MAA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AAA,MAAA,CAAA;AAG1B,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACQ,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;AAGtB,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACQ,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;;"}
|
package/dist/esm/ValueMap.js.map
CHANGED
|
@@ -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":[],"mappings":";;MAOa,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AAK;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":[],"mappings":";;MAOa,QAAQ,CAAA;AACjB,IAAA,QAAiB,OAAO,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":[],"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;QACjC,WAAW,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/D,WAAW,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":[],"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;QACjC,WAAW,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/D,WAAW,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,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,CAAC;AAOD,MAAM,eAAe,GAAG,CAAC,OAAiB,KAAU;IAChD,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU;QAAE;IAE1E,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,KAAK,KAAK,KAAK,GAAG,CAAC,CAAA,EAAA,EAAK,MAAM,CAAA,CAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AAExF,IAAA,OAAO,CAAC,IAAI,CACR,iCAAiC,OAAO,CAAC,MAAM,CAAA,sEAAA,CAAwE;QACvH,2HAA2H;QAC3H,uHAAuH;QACvH,wHAAwH;AACxH,QAAA,CAAA,6CAAA,EAAgD,SAAS,CAAA,EAAA,CAAI;QAC7D,2HAA2H;QAC3H,0HAA0H;AAC1H,QAAA,oFAAoF,CAAC;AAC7F,CAAC;AAMM,MAAM,sBAAsB,GAAG,MAAW;AAC7C,IAAA,IAAI,UAAU;QAAE;IAChB,UAAU,GAAG,IAAI;AAEjB,IAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,kBAAkB,CAAC;AAC5C,IAAA,MAAM,OAAO,GAAa,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,GAAG,EAAE;AACjE,IAAA,IAAI,OAAO,KAAK,QAAQ,EAAE;AACtB,QAAA,OAAO,CAAC,kBAAkB,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,sC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AAgD,SAAS,CAAA,EAAA,CAAI;QAC7D,2HAA2H;QAC3H,0HAA0H;AAC1H,QAAA,oFAAoF,CAAC;AAC7F,CAAC;AAMM,MAAM,sBAAsB,GAAG,MAAW;AAC7C,IAAA,IAAI,UAAU;QAAE;IAChB,UAAU,GAAG,IAAI;AAEjB,IAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,kBAAkB,CAAC;AAC5C,IAAA,MAAM,OAAO,GAAa,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,GAAG,EAAE;AACjE,IAAA,IAAI,OAAO,KAAK,QAAQ,EAAE;AACtB,QAAA,OAAO,CAAC,kBAAkB,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldDecorator.js","sources":["../../fieldDecorator.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 { 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":[],"mappings":";;;;AAeA,MAAM,cAAc,GAAG,CAAC,KAAyC,KAA2B;IACxF,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;AACtD,CAAC;AAEK,SAAU,KAAK,CAAC,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AC,qDAAqD,CAAC;QAEjG,2BAA2B,CACvB,OAAO,CAAC,QAAQ,EAChB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,sBAAsB,CAAC,CAAC;IACnG;AAEA,IAAA,SAAS,cAAc,CAAC,MAA0B,EAAE,WAA4B,EAAA;QAC5E,IAAI,OAAO,WAAW,KAAK,QAAQ;AAAE,YAAA,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC;QACtG,IAAI,OAAO,WAAW,KAAK,QAAQ;AAAE,YAAA,MAAM,IAAI,SAAS,CAAC,wDAAwD,CAAC;AAClH,QAAA,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,UAAU;AAAE,YAAA,MAAM,IAAI,SAAS,CAAC,sCAAsC,CAAC;AAExG,QAAA,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAA0B,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,sBAAsB,CAAC;IAC5I;AAEA,IAAA,OAAO,SAAS;AACpB
|
|
1
|
+
{"version":3,"file":"fieldDecorator.js","sources":["../../fieldDecorator.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 { 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":[],"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,EA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,2BAA2B,CACvB,OAAO,CAAC,QAAQ,EAChB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,sBAAsB,CAAC,CAAC;IACnG;AAEA,IAAA,SAAS,cAAc,CAAC,MAA0B,EAAE,WAA4B,EAAA;QAC5E,IAAI,OAAO,WAAW,KAAK,QAAQ;AAAE,YAAA,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC;QACtG,IAAI,OAAO,WAAW,KAAK,QAAQ;AAAE,YAAA,MAAM,IAAI,SAAS,CAAC,wDAAwD,CAAC;AAClH,QAAA,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,UAAU;AAAE,YAAA,MAAM,IAAI,SAAS,CAAC,sCAAsC,CAAC;AAExG,QAAA,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAA0B,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,sBAAsB,CAAC;IAC5I;AAEA,IAAA,OAAO,SAAS;AACpB;;"}
|
|
@@ -1 +1 @@
|
|
|
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
|
+
{"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":[],"mappings":";;MASa,UAAU,CAAA;AACnB,IAAA,QAAiB,OAAO,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":[],"mappings":";;MASa,UAAU,CAAA;AACnB,IAAA,QAAiB,OAAO,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":[],"mappings":";;;;MASa,KAAK,CAAA;AACd,IAAA,QAAiB,OAAO,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;;AAxBA,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACK,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAGnB,UAAA,CAAA;IADC,KAAK,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":[],"mappings":";;;;MASa,KAAK,CAAA;AACd,IAAA,QAAiB,OAAO,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;;AAxBA,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;;AACK,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAGnB,UAAA,CAAA;IADC,KAAK,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":[],"mappings":";;MASa,OAAO,CAAA;AAChB,IAAA,QAAiB,OAAO,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":[],"mappings":";;MASa,OAAO,CAAA;AAChB,IAAA,QAAiB,OAAO,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":[],"mappings":";;AAWM,MAAO,iBAAkB,SAAQ,aAAmB,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":[],"mappings":";;AAWM,MAAO,iBAAkB,SAAQ,aAAmB,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":[],"mappings":";;;AAYM,MAAO,qBAAsB,SAAQ,aAAuB,CAAA;AAE9D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,QAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAO,QAAQ,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":[],"mappings":";;;AAYM,MAAO,qBAAsB,SAAQ,aAAuB,CAAA;AAE9D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,QAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAO,QAAQ,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":[],"mappings":";;;AAYM,MAAO,iBAAkB,SAAQ,aAAmB,CAAA;AAEtD,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,IAAI;IACf;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAO,IAAI,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":[],"mappings":";;;AAYM,MAAO,iBAAkB,SAAQ,aAAmB,CAAA;AAEtD,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,IAAI;IACf;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAO,IAAI,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":[],"mappings":";;;;AAYM,MAAO,uBAAwB,SAAQ,aAAyB,CAAA;AAElE,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,UAAU;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,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACxF,QAAA,OAAO,IAAI,UAAU,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":[],"mappings":";;;;AAYM,MAAO,uBAAwB,SAAQ,aAAyB,CAAA;AAElE,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,UAAU;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,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACxF,QAAA,OAAO,IAAI,UAAU,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":[],"mappings":";;;AAYM,MAAO,kBAAmB,SAAQ,aAAoB,CAAA;AAExD,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,KAAK;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,IAAI,KAAK,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":[],"mappings":";;;AAYM,MAAO,kBAAmB,SAAQ,aAAoB,CAAA;AAExD,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,KAAK;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,IAAI,KAAK,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":[],"mappings":";;;;;AAYM,MAAO,oBAAqB,SAAQ,aAAsB,CAAA;AAE5D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,OAAO;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,IAAI,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAe,KAAK,IAAI,KAAK,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,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAe,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/E;AACD,QAAA,OAAO,IAAI,OAAO,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":[],"mappings":";;;;;AAYM,MAAO,oBAAqB,SAAQ,aAAsB,CAAA;AAE5D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,OAAO;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,IAAI,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAe,KAAK,IAAI,KAAK,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,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAe,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/E;AACD,QAAA,OAAO,IAAI,OAAO,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":[],"mappings":";;;AAYM,MAAO,qBAAsB,SAAQ,aAAuB,CAAA;AAE9D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,QAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAO,QAAQ,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":[],"mappings":";;;AAYM,MAAO,qBAAsB,SAAQ,aAAuB,CAAA;AAE9D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,QAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAO,QAAQ,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":[],"mappings":";;;AAYM,MAAO,qBAAsB,SAAQ,aAAuB,CAAA;AAE9D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,QAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAO,QAAQ,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":[],"mappings":";;;AAYM,MAAO,qBAAsB,SAAQ,aAAuB,CAAA;AAE9D,IAAA,IAAI,IAAI,GAAA;AACJ,QAAA,OAAO,QAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,KAAU,EAAA;QACX,OAAO,QAAQ,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":[],"mappings":";;;AAiBM,MAAO,qBAAsB,SAAQ,aAAiC,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,OAAO,QAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,MAAW,EAAA;AAIZ,QAAA,MAAM,QAAQ,GAAG,IAAI,QAAQ,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":[],"mappings":";;;AAiBM,MAAO,qBAAsB,SAAQ,aAAiC,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,OAAO,QAAQ;IACnB;AAGA,IAAA,IAAI,CAAC,MAAW,EAAA;AAIZ,QAAA,MAAM,QAAQ,GAAG,IAAI,QAAQ,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;;;"}
|
package/dist/esm/typeKey.js.map
CHANGED
|
@@ -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;;"}
|