{"version":3,"sources":["../package.json","../src/collections/map.ts","../src/lib/error.ts"],"names":["name","AspectraMap","__name","key","fallback","current","value","CustomError","message","MultipleScopeModifierError","scope","other","DuplicateProviderError","contextId","ProviderNotFoundError","contexts","context","SealedClassExtentionError","target","newtarget"],"mappings":"aAEE,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,YAAA,CAAA,CAAA,CAAA,CAAA,EAAA,IAAAA,EAAQ,WCFH,IAAMC,CAAN,CAAA,cAAgC,GAAU,CAAjD,OAAiDC,CAAAA,CAAA,qBACxC,QAASC,CAAAA,CAAAA,CAAQC,CAAsB,CAAA,CAC5C,IAAMC,CAAU,CAAA,IAAA,CAAK,GAAIF,CAAAA,CAAG,EAC5B,GAAIE,CAAAA,CACF,OAAOA,CAAAA,CAET,IAAMC,CAAQF,CAAAA,CAAAA,EACd,CAAA,OAAA,IAAA,CAAK,IAAID,CAAKG,CAAAA,CAAK,EACZA,CACT,CACF,ECNeC,IAAAA,CAAAA,CAAf,cAAmC,KAAM,CAJzC,OAIyCL,CAAA,CAAA,IAAA,CAAA,aAAA,EAAA,CAC7B,YAAYM,CAAiB,CAAA,CACrC,KAAM,EAAA,CACN,KAAK,IAAO,CAAA,IAAA,CAAK,YAAY,IAC7B,CAAA,IAAA,CAAK,QAAUA,EACjB,CACF,CAEaC,CAAAA,CAAAA,CAAN,cAAyCF,CAAY,CAZ5D,OAY4DL,EAAA,IACnD,CAAA,4BAAA,EAAA,CAAA,WAAA,CAAYF,CAAcU,CAAAA,CAAAA,CAAcC,EAAe,CAC5D,KAAA,CACE,aAAaX,CAAI,CAAA,wBAAA,EAA2BU,CAAK,CAAgCC,6BAAAA,EAAAA,CAAK,CACxF,CAAA,CAAA,EACF,CACF,CAEaC,CAAAA,CAAAA,CAAN,cAAqCL,CAAY,CApBxD,OAoBwDL,CAAA,CAAA,IAAA,CAAA,wBAAA,EAAA,CAC/C,YAAYF,CAAca,CAAAA,CAAAA,CAAsB,CACrD,KAAA,CACE,aAAab,CAAI,CAAA,8BAAA,EAAiC,MAAOa,CAAAA,CAAS,CAAC,CACrE,CAAA,CAAA,EACF,CACF,CAAA,CAEaC,EAAN,cAAoCP,CAAY,CA5BvD,OA4BuDL,CAAA,CAAA,IAAA,CAAA,uBAAA,EAAA,CAC9C,YAAYF,CAAce,CAAAA,CAAAA,CAAgC,CAC/D,KACE,CAAA,CAAA,UAAA,EAAaf,CAAI,CAAA,0BAAA,EAA6B,MAAM,IAAKe,CAAAA,CAAQ,CAC9D,CAAA,GAAA,CAAIC,GAAWA,CAAQ,CAAA,EAAA,CAAG,QAAS,EAAC,EACpC,IAAK,CAAA,IAAI,CAAC,CACf,CAAA,CAAA,EACF,CACF,EAQO,IAAMC,CAAN,CAAA,cAAwCV,CAAY,CA5C3D,OA4C2DL,CAAAA,CAAA,mCAClD,WAAYgB,CAAAA,CAAAA,CAAgBC,CAAmB,CAAA,CACpD,MAAM,CAAUD,OAAAA,EAAAA,CAAM,gCAAgCC,CAAS,CAAA,EAAA,CAAI,EACrE,CACF","file":"chunk-AYE24R47.cjs","sourcesContent":["{\n  \"$schema\": \"https://json.schemastore.org/package.json\",\n  \"name\": \"aspectra\",\n  \"version\": \"0.1.15\",\n  \"description\": \"Type-safe Dependency Injection for Scalable Applications\",\n  \"keywords\": [\n    \"aspect oriented\",\n    \"decorator\",\n    \"decorators\",\n    \"dependency injection\",\n    \"di\",\n    \"injection\",\n    \"inversion of control\",\n    \"inversify\",\n    \"ioc\",\n    \"typescript\"\n  ],\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/shunueda/aspectra.git\",\n    \"directory\": \"packages/aspectra\"\n  },\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"toolbox build\",\n    \"test\": \"tsx --test\",\n    \"type-check\": \"tsc\"\n  },\n  \"publishConfig\": {\n    \"access\": \"public\",\n    \"directory\": \"dist\",\n    \"provenance\": true\n  }\n}\n","export class AspectraMap<K, V> extends Map<K, V> {\n  public getOrPut(key: K, fallback: () => V): V {\n    const current = this.get(key)\n    if (current) {\n      return current\n    }\n    const value = fallback()\n    this.set(key, value)\n    return value\n  }\n}\n","import type { ContextId } from '../context'\nimport type { Context } from '../context'\nimport type { Scope } from './scope'\n\nabstract class CustomError extends Error {\n  protected constructor(message: string) {\n    super()\n    this.name = this.constructor.name\n    this.message = message\n  }\n}\n\nexport class MultipleScopeModifierError extends CustomError {\n  public constructor(name: string, scope: Scope, other: string) {\n    super(\n      `Provider [${name}] is already marked as [${scope}], and you attemped mark as [${other}]`,\n    )\n  }\n}\n\nexport class DuplicateProviderError extends CustomError {\n  public constructor(name: string, contextId: ContextId) {\n    super(\n      `Provider [${name}] already exists in context: [${String(contextId)}]`,\n    )\n  }\n}\n\nexport class ProviderNotFoundError extends CustomError {\n  public constructor(name: string, contexts: ReadonlySet<Context>) {\n    super(\n      `Provider [${name}] not found in contexts: [${Array.from(contexts)\n        .map(context => context.id.toString())\n        .join(', ')}]`,\n    )\n  }\n}\n\nexport class DuplicateContextError extends CustomError {\n  public constructor(id: ContextId) {\n    super(`Context with id [${id.toString}] already exists`)\n  }\n}\n\nexport class SealedClassExtentionError extends CustomError {\n  public constructor(target: string, newtarget: string) {\n    super(`Class [${target}] is sealed but extended by [${newtarget}].`)\n  }\n}\n"]}