@fluidframework/synthesize 0.58.2000 → 0.58.3000-61081

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.
@@ -1 +1 @@
1
- {"version":3,"file":"dependencyContainer.js","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,+EAEuC;AAEvC;;;GAGG;AACH,MAAa,mBAAmB;IAK5B,YAAmB,GAAI,OAAoD;QAJ1D,cAAS,GAAG,IAAI,GAAG,EAAwC,CAAC;QAKzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IAC5F,CAAC;IAJD,IAAW,2BAA2B,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAMzD;;;;;OAKG;IACI,QAAQ,CAAoC,IAAO,EAAE,QAA4C;QACpG,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,6CAA6C,IAAI,sBAAsB,CAAC,CAAC;SAC5F;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,IAAgB;QAC9B,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC1B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SAC/B;IACL,CAAC;IAED;;OAEG;IACI,UAAU,CACb,aAA2C,EAC3C,aAAqD;QAErD,MAAM,IAAI,GAAmC,EAAS,CAAC;QACvD,IAAI,CAAC,gBAAgB,CAAI,IAAI,EAAE,aAAa,CAAC,CAAC;QAC9C,IAAI,CAAC,gBAAgB,CAAI,IAAI,EAAE,aAAa,CAAC,CAAC;QAC9C,MAAM,CAAC,c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B,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;gBAC3D,IAAI,UAAU,KAAK,SAAS,EAAE;oBAC1B,OAAO,UAAU,CAAC;iBACrB;aACJ;YACD,OAAO,SAAS,CAAC;SACpB;QAED,+EAA+E;QAC/E,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YAChC,OAAO;gBACH,GAAG;oBACC,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;wBAC5C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,yDAA2B,CAAC,CAAC;6BACpD,IAAI,CAAC,KAAK,EAAE,GAAG,EAAgB,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;6BAChD,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAG,CAAC,CAAC,CAAC,CAAC;qBAC5B;gBACL,CAAC;aACJ,CAAC;SACL;QACD,OAAO;YACC,GAAG;gBACC,IAAI,QAAQ,EAAE;oBACV,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;wBACxC,IAAI,CAAC,EAAE;4BACH,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;yBACf;oBACL,CAAC,CAAC,CAAC;iBACN;YACL,CAAC;SACJ,CAAC;IACV,CAAC;CACJ;AAnKD,kDAmKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n AsyncFluidObjectProvider,\n FluidObjectSymbolProvider,\n FluidObjectProvider,\n AsyncOptionalFluidObjectProvider,\n AsyncRequiredFluidObjectProvider,\n} from \"./types\";\nimport {\n IFluidDependencySynthesizer,\n} from \"./IFluidDependencySynthesizer\";\n\n/**\n * DependencyContainer is similar to a IoC Container. It takes providers and will\n * synthesize an object based on them when requested.\n */\nexport class DependencyContainer<TMap> implements IFluidDependencySynthesizer {\n private readonly providers = new Map<keyof TMap, FluidObjectProvider<any>>();\n private readonly parents: IFluidDependencySynthesizer[];\n public get IFluidDependencySynthesizer() { return this; }\n\n public constructor(... parents: (IFluidDependencySynthesizer | undefined)[]) {\n this.parents = parents.filter((v): v is IFluidDependencySynthesizer => v !== undefined);\n }\n\n /**\n * Add a new provider\n * @param type - Name of the Type T being provided\n * @param provider - A provider that will resolve the T correctly when asked\n * @throws - If passing a type that's already registered\n */\n public register<T extends keyof TMap = keyof TMap>(type: T, provider: FluidObjectProvider<Pick<TMap, T>>): void {\n if (this.providers.has(type)) {\n throw new Error(`Attempting to register a provider of type ${type} that already exists`);\n }\n\n this.providers.set(type, provider);\n }\n\n /**\n * Remove a provider\n * @param type - Name of the provider to remove\n */\n public unregister(type: keyof TMap): void {\n if (this.providers.has(type)) {\n this.providers.delete(type);\n }\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}\n */\n public synthesize<O, R = undefined | Record<string, never>>(\n optionalTypes: FluidObjectSymbolProvider<O>,\n requiredTypes: Required<FluidObjectSymbolProvider<R>>,\n ): AsyncFluidObjectProvider<O, R> {\n const base: AsyncFluidObjectProvider<O, R> = {} as any;\n this.generateRequired<R>(base, requiredTypes);\n this.generateOptional<O>(base, optionalTypes);\n Object.defineProperty(base, IFluidDependencySynthesizer, { get: () => this });\n return base;\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).has}\n * @param excludeParents - If true, exclude checking parent registries\n */\n public has(type: string, excludeParents?: boolean): boolean {\n if (this.providers.has(type as keyof TMap)) {\n return true;\n }\n if (excludeParents !== true) {\n return this.parents.some((p: IFluidDependencySynthesizer) => p.has(type));\n }\n return false;\n }\n /**\n * @deprecated - Needed for back compat\n */\n private getProvider(provider: string & keyof TMap) {\n // this was removed, but some partners have trouble with back compat where they\n // use invalid patterns with IFluidObject and IFluidDependencySynthesizer\n // this is just for back compat until those are removed\n if(this.has(provider)) {\n if(this.providers.has(provider)) {\n return this.providers.get(provider);\n }\n for(const parent of this.parents) {\n if(parent instanceof DependencyContainer) {\n return parent.getProvider(provider);\n }else{\n // older implementations of the IFluidDependencySynthesizer exposed getProvider\n const maybeGetProvider: {getProvider?(provider: string & keyof TMap)} = parent as any;\n if(maybeGetProvider?.getProvider !== undefined) {\n return maybeGetProvider.getProvider(provider);\n }\n }\n }\n }\n }\n\n private generateRequired<T>(\n base: AsyncRequiredFluidObjectProvider<T>,\n types: Required<FluidObjectSymbolProvider<T>>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n const provider = this.resolveProvider(key);\n if(provider === undefined) {\n throw new Error(`Object attempted to be created without registered required provider ${key}`);\n }\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private generateOptional<T>(\n base: AsyncOptionalFluidObjectProvider<T>,\n types: FluidObjectSymbolProvider<T>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n // back-compat: in 0.56 we allow undefined in the types, but we didn't before\n // this will keep runtime back compat, eventually we should support undefined properties\n // rather than properties that return promises that resolve to undefined\n const provider = this.resolveProvider(key) ?? { get: async () => undefined };\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private resolveProvider<T extends keyof TMap>(t: T): PropertyDescriptor | undefined {\n // If we have the provider return it\n const provider = this.providers.get(t);\n if (provider === undefined) {\n for (const parent of this.parents) {\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n const sp = { [t]: t } as FluidObjectSymbolProvider<Pick<TMap, T>>;\n const syn = parent.synthesize<Pick<TMap, T>,{}>(\n sp,\n {});\n const descriptor = Object.getOwnPropertyDescriptor(syn, t);\n if (descriptor !== undefined) {\n return descriptor;\n }\n }\n return undefined;\n }\n\n // The double nested gets are required for lazy loading the provider resolution\n if (typeof provider === \"function\") {\n return {\n get() {\n if (provider && typeof provider === \"function\") {\n return Promise.resolve(this[IFluidDependencySynthesizer])\n .then(async (fds): Promise<any> => provider(fds))\n .then((p) => p?.[t]);\n }\n },\n };\n }\n return {\n get() {\n if (provider) {\n return Promise.resolve(provider).then((p) => {\n if (p) {\n return p[t];\n }\n });\n }\n },\n };\n }\n}\n"]}
1
+ {"version":3,"file":"dependencyContainer.js","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,+EAEuC;AAEvC;;;GAGG;AACH,MAAa,mBAAmB;IAK5B,YAAmB,GAAI,OAAoD;QAJ1D,cAAS,GAAG,IAAI,GAAG,EAAwC,CAAC;QAKzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IAC5F,CAAC;IAJD,IAAW,2BAA2B,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAMzD;;;;;OAKG;IACI,QAAQ,CAAoC,IAAO,EAAE,QAA4C;QACpG,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,6CAA6C,IAAI,sBAAsB,CAAC,CAAC;SAC5F;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,IAAgB;QAC9B,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC1B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SAC/B;IACL,CAAC;IAED;;OAEG;IACI,UAAU,CACb,aAA2C,EAC3C,aAAqD;QAErD,MAAM,IAAI,GAAmC,EAAS,CAAC;QACvD,IAAI,CAAC,gBAAgB,CAAI,IAAI,EAAE,aAAa,CAAC,CAAC;QAC9C,IAAI,CAAC,gBAAgB,CAAI,IAAI,EAAE,aAAa,CAAC,CAAC;QAC9C,M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CAAC,wBAAwB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;gBAC3D,IAAI,UAAU,KAAK,SAAS,EAAE;oBAC1B,OAAO,UAAU,CAAC;iBACrB;aACJ;YACD,OAAO,SAAS,CAAC;SACpB;QAED,+EAA+E;QAC/E,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YAChC,OAAO;gBACH,GAAG;oBACC,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;wBAC5C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,yDAA2B,CAAC,CAAC;6BACpD,IAAI,CAAC,KAAK,EAAE,GAAG,EAAgB,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;6BAChD,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAG,CAAC,CAAC,CAAC,CAAC;qBAC5B;gBACL,CAAC;aACJ,CAAC;SACL;QACD,OAAO;YACC,GAAG;gBACC,IAAI,QAAQ,EAAE;oBACV,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;wBACxC,IAAI,CAAC,EAAE;4BACH,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;yBACf;oBACL,CAAC,CAAC,CAAC;iBACN;YACL,CAAC;SACJ,CAAC;IACV,CAAC;CACJ;AAnKD,kDAmKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n AsyncFluidObjectProvider,\n FluidObjectSymbolProvider,\n FluidObjectProvider,\n AsyncOptionalFluidObjectProvider,\n AsyncRequiredFluidObjectProvider,\n} from \"./types\";\nimport {\n IFluidDependencySynthesizer,\n} from \"./IFluidDependencySynthesizer\";\n\n/**\n * DependencyContainer is similar to a IoC Container. It takes providers and will\n * synthesize an object based on them when requested.\n */\nexport class DependencyContainer<TMap> implements IFluidDependencySynthesizer {\n private readonly providers = new Map<keyof TMap, FluidObjectProvider<any>>();\n private readonly parents: IFluidDependencySynthesizer[];\n public get IFluidDependencySynthesizer() { return this; }\n\n public constructor(... parents: (IFluidDependencySynthesizer | undefined)[]) {\n this.parents = parents.filter((v): v is IFluidDependencySynthesizer => v !== undefined);\n }\n\n /**\n * Add a new provider\n * @param type - Name of the Type T being provided\n * @param provider - A provider that will resolve the T correctly when asked\n * @throws - If passing a type that's already registered\n */\n public register<T extends keyof TMap = keyof TMap>(type: T, provider: FluidObjectProvider<Pick<TMap, T>>): void {\n if (this.providers.has(type)) {\n throw new Error(`Attempting to register a provider of type ${type} that already exists`);\n }\n\n this.providers.set(type, provider);\n }\n\n /**\n * Remove a provider\n * @param type - Name of the provider to remove\n */\n public unregister(type: keyof TMap): void {\n if (this.providers.has(type)) {\n this.providers.delete(type);\n }\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}\n */\n public synthesize<O, R = undefined | Record<string, never>>(\n optionalTypes: FluidObjectSymbolProvider<O>,\n requiredTypes: Required<FluidObjectSymbolProvider<R>>,\n ): AsyncFluidObjectProvider<O, R> {\n const base: AsyncFluidObjectProvider<O, R> = {} as any;\n this.generateRequired<R>(base, requiredTypes);\n this.generateOptional<O>(base, optionalTypes);\n Object.defineProperty(base, IFluidDependencySynthesizer, { get: () => this });\n return base;\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).has}\n * @param excludeParents - If true, exclude checking parent registries\n */\n public has(type: string, excludeParents?: boolean): boolean {\n if (this.providers.has(type as keyof TMap)) {\n return true;\n }\n if (excludeParents !== true) {\n return this.parents.some((p: IFluidDependencySynthesizer) => p.has(type));\n }\n return false;\n }\n /**\n * @deprecated - Needed for back compat\n */\n private getProvider(provider: string & keyof TMap) {\n // this was removed, but some partners have trouble with back compat where they\n // use invalid patterns with IFluidObject and IFluidDependencySynthesizer\n // this is just for back compat until those are removed\n if(this.has(provider)) {\n if(this.providers.has(provider)) {\n return this.providers.get(provider);\n }\n for(const parent of this.parents) {\n if(parent instanceof DependencyContainer) {\n return parent.getProvider(provider);\n }else{\n // older implementations of the IFluidDependencySynthesizer exposed getProvider\n const maybeGetProvider: {getProvider?(provider: string & keyof TMap)} = parent as any;\n if(maybeGetProvider?.getProvider !== undefined) {\n return maybeGetProvider.getProvider(provider);\n }\n }\n }\n }\n }\n\n private generateRequired<T>(\n base: AsyncRequiredFluidObjectProvider<T>,\n types: Required<FluidObjectSymbolProvider<T>>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n const provider = this.resolveProvider(key);\n if(provider === undefined) {\n throw new Error(`Object attempted to be created without registered required provider ${key}`);\n }\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private generateOptional<T>(\n base: AsyncOptionalFluidObjectProvider<T>,\n types: FluidObjectSymbolProvider<T>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n // back-compat: in 0.56 we allow undefined in the types, but we didn't before\n // this will keep runtime back compat, eventually we should support undefined properties\n // rather than properties that return promises that resolve to undefined\n const provider = this.resolveProvider(key) ?? { get: async () => undefined };\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private resolveProvider<T extends keyof TMap>(t: T): PropertyDescriptor | undefined {\n // If we have the provider return it\n const provider = this.providers.get(t);\n if (provider === undefined) {\n for (const parent of this.parents) {\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n const sp = { [t]: t } as FluidObjectSymbolProvider<Pick<TMap, T>>;\n const syn = parent.synthesize<Pick<TMap, T>, Record<string, unknown>>(\n sp,\n {});\n const descriptor = Object.getOwnPropertyDescriptor(syn, t);\n if (descriptor !== undefined) {\n return descriptor;\n }\n }\n return undefined;\n }\n\n // The double nested gets are required for lazy loading the provider resolution\n if (typeof provider === \"function\") {\n return {\n get() {\n if (provider && typeof provider === \"function\") {\n return Promise.resolve(this[IFluidDependencySynthesizer])\n .then(async (fds): Promise<any> => provider(fds))\n .then((p) => p?.[t]);\n }\n },\n };\n }\n return {\n get() {\n if (provider) {\n return Promise.resolve(provider).then((p) => {\n if (p) {\n return p[t];\n }\n });\n }\n },\n };\n }\n}\n"]}
@@ -496,22 +496,22 @@
496
496
  "signature": "3eaa82d284d2ecf646a9f84e79269ec4505c0491876a9fd07f0cd7b5827f7df9",
497
497
  "affectsGlobalScope": false
498
498
  },
499
- "../../../../../node_modules/@fluidframework/driver-definitions/dist/driverError.d.ts": {
499
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/driverError.d.ts": {
500
500
  "version": "9c35bf4f305ed653f657ebe97ced739b0778fab04b76268d4adcac72f279b242",
501
501
  "signature": "9c35bf4f305ed653f657ebe97ced739b0778fab04b76268d4adcac72f279b242",
502
502
  "affectsGlobalScope": false
503
503
  },
504
- "../../../../../node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts": {
504
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts": {
505
505
  "version": "fb75519ad714b609817f371b9e3fca4f02e2302d50bb84a3e8e9ba6ba233ce3d",
506
506
  "signature": "fb75519ad714b609817f371b9e3fca4f02e2302d50bb84a3e8e9ba6ba233ce3d",
507
507
  "affectsGlobalScope": false
508
508
  },
509
- "../../../../../node_modules/@fluidframework/driver-definitions/dist/storage.d.ts": {
509
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/storage.d.ts": {
510
510
  "version": "dc51da03872a900f82db416a294523a0d37f4be324e1fd9d69c20856f01604e8",
511
511
  "signature": "dc51da03872a900f82db416a294523a0d37f4be324e1fd9d69c20856f01604e8",
512
512
  "affectsGlobalScope": false
513
513
  },
514
- "../../../../../node_modules/@fluidframework/driver-definitions/dist/index.d.ts": {
514
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/index.d.ts": {
515
515
  "version": "db393dd65f2c615ff4ad4078bc1a2660b53f18ac0b27dbee9e11a00c129feab1",
516
516
  "signature": "db393dd65f2c615ff4ad4078bc1a2660b53f18ac0b27dbee9e11a00c129feab1",
517
517
  "affectsGlobalScope": false
@@ -686,6 +686,26 @@
686
686
  "signature": "f8eb054ed71a693219fa8c4ecd08272a72dadf73ab82ec9a73b365662f16775c",
687
687
  "affectsGlobalScope": false
688
688
  },
689
+ "../../../../../node_modules/@fluidframework/driver-definitions/dist/driverError.d.ts": {
690
+ "version": "9c35bf4f305ed653f657ebe97ced739b0778fab04b76268d4adcac72f279b242",
691
+ "signature": "9c35bf4f305ed653f657ebe97ced739b0778fab04b76268d4adcac72f279b242",
692
+ "affectsGlobalScope": false
693
+ },
694
+ "../../../../../node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts": {
695
+ "version": "fb75519ad714b609817f371b9e3fca4f02e2302d50bb84a3e8e9ba6ba233ce3d",
696
+ "signature": "fb75519ad714b609817f371b9e3fca4f02e2302d50bb84a3e8e9ba6ba233ce3d",
697
+ "affectsGlobalScope": false
698
+ },
699
+ "../../../../../node_modules/@fluidframework/driver-definitions/dist/storage.d.ts": {
700
+ "version": "23333bf4703c216fc9707c31b1c80d913f0dcbb66b2603011a399c5bc517cc84",
701
+ "signature": "23333bf4703c216fc9707c31b1c80d913f0dcbb66b2603011a399c5bc517cc84",
702
+ "affectsGlobalScope": false
703
+ },
704
+ "../../../../../node_modules/@fluidframework/driver-definitions/dist/index.d.ts": {
705
+ "version": "db393dd65f2c615ff4ad4078bc1a2660b53f18ac0b27dbee9e11a00c129feab1",
706
+ "signature": "db393dd65f2c615ff4ad4078bc1a2660b53f18ac0b27dbee9e11a00c129feab1",
707
+ "affectsGlobalScope": false
708
+ },
689
709
  "../../../../runtime/runtime-definitions/dist/dataStoreRegistry.d.ts": {
690
710
  "version": "eff90c8fb7521204ef889ea0684748a7ff8a1b62a7e0cc23ace822a96d1bff44",
691
711
  "signature": "eff90c8fb7521204ef889ea0684748a7ff8a1b62a7e0cc23ace822a96d1bff44",
@@ -707,8 +727,8 @@
707
727
  "affectsGlobalScope": false
708
728
  },
709
729
  "../../../../runtime/runtime-definitions/dist/dataStoreContext.d.ts": {
710
- "version": "e51deb6147caefb48bf6079266b51eae164a6e770ff47945464cbdf20a74ce70",
711
- "signature": "e51deb6147caefb48bf6079266b51eae164a6e770ff47945464cbdf20a74ce70",
730
+ "version": "f3838179c26a4bb23819e58d86519e93db5b7c4400feb1c3bfe1f2acd1507dc9",
731
+ "signature": "f3838179c26a4bb23819e58d86519e93db5b7c4400feb1c3bfe1f2acd1507dc9",
712
732
  "affectsGlobalScope": false
713
733
  },
714
734
  "../../../../runtime/runtime-definitions/dist/dataStoreFactory.d.ts": {
@@ -791,6 +811,31 @@
791
811
  "signature": "abc949a48872f03572ff3108a999c28e5e394296186194fa9e4ad357fa3cfcd7",
792
812
  "affectsGlobalScope": false
793
813
  },
814
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts": {
815
+ "version": "461180d6ff91eb3902b1a5fa34185327d785e059fdc52ad2fe2b0a16c0960489",
816
+ "signature": "461180d6ff91eb3902b1a5fa34185327d785e059fdc52ad2fe2b0a16c0960489",
817
+ "affectsGlobalScope": false
818
+ },
819
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts": {
820
+ "version": "a15809b8be1e3dd5a4f89df2886c9609eff56afa7b5e262adae346dc81d80a19",
821
+ "signature": "a15809b8be1e3dd5a4f89df2886c9609eff56afa7b5e262adae346dc81d80a19",
822
+ "affectsGlobalScope": false
823
+ },
824
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/dependencyContainer.d.ts": {
825
+ "version": "abbf5a289e8fbe488cf30a8024ebb89cafa6ab47277ffe735ce2dd18fe1ca107",
826
+ "signature": "abbf5a289e8fbe488cf30a8024ebb89cafa6ab47277ffe735ce2dd18fe1ca107",
827
+ "affectsGlobalScope": false
828
+ },
829
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/index.d.ts": {
830
+ "version": "48010a1e04aff055895b4d95949566d9cd43f356bf1d989548dcbe34b07e0702",
831
+ "signature": "48010a1e04aff055895b4d95949566d9cd43f356bf1d989548dcbe34b07e0702",
832
+ "affectsGlobalScope": false
833
+ },
834
+ "../../src/test/types/validateSynthesizePrevious.ts": {
835
+ "version": "f72d196be03d90a1f9e636fbbc046197d962abc00285ea7bc9026cb453388e5c",
836
+ "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881",
837
+ "affectsGlobalScope": false
838
+ },
794
839
  "../../../../../node_modules/@types/mocha/index.d.ts": {
795
840
  "version": "5f186a758a616c107c70e8918db4630d063bd782f22e6e0b17573b125765b40b",
796
841
  "signature": "5f186a758a616c107c70e8918db4630d063bd782f22e6e0b17573b125765b40b",
@@ -893,6 +938,7 @@
893
938
  "../../../../../node_modules/@fluidframework/common-definitions/dist/index.d.ts",
894
939
  "../../../../../node_modules/@fluidframework/container-definitions/dist/legacy/index.d.ts",
895
940
  "../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts",
941
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts",
896
942
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
897
943
  "../../../../../node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts",
898
944
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/index.d.ts"
@@ -920,6 +966,7 @@
920
966
  "../../../../../node_modules/@fluidframework/container-definitions/dist/deltas.d.ts",
921
967
  "../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts",
922
968
  "../../../../../node_modules/@fluidframework/container-definitions/dist/runtime.d.ts",
969
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts",
923
970
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
924
971
  "../../../../../node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts"
925
972
  ],
@@ -931,14 +978,15 @@
931
978
  "../../../../../node_modules/@fluidframework/container-definitions/dist/fluidModule.d.ts",
932
979
  "../../../../../node_modules/@fluidframework/container-definitions/dist/legacy/index.d.ts",
933
980
  "../../../../../node_modules/@fluidframework/container-definitions/dist/runtime.d.ts",
981
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/index.d.ts",
982
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts",
934
983
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
935
- "../../../../../node_modules/@fluidframework/driver-definitions/dist/index.d.ts",
936
984
  "../../../../../node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts",
937
985
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/index.d.ts"
938
986
  ],
939
987
  "../../../../../node_modules/@fluidframework/container-definitions/dist/proxyLoader.d.ts": [
940
988
  "../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts",
941
- "../../../../../node_modules/@fluidframework/driver-definitions/dist/index.d.ts"
989
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/index.d.ts"
942
990
  ],
943
991
  "../../../../../node_modules/@fluidframework/container-definitions/dist/runtime.d.ts": [
944
992
  "../../../../../node_modules/@fluidframework/common-definitions/dist/index.d.ts",
@@ -946,10 +994,27 @@
946
994
  "../../../../../node_modules/@fluidframework/container-definitions/dist/deltas.d.ts",
947
995
  "../../../../../node_modules/@fluidframework/container-definitions/dist/error.d.ts",
948
996
  "../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts",
997
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/index.d.ts",
949
998
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
950
- "../../../../../node_modules/@fluidframework/driver-definitions/dist/index.d.ts",
951
999
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/index.d.ts"
952
1000
  ],
1001
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/index.d.ts": [
1002
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/driverError.d.ts",
1003
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/storage.d.ts",
1004
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts"
1005
+ ],
1006
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/storage.d.ts": [
1007
+ "../../../../../node_modules/@fluidframework/common-definitions/dist/index.d.ts",
1008
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts",
1009
+ "../../../../../node_modules/@fluidframework/protocol-definitions/dist/index.d.ts"
1010
+ ],
1011
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts": [
1012
+ "../../../../../node_modules/@fluidframework/container-definitions/dist/deltas.d.ts",
1013
+ "../../../../../node_modules/@fluidframework/container-definitions/dist/legacy/index.d.ts",
1014
+ "../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts",
1015
+ "../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
1016
+ "../../../../../node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts"
1017
+ ],
953
1018
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/fluidLoadable.d.ts": [
954
1019
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/handles.d.ts"
955
1020
  ],
@@ -991,6 +1056,7 @@
991
1056
  "../../../../../node_modules/@fluidframework/container-definitions/dist/deltas.d.ts",
992
1057
  "../../../../../node_modules/@fluidframework/container-definitions/dist/legacy/index.d.ts",
993
1058
  "../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts",
1059
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts",
994
1060
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts"
995
1061
  ],
996
1062
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/clients.d.ts": [
@@ -1021,6 +1087,21 @@
1021
1087
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/tokens.d.ts": [
1022
1088
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/users.d.ts"
1023
1089
  ],
1090
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts": [
1091
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts"
1092
+ ],
1093
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/dependencyContainer.d.ts": [
1094
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts",
1095
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts"
1096
+ ],
1097
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/index.d.ts": [
1098
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts",
1099
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/dependencyContainer.d.ts",
1100
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts"
1101
+ ],
1102
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts": [
1103
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/index.d.ts"
1104
+ ],
1024
1105
  "../../../../../node_modules/@types/node/assert.d.ts": [
1025
1106
  "../../../../../node_modules/@types/node/assert.d.ts"
1026
1107
  ],
@@ -1269,6 +1350,10 @@
1269
1350
  "../index.d.ts",
1270
1351
  "../types.d.ts"
1271
1352
  ],
1353
+ "../../src/test/types/validateSynthesizePrevious.ts": [
1354
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/index.d.ts",
1355
+ "../index.d.ts"
1356
+ ],
1272
1357
  "../../../../runtime/datastore-definitions/dist/channel.d.ts": [
1273
1358
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
1274
1359
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/index.d.ts",
@@ -1412,6 +1497,7 @@
1412
1497
  "../../../../../node_modules/@fluidframework/common-definitions/dist/index.d.ts",
1413
1498
  "../../../../../node_modules/@fluidframework/container-definitions/dist/legacy/index.d.ts",
1414
1499
  "../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts",
1500
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts",
1415
1501
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
1416
1502
  "../../../../../node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts",
1417
1503
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/index.d.ts"
@@ -1439,6 +1525,7 @@
1439
1525
  "../../../../../node_modules/@fluidframework/container-definitions/dist/deltas.d.ts",
1440
1526
  "../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts",
1441
1527
  "../../../../../node_modules/@fluidframework/container-definitions/dist/runtime.d.ts",
1528
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts",
1442
1529
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
1443
1530
  "../../../../../node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts"
1444
1531
  ],
@@ -1450,14 +1537,15 @@
1450
1537
  "../../../../../node_modules/@fluidframework/container-definitions/dist/fluidModule.d.ts",
1451
1538
  "../../../../../node_modules/@fluidframework/container-definitions/dist/legacy/index.d.ts",
1452
1539
  "../../../../../node_modules/@fluidframework/container-definitions/dist/runtime.d.ts",
1540
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/index.d.ts",
1541
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts",
1453
1542
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
1454
- "../../../../../node_modules/@fluidframework/driver-definitions/dist/index.d.ts",
1455
1543
  "../../../../../node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts",
1456
1544
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/index.d.ts"
1457
1545
  ],
1458
1546
  "../../../../../node_modules/@fluidframework/container-definitions/dist/proxyLoader.d.ts": [
1459
1547
  "../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts",
1460
- "../../../../../node_modules/@fluidframework/driver-definitions/dist/index.d.ts"
1548
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/index.d.ts"
1461
1549
  ],
1462
1550
  "../../../../../node_modules/@fluidframework/container-definitions/dist/runtime.d.ts": [
1463
1551
  "../../../../../node_modules/@fluidframework/common-definitions/dist/index.d.ts",
@@ -1465,10 +1553,27 @@
1465
1553
  "../../../../../node_modules/@fluidframework/container-definitions/dist/deltas.d.ts",
1466
1554
  "../../../../../node_modules/@fluidframework/container-definitions/dist/error.d.ts",
1467
1555
  "../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts",
1556
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/index.d.ts",
1468
1557
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
1469
- "../../../../../node_modules/@fluidframework/driver-definitions/dist/index.d.ts",
1470
1558
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/index.d.ts"
1471
1559
  ],
1560
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/index.d.ts": [
1561
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/driverError.d.ts",
1562
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/storage.d.ts",
1563
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts"
1564
+ ],
1565
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/storage.d.ts": [
1566
+ "../../../../../node_modules/@fluidframework/common-definitions/dist/index.d.ts",
1567
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts",
1568
+ "../../../../../node_modules/@fluidframework/protocol-definitions/dist/index.d.ts"
1569
+ ],
1570
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts": [
1571
+ "../../../../../node_modules/@fluidframework/container-definitions/dist/deltas.d.ts",
1572
+ "../../../../../node_modules/@fluidframework/container-definitions/dist/legacy/index.d.ts",
1573
+ "../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts",
1574
+ "../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
1575
+ "../../../../../node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts"
1576
+ ],
1472
1577
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/fluidLoadable.d.ts": [
1473
1578
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/handles.d.ts"
1474
1579
  ],
@@ -1510,6 +1615,7 @@
1510
1615
  "../../../../../node_modules/@fluidframework/container-definitions/dist/deltas.d.ts",
1511
1616
  "../../../../../node_modules/@fluidframework/container-definitions/dist/legacy/index.d.ts",
1512
1617
  "../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts",
1618
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts",
1513
1619
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts"
1514
1620
  ],
1515
1621
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/clients.d.ts": [
@@ -1540,6 +1646,21 @@
1540
1646
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/tokens.d.ts": [
1541
1647
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/users.d.ts"
1542
1648
  ],
1649
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts": [
1650
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts"
1651
+ ],
1652
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/dependencyContainer.d.ts": [
1653
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts",
1654
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts"
1655
+ ],
1656
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/index.d.ts": [
1657
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts",
1658
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/dependencyContainer.d.ts",
1659
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts"
1660
+ ],
1661
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts": [
1662
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/index.d.ts"
1663
+ ],
1543
1664
  "../../../../../node_modules/@types/node/assert.d.ts": [
1544
1665
  "../../../../../node_modules/@types/node/assert.d.ts"
1545
1666
  ],
@@ -1897,6 +2018,10 @@
1897
2018
  "../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts",
1898
2019
  "../../../../../node_modules/@fluidframework/container-definitions/dist/proxyLoader.d.ts",
1899
2020
  "../../../../../node_modules/@fluidframework/container-definitions/dist/runtime.d.ts",
2021
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/driverError.d.ts",
2022
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/index.d.ts",
2023
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/storage.d.ts",
2024
+ "../../../../../node_modules/@fluidframework/container-definitions/node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts",
1900
2025
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/fluidLoadable.d.ts",
1901
2026
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/fluidObject.d.ts",
1902
2027
  "../../../../../node_modules/@fluidframework/core-interfaces/dist/fluidPackage.d.ts",
@@ -1920,6 +2045,10 @@
1920
2045
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/summary.d.ts",
1921
2046
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/tokens.d.ts",
1922
2047
  "../../../../../node_modules/@fluidframework/protocol-definitions/dist/users.d.ts",
2048
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts",
2049
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/dependencyContainer.d.ts",
2050
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/index.d.ts",
2051
+ "../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts",
1923
2052
  "../../../../../node_modules/@types/events/index.d.ts",
1924
2053
  "../../../../../node_modules/@types/mocha/index.d.ts",
1925
2054
  "../../../../../node_modules/@types/node/assert.d.ts",
@@ -2000,6 +2129,7 @@
2000
2129
  "../index.d.ts",
2001
2130
  "../types.d.ts",
2002
2131
  "../../src/test/dependencyContainer.spec.ts",
2132
+ "../../src/test/types/validateSynthesizePrevious.ts",
2003
2133
  "../../../../runtime/datastore-definitions/dist/channel.d.ts",
2004
2134
  "../../../../runtime/datastore-definitions/dist/dataStoreRuntime.d.ts",
2005
2135
  "../../../../runtime/datastore-definitions/dist/index.d.ts",
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ use_current_TypeAliasDeclaration_AsyncFluidObjectProvider(get_old_TypeAliasDeclaration_AsyncFluidObjectProvider());
4
+ use_old_TypeAliasDeclaration_AsyncFluidObjectProvider(get_current_TypeAliasDeclaration_AsyncFluidObjectProvider());
5
+ use_current_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider(get_old_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider());
6
+ use_old_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider(get_current_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider());
7
+ use_current_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider(get_old_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider());
8
+ use_old_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider(get_current_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider());
9
+ use_current_ClassDeclaration_DependencyContainer(get_old_ClassDeclaration_DependencyContainer());
10
+ use_old_ClassDeclaration_DependencyContainer(get_current_ClassDeclaration_DependencyContainer());
11
+ use_current_TypeAliasDeclaration_FluidObjectProvider(get_old_TypeAliasDeclaration_FluidObjectProvider());
12
+ use_old_TypeAliasDeclaration_FluidObjectProvider(get_current_TypeAliasDeclaration_FluidObjectProvider());
13
+ use_current_TypeAliasDeclaration_FluidObjectSymbolProvider(get_old_TypeAliasDeclaration_FluidObjectSymbolProvider());
14
+ use_old_TypeAliasDeclaration_FluidObjectSymbolProvider(get_current_TypeAliasDeclaration_FluidObjectSymbolProvider());
15
+ use_current_VariableDeclaration_IFluidDependencySynthesizer(get_old_VariableDeclaration_IFluidDependencySynthesizer());
16
+ use_old_VariableDeclaration_IFluidDependencySynthesizer(get_current_VariableDeclaration_IFluidDependencySynthesizer());
17
+ use_current_InterfaceDeclaration_IFluidDependencySynthesizer(get_old_InterfaceDeclaration_IFluidDependencySynthesizer());
18
+ use_old_InterfaceDeclaration_IFluidDependencySynthesizer(get_current_InterfaceDeclaration_IFluidDependencySynthesizer());
19
+ use_current_InterfaceDeclaration_IProvideFluidDependencySynthesizer(get_old_InterfaceDeclaration_IProvideFluidDependencySynthesizer());
20
+ use_old_InterfaceDeclaration_IProvideFluidDependencySynthesizer(get_current_InterfaceDeclaration_IProvideFluidDependencySynthesizer());
21
+ //# sourceMappingURL=validateSynthesizePrevious.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateSynthesizePrevious.js","sourceRoot":"","sources":["../../../src/test/types/validateSynthesizePrevious.ts"],"names":[],"mappings":";;AAyBA,yDAAyD,CACrD,qDAAqD,EAAE,CAAC,CAAC;AAW7D,qDAAqD,CACjD,yDAAyD,EAAE,CAAC,CAAC;AAWjE,iEAAiE,CAC7D,6DAA6D,EAAE,CAAC,CAAC;AAWrE,6DAA6D,CACzD,iEAAiE,EAAE,CAAC,CAAC;AAWzE,iEAAiE,CAC7D,6DAA6D,EAAE,CAAC,CAAC;AAWrE,6DAA6D,CACzD,iEAAiE,EAAE,CAAC,CAAC;AAWzE,gDAAgD,CAC5C,4CAA4C,EAAE,CAAC,CAAC;AAWpD,4CAA4C,CACxC,gDAAgD,EAAE,CAAC,CAAC;AAWxD,oDAAoD,CAChD,gDAAgD,EAAE,CAAC,CAAC;AAWxD,gDAAgD,CAC5C,oDAAoD,EAAE,CAAC,CAAC;AAW5D,0DAA0D,CACtD,sDAAsD,EAAE,CAAC,CAAC;AAW9D,sDAAsD,CAClD,0DAA0D,EAAE,CAAC,CAAC;AAWlE,2DAA2D,CACvD,uDAAuD,EAAE,CAAC,CAAC;AAW/D,uDAAuD,CACnD,2DAA2D,EAAE,CAAC,CAAC;AAWnE,4DAA4D,CACxD,wDAAwD,EAAE,CAAC,CAAC;AAWhE,wDAAwD,CACpD,4DAA4D,EAAE,CAAC,CAAC;AAWpE,mEAAmE,CAC/D,+DAA+D,EAAE,CAAC,CAAC;AAWvE,+DAA+D,CAC3D,mEAAmE,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by fluid-type-validator in @fluidframework/build-tools.\n */\n/* eslint-disable max-lines */\nimport * as old from \"@fluidframework/synthesize-previous\";\nimport * as current from \"../../index\";\n\ntype TypeOnly<T> = {\n [P in keyof T]: TypeOnly<T[P]>;\n};\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"TypeAliasDeclaration_AsyncFluidObjectProvider\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_AsyncFluidObjectProvider():\n TypeOnly<old.AsyncFluidObjectProvider<any,any>>;\ndeclare function use_current_TypeAliasDeclaration_AsyncFluidObjectProvider(\n use: TypeOnly<current.AsyncFluidObjectProvider<any,any>>);\nuse_current_TypeAliasDeclaration_AsyncFluidObjectProvider(\n get_old_TypeAliasDeclaration_AsyncFluidObjectProvider());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"TypeAliasDeclaration_AsyncFluidObjectProvider\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_AsyncFluidObjectProvider():\n TypeOnly<current.AsyncFluidObjectProvider<any,any>>;\ndeclare function use_old_TypeAliasDeclaration_AsyncFluidObjectProvider(\n use: TypeOnly<old.AsyncFluidObjectProvider<any,any>>);\nuse_old_TypeAliasDeclaration_AsyncFluidObjectProvider(\n get_current_TypeAliasDeclaration_AsyncFluidObjectProvider());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"TypeAliasDeclaration_AsyncOptionalFluidObjectProvider\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider():\n TypeOnly<old.AsyncOptionalFluidObjectProvider<any>>;\ndeclare function use_current_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider(\n use: TypeOnly<current.AsyncOptionalFluidObjectProvider<any>>);\nuse_current_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider(\n get_old_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"TypeAliasDeclaration_AsyncOptionalFluidObjectProvider\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider():\n TypeOnly<current.AsyncOptionalFluidObjectProvider<any>>;\ndeclare function use_old_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider(\n use: TypeOnly<old.AsyncOptionalFluidObjectProvider<any>>);\nuse_old_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider(\n get_current_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"TypeAliasDeclaration_AsyncRequiredFluidObjectProvider\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider():\n TypeOnly<old.AsyncRequiredFluidObjectProvider<any>>;\ndeclare function use_current_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider(\n use: TypeOnly<current.AsyncRequiredFluidObjectProvider<any>>);\nuse_current_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider(\n get_old_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"TypeAliasDeclaration_AsyncRequiredFluidObjectProvider\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider():\n TypeOnly<current.AsyncRequiredFluidObjectProvider<any>>;\ndeclare function use_old_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider(\n use: TypeOnly<old.AsyncRequiredFluidObjectProvider<any>>);\nuse_old_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider(\n get_current_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"ClassDeclaration_DependencyContainer\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_DependencyContainer():\n TypeOnly<old.DependencyContainer<any>>;\ndeclare function use_current_ClassDeclaration_DependencyContainer(\n use: TypeOnly<current.DependencyContainer<any>>);\nuse_current_ClassDeclaration_DependencyContainer(\n get_old_ClassDeclaration_DependencyContainer());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"ClassDeclaration_DependencyContainer\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_DependencyContainer():\n TypeOnly<current.DependencyContainer<any>>;\ndeclare function use_old_ClassDeclaration_DependencyContainer(\n use: TypeOnly<old.DependencyContainer<any>>);\nuse_old_ClassDeclaration_DependencyContainer(\n get_current_ClassDeclaration_DependencyContainer());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"TypeAliasDeclaration_FluidObjectProvider\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_FluidObjectProvider():\n TypeOnly<old.FluidObjectProvider<any>>;\ndeclare function use_current_TypeAliasDeclaration_FluidObjectProvider(\n use: TypeOnly<current.FluidObjectProvider<any>>);\nuse_current_TypeAliasDeclaration_FluidObjectProvider(\n get_old_TypeAliasDeclaration_FluidObjectProvider());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"TypeAliasDeclaration_FluidObjectProvider\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_FluidObjectProvider():\n TypeOnly<current.FluidObjectProvider<any>>;\ndeclare function use_old_TypeAliasDeclaration_FluidObjectProvider(\n use: TypeOnly<old.FluidObjectProvider<any>>);\nuse_old_TypeAliasDeclaration_FluidObjectProvider(\n get_current_TypeAliasDeclaration_FluidObjectProvider());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"TypeAliasDeclaration_FluidObjectSymbolProvider\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_FluidObjectSymbolProvider():\n TypeOnly<old.FluidObjectSymbolProvider<any>>;\ndeclare function use_current_TypeAliasDeclaration_FluidObjectSymbolProvider(\n use: TypeOnly<current.FluidObjectSymbolProvider<any>>);\nuse_current_TypeAliasDeclaration_FluidObjectSymbolProvider(\n get_old_TypeAliasDeclaration_FluidObjectSymbolProvider());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"TypeAliasDeclaration_FluidObjectSymbolProvider\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_FluidObjectSymbolProvider():\n TypeOnly<current.FluidObjectSymbolProvider<any>>;\ndeclare function use_old_TypeAliasDeclaration_FluidObjectSymbolProvider(\n use: TypeOnly<old.FluidObjectSymbolProvider<any>>);\nuse_old_TypeAliasDeclaration_FluidObjectSymbolProvider(\n get_current_TypeAliasDeclaration_FluidObjectSymbolProvider());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"VariableDeclaration_IFluidDependencySynthesizer\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_VariableDeclaration_IFluidDependencySynthesizer():\n TypeOnly<typeof old.IFluidDependencySynthesizer>;\ndeclare function use_current_VariableDeclaration_IFluidDependencySynthesizer(\n use: TypeOnly<typeof current.IFluidDependencySynthesizer>);\nuse_current_VariableDeclaration_IFluidDependencySynthesizer(\n get_old_VariableDeclaration_IFluidDependencySynthesizer());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"VariableDeclaration_IFluidDependencySynthesizer\": {\"backCompat\": false}\n*/\ndeclare function get_current_VariableDeclaration_IFluidDependencySynthesizer():\n TypeOnly<typeof current.IFluidDependencySynthesizer>;\ndeclare function use_old_VariableDeclaration_IFluidDependencySynthesizer(\n use: TypeOnly<typeof old.IFluidDependencySynthesizer>);\nuse_old_VariableDeclaration_IFluidDependencySynthesizer(\n get_current_VariableDeclaration_IFluidDependencySynthesizer());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"InterfaceDeclaration_IFluidDependencySynthesizer\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IFluidDependencySynthesizer():\n TypeOnly<old.IFluidDependencySynthesizer>;\ndeclare function use_current_InterfaceDeclaration_IFluidDependencySynthesizer(\n use: TypeOnly<current.IFluidDependencySynthesizer>);\nuse_current_InterfaceDeclaration_IFluidDependencySynthesizer(\n get_old_InterfaceDeclaration_IFluidDependencySynthesizer());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"InterfaceDeclaration_IFluidDependencySynthesizer\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IFluidDependencySynthesizer():\n TypeOnly<current.IFluidDependencySynthesizer>;\ndeclare function use_old_InterfaceDeclaration_IFluidDependencySynthesizer(\n use: TypeOnly<old.IFluidDependencySynthesizer>);\nuse_old_InterfaceDeclaration_IFluidDependencySynthesizer(\n get_current_InterfaceDeclaration_IFluidDependencySynthesizer());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"InterfaceDeclaration_IProvideFluidDependencySynthesizer\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IProvideFluidDependencySynthesizer():\n TypeOnly<old.IProvideFluidDependencySynthesizer>;\ndeclare function use_current_InterfaceDeclaration_IProvideFluidDependencySynthesizer(\n use: TypeOnly<current.IProvideFluidDependencySynthesizer>);\nuse_current_InterfaceDeclaration_IProvideFluidDependencySynthesizer(\n get_old_InterfaceDeclaration_IProvideFluidDependencySynthesizer());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:\n* \"InterfaceDeclaration_IProvideFluidDependencySynthesizer\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IProvideFluidDependencySynthesizer():\n TypeOnly<current.IProvideFluidDependencySynthesizer>;\ndeclare function use_old_InterfaceDeclaration_IProvideFluidDependencySynthesizer(\n use: TypeOnly<old.IProvideFluidDependencySynthesizer>);\nuse_old_InterfaceDeclaration_IProvideFluidDependencySynthesizer(\n get_current_InterfaceDeclaration_IProvideFluidDependencySynthesizer());\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dependencyContainer.js","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EACH,2BAA2B,GAC9B,MAAM,+BAA+B,CAAC;AAEvC;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAK5B,YAAmB,GAAI,OAAoD;QAJ1D,cAAS,GAAG,IAAI,GAAG,EAAwC,CAAC;QAKzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IAC5F,CAAC;IAJD,IAAW,2BAA2B,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAMzD;;;;;OAKG;IACI,QAAQ,CAAoC,IAAO,EAAE,QAA4C;QACpG,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,6CAA6C,IAAI,sBAAsB,CAAC,CAAC;SAC5F;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,CAA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AC,CAAC,CAAC,CAAC,CAAC;yBACf;oBACL,CAAC,CAAC,CAAC;iBACN;YACL,CAAC;SACJ,CAAC;IACV,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n AsyncFluidObjectProvider,\n FluidObjectSymbolProvider,\n FluidObjectProvider,\n AsyncOptionalFluidObjectProvider,\n AsyncRequiredFluidObjectProvider,\n} from \"./types\";\nimport {\n IFluidDependencySynthesizer,\n} from \"./IFluidDependencySynthesizer\";\n\n/**\n * DependencyContainer is similar to a IoC Container. It takes providers and will\n * synthesize an object based on them when requested.\n */\nexport class DependencyContainer<TMap> implements IFluidDependencySynthesizer {\n private readonly providers = new Map<keyof TMap, FluidObjectProvider<any>>();\n private readonly parents: IFluidDependencySynthesizer[];\n public get IFluidDependencySynthesizer() { return this; }\n\n public constructor(... parents: (IFluidDependencySynthesizer | undefined)[]) {\n this.parents = parents.filter((v): v is IFluidDependencySynthesizer => v !== undefined);\n }\n\n /**\n * Add a new provider\n * @param type - Name of the Type T being provided\n * @param provider - A provider that will resolve the T correctly when asked\n * @throws - If passing a type that's already registered\n */\n public register<T extends keyof TMap = keyof TMap>(type: T, provider: FluidObjectProvider<Pick<TMap, T>>): void {\n if (this.providers.has(type)) {\n throw new Error(`Attempting to register a provider of type ${type} that already exists`);\n }\n\n this.providers.set(type, provider);\n }\n\n /**\n * Remove a provider\n * @param type - Name of the provider to remove\n */\n public unregister(type: keyof TMap): void {\n if (this.providers.has(type)) {\n this.providers.delete(type);\n }\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}\n */\n public synthesize<O, R = undefined | Record<string, never>>(\n optionalTypes: FluidObjectSymbolProvider<O>,\n requiredTypes: Required<FluidObjectSymbolProvider<R>>,\n ): AsyncFluidObjectProvider<O, R> {\n const base: AsyncFluidObjectProvider<O, R> = {} as any;\n this.generateRequired<R>(base, requiredTypes);\n this.generateOptional<O>(base, optionalTypes);\n Object.defineProperty(base, IFluidDependencySynthesizer, { get: () => this });\n return base;\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).has}\n * @param excludeParents - If true, exclude checking parent registries\n */\n public has(type: string, excludeParents?: boolean): boolean {\n if (this.providers.has(type as keyof TMap)) {\n return true;\n }\n if (excludeParents !== true) {\n return this.parents.some((p: IFluidDependencySynthesizer) => p.has(type));\n }\n return false;\n }\n /**\n * @deprecated - Needed for back compat\n */\n private getProvider(provider: string & keyof TMap) {\n // this was removed, but some partners have trouble with back compat where they\n // use invalid patterns with IFluidObject and IFluidDependencySynthesizer\n // this is just for back compat until those are removed\n if(this.has(provider)) {\n if(this.providers.has(provider)) {\n return this.providers.get(provider);\n }\n for(const parent of this.parents) {\n if(parent instanceof DependencyContainer) {\n return parent.getProvider(provider);\n }else{\n // older implementations of the IFluidDependencySynthesizer exposed getProvider\n const maybeGetProvider: {getProvider?(provider: string & keyof TMap)} = parent as any;\n if(maybeGetProvider?.getProvider !== undefined) {\n return maybeGetProvider.getProvider(provider);\n }\n }\n }\n }\n }\n\n private generateRequired<T>(\n base: AsyncRequiredFluidObjectProvider<T>,\n types: Required<FluidObjectSymbolProvider<T>>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n const provider = this.resolveProvider(key);\n if(provider === undefined) {\n throw new Error(`Object attempted to be created without registered required provider ${key}`);\n }\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private generateOptional<T>(\n base: AsyncOptionalFluidObjectProvider<T>,\n types: FluidObjectSymbolProvider<T>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n // back-compat: in 0.56 we allow undefined in the types, but we didn't before\n // this will keep runtime back compat, eventually we should support undefined properties\n // rather than properties that return promises that resolve to undefined\n const provider = this.resolveProvider(key) ?? { get: async () => undefined };\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private resolveProvider<T extends keyof TMap>(t: T): PropertyDescriptor | undefined {\n // If we have the provider return it\n const provider = this.providers.get(t);\n if (provider === undefined) {\n for (const parent of this.parents) {\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n const sp = { [t]: t } as FluidObjectSymbolProvider<Pick<TMap, T>>;\n const syn = parent.synthesize<Pick<TMap, T>,{}>(\n sp,\n {});\n const descriptor = Object.getOwnPropertyDescriptor(syn, t);\n if (descriptor !== undefined) {\n return descriptor;\n }\n }\n return undefined;\n }\n\n // The double nested gets are required for lazy loading the provider resolution\n if (typeof provider === \"function\") {\n return {\n get() {\n if (provider && typeof provider === \"function\") {\n return Promise.resolve(this[IFluidDependencySynthesizer])\n .then(async (fds): Promise<any> => provider(fds))\n .then((p) => p?.[t]);\n }\n },\n };\n }\n return {\n get() {\n if (provider) {\n return Promise.resolve(provider).then((p) => {\n if (p) {\n return p[t];\n }\n });\n }\n },\n };\n }\n}\n"]}
1
+ {"version":3,"file":"dependencyContainer.js","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EACH,2BAA2B,GAC9B,MAAM,+BAA+B,CAAC;AAEvC;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAK5B,YAAmB,GAAI,OAAoD;QAJ1D,cAAS,GAAG,IAAI,GAAG,EAAwC,CAAC;QAKzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IAC5F,CAAC;IAJD,IAAW,2BAA2B,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAMzD;;;;;OAKG;IACI,QAAQ,CAAoC,IAAO,EAAE,QAA4C;QACpG,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,6CAA6C,IAAI,sBAAsB,CAAC,CAAC;SAC5F;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BACxC,IAAI,CAAC,EAAE;4BACH,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;yBACf;oBACL,CAAC,CAAC,CAAC;iBACN;YACL,CAAC;SACJ,CAAC;IACV,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n AsyncFluidObjectProvider,\n FluidObjectSymbolProvider,\n FluidObjectProvider,\n AsyncOptionalFluidObjectProvider,\n AsyncRequiredFluidObjectProvider,\n} from \"./types\";\nimport {\n IFluidDependencySynthesizer,\n} from \"./IFluidDependencySynthesizer\";\n\n/**\n * DependencyContainer is similar to a IoC Container. It takes providers and will\n * synthesize an object based on them when requested.\n */\nexport class DependencyContainer<TMap> implements IFluidDependencySynthesizer {\n private readonly providers = new Map<keyof TMap, FluidObjectProvider<any>>();\n private readonly parents: IFluidDependencySynthesizer[];\n public get IFluidDependencySynthesizer() { return this; }\n\n public constructor(... parents: (IFluidDependencySynthesizer | undefined)[]) {\n this.parents = parents.filter((v): v is IFluidDependencySynthesizer => v !== undefined);\n }\n\n /**\n * Add a new provider\n * @param type - Name of the Type T being provided\n * @param provider - A provider that will resolve the T correctly when asked\n * @throws - If passing a type that's already registered\n */\n public register<T extends keyof TMap = keyof TMap>(type: T, provider: FluidObjectProvider<Pick<TMap, T>>): void {\n if (this.providers.has(type)) {\n throw new Error(`Attempting to register a provider of type ${type} that already exists`);\n }\n\n this.providers.set(type, provider);\n }\n\n /**\n * Remove a provider\n * @param type - Name of the provider to remove\n */\n public unregister(type: keyof TMap): void {\n if (this.providers.has(type)) {\n this.providers.delete(type);\n }\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}\n */\n public synthesize<O, R = undefined | Record<string, never>>(\n optionalTypes: FluidObjectSymbolProvider<O>,\n requiredTypes: Required<FluidObjectSymbolProvider<R>>,\n ): AsyncFluidObjectProvider<O, R> {\n const base: AsyncFluidObjectProvider<O, R> = {} as any;\n this.generateRequired<R>(base, requiredTypes);\n this.generateOptional<O>(base, optionalTypes);\n Object.defineProperty(base, IFluidDependencySynthesizer, { get: () => this });\n return base;\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).has}\n * @param excludeParents - If true, exclude checking parent registries\n */\n public has(type: string, excludeParents?: boolean): boolean {\n if (this.providers.has(type as keyof TMap)) {\n return true;\n }\n if (excludeParents !== true) {\n return this.parents.some((p: IFluidDependencySynthesizer) => p.has(type));\n }\n return false;\n }\n /**\n * @deprecated - Needed for back compat\n */\n private getProvider(provider: string & keyof TMap) {\n // this was removed, but some partners have trouble with back compat where they\n // use invalid patterns with IFluidObject and IFluidDependencySynthesizer\n // this is just for back compat until those are removed\n if(this.has(provider)) {\n if(this.providers.has(provider)) {\n return this.providers.get(provider);\n }\n for(const parent of this.parents) {\n if(parent instanceof DependencyContainer) {\n return parent.getProvider(provider);\n }else{\n // older implementations of the IFluidDependencySynthesizer exposed getProvider\n const maybeGetProvider: {getProvider?(provider: string & keyof TMap)} = parent as any;\n if(maybeGetProvider?.getProvider !== undefined) {\n return maybeGetProvider.getProvider(provider);\n }\n }\n }\n }\n }\n\n private generateRequired<T>(\n base: AsyncRequiredFluidObjectProvider<T>,\n types: Required<FluidObjectSymbolProvider<T>>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n const provider = this.resolveProvider(key);\n if(provider === undefined) {\n throw new Error(`Object attempted to be created without registered required provider ${key}`);\n }\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private generateOptional<T>(\n base: AsyncOptionalFluidObjectProvider<T>,\n types: FluidObjectSymbolProvider<T>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n // back-compat: in 0.56 we allow undefined in the types, but we didn't before\n // this will keep runtime back compat, eventually we should support undefined properties\n // rather than properties that return promises that resolve to undefined\n const provider = this.resolveProvider(key) ?? { get: async () => undefined };\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private resolveProvider<T extends keyof TMap>(t: T): PropertyDescriptor | undefined {\n // If we have the provider return it\n const provider = this.providers.get(t);\n if (provider === undefined) {\n for (const parent of this.parents) {\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n const sp = { [t]: t } as FluidObjectSymbolProvider<Pick<TMap, T>>;\n const syn = parent.synthesize<Pick<TMap, T>, Record<string, unknown>>(\n sp,\n {});\n const descriptor = Object.getOwnPropertyDescriptor(syn, t);\n if (descriptor !== undefined) {\n return descriptor;\n }\n }\n return undefined;\n }\n\n // The double nested gets are required for lazy loading the provider resolution\n if (typeof provider === \"function\") {\n return {\n get() {\n if (provider && typeof provider === \"function\") {\n return Promise.resolve(this[IFluidDependencySynthesizer])\n .then(async (fds): Promise<any> => provider(fds))\n .then((p) => p?.[t]);\n }\n },\n };\n }\n return {\n get() {\n if (provider) {\n return Promise.resolve(provider).then((p) => {\n if (p) {\n return p[t];\n }\n });\n }\n },\n };\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/synthesize",
3
- "version": "0.58.2000",
3
+ "version": "0.58.3000-61081",
4
4
  "description": "A library for synthesizing scope objects.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -35,7 +35,7 @@
35
35
  "lint:fix": "npm run eslint:fix",
36
36
  "test": "npm run test:mocha",
37
37
  "test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
38
- "test:mocha": "mocha --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
38
+ "test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
39
39
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
40
40
  "tsc": "tsc",
41
41
  "tsfmt": "tsfmt --verify",
@@ -64,9 +64,10 @@
64
64
  "devDependencies": {
65
65
  "@fluidframework/build-common": "^0.23.0",
66
66
  "@fluidframework/core-interfaces": "^0.42.0",
67
- "@fluidframework/datastore": "^0.58.2000",
68
- "@fluidframework/eslint-config-fluid": "^0.27.0",
69
- "@fluidframework/mocha-test-setup": "^0.58.2000",
67
+ "@fluidframework/datastore": "0.58.3000-61081",
68
+ "@fluidframework/eslint-config-fluid": "^0.27.2000-59622",
69
+ "@fluidframework/mocha-test-setup": "0.58.3000-61081",
70
+ "@fluidframework/synthesize-previous": "npm:@fluidframework/synthesize@0.58.2000",
70
71
  "@microsoft/api-extractor": "^7.16.1",
71
72
  "@rushstack/eslint-config": "^2.5.1",
72
73
  "@types/mocha": "^8.2.2",
@@ -88,5 +89,9 @@
88
89
  "rimraf": "^2.6.2",
89
90
  "typescript": "~4.1.3",
90
91
  "typescript-formatter": "7.1.0"
92
+ },
93
+ "typeValidation": {
94
+ "version": "0.58.3000",
95
+ "broken": {}
91
96
  }
92
97
  }