@vaadin/hilla-models 25.1.0 → 25.1.1

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/Model.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Model.js","sourceRoot":"","sources":["src/Model.ts"],"names":[],"mappings":"AA+BA,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAEzC,MAAM,cAAc,GAAW,MAAM,CAAC,MAAM,CAC1C;IACE,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY;CAC7B,EACD;IACE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;IAC3B,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;CAC1B,CACF,CAAC;AAUF,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AAKlC,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAKpC,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AAKtC,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAKpC,MAAM,CAAC,MAAM,SAAS,GAAkB,MAAM,CAAC,UAAU,CAAC,CAAC;AAK3D,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAKpD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AAKlD,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAiB1C,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AA4GpE,MAAM,CAAC,MAAM,KAAK,GAAU,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;IAC9C,CAAC,IAAI,CAAC,EAAE;QACN,KAAK,EAAE,OAAO;KACf;IACD,CAAC,KAAK,CAAC,EAAE;QACP,KAAK,EAAE,SAAS;KACjB;IACD,CAAC,MAAM,CAAC,EAAE;QACR,KAAK,EAAE,cAAc;KACtB;IACD,CAAC,KAAK,CAAC,EAAE,EAAE;IACX,CAAC,SAAS,CAAC,EAAE;QACX,KAAK,EAAE,KAAK;KACb;IACD,CAAC,aAAa,CAAC,EAAE,EAAE;IACnB,CAAC,YAAY,CAAC,EAAE;QACd,KAAK,EAAE,EAAE;KACV;IACD,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;QACpB,GAAG;YACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;KACF;IACD,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;QACpB,KAAK,CAAc,CAAU;YAC3B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5G,CAAC;KACF;IACD,QAAQ,EAAE;QACR,KAAK;YAEH,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACzG,CAAC;KACF;CACF,CAAC,CAAC","sourcesContent":["import type { EmptyObject } from 'type-fest';\n\nexport interface JvmTypeRef {\n jvmType: string;\n genericArguments?: JvmTypeRef[];\n}\n\nexport type AnnotationValue = AnnotationValue[] | JvmTypeRef | boolean | number | string | undefined;\n\nexport interface Annotation {\n jvmType: string;\n attributes?: Record<string, AnnotationValue>;\n}\n\n/**\n * The metadata of a model.\n */\nexport interface ModelMetadata {\n jvmType?: string;\n annotations?: Annotation[];\n}\n\n/**\n * The target to which a model is attached. It could be a Binder instance, a\n * Signal or another object. However, it could never be another model.\n */\nexport type Target<T = unknown> = {\n readonly model?: Model<T>;\n readonly value: T;\n};\n\nexport const nothing = Symbol('nothing');\n\nconst detachedTarget: Target = Object.create(\n {\n toString: () => ':detached:',\n },\n {\n model: { value: undefined },\n value: { value: nothing },\n },\n);\n\nexport declare enum Enum {}\n\nexport type AnyObject = Readonly<Record<never, never>>; // {}\n\n/* eslint-disable tsdoc/syntax */\n/**\n * The symbol that represents the {@link Model[$key]} property.\n */\nexport const $key = Symbol('key');\n\n/**\n * The symbol that represents the {@link Model[$name]} property.\n */\nexport const $name = Symbol('name');\n\n/**\n * The symbol that represents the {@link Model[$owner]} property.\n */\nexport const $owner = Symbol('owner');\n\n/**\n * The symbol that represents the {@link Model[$meta]} property.\n */\nexport const $meta = Symbol('meta');\n\n/**\n * The symbol that represents the {@link Model[$optional]} property.\n */\nexport const $optional: unique symbol = Symbol('optional');\n\n/**\n * The symbol that represents the {@link Model[$defaultValue]} property.\n */\nexport const $defaultValue = Symbol('defaultValue');\n\n/**\n * The symbol that represents the constraints property of the {@link Model} type.\n */\nexport const $constraints = Symbol('constraints');\n\n/**\n * The symbol that represents the {@link UnionModel[$members]} property.\n */\nexport const $members = Symbol('members');\n\n/* eslint-enable tsdoc/syntax */\n\n/**\n * Extracts the value type the model represents.\n */\nexport type Value<M extends Model> = M extends Model<infer T> ? T : never;\n\n/**\n * Extracts the list of extra properties of the model.\n */\nexport type Extensions<M extends Model> = M extends Model<unknown, infer EX> ? EX : AnyObject;\n\n/**\n * The symbol that represents the {@link Constraint} method asserting supported model.\n */\nexport const $assertSupportedModel = Symbol('assertSupportedModel');\n\n/**\n * The constraint function type.\n */\nexport type ConstraintFn<V = unknown, A extends AnyObject = AnyObject> = EmptyObject extends A\n ? (attributes?: A) => Constraint<V>\n : { readonly value: never } extends A\n ? (valueOrAttributes: (A & { readonly value: unknown })['value'] | A) => Constraint<V>\n : (attributes: A) => Constraint<V>;\n\n/**\n * The constraint type that doesn't necessarily have attributes specified.\n *\n * @typeParam V - The type of the data described by the model.\n * @typeParam N - The name of the constraint.\n * @typeParam A - The attributes of the constraint.\n */\nexport type NonAttributedConstraint<\n V = unknown,\n N extends string = string,\n A extends AnyObject = AnyObject,\n> = ConstraintFn<V, A> &\n Readonly<{\n attributes: A;\n name: N;\n [$assertSupportedModel](model: Model<V>): void;\n }>;\n\n/**\n * The constraint type with specified attributes.\n *\n * @typeParam V - The type of the data described by the model.\n * @typeParam N - The name of the constraint.\n * @typeParam A - The attributes of the constraint.\n */\nexport type Constraint<V = unknown, N extends string = string, A extends AnyObject = AnyObject> = Readonly<{\n attributes: EmptyObject extends A ? A : Required<A>;\n name: N;\n [$assertSupportedModel](model: Model<V>): void;\n}>;\n\n/**\n * A model that represents a specific type of data.\n *\n * @typeParam V - The type of the data described by the model.\n * @typeParam EX - The extra properties of the model. It could be either a model\n * that represents a property of the object the current model describe, or a\n * model-specific metadata. It's recommended to use a symbol as a key for the\n * metadata property to avoid the potential naming conflicts with the described\n * object properties.\n *\n * @remarks\n * Since we know the full model definition only on this step, the `R` type\n * parameter is essential to describe a model with self-reference properties.\n */\nexport type Model<V = unknown, EX extends AnyObject = AnyObject> = EX & {\n /**\n * The key of the model in the owner model.\n */\n readonly [$key]: keyof any;\n\n /**\n * The name of the model. For attached models, the name will be prefixed\n * with the `@` symbol.\n */\n readonly [$name]: string;\n\n /**\n * The owner model of the model. For detached models, the owner will always\n * be a specific global object `detachedTarget`.\n */\n readonly [$owner]: Model | Target;\n\n /**\n * The metadata of the model.\n */\n readonly [$meta]?: ModelMetadata;\n\n /**\n * Whether the model is optional. It describes if the data described by\n * this model is nullable.\n */\n readonly [$optional]: boolean;\n\n /**\n * The list of validation constraints for the model.\n */\n readonly [$constraints]: readonly Constraint[];\n\n /**\n * The default value of the model.\n */\n readonly [$defaultValue]: V;\n readonly [Symbol.toStringTag]: string;\n [Symbol.hasInstance](value: any): value is Model<V, EX>;\n toString(): string;\n};\n\n/**\n * A function that provides a default value for a model.\n *\n * @typeParam V - The type of the data described by the model.\n * @typeParam EX - The extra properties of the model.\n * @typeParam R - The keys of the self-referencing properties of the model.\n */\nexport type DefaultValueProvider<V, EX extends AnyObject = AnyObject> = (model: Model<V, EX>) => V;\n\nexport const Model: Model = Object.create(null, {\n [$key]: {\n value: 'model',\n },\n [$name]: {\n value: 'unknown',\n },\n [$owner]: {\n value: detachedTarget,\n },\n [$meta]: {},\n [$optional]: {\n value: false,\n },\n [$defaultValue]: {},\n [$constraints]: {\n value: [],\n },\n [Symbol.toStringTag]: {\n get(this: Model) {\n return this[$name];\n },\n },\n [Symbol.hasInstance]: {\n value(this: Model, o: unknown) {\n return typeof o === 'object' && o != null && (this === o || Object.prototype.isPrototypeOf.call(this, o));\n },\n },\n toString: {\n value(this: Model) {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n return `[${String(this[$owner])} / ${String(this[$key])}${this[$optional] ? '?' : ''}] ${this[$name]}`;\n },\n },\n});\n\n// The following symbols are used to define HKT signatures for model converter\n// functions, enabling type inference for functional composition for them.\n// Inspired by: https://stackoverflow.com/a/69247453\n\n/**\n * The symbol marking source (parameter) type for model converter HKT\n * signatures.\n */\nexport declare const $sourceModel: unique symbol;\n\n/**\n * The symbol marking target (return) type for model converter HKT\n * signatures.\n */\nexport declare const $targetModel: unique symbol;\n\n/**\n * Base HKT signature for model converter functions. Corresponds to a function\n * such as.\n */\nexport type ModelConverter<SM extends Model = Model, TM extends Model = Model> = {\n readonly [$sourceModel]: SM;\n readonly [$targetModel]: TM;\n};\n\n/**\n * Gets the source type of the given model converter HKT signature.\n */\nexport type SourceModel<MC extends ModelConverter> = MC[typeof $sourceModel];\n\n/**\n * Gets the target type of the given model converter HKT signature for the given\n * source type.\n */\nexport type TargetModel<MC extends ModelConverter, SM extends SourceModel<MC>> = (MC & {\n readonly [$sourceModel]: SM;\n})[typeof $targetModel];\n\n/**\n * Makes functional composition of two given model converter HKT signatures,\n * given A(x) and B(x) returns A(B(x)) HKT signature.\n */\nexport interface CompositeOf<A extends ModelConverter, B extends ModelConverter<Model, SourceModel<A>>>\n extends ModelConverter<SourceModel<B>> {\n readonly [$targetModel]: TargetModel<A, TargetModel<B, SourceModel<this>>>;\n}\n"]}
1
+ {"version":3,"file":"Model.js","sourceRoot":"","sources":["src/Model.ts"],"names":[],"mappings":"AA+BA,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAEzC,MAAM,cAAc,GAAW,MAAM,CAAC,MAAM,CAC1C;IACE,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY;CAC7B,EACD;IACE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;IAC3B,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;CAC1B,CACF,CAAC;AAUF,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AAKlC,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAKpC,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AAKtC,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAKpC,MAAM,CAAC,MAAM,SAAS,GAAkB,MAAM,CAAC,UAAU,CAAC,CAAC;AAK3D,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAKpD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AAKlD,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAiB1C,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AA4GpE,MAAM,CAAC,MAAM,KAAK,GAAU,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;IAC9C,CAAC,IAAI,CAAC,EAAE;QACN,KAAK,EAAE,OAAO;KACf;IACD,CAAC,KAAK,CAAC,EAAE;QACP,KAAK,EAAE,SAAS;KACjB;IACD,CAAC,MAAM,CAAC,EAAE;QACR,KAAK,EAAE,cAAc;KACtB;IACD,CAAC,KAAK,CAAC,EAAE,EAAE;IACX,CAAC,SAAS,CAAC,EAAE;QACX,KAAK,EAAE,KAAK;KACb;IACD,CAAC,aAAa,CAAC,EAAE,EAAE;IACnB,CAAC,YAAY,CAAC,EAAE;QACd,KAAK,EAAE,EAAE;KACV;IACD,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;QACpB,GAAG;YACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;KACF;IACD,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;QACpB,KAAK,CAAc,CAAU;YAC3B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5G,CAAC;KACF;IACD,QAAQ,EAAE;QACR,KAAK;YAEH,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACzG,CAAC;KACF;CACF,CAAC,CAAC","sourcesContent":["import type { EmptyObject } from 'type-fest';\n\nexport interface JvmTypeRef {\n jvmType: string;\n genericArguments?: JvmTypeRef[];\n}\n\nexport type AnnotationValue = AnnotationValue[] | JvmTypeRef | boolean | number | string | undefined;\n\nexport interface Annotation {\n jvmType: string;\n attributes?: Record<string, AnnotationValue>;\n}\n\n/**\n * The metadata of a model.\n */\nexport interface ModelMetadata {\n jvmType?: string;\n annotations?: Annotation[];\n}\n\n/**\n * The target to which a model is attached. It could be a Binder instance, a\n * Signal or another object. However, it could never be another model.\n */\nexport type Target<T = unknown> = {\n readonly model?: Model<T>;\n readonly value: T;\n};\n\nexport const nothing = Symbol('nothing');\n\nconst detachedTarget: Target = Object.create(\n {\n toString: () => ':detached:',\n },\n {\n model: { value: undefined },\n value: { value: nothing },\n },\n);\n\nexport declare enum Enum {}\n\nexport type AnyObject = Readonly<Record<never, never>>; // {}\n\n/* eslint-disable tsdoc/syntax */\n/**\n * The symbol that represents the {@link Model[$key]} property.\n */\nexport const $key = Symbol('key');\n\n/**\n * The symbol that represents the {@link Model[$name]} property.\n */\nexport const $name = Symbol('name');\n\n/**\n * The symbol that represents the {@link Model[$owner]} property.\n */\nexport const $owner = Symbol('owner');\n\n/**\n * The symbol that represents the {@link Model[$meta]} property.\n */\nexport const $meta = Symbol('meta');\n\n/**\n * The symbol that represents the {@link Model[$optional]} property.\n */\nexport const $optional: unique symbol = Symbol('optional');\n\n/**\n * The symbol that represents the {@link Model[$defaultValue]} property.\n */\nexport const $defaultValue = Symbol('defaultValue');\n\n/**\n * The symbol that represents the constraints property of the {@link Model} type.\n */\nexport const $constraints = Symbol('constraints');\n\n/**\n * The symbol that represents the {@link UnionModel[$members]} property.\n */\nexport const $members = Symbol('members');\n\n/* eslint-enable tsdoc/syntax */\n\n/**\n * Extracts the value type the model represents.\n */\nexport type Value<M extends Model> = M extends Model<infer T> ? T : never;\n\n/**\n * Extracts the list of extra properties of the model.\n */\nexport type Extensions<M extends Model> = M extends Model<unknown, infer EX> ? EX : AnyObject;\n\n/**\n * The symbol that represents the {@link Constraint} method asserting supported model.\n */\nexport const $assertSupportedModel = Symbol('assertSupportedModel');\n\n/**\n * The constraint function type.\n */\nexport type ConstraintFn<V = unknown, A extends AnyObject = AnyObject> = EmptyObject extends A\n ? (attributes?: A) => Constraint<V>\n : { readonly value: never } extends A\n ? (valueOrAttributes: (A & { readonly value: unknown })['value'] | A) => Constraint<V>\n : (attributes: A) => Constraint<V>;\n\n/**\n * The constraint type that doesn't necessarily have attributes specified.\n *\n * @typeParam V - The type of the data described by the model.\n * @typeParam N - The name of the constraint.\n * @typeParam A - The attributes of the constraint.\n */\nexport type NonAttributedConstraint<\n V = unknown,\n N extends string = string,\n A extends AnyObject = AnyObject,\n> = ConstraintFn<V, A> &\n Readonly<{\n attributes: A;\n name: N;\n [$assertSupportedModel](model: Model<V>): void;\n }>;\n\n/**\n * The constraint type with specified attributes.\n *\n * @typeParam V - The type of the data described by the model.\n * @typeParam N - The name of the constraint.\n * @typeParam A - The attributes of the constraint.\n */\nexport type Constraint<V = unknown, N extends string = string, A extends AnyObject = AnyObject> = Readonly<{\n attributes: EmptyObject extends A ? A : Required<A>;\n name: N;\n [$assertSupportedModel](model: Model<V>): void;\n}>;\n\n/**\n * A model that represents a specific type of data.\n *\n * @typeParam V - The type of the data described by the model.\n * @typeParam EX - The extra properties of the model. It could be either a model\n * that represents a property of the object the current model describe, or a\n * model-specific metadata. It's recommended to use a symbol as a key for the\n * metadata property to avoid the potential naming conflicts with the described\n * object properties.\n *\n * @remarks\n * Since we know the full model definition only on this step, the `R` type\n * parameter is essential to describe a model with self-reference properties.\n */\nexport type Model<V = unknown, EX extends AnyObject = AnyObject> = EX & {\n /**\n * The key of the model in the owner model.\n */\n readonly [$key]: keyof any;\n\n /**\n * The name of the model. For attached models, the name will be prefixed\n * with the `@` symbol.\n */\n readonly [$name]: string;\n\n /**\n * The owner model of the model. For detached models, the owner will always\n * be a specific global object `detachedTarget`.\n */\n readonly [$owner]: Model | Target;\n\n /**\n * The metadata of the model.\n */\n readonly [$meta]?: ModelMetadata;\n\n /**\n * Whether the model is optional. It describes if the data described by\n * this model is nullable.\n */\n readonly [$optional]: boolean;\n\n /**\n * The list of validation constraints for the model.\n */\n readonly [$constraints]: readonly Constraint[];\n\n /**\n * The default value of the model.\n */\n readonly [$defaultValue]: V;\n readonly [Symbol.toStringTag]: string;\n [Symbol.hasInstance](value: any): value is Model<V, EX>;\n toString(): string;\n};\n\n/**\n * A function that provides a default value for a model.\n *\n * @typeParam V - The type of the data described by the model.\n * @typeParam EX - The extra properties of the model.\n * @typeParam R - The keys of the self-referencing properties of the model.\n */\nexport type DefaultValueProvider<V, EX extends AnyObject = AnyObject> = (model: Model<V, EX>) => V;\n\nexport const Model: Model = Object.create(null, {\n [$key]: {\n value: 'model',\n },\n [$name]: {\n value: 'unknown',\n },\n [$owner]: {\n value: detachedTarget,\n },\n [$meta]: {},\n [$optional]: {\n value: false,\n },\n [$defaultValue]: {},\n [$constraints]: {\n value: [],\n },\n [Symbol.toStringTag]: {\n get(this: Model) {\n return this[$name];\n },\n },\n [Symbol.hasInstance]: {\n value(this: Model, o: unknown) {\n return typeof o === 'object' && o != null && (this === o || Object.prototype.isPrototypeOf.call(this, o));\n },\n },\n toString: {\n value(this: Model) {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n return `[${String(this[$owner])} / ${String(this[$key])}${this[$optional] ? '?' : ''}] ${this[$name]}`;\n },\n },\n});\n\n// The following symbols are used to define HKT signatures for model converter\n// functions, enabling type inference for functional composition for them.\n// Inspired by: https://stackoverflow.com/a/69247453\n\n/**\n * The symbol marking source (parameter) type for model converter HKT\n * signatures.\n */\nexport declare const $sourceModel: unique symbol;\n\n/**\n * The symbol marking target (return) type for model converter HKT\n * signatures.\n */\nexport declare const $targetModel: unique symbol;\n\n/**\n * Base HKT signature for model converter functions. Corresponds to a function\n * such as.\n */\nexport type ModelConverter<SM extends Model = Model, TM extends Model = Model> = {\n readonly [$sourceModel]: SM;\n readonly [$targetModel]: TM;\n};\n\n/**\n * Gets the source type of the given model converter HKT signature.\n */\nexport type SourceModel<MC extends ModelConverter> = MC[typeof $sourceModel];\n\n/**\n * Gets the target type of the given model converter HKT signature for the given\n * source type.\n */\nexport type TargetModel<MC extends ModelConverter, SM extends SourceModel<MC>> = (MC & {\n readonly [$sourceModel]: SM;\n})[typeof $targetModel];\n\n/**\n * Makes functional composition of two given model converter HKT signatures,\n * given A(x) and B(x) returns A(B(x)) HKT signature.\n */\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-arguments\nexport interface CompositeOf<A extends ModelConverter, B extends ModelConverter<Model, SourceModel<A>>>\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-arguments\n extends ModelConverter<SourceModel<B>> {\n readonly [$targetModel]: TargetModel<A, TargetModel<B, SourceModel<this>>>;\n}\n"]}
package/converters.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"converters.js","sourceRoot":"","sources":["src/converters.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,KAAK,EACL,SAAS,GAUV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAsB,MAAM,aAAa,CAAC;AAiCzE,SAAS,oBAAoB,CAG3B,gBAAmB;IACnB,OAAO,CAAC,CAAC,gBAA0C,EAAE,GAAG,SAAyB,EAAE,EAAE;QACnF,IAAI,OAAO,gBAAgB,KAAK,UAAU,EAAE,CAAC;YAC3C,OAAO,CAAC,KAAY,EAAE,EAAE,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC;QACnF,CAAC;QAED,OAAO,gBAAgB,CAAC,gBAAgB,EAAE,GAAG,SAAS,CAAC,CAAC;IAC1D,CAAC,CAAQ,CAAC;AACZ,CAAC;AASD,SAAS,QAAQ,CAAwB,KAAQ;IAC/C,OAAO,KAAK,CAAC;AACf,CAAC;AAQD,MAAM,KAAK,GAAG,QAAqB,CAAC;AACpC,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC;AASzB,SAAS,YAAY,CAAwB,KAAQ;IACnD,OAAO,IAAI,gBAAgB,CAAC,KAAK,CAAC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pF,OAAO,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAO,CAAC;AACpF,CAAC;AAOD,MAAM,CAAC,MAAM,IAAI,GAAG,oBAAoB,CAA8B,QAAQ,CAAC,CAAC","sourcesContent":["import {\n $assertSupportedModel,\n $constraints,\n $name,\n $optional,\n type $targetModel,\n type Constraint,\n type CompositeOf,\n type SourceModel,\n type TargetModel,\n type Model,\n type ModelConverter,\n type ModelMetadata,\n type Value,\n} from './Model.js';\nimport { CoreModelBuilder } from './modelBuilders.js';\nimport { $itemModel, ArrayModel, type OptionalModel } from './models.js';\n\n/**\n * Function that converts the given model.\n *\n * @param model - the model to convert\n * @returns derived model\n */\nexport type ModelConverterFn<SM extends Model = Model, TM extends Model = Model> = (\n model: SM,\n ...extraArgs: readonly any[]\n) => TM;\n\n/**\n * Universal converter function type for models and model converter functions.\n */\nexport type ModelConverterCallable<\n MC extends ModelConverter,\n F extends ModelConverterFn<SourceModel<MC>, TargetModel<MC, SourceModel<MC>>>,\n> = F extends (model: Model, ...extraArgs: infer E) => Model\n ? <const IMC extends ModelConverter>(modelConverter: IMC, ...extraArgs: E) => CompositeOf<MC, IMC>\n : never;\n\n/**\n * Applies HKT signature and adds model converter callback support for the given\n * simple model converter function implementation. These additions provide\n * support for self-referencing properties in object model, i. g.,\n * `.property(m.optional(m.self))`.\n *\n * @param modelConverterFn - model function implementation\n * @returns model converter that also supports other converters as arguments,\n * for which it returns a composite model converter.\n */\nfunction createModelConverter<\n const MC extends ModelConverter,\n const F extends ModelConverterFn<SourceModel<MC>, TargetModel<MC, SourceModel<MC>>>,\n>(modelConverterFn: F): MC & F & ModelConverterCallable<MC, F> {\n return ((modelOrConverter: Model | ModelConverterFn, ...extraArgs: readonly any[]) => {\n if (typeof modelOrConverter === 'function') {\n return (model: Model) => modelConverterFn(modelOrConverter(model), ...extraArgs);\n }\n\n return modelConverterFn(modelOrConverter, ...extraArgs);\n }) as any;\n}\n\n/**\n * HKT signature for model converters that return models of the same data type\n * as the given model.\n */\nexport interface IdentityOf extends ModelConverter {\n readonly [$targetModel]: SourceModel<this>;\n}\nfunction selfImpl<const M extends Model>(model: M): M {\n return model;\n}\nexport type ModelSelf = IdentityOf & typeof selfImpl;\n\n/**\n * The model converter identity function that returns the given model.\n *\n * @param model - The model to return.\n */\nconst _self = selfImpl as ModelSelf;\nexport { _self as self };\n\n/**\n * HKT signature for optional model converter, which returns optional model\n * of the given one.\n */\nexport interface OptionalOf extends ModelConverter {\n readonly [$targetModel]: OptionalModel<SourceModel<this>>;\n}\nfunction optionalImpl<const M extends Model>(model: M) {\n return new CoreModelBuilder(model).name(model[$name]).define($optional, { value: true }).build() as OptionalModel<M>;\n}\n\n/**\n * Creates a new model that represents an optional value.\n *\n * @param base - The base model to extend.\n */\nexport const optional = createModelConverter<OptionalOf, typeof optionalImpl>(optionalImpl);\n\n/**\n * HKT signature for array model converte, which returns array model with\n * items of the given model.\n */\nexport interface ArrayOf extends ModelConverter {\n readonly [$targetModel]: ArrayModel<SourceModel<this>>;\n}\nfunction arrayImpl<const M extends Model>(model: M) {\n return new CoreModelBuilder<Array<Value<M>>>(ArrayModel, (): Array<Value<M>> => [])\n .name(`Array<${model[$name]}>`)\n .define($itemModel, { value: model })\n .build() as ArrayModel<M>;\n}\n/**\n * Creates a new model that represents an array of items.\n *\n * @param itemModel - The model of the items in the array.\n */\nexport const array = createModelConverter<ArrayOf, typeof arrayImpl>(arrayImpl);\n\nfunction constrainedImpl<const M extends Model>(\n this: void,\n model: M,\n constraint: Constraint<Value<M>>,\n ...moreConstraints: ReadonlyArray<Constraint<Value<M>>>\n): M {\n const previousConstraints = model[$constraints];\n const newConstraints = [constraint, ...moreConstraints];\n for (const newConstraint of newConstraints) {\n newConstraint[$assertSupportedModel](model as Model<Value<M>>);\n }\n return new CoreModelBuilder(model)\n .name(model[$name])\n .define($constraints, { value: [...previousConstraints, ...newConstraints] })\n .build() as any;\n}\n/**\n * Applies the constraints to the given model.\n *\n * @param model - The model to apply the constraints to.\n * @param constraint - The constraint to apply.\n * @param moreConstraints - Additional constraints to apply.\n */\nexport const constrained = createModelConverter<IdentityOf, typeof constrainedImpl>(constrainedImpl);\n\nfunction metaImpl<const M extends Model>(this: void, model: M, metadata: ModelMetadata): M {\n return new CoreModelBuilder(model).name(model[$name]).meta(metadata).build() as M;\n}\n/**\n * Defines the metadata for the given model.\n *\n * @param model - The model to define metadata for.\n * @param metadata - The metadata to define.\n */\nexport const meta = createModelConverter<IdentityOf, typeof metaImpl>(metaImpl);\n"]}
1
+ {"version":3,"file":"converters.js","sourceRoot":"","sources":["src/converters.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,KAAK,EACL,SAAS,GAUV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAsB,MAAM,aAAa,CAAC;AAmCzE,SAAS,oBAAoB,CAI3B,gBAAmB;IACnB,OAAO,CAAC,CAAC,gBAA0C,EAAE,GAAG,SAAyB,EAAE,EAAE;QACnF,IAAI,OAAO,gBAAgB,KAAK,UAAU,EAAE,CAAC;YAC3C,OAAO,CAAC,KAAY,EAAE,EAAE,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC;QACnF,CAAC;QAED,OAAO,gBAAgB,CAAC,gBAAgB,EAAE,GAAG,SAAS,CAAC,CAAC;IAC1D,CAAC,CAAQ,CAAC;AACZ,CAAC;AASD,SAAS,QAAQ,CAAwB,KAAQ;IAC/C,OAAO,KAAK,CAAC;AACf,CAAC;AAQD,MAAM,KAAK,GAAG,QAAqB,CAAC;AACpC,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC;AASzB,SAAS,YAAY,CAAw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C;AAErG,SAAS,QAAQ,CAAoC,KAAQ,EAAE,QAAuB;IACpF,OAAO,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAO,CAAC;AACpF,CAAC;AAQD,MAAM,CAAC,MAAM,IAAI,GAAG,oBAAoB,CAA8B,QAAQ,CAAC,CAAC","sourcesContent":["import {\n $assertSupportedModel,\n $constraints,\n $name,\n $optional,\n type $targetModel,\n type Constraint,\n type CompositeOf,\n type SourceModel,\n type TargetModel,\n type Model,\n type ModelConverter,\n type ModelMetadata,\n type Value,\n} from './Model.js';\nimport { CoreModelBuilder } from './modelBuilders.js';\nimport { $itemModel, ArrayModel, type OptionalModel } from './models.js';\n\n/**\n * Function that converts the given model.\n *\n * @param model - the model to convert\n * @returns derived model\n */\nexport type ModelConverterFn<SM extends Model = Model, TM extends Model = Model> = (\n model: SM,\n ...extraArgs: readonly any[]\n) => TM;\n\n/**\n * Universal converter function type for models and model converter functions.\n */\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-arguments\nexport type ModelConverterCallable<\n MC extends ModelConverter,\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-arguments\n F extends ModelConverterFn<SourceModel<MC>, TargetModel<MC, SourceModel<MC>>>,\n> = F extends (model: Model, ...extraArgs: infer E) => Model\n ? <const IMC extends ModelConverter>(modelConverter: IMC, ...extraArgs: E) => CompositeOf<MC, IMC>\n : never;\n\n/**\n * Applies HKT signature and adds model converter callback support for the given\n * simple model converter function implementation. These additions provide\n * support for self-referencing properties in object model, i. g.,\n * `.property(m.optional(m.self))`.\n *\n * @param modelConverterFn - model function implementation\n * @returns model converter that also supports other converters as arguments,\n * for which it returns a composite model converter.\n */\nfunction createModelConverter<\n const MC extends ModelConverter,\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-arguments\n const F extends ModelConverterFn<SourceModel<MC>, TargetModel<MC, SourceModel<MC>>>,\n>(modelConverterFn: F): MC & F & ModelConverterCallable<MC, F> {\n return ((modelOrConverter: Model | ModelConverterFn, ...extraArgs: readonly any[]) => {\n if (typeof modelOrConverter === 'function') {\n return (model: Model) => modelConverterFn(modelOrConverter(model), ...extraArgs);\n }\n\n return modelConverterFn(modelOrConverter, ...extraArgs);\n }) as any;\n}\n\n/**\n * HKT signature for model converters that return models of the same data type\n * as the given model.\n */\nexport interface IdentityOf extends ModelConverter {\n readonly [$targetModel]: SourceModel<this>;\n}\nfunction selfImpl<const M extends Model>(model: M): M {\n return model;\n}\nexport type ModelSelf = IdentityOf & typeof selfImpl;\n\n/**\n * The model converter identity function that returns the given model.\n *\n * @param model - The model to return.\n */\nconst _self = selfImpl as ModelSelf;\nexport { _self as self };\n\n/**\n * HKT signature for optional model converter, which returns optional model\n * of the given one.\n */\nexport interface OptionalOf extends ModelConverter {\n readonly [$targetModel]: OptionalModel<SourceModel<this>>;\n}\nfunction optionalImpl<const M extends Model>(model: M) {\n return new CoreModelBuilder(model).name(model[$name]).define($optional, { value: true }).build() as OptionalModel<M>;\n}\n\n/**\n * Creates a new model that represents an optional value.\n *\n * @param base - The base model to extend.\n */\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-arguments\nexport const optional = createModelConverter<OptionalOf, typeof optionalImpl>(optionalImpl);\n\n/**\n * HKT signature for array model converte, which returns array model with\n * items of the given model.\n */\nexport interface ArrayOf extends ModelConverter {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-arguments\n readonly [$targetModel]: ArrayModel<SourceModel<this>>;\n}\nfunction arrayImpl<const M extends Model>(model: M) {\n return new CoreModelBuilder<Array<Value<M>>>(ArrayModel, (): Array<Value<M>> => [])\n .name(`Array<${model[$name]}>`)\n .define($itemModel, { value: model })\n .build() as ArrayModel<M>;\n}\n/**\n * Creates a new model that represents an array of items.\n *\n * @param itemModel - The model of the items in the array.\n */\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-arguments\nexport const array = createModelConverter<ArrayOf, typeof arrayImpl>(arrayImpl);\n\nfunction constrainedImpl<const M extends Model>(\n this: void,\n model: M,\n constraint: Constraint<Value<M>>,\n ...moreConstraints: ReadonlyArray<Constraint<Value<M>>>\n): M {\n const previousConstraints = model[$constraints];\n const newConstraints = [constraint, ...moreConstraints];\n for (const newConstraint of newConstraints) {\n newConstraint[$assertSupportedModel](model as Model<Value<M>>);\n }\n return new CoreModelBuilder(model)\n .name(model[$name])\n .define($constraints, { value: [...previousConstraints, ...newConstraints] })\n .build() as any;\n}\n/**\n * Applies the constraints to the given model.\n *\n * @param model - The model to apply the constraints to.\n * @param constraint - The constraint to apply.\n * @param moreConstraints - Additional constraints to apply.\n */\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-arguments\nexport const constrained = createModelConverter<IdentityOf, typeof constrainedImpl>(constrainedImpl);\n\nfunction metaImpl<const M extends Model>(this: void, model: M, metadata: ModelMetadata): M {\n return new CoreModelBuilder(model).name(model[$name]).meta(metadata).build() as M;\n}\n/**\n * Defines the metadata for the given model.\n *\n * @param model - The model to define metadata for.\n * @param metadata - The metadata to define.\n */\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-arguments\nexport const meta = createModelConverter<IdentityOf, typeof metaImpl>(metaImpl);\n"]}
package/m.js CHANGED
@@ -12,9 +12,7 @@ function getRawValue(model) {
12
12
  }
13
13
  export { self, optional, array, constrained, meta } from './converters.js';
14
14
  export function attach(model, targetProvider) {
15
- const _model = new CoreModelBuilder(model)
16
- .name(`@${model[$name]}`)
17
- .build();
15
+ const _model = new CoreModelBuilder(model).name(`@${model[$name]}`).build();
18
16
  defineProperty(_model, $owner, { get: targetProvider });
19
17
  return _model;
20
18
  }
package/m.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"m.js","sourceRoot":"","sources":["src/m.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,EACL,MAAM,EACN,OAAO,EACP,IAAI,EAIJ,KAAK,EAGL,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OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC1B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC,QAAQ,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,EAAE;IACxC,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import type { EmptyObject } from 'type-fest';\nimport {\n type Constraint,\n type NonAttributedConstraint,\n Model,\n $owner,\n nothing,\n $key,\n type Target,\n type Value,\n type Extensions,\n $name,\n type AnyObject,\n type Enum,\n $defaultValue,\n $members,\n} from './Model.js';\nimport { CoreModelBuilder, ObjectModelBuilder } from './modelBuilders.js';\nimport {\n type ArrayModel,\n EnumModel,\n ObjectModel,\n type UnionModel,\n $itemModel,\n type OptionalModel,\n $enum,\n} from './models.js';\n\nconst { defineProperty } = Object;\n\nconst arrayItemModels = new WeakMap<ArrayModel | OptionalModel<ArrayModel>, Model[]>();\n\nfunction getRawValue<T>(model: Model<T>): T | typeof nothing {\n if (model[$owner] instanceof Model) {\n // If the current model is a property of another model, the owner is\n // definitely an object. So we just return the part of the value of\n // the owner.\n const parentValue = getRawValue(model[$owner] as Model<Record<keyof any, T>>);\n return parentValue === nothing ? nothing : parentValue[model[$key]];\n }\n\n // Otherwise, the owner is a Target, so we can return the full value.\n return (model[$owner] as Target<T>).value;\n}\n\nexport { self, optional, array, constrained, meta } from './converters.js';\n\n/**\n * Attaches the given model to the target.\n *\n * @param model - The model to attach.\n * @param targetProvider - The target to attach the model to. It could be a Binder\n * instance, a Signal, or another object. However, it could never be another\n * model.\n */\nexport function attach<M extends Model>(this: void, model: M, targetProvider: () => Target<Value<M>>): M {\n const _model = new CoreModelBuilder<Value<M>, Extensions<M>, { named: false }>(model)\n .name(`@${model[$name]}`)\n .build();\n defineProperty(_model, $owner, { get: targetProvider });\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n return _model as any;\n}\n\n/**\n * Creates a new model that extends the given base model.\n *\n * @param base - The base model to extend.\n */\nexport function extend<M extends Model<AnyObject>>(\n this: void,\n base: M,\n): ObjectModelBuilder<Value<M>, Value<M>, Extensions<M>> {\n return new ObjectModelBuilder(base);\n}\n\n/**\n * Creates a new model that represents an object.\n *\n * @param name - The name of the object.\n */\nexport function object<T extends AnyObject>(\n this: void,\n name: string,\n): ObjectModelBuilder<T, AnyObject, AnyObject, { named: true }> {\n return new ObjectModelBuilder(ObjectModel).name(name) as any;\n}\n\n/**\n * Creates a new model that represents an enum.\n *\n * @param obj - The enum object to represent.\n * @param name - The name of the model.\n */\nfunction _enum<T extends typeof Enum>(this: void, obj: T, name: string): EnumModel<T> {\n return new CoreModelBuilder<T[keyof T]>(EnumModel).define($enum, { value: obj }).name(name).build();\n}\nexport { _enum as enum };\n\n/**\n * Creates a new model that represents a union of the values of the given\n * models.\n *\n * @param members - The models to create the union from.\n */\nexport function union<MM extends Model[]>(this: void, ...members: MM): UnionModel<MM> {\n return new CoreModelBuilder(Model, () => members[0][$defaultValue] as Value<MM[number]>)\n .name(members.map((model) => model[$name]).join(' | '))\n .define($members, { value: members })\n .define(Symbol.hasInstance, {\n value: (v: unknown): v is Value<MM[number]> => members.some((member) => v instanceof member),\n })\n .build();\n}\n\n/**\n * Provides the value the given model represents. For attached models it will\n * be the owner value or its part, for detached models it will be the default\n * value of the model.\n *\n * @param model - The model to get the value from.\n */\nexport function getValue<T>(this: void, model: Model<T>): T {\n const v = getRawValue(model);\n\n // If the value is `nothing`, we return the default value of the model.\n return v === nothing ? model[$defaultValue] : v;\n}\n\n/**\n * Iterates over the given array model yielding an item model for each item\n * the model value has.\n *\n * @param model - The array model to iterate over.\n */\nexport function* items<V extends Model>(\n this: void,\n model: ArrayModel<V> | OptionalModel<ArrayModel<V>>,\n): Generator<V, undefined, void> {\n const list = arrayItemModels.get(model) ?? [];\n arrayItemModels.set(model, list);\n const v = getValue(model) ?? [];\n\n list.length = v.length;\n\n for (let i = 0; i < v.length; i++) {\n if (!list[i]) {\n list[i] = new CoreModelBuilder(model[$itemModel], () => v[i])\n .name(`${model[$itemModel][$name]}[${i}]`)\n .define($key, { value: i })\n .define($owner, { value: model })\n .build();\n }\n\n yield list[i] as V;\n }\n}\n\n/**\n * Replaces the default value of the given model with the given value.\n *\n * @param model - The model to replace the default value of.\n * @param defaultValue - The new default value.\n */\nexport function withDefaultValue<const M extends Model>(this: void, model: M, defaultValue: Value<M>): M {\n return new CoreModelBuilder(model, () => defaultValue).name(model[$name]).build() as M;\n}\n\n/**\n * Checks if the given value is a constraint of the given type.\n *\n * @param arg - The argument to check.\n * @param constraintType - The constraint to check against.\n */\nexport function isConstraint<V, N extends string = string, A extends AnyObject = EmptyObject>(\n this: void,\n arg: unknown,\n constraintType: NonAttributedConstraint<V, N, A>,\n): arg is Constraint<V, N, A> {\n let p: unknown = arg;\n do {\n if (p === constraintType) {\n return true;\n }\n if (typeof p !== 'object') {\n return false;\n }\n p = Object.getPrototypeOf(p);\n } while (p !== undefined && p !== null);\n return false;\n}\n"]}
1
+ {"version":3,"file":"m.js","sourceRoot":"","sources":["src/m.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,EACL,MAAM,EACN,OAAO,EACP,IAAI,EAIJ,KAAK,EAGL,aAAa,EACb,QAAQ,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAEL,SAAS,EACT,WAAW,EAEX,UAAU,EAEV,KAAK,GACN,MAAM,aAAa,CAAC;AAErB,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;AAElC,MAAM,eAAe,GAAG,IAAI,OAAO,EAAmD,CAAC;AAEvF,SAAS,WAAW,CAAI,KAAe;IACrC,IAAI,KAAK,CAAC,MAAM,CAAC,YAAY,KAAK,EAAE,CAAC;QAInC,MAAM,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAg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CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC1D,IAAI,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;iBACzC,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;iBAC1B,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;iBAChC,KAAK,EAAE,CAAC;QACb,CAAC;QAED,MAAM,IAAI,CAAC,CAAC,CAAM,CAAC;IACrB,CAAC;AACH,CAAC;AAQD,MAAM,UAAU,gBAAgB,CAAoC,KAAQ,EAAE,YAAsB;IAClG,OAAO,IAAI,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAO,CAAC;AACzF,CAAC;AAQD,MAAM,UAAU,YAAY,CAE1B,GAAY,EACZ,cAAgD;IAEhD,IAAI,CAAC,GAAY,GAAG,CAAC;IACrB,GAAG,CAAC;QACF,IAAI,CAAC,KAAK,cAAc,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC1B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC,QAAQ,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,EAAE;IACxC,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import type { EmptyObject } from 'type-fest';\nimport {\n type Constraint,\n type NonAttributedConstraint,\n Model,\n $owner,\n nothing,\n $key,\n type Target,\n type Value,\n type Extensions,\n $name,\n type AnyObject,\n type Enum,\n $defaultValue,\n $members,\n} from './Model.js';\nimport { CoreModelBuilder, ObjectModelBuilder } from './modelBuilders.js';\nimport {\n type ArrayModel,\n EnumModel,\n ObjectModel,\n type UnionModel,\n $itemModel,\n type OptionalModel,\n $enum,\n} from './models.js';\n\nconst { defineProperty } = Object;\n\nconst arrayItemModels = new WeakMap<ArrayModel | OptionalModel<ArrayModel>, Model[]>();\n\nfunction getRawValue<T>(model: Model<T>): T | typeof nothing {\n if (model[$owner] instanceof Model) {\n // If the current model is a property of another model, the owner is\n // definitely an object. So we just return the part of the value of\n // the owner.\n const parentValue = getRawValue(model[$owner] as Model<Record<keyof any, T>>);\n return parentValue === nothing ? nothing : parentValue[model[$key]];\n }\n\n // Otherwise, the owner is a Target, so we can return the full value.\n return (model[$owner] as Target<T>).value;\n}\n\nexport { self, optional, array, constrained, meta } from './converters.js';\n\n/**\n * Attaches the given model to the target.\n *\n * @param model - The model to attach.\n * @param targetProvider - The target to attach the model to. It could be a Binder\n * instance, a Signal, or another object. However, it could never be another\n * model.\n */\nexport function attach<M extends Model>(this: void, model: M, targetProvider: () => Target<Value<M>>): M {\n const _model = new CoreModelBuilder<Value<M>, Extensions<M>>(model).name(`@${model[$name]}`).build();\n defineProperty(_model, $owner, { get: targetProvider });\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n return _model as any;\n}\n\n/**\n * Creates a new model that extends the given base model.\n *\n * @param base - The base model to extend.\n */\nexport function extend<M extends Model<AnyObject>>(\n this: void,\n base: M,\n): ObjectModelBuilder<Value<M>, Value<M>, Extensions<M>> {\n return new ObjectModelBuilder(base);\n}\n\n/**\n * Creates a new model that represents an object.\n *\n * @param name - The name of the object.\n */\nexport function object<T extends AnyObject>(\n this: void,\n name: string,\n): ObjectModelBuilder<T, AnyObject, AnyObject, { named: true }> {\n return new ObjectModelBuilder(ObjectModel).name(name) as any;\n}\n\n/**\n * Creates a new model that represents an enum.\n *\n * @param obj - The enum object to represent.\n * @param name - The name of the model.\n */\nfunction _enum<T extends typeof Enum>(this: void, obj: T, name: string): EnumModel<T> {\n return new CoreModelBuilder<T[keyof T]>(EnumModel).define($enum, { value: obj }).name(name).build();\n}\nexport { _enum as enum };\n\n/**\n * Creates a new model that represents a union of the values of the given\n * models.\n *\n * @param members - The models to create the union from.\n */\nexport function union<MM extends Model[]>(this: void, ...members: MM): UnionModel<MM> {\n return new CoreModelBuilder(Model, () => members[0][$defaultValue] as Value<MM[number]>)\n .name(members.map((model) => model[$name]).join(' | '))\n .define($members, { value: members })\n .define(Symbol.hasInstance, {\n value: (v: unknown): v is Value<MM[number]> => members.some((member) => v instanceof member),\n })\n .build();\n}\n\n/**\n * Provides the value the given model represents. For attached models it will\n * be the owner value or its part, for detached models it will be the default\n * value of the model.\n *\n * @param model - The model to get the value from.\n */\nexport function getValue<T>(this: void, model: Model<T>): T {\n const v = getRawValue(model);\n\n // If the value is `nothing`, we return the default value of the model.\n return v === nothing ? model[$defaultValue] : v;\n}\n\n/**\n * Iterates over the given array model yielding an item model for each item\n * the model value has.\n *\n * @param model - The array model to iterate over.\n */\nexport function* items<V extends Model>(\n this: void,\n model: ArrayModel<V> | OptionalModel<ArrayModel<V>>,\n): Generator<V, undefined, void> {\n const list = arrayItemModels.get(model) ?? [];\n arrayItemModels.set(model, list);\n const v = getValue(model) ?? [];\n\n list.length = v.length;\n\n for (let i = 0; i < v.length; i++) {\n if (!list[i]) {\n list[i] = new CoreModelBuilder(model[$itemModel], () => v[i])\n .name(`${model[$itemModel][$name]}[${i}]`)\n .define($key, { value: i })\n .define($owner, { value: model })\n .build();\n }\n\n yield list[i] as V;\n }\n}\n\n/**\n * Replaces the default value of the given model with the given value.\n *\n * @param model - The model to replace the default value of.\n * @param defaultValue - The new default value.\n */\nexport function withDefaultValue<const M extends Model>(this: void, model: M, defaultValue: Value<M>): M {\n return new CoreModelBuilder(model, () => defaultValue).name(model[$name]).build() as M;\n}\n\n/**\n * Checks if the given value is a constraint of the given type.\n *\n * @param arg - The argument to check.\n * @param constraintType - The constraint to check against.\n */\nexport function isConstraint<V, N extends string = string, A extends AnyObject = EmptyObject>(\n this: void,\n arg: unknown,\n constraintType: NonAttributedConstraint<V, N, A>,\n): arg is Constraint<V, N, A> {\n let p: unknown = arg;\n do {\n if (p === constraintType) {\n return true;\n }\n if (typeof p !== 'object') {\n return false;\n }\n p = Object.getPrototypeOf(p);\n } while (p !== undefined && p !== null);\n return false;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/hilla-models",
3
- "version": "25.1.0",
3
+ "version": "25.1.1",
4
4
  "description": "Generative form models for Hilla",
5
5
  "main": "index.js",
6
6
  "module": "index.js",