@typescript-package/wrapped-descriptor
Version:
A lightweight TypeScript library for wrapped property descriptor.
1 lines • 31.7 kB
Source Map (JSON)
{"version":3,"file":"typescript-package-wrapped-descriptor.mjs","sources":["../../../package/wrapped-descriptor/src/lib/wrapped-descriptor-core.abstract.ts","../../../package/wrapped-descriptor/src/lib/plain-wrapped-descriptor-base.abstract.ts","../../../package/wrapped-descriptor/src/lib/wrapped-descriptor-base.abstract.ts","../../../package/wrapped-descriptor/src/lib/plain-wrapped-descriptor.class.ts","../../../package/wrapped-descriptor/src/lib/wrapped-descriptor.class.ts","../../../package/wrapped-descriptor/src/lib/index.ts","../../../package/wrapped-descriptor/src/public-api.ts","../../../package/wrapped-descriptor/src/typescript-package-wrapped-descriptor.ts"],"sourcesContent":["// Abstract.\nimport { CommonDescriptor } from '@typescript-package/descriptor';\n// Interface.\nimport { WrappedPropertyDescriptor } from '@typedly/descriptor';\n// Type.\nimport { GetterCallback, SetterCallback } from '@typedly/callback';\n/**\n * @description The abstract class for wrapped descriptors.\n * @export\n * @abstract\n * @class WrappedDescriptorCore\n * @template [O=any] The type of the object to define the descriptor on.\n * @template {keyof O} [K=keyof O] The key of the object to define the descriptor on.\n * @template {K extends keyof O ? O[K] : any} [V=K extends keyof O ? O[K] : any] The value type of the key in the object.\n * @template {boolean} [A=boolean] The type of active.\n * @template {boolean} [N=boolean] The type of enabled.\n * @template {boolean} [C=boolean] The type of configurable.\n * @template {boolean} [E=boolean] The type of enumerable.\n * @template {WrappedDescriptorCore<O, K, V, A, N, C, E, D> | PropertyDescriptor} [D=WrappedDescriptorCore<O, K, V, A, N, C, E, any>] \n * @extends {CommonDescriptor<C, E>}\n * @implements {WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>}\n */\nexport abstract class WrappedDescriptorCore<\n // Object.\n O = any,\n // Key.\n K extends keyof O = keyof O,\n // Value.\n V extends K extends keyof O ? O[K] : any = K extends keyof O ? O[K] : any,\n // Active.\n A extends boolean = boolean,\n // Enabled.\n N extends boolean = boolean,\n // Configurable.\n C extends boolean = boolean,\n // Enumerable.\n E extends boolean = boolean,\n // The type of the previous and current descriptor.\n D extends WrappedPropertyDescriptor<O, K, V, A, N, C, E, D> | PropertyDescriptor = WrappedPropertyDescriptor<O, K, V, A, N, C, E, any>\n> extends CommonDescriptor<C, E>\n implements WrappedPropertyDescriptor<O, K, V, A, N, C, E, D> {\n /**\n * @description The defaults for instance `active` property.\n * @public\n * @static\n * @type {boolean}\n */\n public static active: boolean = true;\n\n /**\n * @description The defaults for instance `enabled` property.\n * @public\n * @static\n * @type {boolean}\n */\n public static enabled: boolean = true;\n\n /**\n * @description The prefix for the private key.\n * @public\n * @static\n * @type {string}\n */\n public static prefix: string = '_';\n\n /**\n * @description Whether the descriptor is active.\n * If `true`, the descriptor is active.\n * If an object, it can have `onGet` and `onSet` properties\n * that indicate whether the `onGet` and `onSet` methods are active.\n * @abstract\n * @type {(A | { onGet?: boolean; onSet?: boolean })}\n */\n abstract active: A | { onGet?: boolean; onSet?: boolean };\n\n /**\n * @description Whether the descriptor is enabled.\n * If `true`, the descriptor is enabled.\n * If `false`, the descriptor is disabled.\n * @abstract\n * @type {N}\n */\n abstract enabled: N;\n \n /**\n * @description The `get` getter for the descriptor.\n * @abstract\n * @type {(this: O, descriptor?: D) => V}\n */\n abstract get: (this: O, descriptor?: D) => V;\n\n /**\n * @description The index of the descriptor in the chain.\n * @abstract\n * @type {number | undefined}\n */\n abstract index?: number;\n\n /**\n * @description The object key to define the descriptor on.\n * @abstract\n * @type {K} \n */\n abstract key: K;\n\n /**\n * @description The custom getter function for the descriptor.\n * @abstract\n * @type {?GetterCallback<O, K>}\n */\n abstract onGet?: GetterCallback<O, K>;\n\n /**\n * @description The custom setter function for the descriptor.\n * @abstract\n * @type {?SetterCallback<O, K>}\n */\n abstract onSet?: SetterCallback<O, K>;\n\n /**\n * @description The previous descriptor that this descriptor wraps.\n * @abstract\n * @type {?D}\n */\n abstract previousDescriptor?: D;\n\n /**\n * @description The private key used to store the value in the object.\n * @abstract\n * @type {PropertyKey}\n */\n abstract privateKey: PropertyKey;\n\n /**\n * @description The `set` getter for the descriptor.\n * @abstract\n * @type {(this: O, value: V, descriptor?: D) => void}\n */\n abstract set: (this: O, value: V, descriptor?: D) => void;\n\n /**\n * @description Wraps the property with the descriptor.\n * @protected\n * @param {Partial<WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>>} param0 The wrapped property `set` and `get` descriptor.\n * @returns {(Pick<WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>, 'get' | 'set'>)} \n */\n protected wrap({ get, set }: Partial<WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>>): Pick<WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>, 'get' | 'set'> {\n // Use descriptor instance.\n const descriptor = this;\n // Return the wrapped property.\n return {\n get: get\n ? (function (this: O): V { return get?.call(this, descriptor as unknown as D) as V; })\n : (function (this: O): V {\n const o = (this as O);\n\n // Check if the descriptor is active.\n const active = typeof descriptor.active === 'object' ? descriptor.active.onGet : descriptor.active;\n\n // Check if the descriptor is enabled.\n const enabled = typeof descriptor.enabled === 'boolean' ? descriptor.enabled : WrappedDescriptorCore.enabled;\n\n // Perform previous descriptor `get`. Handle the data descriptor as first.\n let previousValue = descriptor.previousDescriptor && (descriptor.previousDescriptor as WrappedPropertyDescriptor).enabled !== false\n ? 'value' in descriptor.previousDescriptor\n ? (descriptor.previousDescriptor as PropertyDescriptor).value\n : descriptor.previousDescriptor?.get\n ? descriptor.previousDescriptor.get.call(o, descriptor.previousDescriptor as D)\n : undefined as V\n : undefined as V;\n\n // Returns.\n // If descriptor is enabled, return the value from the `privateKey` also by using `onGet` hook on `active` set to `true`.\n if (enabled === true) {\n return descriptor.onGet && active === true\n ? descriptor.onGet.call(o, descriptor.key as K, previousValue, o[descriptor.privateKey as K] as V, o) as V\n : o[descriptor.privateKey as K] as V;\n }\n return void(0) as any;\n }\n ),\n set: set\n ? function(this: O, value: V) {\n set?.call(this, value, descriptor as unknown as D);\n }\n : function(this: O, value: V): void {\n // Set the this as the target object.\n const o = (this as O);\n\n // Check if the descriptor is active.\n const active = typeof descriptor.active === 'object' ? descriptor.active.onSet : descriptor.active\n\n // Check if the descriptor is enabled.\n const enabled = typeof descriptor.enabled === 'boolean' ? descriptor.enabled : WrappedDescriptorCore.enabled\n\n // Initialize `previousValue`.\n let previousValue: V = undefined as V;\n\n // Get the previous value from previous descriptor or current value.\n if (enabled === true) {\n previousValue = descriptor.previousDescriptor && (descriptor.previousDescriptor as WrappedPropertyDescriptor).enabled !== false\n ? 'value' in descriptor.previousDescriptor\n ? (descriptor.previousDescriptor as PropertyDescriptor).value\n : (descriptor.previousDescriptor as WrappedPropertyDescriptor).privateKey\n ? o[(descriptor.previousDescriptor as WrappedPropertyDescriptor).privateKey as K] as V\n : o[descriptor.privateKey as K] as V\n : o[descriptor.privateKey as K] as V;\n }\n\n // Perform previous descriptor.\n descriptor.previousDescriptor?.set\n && (descriptor.previousDescriptor as WrappedPropertyDescriptor).enabled !== false\n && descriptor.previousDescriptor.set.call(o, value, descriptor.previousDescriptor as D);\n\n if (enabled === true) {\n // Set the value under the `privateKey`.\n o[descriptor.privateKey as K] = descriptor.onSet && active === true\n ? descriptor.onSet.call(o, value, previousValue, descriptor.key, o) as V\n : value;\n }\n }};\n }\n}\n","// Abstract.\nimport { WrappedDescriptorCore } from './wrapped-descriptor-core.abstract';\n// Interface.\nimport { WrappedPropertyDescriptor } from '@typedly/descriptor';\n// Type.\nimport { SetterCallback, GetterCallback } from '@typedly/callback';\n/**\n * @description The base abstraction class for plain wrapped descriptors.\n * @export\n * @abstract\n * @class PlainWrappedDescriptorBase\n * @template [O=any] The type of the object to define the descriptor on.\n * @template {keyof O} [K=keyof O] The key of the object to define the descriptor on.\n * @template {K extends keyof O ? O[K] : any} [V=K extends keyof O ? O[K] : any] The value type of the key in the object.\n * @template {boolean} [A=boolean] The type of active.\n * @template {boolean} [N=boolean] The type of enabled.\n * @template {boolean} [C=boolean] The type of configurable.\n * @template {boolean} [E=boolean] The type of enumerable.\n * @template {PlainWrappedDescriptorBase<O, K, V, A, N, C, E, D> | PropertyDescriptor} [D=PlainWrappedDescriptorBase<O, K, V, A, N, C, E, any>] \n * @extends {WrappedDescriptorCore<O, K, V, A, N, C, E, D>}\n */\nexport abstract class PlainWrappedDescriptorBase<\n // Object.\n O = any,\n // Key.\n K extends keyof O = keyof O,\n // Value.\n V extends K extends keyof O ? O[K] : any = K extends keyof O ? O[K] : any,\n // Active.\n A extends boolean = boolean,\n // Enabled.\n N extends boolean = boolean,\n // Configurable.\n C extends boolean = boolean,\n // Enumerable.\n E extends boolean = boolean,\n // The type of the previous descriptor.\n D extends PlainWrappedDescriptorBase<O, K, V, A, N, C, E, D> | PropertyDescriptor = PlainWrappedDescriptorBase<O, K, V, A, N, C, E, any>,\n> extends WrappedDescriptorCore<O, K, V, A, N, C, E, D> {\n /**\n * @description The active state of the descriptor.\n * @public\n * @type {(A | { onGet?: boolean; onSet?: boolean })}\n */\n public active: A | { onGet?: boolean; onSet?: boolean };\n \n /**\n * @description The enabled state of the descriptor.\n * @public\n * @type {N}\n */\n public enabled: N;\n \n /**\n * @description The index of the descriptor in the chain.\n * @public\n * @type {?number}\n */\n public index?: number;\n\n /**\n * @description The optional `get` method for the descriptor.\n * @public\n * @type {(this: O, descriptor?: D) => V}\n */\n public get: (this: O, descriptor?: D) => V;\n \n /**\n * @description The key of the descriptor.\n * @public\n * @type {K}\n */\n public key: K;\n \n /**\n * @description The on get hook function for the descriptor.\n * @public\n * @type {?GetterCallback<O, K>}\n */\n public onGet?: GetterCallback<O, K>;\n\n /**\n * @description The on set hook function for the descriptor.\n * @public\n * @type {?SetterCallback<O, K>}\n */\n public onSet?: SetterCallback<O, K>;\n \n /**\n * @description The previous descriptor.\n * @public\n * @type {D}\n */\n public previousDescriptor: D;\n\n /**\n * @description The private key for the descriptor.\n * @public\n * @type {PropertyKey}\n */\n public privateKey: PropertyKey;\n\n /**\n * @description The optional `set` method for the descriptor.\n * @public\n * @type {(this: O, value: V, descriptor?: D) => void}\n */\n public set: (this: O, value: V, descriptor?: D) => void;\n\n /**\n * Creates an instance of `WrappedDescriptorBase` child class.\n * @constructor\n * @param {O} object The object to define the descriptor on.\n * @param {K} key The key of the object to define the descriptor on.\n * @param {Partial<WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>>} attributes The property descriptor to wrap.\n */\n constructor(\n object: O,\n key: K, \n attributes: Partial<WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>>,\n ) {\n super(attributes);\n\n delete this.index;\n delete this.onGet;\n delete this.onSet;\n // delete this.previousDescriptor;\n\n // Assign the properties.\n // Required.\n this.active = typeof attributes.active === 'boolean' || typeof attributes.active === 'object' ? attributes.active : PlainWrappedDescriptorBase.active as A;\n this.enabled = typeof attributes.enabled === 'boolean' || typeof attributes.enabled === 'object' ? attributes.enabled : PlainWrappedDescriptorBase.enabled as N;\n this.key = key;\n this.previousDescriptor = (attributes.previousDescriptor || Object.getOwnPropertyDescriptor(object, key)) as any;\n this.privateKey = attributes.privateKey || `_${String(key)}`;\n\n // Optional.\n attributes.index && (this.index = attributes.index);\n attributes.onGet && (this.onGet = attributes.onGet);\n attributes.onSet && (this.onSet = attributes.onSet);\n\n // Wraps the `get` getter and `set` setter of the descriptor.\n const {get, set} = super.wrap(attributes);\n // Assigns the wrapped `get` getter and `set` setter to the descriptor.\n this.get = get!\n this.set = set!;\n }\n}\n","// Abstract.\nimport { WrappedDescriptorCore } from './wrapped-descriptor-core.abstract';\n// Interface.\nimport { WrappedPropertyDescriptor } from '@typedly/descriptor';\n// Type.\nimport { GetterCallback, SetterCallback } from '@typedly/callback';\n/**\n * @description The base abstraction class for wrapped descriptors.\n * @export\n * @abstract\n * @class WrappedDescriptorBase\n * @template [O=any] The type of the object to define the descriptor on.\n * @template {keyof O} [K=keyof O] The key of the object to define the descriptor on.\n * @template {K extends keyof O ? O[K] : any} [V=K extends keyof O ? O[K] : any] The value type of the key in the object.\n * @template {boolean} [A=boolean] The type of active.\n * @template {boolean} [N=boolean] The type of enabled.\n * @template {boolean} [C=boolean] The type of configurable.\n * @template {boolean} [E=boolean] The type of enumerable.\n * @template {WrappedDescriptorBase<O, K, V, A, N, C, E, D> | PropertyDescriptor} [D=WrappedDescriptorBase<O, K, V, A, N, C, E, any>] \n * @extends {WrappedDescriptorCore<O, K, V, A, N, C, E, D>}\n */\nexport abstract class WrappedDescriptorBase<\n // Object.\n O = any,\n // Key.\n K extends keyof O = keyof O,\n // Value.\n V extends K extends keyof O ? O[K] : any = K extends keyof O ? O[K] : any,\n // Active.\n A extends boolean = boolean,\n // Enabled.\n N extends boolean = boolean,\n // Configurable.\n C extends boolean = boolean,\n // Enumerable.\n E extends boolean = boolean,\n // The type of the previous descriptor.\n D extends WrappedDescriptorBase<O, K, V, A, N, C, E, D> | PropertyDescriptor = WrappedDescriptorBase<O, K, V, A, N, C, E, any>,\n> extends WrappedDescriptorCore<O, K, V, A, N, C, E, D> {\n /**\n * @inheritdoc\n */\n public get active() {\n return this.#active;\n }\n\n /**\n * @inheritdoc\n */\n public get enabled() {\n return this.#enabled;\n }\n\n /**\n * @inheritdoc\n */\n public get index() {\n return this.#index;\n }\n\n /**\n * @inheritdoc\n */\n public get key() {\n return this.#key;\n }\n\n /**\n * @inheritdoc\n */\n public get onGet() {\n return this.#onGet;\n }\n\n /**\n * @inheritdoc\n */\n public get onSet() {\n return this.#onSet;\n }\n\n /**\n * @inheritdoc\n */\n public get previousDescriptor() {\n return this.#previous;\n }\n\n /**\n * @inheritdoc\n */\n public get privateKey() {\n return this.#privateKey;\n }\n \n /**\n * @description The active state of the descriptor.\n * @type {(A | {onGet?: boolean | undefined; onSet?: boolean | undefined;})}\n */\n #active: A | {onGet?: boolean | undefined; onSet?: boolean | undefined;};\n\n /**\n * @description The enabled state of the descriptor.\n * @type {N}\n */\n #enabled: N;\n\n /**\n * @description The index of the descriptor in the chain.\n * @type {?number}\n */\n #index?: number;\n \n /**\n * @description The key of the descriptor.\n * @type {K}\n */\n #key: K;\n\n /**\n * @description The on get hook function for the descriptor.\n * @type {?GetterCallback<O, K>}\n */\n #onGet?: GetterCallback<O, K>;\n\n /**\n * @description The on set hook function for the descriptor.\n * @type {?SetterCallback<O, K>}\n */\n #onSet?: SetterCallback<O, K>;\n\n /**\n * @description The previous descriptor in the chain.\n * @type {?D}\n */\n #previous?: D;\n\n /**\n * @description The private key for the descriptor.\n * @type {PropertyKey}\n */\n #privateKey: PropertyKey;\n\n /**\n * Creates an instance of `WrappedDescriptorBase` child class.\n * @constructor\n * @param {O} object The object to define the descriptor on.\n * @param {K} key The key of the object to define the descriptor on.\n * @param {Partial<WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>>} [attributes={}] The property descriptor attributes.\n */\n constructor(\n object: O,\n key: K, \n attributes: Partial<WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>> = {},\n ) {\n super(attributes);\n\n // Assign the properties.\n // Required.\n this.#active = typeof attributes.active === 'boolean' || typeof attributes.active === 'object' ? attributes.active : WrappedDescriptorBase.active as A;\n this.#enabled = typeof attributes.enabled === 'boolean' || typeof attributes.enabled === 'object' ? attributes.enabled : WrappedDescriptorBase.enabled as N;\n this.#privateKey = attributes.privateKey || `${WrappedDescriptorBase.prefix}${String(key)}`;\n\n // Optional.\n this.#index = attributes.index;\n this.#key = key;\n this.#onGet = attributes.onGet;\n this.#onSet = attributes.onSet;\n this.#previous = attributes.previousDescriptor;\n }\n\n /**\n * @inheritdoc\n * @public\n * @returns {WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>} \n */\n public override valueOf(): WrappedPropertyDescriptor<O, K, V, A, N, C, E, D> {\n return {\n active: this.active,\n configurable: this.configurable,\n enabled: this.enabled,\n enumerable: this.enumerable,\n get: this.get,\n index: this.index,\n onGet: this.onGet,\n onSet: this.onSet,\n previousDescriptor: this.previousDescriptor,\n privateKey: this.privateKey,\n set: this.set,\n };\n }\n}\n","// Abstract.\nimport { PlainWrappedDescriptorBase } from './plain-wrapped-descriptor-base.abstract';\n// Interface.\nimport { WrappedPropertyDescriptor } from '@typedly/descriptor';\n/**\n * @description The plain wrapped descriptor class.\n * @export\n * @class PlainWrappedDescriptor\n * @template [O=any] The type of the object to define the descriptor on.\n * @template {keyof O} [K=keyof O] The key of the object to define the descriptor on.\n * @template {K extends keyof O ? O[K] : any} [V=K extends keyof O ? O[K] : any] The value type of the key in the object.\n * @template {boolean} [A=boolean] The type of active.\n * @template {boolean} [N=boolean] The type of enabled.\n * @template {boolean} [C=boolean] The type of configurable.\n * @template {boolean} [E=boolean] The type of enumerable.\n * @template {PlainWrappedDescriptorBase<O, K, V, A, N, C, E, D> | PropertyDescriptor} [D=PlainWrappedDescriptorBase<O, K, V, A, N, C, E, any>] \n */\nexport class PlainWrappedDescriptor<\n // Object.\n O = any,\n // Key.\n K extends keyof O = keyof O,\n // Value.\n V extends K extends keyof O ? O[K] : any = K extends keyof O ? O[K] : any,\n // Active.\n A extends boolean = boolean,\n // Enabled.\n N extends boolean = boolean,\n // Configurable.\n C extends boolean = boolean,\n // Enumerable.\n E extends boolean = boolean,\n // The type of the previous descriptor.\n D extends PlainWrappedDescriptorBase<O, K, V, A, N, C, E, D> | PropertyDescriptor = PlainWrappedDescriptorBase<O, K, V, A, N, C, E, any>,\n> extends PlainWrappedDescriptorBase<O, K, V, A, N, C, E, D> {\n constructor(object: O, key: K, descriptor: WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>) {\n super(object, key, descriptor);\n }\n}\n","// Abstract.\nimport { WrappedDescriptorBase } from './wrapped-descriptor-base.abstract';\n// Interface.\nimport { WrappedPropertyDescriptor } from '@typedly/descriptor';\n/**\n * @description The concrete implementation of wrapped property descriptor.\n * @export\n * @class WrappedDescriptor\n * @template [O=any] The type of the object to define the descriptor on.\n * @template {keyof O} [K=keyof O] The key of the object to define the descriptor on.\n * @template {K extends keyof O ? O[K] : any} [V=K extends keyof O ? O[K] : any] The value type of the key in the object.\n * @template {boolean} [A=boolean] The type of active.\n * @template {boolean} [N=boolean] The type of enabled.\n * @template {boolean} [C=boolean] The type of configurable.\n * @template {boolean} [E=boolean] The type of enumerable.\n * @template {WrappedDescriptor<O, K, V, A, N, C, E, D> | PropertyDescriptor} [D=WrappedDescriptor<O, K, V, A, N, C, E, any>] The type of the previous descriptor.\n * @extends {WrappedDescriptorBase<O, K, V, A, N, C, E, D>}\n */\nexport class WrappedDescriptor<\n // Object.\n O = any,\n // Key.\n K extends keyof O = keyof O,\n // Value.\n V extends K extends keyof O ? O[K] : any = K extends keyof O ? O[K] : any,\n // Active.\n A extends boolean = boolean,\n // Enabled.\n N extends boolean = boolean,\n // Configurable.\n C extends boolean = boolean,\n // Enumerable.\n E extends boolean = boolean,\n // Descriptor.\n D extends WrappedDescriptor<O, K, V, A, N, C, E, D> | PropertyDescriptor = WrappedDescriptor<O, K, V, A, N, C, E, any>,\n> extends WrappedDescriptorBase<O, K, V, A, N, C, E, D> {\n /**\n * @description The string tag for the descriptor.\n * @public\n * @readonly\n * @type {string}\n */\n public get [Symbol.toStringTag](): string {\n return 'WrappedDescriptor';\n }\n\n /**\n * @inheritdoc\n */\n public get get() {\n return this.#get;\n }\n\n /**\n * @inheritdoc\n */\n public get set() {\n return this.#set;\n }\n \n /**\n * @description The `get` method for the descriptor.\n * @type {(this: O, descriptor?: D | undefined) => V}\n */\n #get: (this: O, descriptor?: D | undefined) => V;\n\n /**\n * @description The `set` method for the descriptor.\n * @type {(this: O, value: V, descriptor?: D | undefined) => void}\n */\n #set: (this: O, value: V, descriptor?: D | undefined) => void;\n\n /**\n * Creates an instance of `WrappedDescriptor`.\n * @constructor\n * @param {O} object The object to define the descriptor on.\n * @param {K} key The key of the object to define the descriptor on.\n * @param {Partial<WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>>} attributes\n */\n constructor(\n object: O,\n key: K,\n attributes: Partial<WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>> = {},\n ) {\n super(object, key, attributes);\n\n // Wrap the property `get` and `set`.\n const {get, set} = this.wrap({\n get: attributes.get,\n set: attributes.set \n });\n\n // Assign the wrapped `get` and `set` methods.\n this.#get = get!;\n this.#set = set!;\n }\n}\n","// Abstract.\nexport { PlainWrappedDescriptorBase } from './plain-wrapped-descriptor-base.abstract';\nexport { WrappedDescriptorBase } from './wrapped-descriptor-base.abstract';\nexport { WrappedDescriptorCore } from './wrapped-descriptor-core.abstract';\n// Class.\nexport { PlainWrappedDescriptor } from './plain-wrapped-descriptor.class';\nexport { WrappedDescriptor } from './wrapped-descriptor.class';\n","/*\n * Public API Surface of wrapped-descriptor\n */\n\nexport {\n // Abstract.\n PlainWrappedDescriptorBase,\n WrappedDescriptorBase,\n WrappedDescriptorCore,\n // Class.\n PlainWrappedDescriptor,\n WrappedDescriptor\n} from './lib';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;AAMA;;;;;;;;;;;;;;;AAeG;AACG,MAAgB,qBAiBpB,SAAQ,gBAAsB,CAAA;AAE9B;;;;;AAKG;AACI,IAAA,OAAO,MAAM,GAAY,IAAI;AAEpC;;;;;AAKG;AACI,IAAA,OAAO,OAAO,GAAY,IAAI;AAErC;;;;;AAKG;AACI,IAAA,OAAO,MAAM,GAAW,GAAG;AA6ElC;;;;;AAKG;AACO,IAAA,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAA8D,EAAA;;QAErF,MAAM,UAAU,GAAG,IAAI;;QAEvB,OAAO;AACL,YAAA,GAAG,EAAE;AACH,mBAAG,YAAwB,EAAA,OAAO,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,UAA0B,CAAM,CAAC,EAAE;AACrF,mBAAG,YAAA;oBACD,MAAM,CAAC,GAAI,IAAU;;oBAGrB,MAAM,MAAM,GAAG,OAAO,UAAU,CAAC,MAAM,KAAK,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,MAAM;;oBAGlG,MAAM,OAAO,GAAG,OAAO,U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