@vicin/sigil 2.1.0 → 2.2.0

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/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/options.ts","../src/core/symbols.ts","../src/core/constants.ts","../src/core/helpers.ts","../src/core/mixin.ts","../src/core/classes.ts","../src/core/decorator.ts","../src/core/hof.ts"],"names":["ctor","createId"],"mappings":";;;;;AAoDO,IAAM,OAAA,GAAkC;AAAA,EAC7C,eAAA,EAAiB,IAAA;AAAA,EACjB,yBAAA,EAA2B,KAAA;AAAA,EAC3B,cAAA,EAAgB;AAClB,CAAA;AAQO,IAAM,kBAAA,GAAqB,CAAC,IAAA,KAA6B;AAC9D,EAAA,IAAI,KAAK,cAAA,EAAgB;AACvB,IAAA,IAAI,OAAO,KAAK,cAAA,KAAmB,SAAA;AACjC,MAAA,MAAM,IAAI,MAAM,qDAAqD,CAAA;AACvE,IAAA,OAAA,CAAQ,iBAAiB,IAAA,CAAK,cAAA;AAAA,EAChC;AACA,EAAA,IAAI,KAAK,yBAAA,EAA2B;AAClC,IAAA,IAAI,OAAO,KAAK,yBAAA,KAA8B,SAAA;AAC5C,MAAA,MAAM,IAAI,MAAM,gEAAgE,CAAA;AAClF,IAAA,OAAA,CAAQ,4BAA4B,IAAA,CAAK,yBAAA;AAAA,EAC3C;AACA,EAAA,IAAI,KAAK,eAAA,EAAiB;AACxB,IAAA,IACE,IAAA,CAAK,oBAAoB,IAAA,IACzB,OAAO,KAAK,eAAA,KAAoB,UAAA,IAChC,EAAE,IAAA,CAAK,eAAA,YAA2B,MAAA,CAAA;AAElC,MAAA,MAAM,IAAI,KAAA;AAAA,QACR;AAAA,OACF;AACF,IAAA,OAAA,CAAQ,kBAAkB,IAAA,CAAK,eAAA;AAAA,EACjC;AACF;AAaO,IAAM,mBAAA,GAAsB;;;AC1F5B,IAAM,SAAA,mBAAY,MAAA,CAAO,GAAA,CA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a,MAAM,CAAC,CAAA;AACpB,EAAA,IAAI,OAAA,EAAS,gBAAA,CAAiB,IAAA,EAAM,IAAI,CAAA;AAExC,EAAA,OAAO,KAAA;AACT;AAaO,SAAS,cAAA,CACd,KAAA,EACA,KAAA,EACA,IAAA,EACkB;AA9DpB,EAAA,IAAA,EAAA;AA+DE,EAAA,IAAI,CAAC,YAAY,KAAK,CAAA;AACpB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,+EAAA,EAAA,CAAkF,EAAA,GAAA,KAAA,IAAA,IAAA,GAAA,MAAA,GAAA,KAAA,CAAO,IAAA,KAAP,IAAA,GAAA,EAAA,GAAe,SAAS,CAAA;AAAA,KAC5G;AAGF,EAAA,IAAI,CAAA;AACJ,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,WAAA,CAAY,OAAO,IAAI,CAAA;AACvB,IAAA,CAAA,GAAI,KAAA;AAAA,EACN,CAAA,UAAW,mBAAA,EAAoB;AAG/B,EAAA,MAAM,IAAA,GAAO,KAAA;AACb,EAAA,YAAA,CAAa,MAAM,CAAC,CAAA;AACpB,EAAA,IAAI,OAAA,EAAS,gBAAA,CAAiB,IAAA,EAAM,IAAI,CAAA;AAExC,EAAA,OAAO,KAAA;AACT","file":"index.js","sourcesContent":["/**\n * Configuration options for the Sigil library.\n *\n * These options control runtime validation, inheritance checks, label autofill behavior.\n */\nexport interface SigilOptions {\n /**\n * Validation rule applied to sigil labels before registration.\n *\n * - A function receives the label and must return `true` if valid.\n * - A `RegExp` must match the label.\n * - `null` disables validation entirely.\n *\n * Defaults to `null`.\n */\n labelValidation?: ((label: string) => boolean) | RegExp | null;\n\n /**\n * Skips the runtime check that prevents subclasses from inheriting\n * the same sigil label as their ancestors.\n *\n * When `false` (default), extending a sigil class without\n * using `WithSigil(newLabel)` decorator will throw an error if the label\n * is reused and `OPTIONS.autofillLabels` is set to `false`.\n *\n * Set this to `true` only if you intentionally want subclasses to inherit labels\n * from their ancestors (this weakens the uniqueness guarantees).\n *\n * WARNING:\n * Disabling inheritanceCheck removes guaranties by 'Sigil' or unique label for\n * each class and allow multiple child classes to use the same label which can\n * result on false 'isOfType' result. this options should be used in debugging\n * only to silence all errors but never in production.\n */\n skipLabelInheritanceCheck?: boolean;\n\n /**\n * When enabled, non-decorated subclasses that would otherwise inherit an ancestor's label\n * will be assigned an autogenerated random label (so that explicit labels stay unique).\n */\n autofillLabels?: boolean;\n}\n\n/** -----------------------------------------\n * Main options object\n * ----------------------------------------- */\n\n/**\n * Defined SigilOptions used in the library.\n *\n * @internal\n */\nexport const OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n skipLabelInheritanceCheck: false,\n autofillLabels: false,\n};\n\n/**\n * Update runtime options for the Sigil library.\n * Call this early during application startup if you want non-default behavior.\n *\n * @param opts - Partial options to merge into the global `OPTIONS` object.\n */\nexport const updateSigilOptions = (opts: SigilOptions): void => {\n if (opts.autofillLabels) {\n if (typeof opts.autofillLabels !== 'boolean')\n throw new Error(\"'updateSigilOptions.autofillLabels' must be boolean\");\n OPTIONS.autofillLabels = opts.autofillLabels;\n }\n if (opts.skipLabelInheritanceCheck) {\n if (typeof opts.skipLabelInheritanceCheck !== 'boolean')\n throw new Error(\"'updateSigilOptions.skipLabelInheritanceCheck' must be boolean\");\n OPTIONS.skipLabelInheritanceCheck = opts.skipLabelInheritanceCheck;\n }\n if (opts.labelValidation) {\n if (\n opts.labelValidation !== null &&\n typeof opts.labelValidation !== 'function' &&\n !(opts.labelValidation instanceof RegExp)\n )\n throw new Error(\n \"'updateSigilOptions.labelValidation' must be null, function or regex expression\"\n );\n OPTIONS.labelValidation = opts.labelValidation;\n }\n};\n\n/** -----------------------------------------\n * Label validation\n * ----------------------------------------- */\n\n/**\n * Label validation regex. Labels must follow the pattern\n * `@scope/package.ClassName` where `ClassName` begins with an uppercase\n * letter. This avoids collisions across packages and helps debugging.\n *\n * It's advised to use this regex in 'SigilOptions.labelValidation'.\n */\nexport const DEFAULT_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n","/**\n * Symbol to uniquely identify sigil classes.\n *\n * Uses `Symbol.for()` so the symbol is stable across multiple bundles/realms\n * that share the same global symbol registry.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@Sigil.__SIGIL__');\n\n/**\n * Symbol to uniquely identify the base of sigil classes.\n *\n * When attached to a constructor it indicates that the constructor is a\n * sigil base and should be treated specially by inheritance checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL_BASE__ = Symbol.for('@Sigil.__SIGIL_BASE__');\n\n/**\n * Symbol to mark constructors that were explicitly decorated with `WithSigil()`.\n *\n * This differs from `__SIGIL__` in that `__DECORATED__` indicates explicit\n * decoration (as opposed to automatically assigned labels).\n *\n * @internal\n * @constant {symbol}\n */\nexport const __DECORATED__ = Symbol.for('@Sigil.__DECORATED__');\n\n/**\n * Symbol to mark that inheritance checks for a given constructor have been completed.\n *\n * This is used to avoid repeated DEV-time validation on subsequent instance creations.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __INHERITANCE_CHECKED__ = Symbol.for('@Sigil.__INHERITANCE_CHECKED__');\n\n/**\n * Symbol used to store the human-readable label for a sigil constructor.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL__ = Symbol.for('@Sigil.__LABEL__');\n\n/**\n * Symbol used to store the linearized label lineage for a sigil constructor.\n *\n * This is an array of labels (strings) representing the inheritance path of labels.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_LINEAGE__ = Symbol.for('@Sigil.__LABEL_LINEAGE__');\n\n/**\n * Symbol used to store the set of labels for a sigil constructor.\n *\n * This is a `Set<string>` that mirrors `__LABEL_LINEAGE__` for fast membership checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_SET__ = Symbol.for('@Sigil.__LABEL_SET__');\n","export const __DEV__ = typeof process !== 'undefined' && process.env.NODE_ENV === 'development';\n","import { OPTIONS, type SigilOptions } from './options';\nimport {\n __DECORATED__,\n __INHERITANCE_CHECKED__,\n __LABEL__,\n __SIGIL_BASE__,\n __SIGIL__,\n __LABEL_LINEAGE__,\n __LABEL_SET__,\n} from './symbols';\nimport type { ISigil, GetInstance } from './types';\nimport { createId } from '@paralleldrive/cuid2';\nimport { __DEV__ } from './constants';\n\n/** -----------------------------------------\n * High level helpers\n * ----------------------------------------- */\n\n/**\n * Attach sigil-related statics to a constructor and register its label.\n *\n * Side effects:\n * - Defines non-enumerable statics on the constructor:\n * - `__LABEL__` (string)\n * - `__LABEL_LINEAGE__` (array of strings)\n * - `__LABEL_SET__` (Set of strings)\n * - Marks the constructor as decorated via `markDecorated`.\n *\n * Throws if the constructor is already decorated.\n *\n * @internal\n * @param ctor - The constructor to decorate.\n * @param label - The identity label to register and attach (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @throws Error when `ctor` is already decorated.\n */\nexport function decorateCtor(ctor: Function, label: string, isMixin: boolean = false) {\n // if already decorated throw error\n if (isDecorated(ctor))\n throw new Error(\n `Constructor ${ctor} is already decorated. if you are using 'withSigilTyped()' & '@WithSigil()' at the same time remove one of them.`\n );\n\n // attach basic runtime statics\n Object.defineProperty(ctor, __LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // get parent chain (safe if parent hasn't been augmented yet — uses existing value or empty)\n const parent = Object.getPrototypeOf(ctor);\n const parentChain = parent && parent[__LABEL_LINEAGE__] ? parent[__LABEL_LINEAGE__] : [];\n\n // generate Ctor chain, if mixin (Sigilify function) then append 'Sigil' at the start\n const ctorChain =\n isMixin && label !== 'Sigil' ? ['Sigil', ...parentChain, label] : [...parentChain, label];\n\n // attach symbol lineage and set\n Object.defineProperty(ctor, __LABEL_LINEAGE__, {\n value: ctorChain,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __LABEL_SET__, {\n value: new Set(ctorChain),\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // mark as decorated\n markDecorated(ctor);\n}\n\n/**\n * Perform development-only inheritance checks to ensure no ancestor classes\n * reuse the same sigil label.\n *\n * Behavior:\n * - No-op if `ctor` is not a sigil constructor.\n * - No-op in non-DEV builds.\n * - No-op if inheritance checks were already performed or `OPTIONS.skipLabelInheritanceCheck` is true.\n *\n * When a duplicate label is detected:\n * - If the class is explicitly decorated (`isDecorated`) or `OPTIONS.autofillLabels` is false,\n * an Error is thrown describing the label collision.\n * - Otherwise (autofill enabled), a random label will be generated and assigned\n * to the offending constructor via `decorateCtor`.\n *\n * @internal\n * @param ctor - The constructor to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws Error when a decorated subclass re-uses an ancestor's sigil label.\n */\nexport function checkInheritance(\n ctor: Function,\n opts?: Pick<SigilOptions, 'skipLabelInheritanceCheck' | 'autofillLabels'>\n) {\n const skipLabelInheritanceCheck =\n opts?.skipLabelInheritanceCheck ?? OPTIONS.skipLabelInheritanceCheck;\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n\n if (!isSigilCtor(ctor)) return;\n if (isInheritanceChecked(ctor) || skipLabelInheritanceCheck) return;\n\n /** Array of all sigil constructors in the chain (starting with the provided ctor) */\n const ctors: ISigil[] = [ctor];\n\n // go through prototype chain to get all sigil ancestors\n let ancestor: any = Object.getPrototypeOf(ctor);\n while (isSigilCtor(ancestor)) {\n ctors.push(ancestor);\n ancestor = Object.getPrototypeOf(ancestor);\n }\n\n /** Map<label, className> to record the owner of each label. */\n const labelOwner = new Map<string, string>();\n\n // loop ctors from base to current and make sure no label is reused\n for (let i = ctors.length - 1; i >= 0; i--) {\n const ctor = ctors[i];\n if (!ctor) continue;\n let label = ctor.SigilLabel;\n if (labelOwner.has(label)) {\n if (isDecorated(ctor) || !autofillLabels) {\n const ancestorName = labelOwner.get(label);\n throw new Error(\n `[Sigil Error] Class \"${ctor.name}\" re-uses Sigil label \"${label}\" from ancestor \"${ancestorName}\". ` +\n `Each Sigil subclass must use a unique label. Did you forget to use \"WithSigil(newLabel)\" on the subclass?`\n );\n }\n label = generateRandomLabel();\n decorateCtor(ctor, label);\n }\n labelOwner.set(label, ctor.name);\n }\n markInheritanceChecked(ctor);\n}\n\n/**\n * Validate a sigil label at runtime and throw a helpful error if it is malformed.\n *\n * This is intentionally `void` and runs synchronously at class declaration time so\n * invalid labels fail fast during development. Validation behavior follows `OPTIONS.labelValidation`:\n * - If `OPTIONS.labelValidation` is `null` no validation is performed.\n * - If it is a `RegExp`, the label must match the regex.\n * - If it is a function, the function must return `true` for the label to be considered valid.\n *\n * @internal\n * @typeParam L - Label string literal type.\n * @param label - The label to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws {Error} Throws when the label does not pass configured validation.\n */\nexport function verifyLabel<L extends string>(\n label: L,\n opts?: Pick<SigilOptions, 'labelValidation'>\n): void {\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\n\n if (labelValidation) {\n let valid: boolean;\n if (labelValidation instanceof RegExp) valid = labelValidation.test(label);\n else valid = labelValidation(label);\n\n if (!valid)\n throw new Error(\n `[Sigil] Invalid identity label \"${label}\". Make sure that supplied label matches validation regex or function.`\n );\n }\n}\n\n/**\n * Generate a random alphanumeric label of the requested length.\n *\n * This is used to auto-generate labels when `OPTIONS.autofillLabels` is enabled.\n * It insures that generated label is not registered yet.\n *\n * @internal\n * @param length - Desired length of the generated string (defaults to 16).\n * @returns A random label.\n */\nexport function generateRandomLabel(): string {\n let label = createId();\n return `@Sigil.auto-${label}`;\n}\n\n/** -----------------------------------------\n * Introspection helpers\n * ----------------------------------------- */\n\n/**\n * Mark a constructor as a sigil constructor by attaching an internal symbol.\n *\n * This function defines a non-enumerable, non-writable, non-configurable\n * property on the constructor so subsequent checks can detect sigil\n * constructors.\n *\n * @internal\n * @param ctor - The constructor to mark.\n */\nexport function markSigil(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as a \"sigil base\" constructor.\n *\n * A sigil base constructor indicates that the class is the base for\n * other sigil classes. This writes a stable, non-enumerable property\n * to the constructor.\n *\n * @internal\n * @param ctor - The constructor to mark as sigil base.\n */\nexport function markSigilBase(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL_BASE__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as having been decorated with `WithSigil`.\n *\n * This is used to detect classes that were explicitly decorated rather\n * than auto-filled by the library.\n *\n * @internal\n * @param ctor - The constructor that was decorated.\n */\nexport function markDecorated(ctor: Function) {\n Object.defineProperty(ctor, __DECORATED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark that inheritance checks for this constructor have already been performed.\n *\n * The library uses this to avoid repeating expensive inheritance validation\n * during development.\n *\n * @internal\n * @param ctor - The constructor that has been checked.\n */\nexport function markInheritanceChecked(ctor: Function) {\n Object.defineProperty(ctor, __INHERITANCE_CHECKED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil constructor.\n *\n * @param ctor - Constructor to test.\n * @returns `true` if `value` is a sigil constructor, otherwise `false`.\n */\nexport function isSigilCtor(ctor: unknown): ctor is ISigil {\n return typeof ctor === 'function' && (ctor as any)[__SIGIL__] === true;\n}\n\n/**\n * Runtime predicate that checks whether the provided object is an instance\n * of a sigil class.\n *\n * @param inst - The instanca to test.\n * @returns `true` if `obj` is an instance produced by a sigil constructor.\n */\nexport function isSigilInstance(inst: unknown): inst is GetInstance<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilCtor(ctor);\n}\n\n/**\n * Check whether the provided constructor was marked as a sigil base constructor.\n *\n * @param ctor - Constructor to check.\n * @returns `true` if `ctor` is a sigil base constructor.\n */\nexport function isSigilBaseCtor(ctor: Function): ctor is ISigil {\n return Object.hasOwn(ctor, __SIGIL_BASE__);\n}\n\n/**\n * Check whether the provided object is an instance of a sigil base constructor.\n *\n * @param inst - The instance to test.\n * @returns `true` if `inst` is an instance of a sigil base constructor.\n */\nexport function isSigilBaseInstance(inst: unknown): inst is GetInstance<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilBaseCtor(ctor);\n}\n\n/**\n * Returns whether the constructor has been explicitly decorated with `WithSigil`.\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if the constructor is explicitly decorated.\n */\nexport function isDecorated(ctor: Function): boolean {\n return Object.hasOwn(ctor, __DECORATED__);\n}\n\n/**\n * Returns whether inheritance checks have already been performed for the constructor.\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if inheritance checks were marked as completed.\n */\nexport function isInheritanceChecked(ctor: Function): boolean {\n return Object.hasOwn(ctor, __INHERITANCE_CHECKED__);\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\n/**\n * Retrieve the constructor function for a given instance.\n *\n * Returns `null` for non-objects or when a constructor cannot be resolved.\n *\n * @internal\n * @param obj - The value that may be an instance whose constructor should be returned.\n * @returns The constructor function or `null` if not available.\n */\nexport function getConstructor(obj: any) {\n if (!obj || typeof obj !== 'object') return null;\n return obj.constructor ?? Object.getPrototypeOf(obj)?.constructor ?? null;\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n getConstructor,\n isSigilCtor,\n isSigilInstance,\n markSigil,\n markSigilBase,\n verifyLabel,\n} from './helpers';\nimport type { SigilOptions } from './options';\nimport { __LABEL__, __LABEL_LINEAGE__, __LABEL_SET__ } from './symbols';\nimport type {\n Constructor,\n ISigil,\n Prettify,\n GetInstance,\n ConstructorAbstract,\n ISigilInstance,\n} from './types';\nimport { __DEV__ } from './constants';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers.\n *\n * @param Base - The base constructor to extend.\n * @param label - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A new abstract constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilized.\n */\nexport function Sigilify<B extends Constructor, L extends string>(\n Base: B,\n label?: L,\n opts?: SigilOptions\n) {\n // if siglified throw\n if (isSigilCtor(Base)) throw new Error(`[Sigil Error] 'Sigilify(${label})' already siglified.`);\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // extend actual class\n class Sigilified extends Base implements ISigilInstance {\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare static readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n /**\n * Class-level human-readable label constant for this sigil constructor.\n */\n static get SigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Copy of the linearized sigil type label chain for the current constructor.\n *\n * Useful for debugging and performing strict lineage comparisons.\n *\n * @returns An array of labels representing parent → child type labels.\n */\n static get SigilLabelLineage(): readonly string[] {\n return [...((this as any)[__LABEL_LINEAGE__] ?? [])];\n }\n\n /**\n * Copy of the sigil type label set for the current constructor.\n *\n * Useful for quick membership checks (O(1) lookups) and debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n const set: Set<string> = new Set();\n for (const s of (this as any)[__LABEL_SET__]) set.add(s);\n return set;\n }\n\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n\n // Correct prototype chain when necessary (defensive for transpiled code / edge cases)\n if (Object.getPrototypeOf(this) !== new.target.prototype)\n Object.setPrototypeOf(this, new.target.prototype);\n\n // Resolve constructor; defensive null-check helps catch weird runtime cases.\n const ctor = getConstructor(this);\n if (!ctor) {\n if (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return;\n }\n\n // Perform dev-only inheritance validation to ensure labels are unique across the chain.\n if (__DEV__) checkInheritance(ctor);\n }\n\n /**\n * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.\n *\n * @param obj - The value to test.\n * @returns `true` if `obj` is a sigil instance.\n */\n static isSigilified(obj: unknown): obj is ISigil {\n return isSigilInstance(obj);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type represented by the calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The calling constructor type (narrowing the returned instance type).\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is an instance of this type or a subtype.\n */\n static isOfType<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = (this as any)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label lineage arrays element-by-element.\n *\n * @typeParam T - The calling constructor type.\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.\n */\n static isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = (this as any)[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type instance.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is the same instance of this type or a subtype.\n */\n isOfType<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = getConstructor(this)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label lineage arrays element-by-element.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` has an identical lineage up to the length of this instance's lineage.\n */\n isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = getConstructor(this)?.[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.\n */\n getSigilLabel(): string {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return '@Sigil.unknown';\n }\n return ctor.SigilLabel;\n }\n\n /**\n * Returns a copy of the sigil type label lineage for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelLineage(): readonly string[] {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return ['@Sigil.unknown'];\n }\n return ctor.SigilLabelLineage;\n }\n\n /**\n * Returns a readonly copy of the sigil type label set for this instance's constructor.\n *\n * @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return new Set(['@Sigil.unknown']);\n }\n return ctor.SigilLabelSet;\n }\n }\n\n // Attach sigil metadata to constructor (registers label, sets labels, marks decorated)\n decorateCtor(Sigilified, l, true);\n\n // Mark the returned constructor as sigil (runtime flag) and as a base.\n markSigil(Sigilified);\n markSigilBase(Sigilified);\n\n return Sigilified;\n}\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers. Accept and return 'abstract' class.\n *\n * @param Base - The base constructor to extend.\n * @param label - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A new abstract constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilized.\n */\nexport function SigilifyAbstract<B extends ConstructorAbstract, L extends string>(\n Base: B,\n label?: L,\n opts?: SigilOptions\n) {\n // if siglified throw\n if (isSigilCtor(Base)) throw new Error(`[Sigil Error] 'Sigilify(${label})' already siglified.`);\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // extend actual class\n abstract class Sigilified extends Base implements ISigilInstance {\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare static readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n /**\n * Class-level human-readable label constant for this sigil constructor.\n */\n static get SigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Copy of the linearized sigil type label chain for the current constructor.\n *\n * Useful for debugging and performing strict lineage comparisons.\n *\n * @returns An array of labels representing parent → child type labels.\n */\n static get SigilLabelLineage(): readonly string[] {\n return [...((this as any)[__LABEL_LINEAGE__] ?? [])];\n }\n\n /**\n * Copy of the sigil type label set for the current constructor.\n *\n * Useful for quick membership checks (O(1) lookups) and debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n const set: Set<string> = new Set();\n for (const s of (this as any)[__LABEL_SET__]) set.add(s);\n return set;\n }\n\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n\n // Correct prototype chain when necessary (defensive for transpiled code / edge cases)\n if (Object.getPrototypeOf(this) !== new.target.prototype)\n Object.setPrototypeOf(this, new.target.prototype);\n\n // Resolve constructor; defensive null-check helps catch weird runtime cases.\n const ctor = getConstructor(this);\n if (!ctor) {\n if (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return;\n }\n\n // Perform dev-only inheritance validation to ensure labels are unique across the chain.\n if (__DEV__) checkInheritance(ctor);\n }\n\n /**\n * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.\n *\n * @param obj - The value to test.\n * @returns `true` if `obj` is a sigil instance.\n */\n static isSigilified(obj: unknown): obj is ISigil {\n return isSigilInstance(obj);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type represented by the calling constructor.\n *\n * Implementation detail:\n * - Uses the other instance's `__LABEL_SET__` for O(1) membership test.\n * - O(1) and reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The calling constructor type (narrowing the returned instance type).\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is an instance of this type or a subtype.\n */\n static isOfType<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other) || !isSigilCtor(this)) return false;\n const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = (this as any)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label lineage arrays element-by-element.\n *\n * Implementation detail:\n * - Works in O(n) time where n is the depth of the lineage.\n * - Reliable when `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * @typeParam T - The calling constructor type.\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.\n */\n static isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other) || !isSigilCtor(this)) return false;\n const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = (this as any)[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type instance.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is the same instance of this type or a subtype.\n */\n isOfType<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other) || !isSigilInstance(this)) return false;\n const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = getConstructor(this)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label lineage arrays element-by-element.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` has an identical lineage up to the length of this instance's lineage.\n */\n isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other) || !isSigilInstance(this)) return false;\n const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = getConstructor(this)?.[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.\n */\n getSigilLabel(): string {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return '@Sigil.unknown';\n }\n return ctor.SigilLabel;\n }\n\n /**\n * Returns a copy of the sigil type label lineage for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelLineage(): readonly string[] {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return ['@Sigil.unknown'];\n }\n return ctor.SigilLabelLineage;\n }\n\n /**\n * Returns a readonly copy of the sigil type label set for this instance's constructor.\n *\n * @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return new Set(['@Sigil.unknown']);\n }\n return ctor.SigilLabelSet;\n }\n }\n\n // Attach sigil metadata to constructor (registers label, sets labels, marks decorated)\n decorateCtor(Sigilified, l, true);\n\n // Mark the returned constructor as sigil (runtime flag) and as a base.\n markSigil(Sigilified);\n markSigilBase(Sigilified);\n\n return Sigilified;\n}\n","import { Sigilify } from './mixin';\nimport type { GetInstance } from './types';\n\n/**\n * A minimal root Sigil class used by the library as a base identity.\n *\n * This is produced by `Sigilify` and can serve as a basic sentinel/base\n * class for other sigil classes or for debugging/inspection.\n */\nexport const Sigil = Sigilify(class {}, 'Sigil');\nexport type Sigil = GetInstance<typeof Sigil>;\n\n/**\n * A sigil variant of the built-in `Error` constructor used by the library\n * to represent Sigil-specific errors.\n *\n * Use `SigilError` when you want an Error type that is identifiable via sigil\n * runtime checks (e.g. `SigilError.isOfType(someError)`).\n */\nexport const SigilError = Sigilify(Error, 'SigilError');\nexport type SigilError = GetInstance<typeof SigilError>;\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport type { SigilOptions } from './options';\nimport { __DEV__ } from './constants';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * Notes:\n * - This decorator is intended to be applied to classes only. When used\n * incorrectly (e.g. on a property), it is a no-op.\n * - Throws an error during class creation if the label validation fails.\n *\n * @typeParam L - Narrow string literal type for the provided label.\n * @param label - Optional sigil label to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A class decorator compatible with the ECMAScript decorator context.\n */\nexport function WithSigil<L extends string>(label?: L, opts?: SigilOptions) {\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n return function (value: Function, context: any) {\n // Only apply to class declarations\n if (context.kind !== 'class') return;\n if (!isSigilCtor(value))\n throw new Error(\n `[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class ${value.name}`\n );\n // Attach sigil metadata to constructor (registers label, sets symbols, marks decorated)\n decorateCtor(value, l);\n // Development-only inheritance checks and potential autofill\n if (__DEV__) checkInheritance(value, opts);\n };\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport type { SigilOptions } from './options';\nimport type { TypedSigil } from './types';\nimport { __DEV__ } from './constants';\n\n/**\n * HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@WithSigil' if you prefer HOFs.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to enhance.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured.\n */\nexport function withSigil<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l);\n if (__DEV__) checkInheritance(ctor, opts);\n\n return Class;\n}\n\n/**\n * Convenience helper that combine 'withSigil' and update 'SigilBrand'.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to decorate and type.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param parent - Optional parent sigil constructor (type-only).\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured and typed as `TypedSigil<S,L,P>`.\n */\nexport function withSigilTyped<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): TypedSigil<S, L> {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigilTyped' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l);\n if (__DEV__) checkInheritance(ctor, opts);\n\n return Class as unknown as TypedSigil<S, L>;\n}\n"]}
1
+ {"version":3,"sources":["../src/core/options.ts","../src/core/symbols.ts","../src/core/helpers.ts","../src/core/mixin.ts","../src/core/classes.ts","../src/core/decorator.ts","../src/core/hof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GAAe,SAAS,CAAA;AAAA,KACxG;AAGF,EAAA,IAAI,CAAA;AACJ,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,WAAA,CAAY,OAAO,IAAI,CAAA;AACvB,IAAA,CAAA,GAAI,KAAA;AAAA,EACN,CAAA,UAAW,mBAAA,EAAoB;AAG/B,EAAA,MAAM,IAAA,GAAO,KAAA;AACb,EAAA,YAAA,CAAa,MAAM,CAAC,CAAA;AACpB,EAAA,gBAAA,CAAiB,MAAM,IAAI,CAAA;AAE3B,EAAA,OAAO,KAAA;AACT;AAaO,SAAS,cAAA,CACd,KAAA,EACA,KAAA,EACA,IAAA,EACkB;AA7DpB,EAAA,IAAA,EAAA;AA8DE,EAAA,IAAI,CAAC,YAAY,KAAK,CAAA;AACpB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,+EAAA,EAAA,CAAkF,EAAA,GAAA,KAAA,IAAA,IAAA,GAAA,MAAA,GAAA,KAAA,CAAO,IAAA,KAAP,IAAA,GAAA,EAAA,GAAe,SAAS,CAAA;AAAA,KAC5G;AAGF,EAAA,IAAI,CAAA;AACJ,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,WAAA,CAAY,OAAO,IAAI,CAAA;AACvB,IAAA,CAAA,GAAI,KAAA;AAAA,EACN,CAAA,UAAW,mBAAA,EAAoB;AAG/B,EAAA,MAAM,IAAA,GAAO,KAAA;AACb,EAAA,YAAA,CAAa,MAAM,CAAC,CAAA;AACpB,EAAA,gBAAA,CAAiB,MAAM,IAAI,CAAA;AAE3B,EAAA,OAAO,KAAA;AACT","file":"index.js","sourcesContent":["/**\n * Configuration options for the Sigil library.\n *\n * These options control runtime validation, inheritance checks, label autofill behavior.\n */\nexport interface SigilOptions {\n /**\n * Validation rule applied to sigil labels before registration.\n *\n * - A function receives the label and must return `true` if valid.\n * - A `RegExp` must match the label.\n * - `null` disables validation entirely.\n *\n * Defaults to `null`.\n */\n labelValidation?: ((label: string) => boolean) | RegExp | null;\n\n /**\n * Skips the runtime check that prevents subclasses from inheriting\n * the same sigil label as their ancestors.\n *\n * When `false` (default), extending a sigil class without\n * using `WithSigil(newLabel)` decorator will throw an error if the label\n * is reused and `OPTIONS.autofillLabels` is set to `false`.\n *\n * Set this to `true` only if you intentionally want subclasses to inherit labels\n * from their ancestors (this weakens the uniqueness guarantees).\n *\n * WARNING:\n * Disabling inheritanceCheck removes guaranties by 'Sigil' or unique label for\n * each class and allow multiple child classes to use the same label which can\n * result on false 'isOfType' result. this options should be used in debugging\n * only to silence all errors but never in production.\n */\n skipLabelInheritanceCheck?: boolean;\n\n /**\n * When enabled, non-decorated subclasses that would otherwise inherit an ancestor's label\n * will be assigned an autogenerated random label (so that explicit labels stay unique).\n */\n autofillLabels?: boolean;\n}\n\n/** -----------------------------------------\n * Main options object\n * ----------------------------------------- */\n\n/**\n * Defined SigilOptions used in the library.\n *\n * @internal\n */\nexport const OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n skipLabelInheritanceCheck: false,\n autofillLabels: true,\n};\n\n/**\n * Update runtime options for the Sigil library.\n * Call this early during application startup if you want non-default behavior.\n *\n * @param opts - Partial options to merge into the global `OPTIONS` object.\n */\nexport const updateSigilOptions = (opts: SigilOptions): void => {\n if ('autofillLabels' in opts) {\n if (typeof opts.autofillLabels !== 'boolean')\n throw new Error(\"'updateSigilOptions.autofillLabels' must be boolean\");\n OPTIONS.autofillLabels = opts.autofillLabels!;\n }\n\n if ('skipLabelInheritanceCheck' in opts) {\n if (typeof opts.skipLabelInheritanceCheck !== 'boolean')\n throw new Error(\"'updateSigilOptions.skipLabelInheritanceCheck' must be boolean\");\n OPTIONS.skipLabelInheritanceCheck = opts.skipLabelInheritanceCheck!;\n }\n\n if ('labelValidation' in opts) {\n const val = opts.labelValidation;\n if (val !== null && typeof val !== 'function' && !(val instanceof RegExp))\n throw new Error(\"'updateSigilOptions.labelValidation' must be null, function or RegExp\");\n OPTIONS.labelValidation = val ?? null;\n }\n};\n\n/** -----------------------------------------\n * Label validation\n * ----------------------------------------- */\n\n/**\n * Label validation regex. Labels must follow the pattern\n * `@scope/package.ClassName` where `ClassName` begins with an uppercase\n * letter. This avoids collisions across packages and helps debugging.\n *\n * It's advised to use this regex in 'SigilOptions.labelValidation'.\n */\nexport const DEFAULT_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n","/**\n * Symbol to uniquely identify sigil classes.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@Sigil.__SIGIL__');\n\n/**\n * Symbol to uniquely identify the base of sigil classes.\n *\n * When attached to a constructor it indicates that the constructor is a\n * sigil base and should be treated specially by inheritance checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL_BASE__ = Symbol.for('@Sigil.__SIGIL_BASE__');\n\n/**\n * Symbol to mark constructors that were explicitly decorated with `WithSigil()`.\n *\n * This differs from `__SIGIL__` in that `__DECORATED__` indicates explicit\n * decoration (as opposed to automatically assigned labels).\n *\n * @internal\n * @constant {symbol}\n */\nexport const __DECORATED__ = Symbol.for('@Sigil.__DECORATED__');\n\n/**\n * Symbol to mark that inheritance checks for a given constructor have been completed.\n *\n * This is used to avoid repeated DEV-time validation on subsequent instance creations.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __INHERITANCE_CHECKED__ = Symbol.for('@Sigil.__INHERITANCE_CHECKED__');\n\n/**\n * Symbol used to store the identity label for a sigil constructor.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL__ = Symbol.for('@Sigil.__LABEL__');\n\n/**\n * Symbol used to store the human-readable label for a sigil constructor, it can be inherited if no label is deined.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __EFFECTIVE_LABEL__ = Symbol.for('@Sigil.__EFFECTIVE_LABEL__');\n\n/**\n * Symbol used to store the linearized label lineage for a sigil constructor.\n *\n * This is an array of labels (strings) representing the inheritance path of labels.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_LINEAGE__ = Symbol.for('@Sigil.__LABEL_LINEAGE__');\n\n/**\n * Symbol used to store the set of labels for a sigil constructor.\n *\n * This is a `Set<string>` that mirrors `__LABEL_LINEAGE__` for fast membership checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_SET__ = Symbol.for('@Sigil.__LABEL_SET__');\n","import { OPTIONS, type SigilOptions } from './options';\nimport {\n __DECORATED__,\n __INHERITANCE_CHECKED__,\n __LABEL__,\n __EFFECTIVE_LABEL__,\n __SIGIL_BASE__,\n __SIGIL__,\n __LABEL_LINEAGE__,\n __LABEL_SET__,\n} from './symbols';\nimport type { ISigil, GetInstance } from './types';\nimport { createId } from '@paralleldrive/cuid2';\n\n/** -----------------------------------------\n * High level helpers\n * ----------------------------------------- */\n\n/**\n * Attach sigil-related statics to a constructor and register its label.\n *\n * Side effects:\n * - Defines non-enumerable statics on the constructor:\n * - `__LABEL__` (string)\n * - `__LABEL_LINEAGE__` (array of strings)\n * - `__LABEL_SET__` (Set of strings)\n * - Marks the constructor as decorated via `markDecorated`.\n *\n * Throws if the constructor is already decorated.\n *\n * @internal\n * @param ctor - The constructor to decorate.\n * @param label - The identity label to register and attach (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @throws Error when `ctor` is already decorated.\n */\nexport function decorateCtor(\n ctor: Function,\n label: string,\n runtime?: { isInheritanceCheck?: boolean; isMixin?: boolean }\n) {\n // if already decorated throw error\n if (process.env.NODE_ENV !== 'production')\n if (isDecorated(ctor))\n throw new Error(\n `Constructor ${ctor} is already decorated. if you are using 'withSigilTyped()' & '@WithSigil()' at the same time remove one of them.`\n );\n\n // attach basic runtime statics\n Object.defineProperty(ctor, __LABEL__, {\n value: label,\n configurable: true,\n enumerable: false,\n writable: false,\n });\n if (!runtime?.isInheritanceCheck)\n Object.defineProperty(ctor, __EFFECTIVE_LABEL__, {\n value: label,\n configurable: true,\n enumerable: false,\n writable: false,\n });\n\n // get parent chain (safe if parent hasn't been augmented yet — uses existing value or empty)\n const parent = Object.getPrototypeOf(ctor);\n const parentChain = parent && parent[__LABEL_LINEAGE__] ? parent[__LABEL_LINEAGE__] : [];\n\n // generate Ctor chain, if mixin (Sigilify function) then append 'Sigil' at the start\n const ctorChain =\n runtime?.isMixin && label !== 'Sigil'\n ? ['Sigil', ...parentChain, label]\n : [...parentChain, label];\n\n // attach symbol lineage and set\n Object.defineProperty(ctor, __LABEL_LINEAGE__, {\n value: ctorChain,\n configurable: true,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __LABEL_SET__, {\n value: new Set(ctorChain),\n configurable: true,\n enumerable: false,\n writable: false,\n });\n\n // mark as decorated\n if (!runtime?.isInheritanceCheck) markDecorated(ctor);\n}\n\n/**\n * Perform inheritance checks to ensure no ancestor classes reuse the same sigil label.\n *\n * Behavior:\n * - No-op if `ctor` is not a sigil constructor.\n * - No-op if inheritance checks were already performed.\n * - No-op if `OPTIONS.skipLabelInheritanceCheck` is set to true.\n *\n * When a duplicate label is detected:\n * - If the class is explicitly decorated (`isDecorated`) or `OPTIONS.autofillLabels` is false, And in\n * development build, an Error is thrown describing the label collision.\n * - Otherwise, a random label will be generated and assigned to the offending constructor via `decorateCtor`.\n *\n * @internal\n * @param ctor - The constructor to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws Error when a decorated subclass re-uses an ancestor's sigil label in development builds only.\n */\nexport function checkInheritance(\n ctor: ISigil,\n opts?: Pick<SigilOptions, 'skipLabelInheritanceCheck' | 'autofillLabels'>\n) {\n if (\n isInheritanceChecked(ctor) ||\n (opts?.skipLabelInheritanceCheck ?? OPTIONS.skipLabelInheritanceCheck)\n )\n return;\n\n /** Array of all sigil constructors in the chain (starting with the provided ctor) */\n const ctors: ISigil[] = [ctor];\n\n // go through prototype chain to get all sigil ancestors\n let ancestor: any = Object.getPrototypeOf(ctor);\n while (isSigilCtor(ancestor)) {\n ctors.push(ancestor);\n ancestor = Object.getPrototypeOf(ancestor);\n }\n\n /** Map<label, className> to record the owner of each label. */\n const labelOwner = new Map<string, string>();\n\n // loop ctors from base to current and make sure no label is reused\n for (let i = ctors.length - 1; i >= 0; i--) {\n const ctor = ctors[i];\n if (!ctor) continue;\n let label = (ctor as any)[__LABEL__];\n if (labelOwner.has(label)) {\n if (process.env.NODE_ENV !== 'production')\n if (isDecorated(ctor) || !(opts?.autofillLabels ?? OPTIONS.autofillLabels))\n throw new Error(\n `[Sigil Error] Class \"${ctor.name}\" re-uses Sigil label \"${label}\" from ancestor \"${labelOwner.get(label)}\". ` +\n `Each Sigil subclass must use a unique label. Did you forget to use \"WithSigil(newLabel)\" on the subclass?`\n );\n\n label = generateRandomLabel();\n decorateCtor(ctor, label, { isInheritanceCheck: true });\n }\n labelOwner.set(label, ctor.name);\n }\n markInheritanceChecked(ctor);\n}\n\n/**\n * Validate a sigil label at runtime and throw a helpful error if it is malformed.\n *\n * This is intentionally `void` and runs synchronously at class declaration time so\n * invalid labels fail fast during development. Validation behavior follows `OPTIONS.labelValidation`:\n * - If `OPTIONS.labelValidation` is `null` no validation is performed.\n * - If it is a `RegExp`, the label must match the regex.\n * - If it is a function, the function must return `true` for the label to be considered valid.\n *\n * @internal\n * @typeParam L - Label string literal type.\n * @param label - The label to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws {Error} Throws when the label does not pass configured validation.\n */\nexport function verifyLabel<L extends string>(\n label: L,\n opts?: Pick<SigilOptions, 'labelValidation'>\n): void {\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\n\n if (labelValidation) {\n let valid: boolean;\n if (labelValidation instanceof RegExp) valid = labelValidation.test(label);\n else valid = labelValidation(label);\n\n if (process.env.NODE_ENV !== 'production')\n if (!valid)\n throw new Error(\n `[Sigil] Invalid identity label \"${label}\". Make sure that supplied label matches validation regex or function.`\n );\n }\n}\n\n/**\n * Generate a random alphanumeric label of the requested length.\n *\n * This is used to auto-generate labels when `OPTIONS.autofillLabels` is enabled.\n * It insures that generated label is not registered yet.\n *\n * @internal\n * @param length - Desired length of the generated string (defaults to 16).\n * @returns A random label.\n */\nexport function generateRandomLabel(): string {\n let label = createId();\n return `@Sigil.auto-${label}`;\n}\n\n/** -----------------------------------------\n * Introspection helpers\n * ----------------------------------------- */\n\n/**\n * Mark a constructor as a sigil constructor by attaching an internal symbol.\n *\n * This function defines a non-enumerable, non-writable, non-configurable\n * property on the constructor so subsequent checks can detect sigil\n * constructors.\n *\n * @internal\n * @param ctor - The constructor to mark.\n */\nexport function markSigil(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as a \"sigil base\" constructor.\n *\n * A sigil base constructor indicates that the class is the base for\n * other sigil classes. This writes a stable, non-enumerable property\n * to the constructor.\n *\n * @internal\n * @param ctor - The constructor to mark as sigil base.\n */\nexport function markSigilBase(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL_BASE__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as having been decorated with `WithSigil`.\n *\n * This is used to detect classes that were explicitly decorated rather\n * than auto-filled by the library.\n *\n * @internal\n * @param ctor - The constructor that was decorated.\n */\nexport function markDecorated(ctor: Function) {\n Object.defineProperty(ctor, __DECORATED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark that inheritance checks for this constructor have already been performed.\n *\n * The library uses this to avoid repeating expensive inheritance validation\n * during development.\n *\n * @internal\n * @param ctor - The constructor that has been checked.\n */\nexport function markInheritanceChecked(ctor: Function) {\n Object.defineProperty(ctor, __INHERITANCE_CHECKED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil constructor.\n *\n * @param ctor - Constructor to test.\n * @returns `true` if `value` is a sigil constructor, otherwise `false`.\n */\nexport function isSigilCtor(ctor: unknown): ctor is ISigil {\n return typeof ctor === 'function' && (ctor as any)[__SIGIL__] === true;\n}\n\n/**\n * Runtime predicate that checks whether the provided object is an instance\n * of a sigil class.\n *\n * @param inst - The instanca to test.\n * @returns `true` if `obj` is an instance produced by a sigil constructor.\n */\nexport function isSigilInstance(inst: unknown): inst is GetInstance<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilCtor(ctor);\n}\n\n/**\n * Check whether the provided constructor was marked as a sigil base constructor.\n *\n * @param ctor - Constructor to check.\n * @returns `true` if `ctor` is a sigil base constructor.\n */\nexport function isSigilBaseCtor(ctor: Function): ctor is ISigil {\n return Object.hasOwn(ctor, __SIGIL_BASE__);\n}\n\n/**\n * Check whether the provided object is an instance of a sigil base constructor.\n *\n * @param inst - The instance to test.\n * @returns `true` if `inst` is an instance of a sigil base constructor.\n */\nexport function isSigilBaseInstance(inst: unknown): inst is GetInstance<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilBaseCtor(ctor);\n}\n\n/**\n * Returns whether the constructor has been explicitly decorated with `WithSigil`.\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if the constructor is explicitly decorated.\n */\nexport function isDecorated(ctor: Function): boolean {\n return Object.hasOwn(ctor, __DECORATED__);\n}\n\n/**\n * Returns whether inheritance checks have already been performed for the constructor.\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if inheritance checks were marked as completed.\n */\nexport function isInheritanceChecked(ctor: Function): boolean {\n return Object.hasOwn(ctor, __INHERITANCE_CHECKED__);\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\n/**\n * Retrieve the constructor function for a given instance.\n *\n * Returns `null` for non-objects or when a constructor cannot be resolved.\n *\n * @internal\n * @param obj - The value that may be an instance whose constructor should be returned.\n * @returns The constructor function or `null` if not available.\n */\nexport function getConstructor(obj: any) {\n if (!obj || typeof obj !== 'object') return null;\n return obj.constructor ?? Object.getPrototypeOf(obj)?.constructor ?? null;\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n getConstructor,\n isSigilCtor,\n isSigilInstance,\n markSigil,\n markSigilBase,\n verifyLabel,\n isInheritanceChecked,\n} from './helpers';\nimport { OPTIONS, type SigilOptions } from './options';\nimport { __LABEL__, __EFFECTIVE_LABEL__, __LABEL_LINEAGE__, __LABEL_SET__ } from './symbols';\nimport type {\n Constructor,\n ISigil,\n Prettify,\n GetInstance,\n ConstructorAbstract,\n ISigilInstance,\n} from './types';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers.\n *\n * @param Base - The base constructor to extend.\n * @param label - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A new abstract constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilified.\n */\nexport function Sigilify<B extends Constructor, L extends string>(\n Base: B,\n label?: L,\n opts?: SigilOptions\n) {\n // if sigilified throw\n if (isSigilCtor(Base)) throw new Error(`[Sigil Error] 'Sigilify(${label})' already sigilified.`);\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // extend actual class\n class Sigilified extends Base implements ISigilInstance {\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare static readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): string {\n if (!isInheritanceChecked(this)) checkInheritance(this);\n return (this as any)[__LABEL__];\n }\n\n /**\n * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.\n */\n static get SigilEffectiveLabel(): string {\n return (this as any)[__EFFECTIVE_LABEL__];\n }\n\n /**\n * Copy of the linearized sigil type label chain for the current constructor.\n *\n * Useful for debugging and performing strict lineage comparisons.\n *\n * @returns An array of labels representing parent → child type labels.\n */\n static get SigilLabelLineage(): readonly string[] {\n if (!isInheritanceChecked(this)) checkInheritance(this);\n return [...((this as any)[__LABEL_LINEAGE__] ?? [])];\n }\n\n /**\n * Copy of the sigil type label set for the current constructor.\n *\n * Useful for quick membership checks (O(1) lookups) and debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n if (!isInheritanceChecked(this)) checkInheritance(this);\n const set: Set<string> = new Set();\n for (const s of (this as any)[__LABEL_SET__]) set.add(s);\n return set;\n }\n\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n\n // Correct prototype chain when necessary (defensive for transpiled code / edge cases)\n if (Object.getPrototypeOf(this) !== new.target.prototype)\n Object.setPrototypeOf(this, new.target.prototype);\n\n // Resolve constructor; defensive null-check helps catch weird runtime cases.\n const ctor = getConstructor(this);\n if (!ctor) {\n if (process.env.NODE_ENV !== 'production')\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return;\n }\n\n // Perform inheritance validation to ensure labels are unique across the chain.\n checkInheritance(ctor);\n }\n\n /**\n * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.\n *\n * @param obj - The value to test.\n * @returns `true` if `obj` is a sigil instance.\n */\n static isSigilified(obj: unknown): obj is ISigil {\n return isSigilInstance(obj);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type represented by the calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The calling constructor type (narrowing the returned instance type).\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is an instance of this type or a subtype.\n */\n static isOfType<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = (this as any)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label lineage arrays element-by-element.\n *\n * @typeParam T - The calling constructor type.\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.\n */\n static isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = (this as any)[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type instance.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is the same instance of this type or a subtype.\n */\n isOfType<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = getConstructor(this)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label lineage arrays element-by-element.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` has an identical lineage up to the length of this instance's lineage.\n */\n isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = getConstructor(this)?.[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil.auto-dq62ib6jnvmmlfbjhxh2937h') or '@Sigil.unknown' if constructor is missing.\n */\n getSigilLabel(): string {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (process.env.NODE_ENV !== 'production')\n throw new Error(`[Sigil Error] Sigil class instance without constructor`);\n return '@Sigil.unknown';\n }\n return ctor.SigilLabel;\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The last passed label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' if constructor is missing.\n */\n getSigilEffectiveLabel(): string {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (process.env.NODE_ENV !== 'production')\n throw new Error(`[Sigil Error] Sigil class instance without constructor`);\n return '@Sigil.unknown';\n }\n return ctor.SigilEffectiveLabel;\n }\n\n /**\n * Returns a copy of the sigil type label lineage for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelLineage(): readonly string[] {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (process.env.NODE_ENV !== 'production')\n throw new Error(`[Sigil Error] Sigil class instance without constructor`);\n return ['@Sigil.unknown'];\n }\n return ctor.SigilLabelLineage;\n }\n\n /**\n * Returns a readonly copy of the sigil type label set for this instance's constructor.\n *\n * @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (process.env.NODE_ENV !== 'production')\n throw new Error(`[Sigil Error] Sigil class instance without constructor`);\n return new Set(['@Sigil.unknown']);\n }\n return ctor.SigilLabelSet;\n }\n }\n\n // Attach sigil metadata to constructor (registers label, sets labels, marks decorated)\n decorateCtor(Sigilified, l, { isMixin: true });\n\n // Mark the returned constructor as sigil (runtime flag) and as a base.\n markSigil(Sigilified);\n markSigilBase(Sigilified);\n\n return Sigilified;\n}\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers. Accept and return 'abstract' class.\n *\n * @param Base - The base constructor to extend.\n * @param label - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A new abstract constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilified.\n */\nexport function SigilifyAbstract<B extends ConstructorAbstract, L extends string>(\n Base: B,\n label?: L,\n opts?: SigilOptions\n) {\n // if sigilified throw\n if (isSigilCtor(Base)) throw new Error(`[Sigil Error] 'Sigilify(${label})' already sigilified.`);\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // extend actual class\n abstract class Sigilified extends Base implements ISigilInstance {\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare static readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): string {\n if (!isInheritanceChecked(this)) checkInheritance(this);\n return (this as any)[__LABEL__];\n }\n\n /**\n * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.\n */\n static get SigilEffectiveLabel(): string {\n return (this as any)[__EFFECTIVE_LABEL__];\n }\n\n /**\n * Copy of the linearized sigil type label chain for the current constructor.\n *\n * Useful for debugging and performing strict lineage comparisons.\n *\n * @returns An array of labels representing parent → child type labels.\n */\n static get SigilLabelLineage(): readonly string[] {\n if (!isInheritanceChecked(this)) checkInheritance(this);\n return [...((this as any)[__LABEL_LINEAGE__] ?? [])];\n }\n\n /**\n * Copy of the sigil type label set for the current constructor.\n *\n * Useful for quick membership checks (O(1) lookups) and debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n if (!isInheritanceChecked(this)) checkInheritance(this);\n const set: Set<string> = new Set();\n for (const s of (this as any)[__LABEL_SET__]) set.add(s);\n return set;\n }\n\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n\n // Correct prototype chain when necessary (defensive for transpiled code / edge cases)\n if (Object.getPrototypeOf(this) !== new.target.prototype)\n Object.setPrototypeOf(this, new.target.prototype);\n\n // Resolve constructor; defensive null-check helps catch weird runtime cases.\n const ctor = getConstructor(this);\n if (!ctor) {\n if (process.env.NODE_ENV !== 'production')\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return;\n }\n\n // Perform inheritance validation to ensure labels are unique across the chain.\n checkInheritance(ctor);\n }\n\n /**\n * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.\n *\n * @param obj - The value to test.\n * @returns `true` if `obj` is a sigil instance.\n */\n static isSigilified(obj: unknown): obj is ISigil {\n return isSigilInstance(obj);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type represented by the calling constructor.\n *\n * Implementation detail:\n * - Uses the other instance's `__LABEL_SET__` for O(1) membership test.\n * - O(1) and reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The calling constructor type (narrowing the returned instance type).\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is an instance of this type or a subtype.\n */\n static isOfType<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = (this as any)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label lineage arrays element-by-element.\n *\n * Implementation detail:\n * - Works in O(n) time where n is the depth of the lineage.\n * - Reliable when `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * @typeParam T - The calling constructor type.\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.\n */\n static isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = (this as any)[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type instance.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is the same instance of this type or a subtype.\n */\n isOfType<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = getConstructor(this)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label lineage arrays element-by-element.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` has an identical lineage up to the length of this instance's lineage.\n */\n isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = getConstructor(this)?.[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil.auto-dq62ib6jnvmmlfbjhxh2937h') or '@Sigil.unknown' if constructor is missing.\n */\n getSigilLabel(): string {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (process.env.NODE_ENV !== 'production')\n throw new Error(`[Sigil Error] Sigil class instance without constructor`);\n return '@Sigil.unknown';\n }\n return ctor.SigilLabel;\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The last passed label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' if constructor is missing.\n */\n getSigilEffectiveLabel(): string {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (process.env.NODE_ENV !== 'production')\n throw new Error(`[Sigil Error] Sigil class instance without constructor`);\n return '@Sigil.unknown';\n }\n return ctor.SigilEffectiveLabel;\n }\n\n /**\n * Returns a copy of the sigil type label lineage for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelLineage(): readonly string[] {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (process.env.NODE_ENV !== 'production')\n throw new Error(`[Sigil Error] Sigil class instance without constructor`);\n return ['@Sigil.unknown'];\n }\n return ctor.SigilLabelLineage;\n }\n\n /**\n * Returns a readonly copy of the sigil type label set for this instance's constructor.\n *\n * @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (process.env.NODE_ENV !== 'production')\n throw new Error(`[Sigil Error] Sigil class instance without constructor`);\n return new Set(['@Sigil.unknown']);\n }\n return ctor.SigilLabelSet;\n }\n }\n\n // Attach sigil metadata to constructor (registers label, sets labels, marks decorated)\n decorateCtor(Sigilified, l, { isMixin: true });\n\n // Mark the returned constructor as sigil (runtime flag) and as a base.\n markSigil(Sigilified);\n markSigilBase(Sigilified);\n\n return Sigilified;\n}\n","import { Sigilify } from './mixin';\nimport type { GetInstance } from './types';\n\n/**\n * A minimal root Sigil class used by the library as a base identity.\n *\n * This is produced by `Sigilify` and can serve as a basic sentinel/base\n * class for other sigil classes or for debugging/inspection.\n */\nexport const Sigil = Sigilify(class {}, 'Sigil');\nexport type Sigil = GetInstance<typeof Sigil>;\n\n/**\n * A sigil variant of the built-in `Error` constructor used by the library\n * to represent Sigil-specific errors.\n *\n * Use `SigilError` when you want an Error type that is identifiable via sigil\n * runtime checks (e.g. `SigilError.isOfType(someError)`).\n */\nexport const SigilError = Sigilify(Error, 'SigilError');\nexport type SigilError = GetInstance<typeof SigilError>;\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport type { SigilOptions } from './options';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * Notes:\n * - This decorator is intended to be applied to classes only. When used\n * incorrectly (e.g. on a property), it is a no-op.\n * - Throws an error during class creation if the label validation fails (in development only).\n *\n * @typeParam L - Narrow string literal type for the provided label.\n * @param label - Optional sigil label to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A class decorator compatible with the ECMAScript decorator context.\n */\nexport function WithSigil<L extends string>(label?: L, opts?: SigilOptions) {\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n return function (value: Function, context: any) {\n // Only apply to class declarations\n if (context.kind !== 'class') return;\n if (!isSigilCtor(value))\n throw new Error(\n `[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class ${value.name}`\n );\n // Attach sigil metadata to constructor (registers label, sets symbols, marks decorated)\n decorateCtor(value, l);\n // Inheritance checks and potential autofill\n checkInheritance(value, opts);\n };\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport type { SigilOptions } from './options';\nimport type { TypedSigil } from './types';\n\n/**\n * HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@WithSigil' if you prefer HOFs.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to enhance.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured.\n */\nexport function withSigil<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l);\n checkInheritance(ctor, opts);\n\n return Class;\n}\n\n/**\n * Convenience helper that combine 'withSigil' and update 'SigilBrand'.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to decorate and type.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param parent - Optional parent sigil constructor (type-only).\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured and typed as `TypedSigil<S,L,P>`.\n */\nexport function withSigilTyped<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): TypedSigil<S, L> {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigilTyped' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l);\n checkInheritance(ctor, opts);\n\n return Class as unknown as TypedSigil<S, L>;\n}\n"]}