@fluidframework/synthesize 2.0.0-rc.1.0.3 → 2.0.0-rc.2.0.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.
Files changed (56) hide show
  1. package/dist/IFluidDependencySynthesizer.d.ts +1 -1
  2. package/dist/IFluidDependencySynthesizer.d.ts.map +1 -1
  3. package/dist/IFluidDependencySynthesizer.js.map +1 -1
  4. package/dist/dependencyContainer.d.ts +2 -2
  5. package/dist/dependencyContainer.d.ts.map +1 -1
  6. package/dist/dependencyContainer.js +3 -3
  7. package/dist/dependencyContainer.js.map +1 -1
  8. package/dist/index.d.ts +3 -3
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +4 -4
  11. package/dist/index.js.map +1 -1
  12. package/dist/package.json +3 -0
  13. package/dist/test/dependencyContainer.spec.js +41 -41
  14. package/dist/test/dependencyContainer.spec.js.map +1 -1
  15. package/dist/test/tsconfig.cjs.tsbuildinfo +1 -0
  16. package/dist/test/types/validateSynthesizePrevious.generated.js.map +1 -1
  17. package/dist/tsdoc-metadata.json +1 -1
  18. package/dist/types.d.ts +1 -1
  19. package/dist/types.d.ts.map +1 -1
  20. package/dist/types.js.map +1 -1
  21. package/lib/{IFluidDependencySynthesizer.d.mts → IFluidDependencySynthesizer.d.ts} +2 -2
  22. package/lib/IFluidDependencySynthesizer.d.ts.map +1 -0
  23. package/lib/{IFluidDependencySynthesizer.mjs → IFluidDependencySynthesizer.js} +1 -1
  24. package/lib/IFluidDependencySynthesizer.js.map +1 -0
  25. package/lib/{dependencyContainer.d.mts → dependencyContainer.d.ts} +3 -3
  26. package/lib/dependencyContainer.d.ts.map +1 -0
  27. package/lib/{dependencyContainer.mjs → dependencyContainer.js} +2 -2
  28. package/lib/dependencyContainer.js.map +1 -0
  29. package/lib/{index.d.mts → index.d.ts} +4 -4
  30. package/lib/index.d.ts.map +1 -0
  31. package/lib/{index.mjs → index.js} +3 -3
  32. package/lib/index.js.map +1 -0
  33. package/lib/test/dependencyContainer.spec.js +405 -0
  34. package/lib/test/dependencyContainer.spec.js.map +1 -0
  35. package/lib/test/tsconfig.tsbuildinfo +1 -0
  36. package/lib/test/types/validateSynthesizePrevious.generated.js +20 -0
  37. package/lib/test/types/validateSynthesizePrevious.generated.js.map +1 -0
  38. package/lib/{types.d.mts → types.d.ts} +6 -2
  39. package/lib/types.d.ts.map +1 -0
  40. package/lib/types.js +2 -0
  41. package/lib/types.js.map +1 -0
  42. package/package.json +33 -40
  43. package/dist/test/tsconfig.tsbuildinfo +0 -1
  44. package/lib/IFluidDependencySynthesizer.d.mts.map +0 -1
  45. package/lib/IFluidDependencySynthesizer.mjs.map +0 -1
  46. package/lib/dependencyContainer.d.mts.map +0 -1
  47. package/lib/dependencyContainer.mjs.map +0 -1
  48. package/lib/index.d.mts.map +0 -1
  49. package/lib/index.mjs.map +0 -1
  50. package/lib/types.d.mts.map +0 -1
  51. package/lib/types.mjs +0 -2
  52. package/lib/types.mjs.map +0 -1
  53. /package/lib/{synthesize-alpha.d.mts → synthesize-alpha.d.ts} +0 -0
  54. /package/lib/{synthesize-beta.d.mts → synthesize-beta.d.ts} +0 -0
  55. /package/lib/{synthesize-public.d.mts → synthesize-public.d.ts} +0 -0
  56. /package/lib/{synthesize-untrimmed.d.mts → synthesize-untrimmed.d.ts} +0 -0
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { AsyncFluidObjectProvider, FluidObjectSymbolProvider } from "./types";
5
+ import { AsyncFluidObjectProvider, FluidObjectSymbolProvider } from "./types.js";
6
6
  /**
7
7
  * @alpha
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"IFluidDependencySynthesizer.d.ts","sourceRoot":"","sources":["../src/IFluidDependencySynthesizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,SAAS,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EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"IFluidDependencySynthesizer.js","sourceRoot":"","sources":["../src/IFluidDependencySynthesizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;GAEG;AACU,QAAA,2BAA2B,GACvC,6BAA6B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AsyncFluidObjectProvider, FluidObjectSymbolProvider } from \"./types\";\n\n/**\n * @alpha\n */\nexport const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer =\n\t\"IFluidDependencySynthesizer\";\n\n/**\n * @alpha\n */\nexport interface IProvideFluidDependencySynthesizer {\n\tIFluidDependencySynthesizer: IFluidDependencySynthesizer;\n}\n\n/**\n * IFluidDependencySynthesizer can generate FluidObjects based on the IProvideFluidObject pattern.\n * It allow for registering providers and uses synthesize to generate a new object with the optional\n * and required types.\n * @alpha\n */\nexport interface IFluidDependencySynthesizer extends IProvideFluidDependencySynthesizer {\n\t/**\n\t * synthesize takes optional and required types and returns an object that will fulfill the\n\t * defined types based off objects that has been previously registered.\n\t *\n\t * @param optionalTypes - optional types to be in the Scope object\n\t * @param requiredTypes - required types that need to be in the Scope object\n\t */\n\tsynthesize<O, R = undefined | Record<string, never>>(\n\t\toptionalTypes: FluidObjectSymbolProvider<O>,\n\t\trequiredTypes: Required<FluidObjectSymbolProvider<R>>,\n\t): AsyncFluidObjectProvider<O, R>;\n\n\t/**\n\t * Check if a given type is registered\n\t * @param type - Type to check\n\t */\n\thas(type: string): boolean;\n}\n"]}
1
+ {"version":3,"file":"IFluidDependencySynthesizer.js","sourceRoot":"","sources":["../src/IFluidDependencySynthesizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;GAEG;AACU,QAAA,2BAA2B,GACvC,6BAA6B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AsyncFluidObjectProvider, FluidObjectSymbolProvider } from \"./types.js\";\n\n/**\n * @alpha\n */\nexport const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer =\n\t\"IFluidDependencySynthesizer\";\n\n/**\n * @alpha\n */\nexport interface IProvideFluidDependencySynthesizer {\n\tIFluidDependencySynthesizer: IFluidDependencySynthesizer;\n}\n\n/**\n * IFluidDependencySynthesizer can generate FluidObjects based on the IProvideFluidObject pattern.\n * It allow for registering providers and uses synthesize to generate a new object with the optional\n * and required types.\n * @alpha\n */\nexport interface IFluidDependencySynthesizer extends IProvideFluidDependencySynthesizer {\n\t/**\n\t * synthesize takes optional and required types and returns an object that will fulfill the\n\t * defined types based off objects that has been previously registered.\n\t *\n\t * @param optionalTypes - optional types to be in the Scope object\n\t * @param requiredTypes - required types that need to be in the Scope object\n\t */\n\tsynthesize<O, R = undefined | Record<string, never>>(\n\t\toptionalTypes: FluidObjectSymbolProvider<O>,\n\t\trequiredTypes: Required<FluidObjectSymbolProvider<R>>,\n\t): AsyncFluidObjectProvider<O, R>;\n\n\t/**\n\t * Check if a given type is registered\n\t * @param type - Type to check\n\t */\n\thas(type: string): boolean;\n}\n"]}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { AsyncFluidObjectProvider, FluidObjectSymbolProvider, FluidObjectProvider } from "./types";
6
- import { IFluidDependencySynthesizer } from "./IFluidDependencySynthesizer";
5
+ import { AsyncFluidObjectProvider, FluidObjectSymbolProvider, FluidObjectProvider } from "./types.js";
6
+ import { IFluidDependencySynthesizer } from "./IFluidDependencySynthesizer.js";
7
7
  /**
8
8
  * DependencyContainer is similar to a IoC Container. It takes providers and will
9
9
  * synthesize an object based on them when requested.
@@ -1 +1 @@
1
- {"version":3,"file":"dependencyContainer.d.ts","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mapp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idframework/core-utils");
9
- const IFluidDependencySynthesizer_1 = require("./IFluidDependencySynthesizer");
9
+ const IFluidDependencySynthesizer_js_1 = require("./IFluidDependencySynthesizer.js");
10
10
  /**
11
11
  * DependencyContainer is similar to a IoC Container. It takes providers and will
12
12
  * synthesize an object based on them when requested.
@@ -48,7 +48,7 @@ class DependencyContainer {
48
48
  const base = {};
49
49
  this.generateRequired(base, requiredTypes);
50
50
  this.generateOptional(base, optionalTypes);
51
- Object.defineProperty(base, IFluidDependencySynthesizer_1.IFluidDependencySynthesizer, { get: () => this });
51
+ Object.defineProperty(base, IFluidDependencySynthesizer_js_1.IFluidDependencySynthesizer, { get: () => this });
52
52
  return base;
53
53
  }
54
54
  /**
@@ -134,7 +134,7 @@ class DependencyContainer {
134
134
  // eslint-disable-next-line @typescript-eslint/promise-function-async
135
135
  get() {
136
136
  if (provider && typeof provider === "function") {
137
- return Promise.resolve(this[IFluidDependencySynthesizer_1.IFluidDependencySynthesizer])
137
+ return Promise.resolve(this[IFluidDependencySynthesizer_js_1.IFluidDependencySynthesizer])
138
138
  .then(async (fds) => provider(fds))
139
139
  .then((p) => p?.[t]);
140
140
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dependencyContainer.js","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAyD;AAQzD,+EAA4E;AAE5E;;;;GAIG;AACH,MAAa,mBAAmB;IAG/B,IAAW,2BAA2B;QACrC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,YAAmB,GAAG,OAAoD;QANzD,cAAS,GAAG,IAAI,GAAG,EAAwC,CAAC;QAO5E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IACzF,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CACd,IAAO,EACP,QAA4C;QAE5C,IAAI,IAAI,CAAC,SAAS,CAAC,GA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,IAAI,wBAAW,CAAC,KAAK,IAAI,EAAE;wBACjC,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;4BAC3C,IAAI,CAAC,EAAE;gCACN,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;6BACZ;wBACF,CAAC,CAAC,CAAC;oBACJ,CAAC,CAAC,CAAC;iBACH;YACF,CAAC;SACD,CAAC;IACH,CAAC;CACD;AA5KD,kDA4KC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { LazyPromise } from \"@fluidframework/core-utils\";\nimport {\n\tAsyncFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n\tFluidObjectProvider,\n\tAsyncOptionalFluidObjectProvider,\n\tAsyncRequiredFluidObjectProvider,\n} from \"./types\";\nimport { IFluidDependencySynthesizer } 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 * @alpha\n */\nexport class DependencyContainer<TMap> implements IFluidDependencySynthesizer {\n\tprivate readonly providers = new Map<keyof TMap, FluidObjectProvider<any>>();\n\tprivate readonly parents: IFluidDependencySynthesizer[];\n\tpublic get IFluidDependencySynthesizer() {\n\t\treturn this;\n\t}\n\n\tpublic constructor(...parents: (IFluidDependencySynthesizer | undefined)[]) {\n\t\tthis.parents = parents.filter((v): v is IFluidDependencySynthesizer => v !== undefined);\n\t}\n\n\t/**\n\t * Add a new provider\n\t * @param type - Name of the Type T being provided\n\t * @param provider - A provider that will resolve the T correctly when asked\n\t * @throws - If passing a type that's already registered\n\t */\n\tpublic register<T extends keyof TMap = keyof TMap>(\n\t\ttype: T,\n\t\tprovider: FluidObjectProvider<Pick<TMap, T>>,\n\t): void {\n\t\tif (this.providers.has(type)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Attempting to register a provider of type ${String(type)} that already exists`,\n\t\t\t);\n\t\t}\n\n\t\tthis.providers.set(type, provider);\n\t}\n\n\t/**\n\t * Remove a provider\n\t * @param type - Name of the provider to remove\n\t */\n\tpublic unregister(type: keyof TMap): void {\n\t\tif (this.providers.has(type)) {\n\t\t\tthis.providers.delete(type);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}\n\t */\n\tpublic synthesize<O, R = undefined | Record<string, never>>(\n\t\toptionalTypes: FluidObjectSymbolProvider<O>,\n\t\trequiredTypes: Required<FluidObjectSymbolProvider<R>>,\n\t): AsyncFluidObjectProvider<O, R> {\n\t\tconst base: AsyncFluidObjectProvider<O, R> = {} as any;\n\t\tthis.generateRequired<R>(base, requiredTypes);\n\t\tthis.generateOptional<O>(base, optionalTypes);\n\t\tObject.defineProperty(base, IFluidDependencySynthesizer, { get: () => this });\n\t\treturn base;\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidDependencySynthesizer:interface).has}\n\t * @param excludeParents - If true, exclude checking parent registries\n\t */\n\tpublic has(type: string, excludeParents?: boolean): boolean {\n\t\tif (this.providers.has(type as keyof TMap)) {\n\t\t\treturn true;\n\t\t}\n\t\tif (excludeParents !== true) {\n\t\t\treturn this.parents.some((p: IFluidDependencySynthesizer) => p.has(type));\n\t\t}\n\t\treturn false;\n\t}\n\t/**\n\t * @deprecated Needed for backwards compatability.\n\t */\n\tprivate getProvider(provider: string & keyof TMap) {\n\t\t// this was removed, but some partners have trouble with back compat where they\n\t\t// use invalid patterns with FluidObject and IFluidDependencySynthesizer\n\t\t// this is just for back compat until those are removed\n\t\tif (this.has(provider)) {\n\t\t\tif (this.providers.has(provider)) {\n\t\t\t\treturn this.providers.get(provider);\n\t\t\t}\n\t\t\tfor (const parent of this.parents) {\n\t\t\t\tif (parent instanceof DependencyContainer) {\n\t\t\t\t\treturn parent.getProvider(provider);\n\t\t\t\t} else {\n\t\t\t\t\t// older implementations of the IFluidDependencySynthesizer exposed getProvider\n\t\t\t\t\tconst maybeGetProvider: { getProvider?(provider: string & keyof TMap) } =\n\t\t\t\t\t\tparent as any;\n\t\t\t\t\tif (maybeGetProvider?.getProvider !== undefined) {\n\t\t\t\t\t\treturn maybeGetProvider.getProvider(provider);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate generateRequired<T>(\n\t\tbase: AsyncRequiredFluidObjectProvider<T>,\n\t\ttypes: Required<FluidObjectSymbolProvider<T>>,\n\t) {\n\t\tif (types === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n\t\t\tconst provider = this.resolveProvider(key);\n\t\t\tif (provider === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Object attempted to be created without registered required provider ${String(\n\t\t\t\t\t\tkey,\n\t\t\t\t\t)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tObject.defineProperty(base, key, provider);\n\t\t}\n\t}\n\n\tprivate generateOptional<T>(\n\t\tbase: AsyncOptionalFluidObjectProvider<T>,\n\t\ttypes: FluidObjectSymbolProvider<T>,\n\t) {\n\t\tif (types === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n\t\t\t// back-compat: in 0.56 we allow undefined in the types, but we didn't before\n\t\t\t// this will keep runtime back compat, eventually we should support undefined properties\n\t\t\t// rather than properties that return promises that resolve to undefined\n\t\t\tconst provider = this.resolveProvider(key) ?? { get: async () => undefined };\n\t\t\tObject.defineProperty(base, key, provider);\n\t\t}\n\t}\n\n\tprivate resolveProvider<T extends keyof TMap>(t: T): PropertyDescriptor | undefined {\n\t\t// If we have the provider return it\n\t\tconst provider = this.providers.get(t);\n\t\tif (provider === undefined) {\n\t\t\tfor (const parent of this.parents) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\t\tconst sp = { [t]: t } as FluidObjectSymbolProvider<Pick<TMap, T>>;\n\t\t\t\tconst syn = parent.synthesize<Pick<TMap, T>, Record<string, unknown>>(sp, {});\n\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(syn, t);\n\t\t\t\tif (descriptor !== undefined) {\n\t\t\t\t\treturn descriptor;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// The double nested gets are required for lazy loading the provider resolution\n\t\tif (typeof provider === \"function\") {\n\t\t\treturn {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\t\t\t\tget() {\n\t\t\t\t\tif (provider && typeof provider === \"function\") {\n\t\t\t\t\t\treturn Promise.resolve(this[IFluidDependencySynthesizer])\n\t\t\t\t\t\t\t.then(async (fds): Promise<any> => provider(fds))\n\t\t\t\t\t\t\t.then((p) => p?.[t]);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tget() {\n\t\t\t\tif (provider) {\n\t\t\t\t\treturn new LazyPromise(async () => {\n\t\t\t\t\t\treturn Promise.resolve(provider).then((p) => {\n\t\t\t\t\t\t\tif (p) {\n\t\t\t\t\t\t\t\treturn p[t];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"dependencyContainer.js","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAyD;AAQzD,qFAA+E;AAE/E;;;;GAIG;AACH,MAAa,mBAAmB;IAG/B,IAAW,2BAA2B;QACrC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,YAAmB,GAAG,OAAoD;QANzD,cAAS,GAAG,IAAI,GAAG,EAAwC,CAAC;QAO5E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IACzF,CAAC;IAED;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gBACF,CAAC;aACD,CAAC;SACF;QACD,OAAO;YACN,GAAG;gBACF,IAAI,QAAQ,EAAE;oBACb,OAAO,IAAI,wBAAW,CAAC,KAAK,IAAI,EAAE;wBACjC,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;4BAC3C,IAAI,CAAC,EAAE;gCACN,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;6BACZ;wBACF,CAAC,CAAC,CAAC;oBACJ,CAAC,CAAC,CAAC;iBACH;YACF,CAAC;SACD,CAAC;IACH,CAAC;CACD;AA5KD,kDA4KC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { LazyPromise } from \"@fluidframework/core-utils\";\nimport {\n\tAsyncFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n\tFluidObjectProvider,\n\tAsyncOptionalFluidObjectProvider,\n\tAsyncRequiredFluidObjectProvider,\n} from \"./types.js\";\nimport { IFluidDependencySynthesizer } from \"./IFluidDependencySynthesizer.js\";\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 * @alpha\n */\nexport class DependencyContainer<TMap> implements IFluidDependencySynthesizer {\n\tprivate readonly providers = new Map<keyof TMap, FluidObjectProvider<any>>();\n\tprivate readonly parents: IFluidDependencySynthesizer[];\n\tpublic get IFluidDependencySynthesizer() {\n\t\treturn this;\n\t}\n\n\tpublic constructor(...parents: (IFluidDependencySynthesizer | undefined)[]) {\n\t\tthis.parents = parents.filter((v): v is IFluidDependencySynthesizer => v !== undefined);\n\t}\n\n\t/**\n\t * Add a new provider\n\t * @param type - Name of the Type T being provided\n\t * @param provider - A provider that will resolve the T correctly when asked\n\t * @throws - If passing a type that's already registered\n\t */\n\tpublic register<T extends keyof TMap = keyof TMap>(\n\t\ttype: T,\n\t\tprovider: FluidObjectProvider<Pick<TMap, T>>,\n\t): void {\n\t\tif (this.providers.has(type)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Attempting to register a provider of type ${String(type)} that already exists`,\n\t\t\t);\n\t\t}\n\n\t\tthis.providers.set(type, provider);\n\t}\n\n\t/**\n\t * Remove a provider\n\t * @param type - Name of the provider to remove\n\t */\n\tpublic unregister(type: keyof TMap): void {\n\t\tif (this.providers.has(type)) {\n\t\t\tthis.providers.delete(type);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}\n\t */\n\tpublic synthesize<O, R = undefined | Record<string, never>>(\n\t\toptionalTypes: FluidObjectSymbolProvider<O>,\n\t\trequiredTypes: Required<FluidObjectSymbolProvider<R>>,\n\t): AsyncFluidObjectProvider<O, R> {\n\t\tconst base: AsyncFluidObjectProvider<O, R> = {} as any;\n\t\tthis.generateRequired<R>(base, requiredTypes);\n\t\tthis.generateOptional<O>(base, optionalTypes);\n\t\tObject.defineProperty(base, IFluidDependencySynthesizer, { get: () => this });\n\t\treturn base;\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidDependencySynthesizer:interface).has}\n\t * @param excludeParents - If true, exclude checking parent registries\n\t */\n\tpublic has(type: string, excludeParents?: boolean): boolean {\n\t\tif (this.providers.has(type as keyof TMap)) {\n\t\t\treturn true;\n\t\t}\n\t\tif (excludeParents !== true) {\n\t\t\treturn this.parents.some((p: IFluidDependencySynthesizer) => p.has(type));\n\t\t}\n\t\treturn false;\n\t}\n\t/**\n\t * @deprecated Needed for backwards compatability.\n\t */\n\tprivate getProvider(provider: string & keyof TMap) {\n\t\t// this was removed, but some partners have trouble with back compat where they\n\t\t// use invalid patterns with FluidObject and IFluidDependencySynthesizer\n\t\t// this is just for back compat until those are removed\n\t\tif (this.has(provider)) {\n\t\t\tif (this.providers.has(provider)) {\n\t\t\t\treturn this.providers.get(provider);\n\t\t\t}\n\t\t\tfor (const parent of this.parents) {\n\t\t\t\tif (parent instanceof DependencyContainer) {\n\t\t\t\t\treturn parent.getProvider(provider);\n\t\t\t\t} else {\n\t\t\t\t\t// older implementations of the IFluidDependencySynthesizer exposed getProvider\n\t\t\t\t\tconst maybeGetProvider: { getProvider?(provider: string & keyof TMap) } =\n\t\t\t\t\t\tparent as any;\n\t\t\t\t\tif (maybeGetProvider?.getProvider !== undefined) {\n\t\t\t\t\t\treturn maybeGetProvider.getProvider(provider);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate generateRequired<T>(\n\t\tbase: AsyncRequiredFluidObjectProvider<T>,\n\t\ttypes: Required<FluidObjectSymbolProvider<T>>,\n\t) {\n\t\tif (types === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n\t\t\tconst provider = this.resolveProvider(key);\n\t\t\tif (provider === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Object attempted to be created without registered required provider ${String(\n\t\t\t\t\t\tkey,\n\t\t\t\t\t)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tObject.defineProperty(base, key, provider);\n\t\t}\n\t}\n\n\tprivate generateOptional<T>(\n\t\tbase: AsyncOptionalFluidObjectProvider<T>,\n\t\ttypes: FluidObjectSymbolProvider<T>,\n\t) {\n\t\tif (types === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n\t\t\t// back-compat: in 0.56 we allow undefined in the types, but we didn't before\n\t\t\t// this will keep runtime back compat, eventually we should support undefined properties\n\t\t\t// rather than properties that return promises that resolve to undefined\n\t\t\tconst provider = this.resolveProvider(key) ?? { get: async () => undefined };\n\t\t\tObject.defineProperty(base, key, provider);\n\t\t}\n\t}\n\n\tprivate resolveProvider<T extends keyof TMap>(t: T): PropertyDescriptor | undefined {\n\t\t// If we have the provider return it\n\t\tconst provider = this.providers.get(t);\n\t\tif (provider === undefined) {\n\t\t\tfor (const parent of this.parents) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\t\tconst sp = { [t]: t } as FluidObjectSymbolProvider<Pick<TMap, T>>;\n\t\t\t\tconst syn = parent.synthesize<Pick<TMap, T>, Record<string, unknown>>(sp, {});\n\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(syn, t);\n\t\t\t\tif (descriptor !== undefined) {\n\t\t\t\t\treturn descriptor;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// The double nested gets are required for lazy loading the provider resolution\n\t\tif (typeof provider === \"function\") {\n\t\t\treturn {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\t\t\t\tget() {\n\t\t\t\t\tif (provider && typeof provider === \"function\") {\n\t\t\t\t\t\treturn Promise.resolve(this[IFluidDependencySynthesizer])\n\t\t\t\t\t\t\t.then(async (fds): Promise<any> => provider(fds))\n\t\t\t\t\t\t\t.then((p) => p?.[t]);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tget() {\n\t\t\t\tif (provider) {\n\t\t\t\t\treturn new LazyPromise(async () => {\n\t\t\t\t\t\treturn Promise.resolve(provider).then((p) => {\n\t\t\t\t\t\t\tif (p) {\n\t\t\t\t\t\t\t\treturn p[t];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { DependencyContainer } from "./dependencyContainer";
6
- export { IFluidDependencySynthesizer, IProvideFluidDependencySynthesizer, } from "./IFluidDependencySynthesizer";
7
- export { AsyncFluidObjectProvider, AsyncOptionalFluidObjectProvider, AsyncRequiredFluidObjectProvider, FluidObjectProvider, FluidObjectSymbolProvider, } from "./types";
5
+ export { DependencyContainer } from "./dependencyContainer.js";
6
+ export { IFluidDependencySynthesizer, IProvideFluidDependencySynthesizer, } from "./IFluidDependencySynthesizer.js";
7
+ export { AsyncFluidObjectProvider, AsyncOptionalFluidObjectProvider, AsyncRequiredFluidObjectProvider, FluidObjectProvider, FluidObjectSymbolProvider, } from "./types.js";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACN,2BAA2B,EAC3B,kCAAkC,GAClC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,wBAAwB,EACxB,gCAAgC,EAChC,gCAAgC,EAChC,mBAAmB,EACnB,yBAAyB,GACzB,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACN,2BAA2B,EAC3B,kCAAkC,GAClC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,wBAAwB,EACxB,gCAAgC,EAChC,gCAAgC,EAChC,mBAAmB,EACnB,yBAAyB,GACzB,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -5,8 +5,8 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.IFluidDependencySynthesizer = exports.DependencyContainer = void 0;
8
- var dependencyContainer_1 = require("./dependencyContainer");
9
- Object.defineProperty(exports, "DependencyContainer", { enumerable: true, get: function () { return dependencyContainer_1.DependencyContainer; } });
10
- var IFluidDependencySynthesizer_1 = require("./IFluidDependencySynthesizer");
11
- Object.defineProperty(exports, "IFluidDependencySynthesizer", { enumerable: true, get: function () { return IFluidDependencySynthesizer_1.IFluidDependencySynthesizer; } });
8
+ var dependencyContainer_js_1 = require("./dependencyContainer.js");
9
+ Object.defineProperty(exports, "DependencyContainer", { enumerable: true, get: function () { return dependencyContainer_js_1.DependencyContainer; } });
10
+ var IFluidDependencySynthesizer_js_1 = require("./IFluidDependencySynthesizer.js");
11
+ Object.defineProperty(exports, "IFluidDependencySynthesizer", { enumerable: true, get: function () { return IFluidDependencySynthesizer_js_1.IFluidDependencySynthesizer; } });
12
12
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,6EAGuC;AAFtC,0IAAA,2BAA2B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DependencyContainer } from \"./dependencyContainer\";\nexport {\n\tIFluidDependencySynthesizer,\n\tIProvideFluidDependencySynthesizer,\n} from \"./IFluidDependencySynthesizer\";\nexport {\n\tAsyncFluidObjectProvider,\n\tAsyncOptionalFluidObjectProvider,\n\tAsyncRequiredFluidObjectProvider,\n\tFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n} from \"./types\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mEAA+D;AAAtD,6HAAA,mBAAmB,OAAA;AAC5B,mFAG0C;AAFzC,6IAAA,2BAA2B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DependencyContainer } from \"./dependencyContainer.js\";\nexport {\n\tIFluidDependencySynthesizer,\n\tIProvideFluidDependencySynthesizer,\n} from \"./IFluidDependencySynthesizer.js\";\nexport {\n\tAsyncFluidObjectProvider,\n\tAsyncOptionalFluidObjectProvider,\n\tAsyncRequiredFluidObjectProvider,\n\tFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n} from \"./types.js\";\n"]}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -8,7 +8,7 @@ const assert_1 = require("assert");
8
8
  const core_interfaces_1 = require("@fluidframework/core-interfaces");
9
9
  const datastore_1 = require("@fluidframework/datastore");
10
10
  const core_utils_1 = require("@fluidframework/core-utils");
11
- const index_1 = require("../index");
11
+ const index_js_1 = require("../index.js");
12
12
  const mockHandleContext = {
13
13
  absolutePath: "",
14
14
  isAttached: false,
@@ -41,7 +41,7 @@ describe("someObjectlicious", () => {
41
41
  describe("Aqueduct", () => {
42
42
  describe("DependencyContainer", () => {
43
43
  it(`One Optional Provider registered via value`, async () => {
44
- const dc = new index_1.DependencyContainer();
44
+ const dc = new index_js_1.DependencyContainer();
45
45
  const mock = new MockLoadable();
46
46
  dc.register(core_interfaces_1.IFluidLoadable, mock);
47
47
  const s = dc.synthesize({ IFluidLoadable: core_interfaces_1.IFluidLoadable }, undefined);
@@ -51,7 +51,7 @@ describe("someObjectlicious", () => {
51
51
  (0, assert_1.strict)(loadable?.handle.absolutePath === mock.handle.absolutePath, "IFluidLoadable is valid");
52
52
  });
53
53
  it(`One Optional Provider registered via Promise value`, async () => {
54
- const dc = new index_1.DependencyContainer();
54
+ const dc = new index_js_1.DependencyContainer();
55
55
  const mock = new MockLoadable();
56
56
  dc.register(core_interfaces_1.IFluidLoadable, Promise.resolve(mock));
57
57
  const s = dc.synthesize({ IFluidLoadable: core_interfaces_1.IFluidLoadable }, undefined);
@@ -61,7 +61,7 @@ describe("someObjectlicious", () => {
61
61
  (0, assert_1.strict)(loadable?.handle.absolutePath === mock.handle.absolutePath, "IFluidLoadable is valid");
62
62
  });
63
63
  it(`One Optional Provider registered via factory`, async () => {
64
- const dc = new index_1.DependencyContainer();
64
+ const dc = new index_js_1.DependencyContainer();
65
65
  const mock = new MockLoadable();
66
66
  const factory = () => mock;
67
67
  dc.register(core_interfaces_1.IFluidLoadable, factory);
@@ -72,7 +72,7 @@ describe("someObjectlicious", () => {
72
72
  (0, assert_1.strict)(loadable?.handle.absolutePath === mock.handle.absolutePath, "IFluidLoadable is valid");
73
73
  });
74
74
  it(`One Optional Provider registered via Promise factory`, async () => {
75
- const dc = new index_1.DependencyContainer();
75
+ const dc = new index_js_1.DependencyContainer();
76
76
  const mock = new MockLoadable();
77
77
  const factory = async () => mock;
78
78
  dc.register(core_interfaces_1.IFluidLoadable, factory);
@@ -83,7 +83,7 @@ describe("someObjectlicious", () => {
83
83
  (0, assert_1.strict)(loadable?.handle.absolutePath === mock.handle.absolutePath, "IFluidLoadable is valid");
84
84
  });
85
85
  it(`One Optional Provider registered via LazyPromise factory`, async () => {
86
- const dc = new index_1.DependencyContainer();
86
+ const dc = new index_js_1.DependencyContainer();
87
87
  const mock = new MockLoadable();
88
88
  let lazyPromiseFlag = false;
89
89
  const lazyFactory = new core_utils_1.LazyPromise(async () => {
@@ -103,7 +103,7 @@ describe("someObjectlicious", () => {
103
103
  });
104
104
  });
105
105
  it(`One Required Provider registered via value`, async () => {
106
- const dc = new index_1.DependencyContainer();
106
+ const dc = new index_js_1.DependencyContainer();
107
107
  const mock = new MockLoadable();
108
108
  dc.register(core_interfaces_1.IFluidLoadable, mock);
109
109
  const s = dc.synthesize(undefined, {
@@ -115,7 +115,7 @@ describe("someObjectlicious", () => {
115
115
  (0, assert_1.strict)(loadable?.handle.absolutePath === mock.handle.absolutePath, "IFluidLoadable is valid");
116
116
  });
117
117
  it(`One Required Provider registered via Promise value`, async () => {
118
- const dc = new index_1.DependencyContainer();
118
+ const dc = new index_js_1.DependencyContainer();
119
119
  const mock = new MockLoadable();
120
120
  dc.register(core_interfaces_1.IFluidLoadable, Promise.resolve(mock));
121
121
  const s = dc.synthesize(undefined, {
@@ -127,7 +127,7 @@ describe("someObjectlicious", () => {
127
127
  (0, assert_1.strict)(loadable?.handle.absolutePath === mock.handle.absolutePath, "IFluidLoadable is valid");
128
128
  });
129
129
  it(`One Required Provider registered via factory`, async () => {
130
- const dc = new index_1.DependencyContainer();
130
+ const dc = new index_js_1.DependencyContainer();
131
131
  const mock = new MockLoadable();
132
132
  const factory = () => mock;
133
133
  dc.register(core_interfaces_1.IFluidLoadable, factory);
@@ -140,7 +140,7 @@ describe("someObjectlicious", () => {
140
140
  (0, assert_1.strict)(loadable?.handle.absolutePath === mock.handle.absolutePath, "IFluidLoadable is valid");
141
141
  });
142
142
  it(`One Required Provider registered via Promise factory`, async () => {
143
- const dc = new index_1.DependencyContainer();
143
+ const dc = new index_js_1.DependencyContainer();
144
144
  const mock = new MockLoadable();
145
145
  const factory = async () => mock;
146
146
  dc.register(core_interfaces_1.IFluidLoadable, factory);
@@ -153,7 +153,7 @@ describe("someObjectlicious", () => {
153
153
  (0, assert_1.strict)(loadable?.handle.absolutePath === mock.handle.absolutePath, "IFluidLoadable is valid");
154
154
  });
155
155
  it(`One Required Provider registered via LazyPromise factory`, async () => {
156
- const dc = new index_1.DependencyContainer();
156
+ const dc = new index_js_1.DependencyContainer();
157
157
  const mock = new MockLoadable();
158
158
  let lazyPromiseFlag = false;
159
159
  const lazyFactory = new core_utils_1.LazyPromise(async () => {
@@ -175,7 +175,7 @@ describe("someObjectlicious", () => {
175
175
  });
176
176
  });
177
177
  it(`Two Optional Modules all registered`, async () => {
178
- const dc = new index_1.DependencyContainer();
178
+ const dc = new index_js_1.DependencyContainer();
179
179
  const loadableMock = new MockLoadable();
180
180
  dc.register(core_interfaces_1.IFluidLoadable, loadableMock);
181
181
  const someObjectMock = new MockSomeObject();
@@ -189,7 +189,7 @@ describe("someObjectlicious", () => {
189
189
  (0, assert_1.strict)(someObject === someObjectMock, "ISomeObject is expected");
190
190
  });
191
191
  it(`Two Optional Modules one registered`, async () => {
192
- const dc = new index_1.DependencyContainer();
192
+ const dc = new index_js_1.DependencyContainer();
193
193
  const loadableMock = new MockLoadable();
194
194
  dc.register(core_interfaces_1.IFluidLoadable, loadableMock);
195
195
  const s = dc.synthesize({ IFluidLoadable: core_interfaces_1.IFluidLoadable, ISomeObject }, undefined);
@@ -200,7 +200,7 @@ describe("someObjectlicious", () => {
200
200
  (0, assert_1.strict)(!someObject, "Optional ISomeObject was not registered");
201
201
  });
202
202
  it(`Two Optional Modules none registered`, async () => {
203
- const dc = new index_1.DependencyContainer();
203
+ const dc = new index_js_1.DependencyContainer();
204
204
  const s = dc.synthesize({ IFluidLoadable: core_interfaces_1.IFluidLoadable, ISomeObject }, undefined);
205
205
  const loadable = await s.IFluidLoadable;
206
206
  (0, assert_1.strict)(!loadable, "Optional IFluidLoadable was not registered");
@@ -208,7 +208,7 @@ describe("someObjectlicious", () => {
208
208
  (0, assert_1.strict)(!someObject, "Optional ISomeObject was not registered");
209
209
  });
210
210
  it(`Two Required Modules all registered`, async () => {
211
- const dc = new index_1.DependencyContainer();
211
+ const dc = new index_js_1.DependencyContainer();
212
212
  const loadableMock = new MockLoadable();
213
213
  dc.register(core_interfaces_1.IFluidLoadable, loadableMock);
214
214
  const someObjectMock = new MockSomeObject();
@@ -222,16 +222,16 @@ describe("someObjectlicious", () => {
222
222
  (0, assert_1.strict)(someObject === someObjectMock, "ISomeObject is expected");
223
223
  });
224
224
  it(`Required Provider not registered should throw`, async () => {
225
- const dc = new index_1.DependencyContainer();
225
+ const dc = new index_js_1.DependencyContainer();
226
226
  assert_1.strict.throws(() => dc.synthesize(undefined, {
227
227
  IFluidLoadable: core_interfaces_1.IFluidLoadable,
228
228
  }), Error);
229
229
  });
230
230
  it(`Optional Provider found in Parent`, async () => {
231
- const parentDc = new index_1.DependencyContainer();
231
+ const parentDc = new index_js_1.DependencyContainer();
232
232
  const mock = new MockLoadable();
233
233
  parentDc.register(core_interfaces_1.IFluidLoadable, mock);
234
- const dc = new index_1.DependencyContainer(parentDc);
234
+ const dc = new index_js_1.DependencyContainer(parentDc);
235
235
  const s = dc.synthesize({ IFluidLoadable: core_interfaces_1.IFluidLoadable }, undefined);
236
236
  const loadable = await s.IFluidLoadable;
237
237
  (0, assert_1.strict)(loadable, "Optional IFluidLoadable was registered");
@@ -239,10 +239,10 @@ describe("someObjectlicious", () => {
239
239
  (0, assert_1.strict)(loadable?.handle.absolutePath === mock.handle.absolutePath, "IFluidLoadable is valid");
240
240
  });
241
241
  it(`Optional Modules found in Parent and Child`, async () => {
242
- const parentDc = new index_1.DependencyContainer();
242
+ const parentDc = new index_js_1.DependencyContainer();
243
243
  const loadableMock = new MockLoadable();
244
244
  parentDc.register(core_interfaces_1.IFluidLoadable, loadableMock);
245
- const dc = new index_1.DependencyContainer(parentDc);
245
+ const dc = new index_js_1.DependencyContainer(parentDc);
246
246
  const someObjectMock = new MockSomeObject();
247
247
  dc.register(ISomeObject, someObjectMock);
248
248
  const s = dc.synthesize({ IFluidLoadable: core_interfaces_1.IFluidLoadable, ISomeObject }, undefined);
@@ -254,9 +254,9 @@ describe("someObjectlicious", () => {
254
254
  (0, assert_1.strict)(someObject === someObjectMock, "ISomeObject is expected");
255
255
  });
256
256
  it(`Optional Provider found in Parent and Child resolves Child`, async () => {
257
- const parentDc = new index_1.DependencyContainer();
257
+ const parentDc = new index_js_1.DependencyContainer();
258
258
  parentDc.register(core_interfaces_1.IFluidLoadable, new MockLoadable());
259
- const dc = new index_1.DependencyContainer(parentDc);
259
+ const dc = new index_js_1.DependencyContainer(parentDc);
260
260
  const loadableMock = new MockLoadable();
261
261
  dc.register(core_interfaces_1.IFluidLoadable, loadableMock);
262
262
  const s = dc.synthesize({ IFluidLoadable: core_interfaces_1.IFluidLoadable }, undefined);
@@ -265,10 +265,10 @@ describe("someObjectlicious", () => {
265
265
  (0, assert_1.strict)(loadable === loadableMock, "IFluidLoadable is expected");
266
266
  });
267
267
  it(`Required Provider found in Parent`, async () => {
268
- const parentDc = new index_1.DependencyContainer();
268
+ const parentDc = new index_js_1.DependencyContainer();
269
269
  const mock = new MockLoadable();
270
270
  parentDc.register(core_interfaces_1.IFluidLoadable, mock);
271
- const dc = new index_1.DependencyContainer(parentDc);
271
+ const dc = new index_js_1.DependencyContainer(parentDc);
272
272
  const s = dc.synthesize(undefined, {
273
273
  IFluidLoadable: core_interfaces_1.IFluidLoadable,
274
274
  });
@@ -278,10 +278,10 @@ describe("someObjectlicious", () => {
278
278
  (0, assert_1.strict)(loadable?.handle.absolutePath === mock.handle.absolutePath, "IFluidLoadable is valid");
279
279
  });
280
280
  it(`Required Modules found in Parent and Child`, async () => {
281
- const parentDc = new index_1.DependencyContainer();
281
+ const parentDc = new index_js_1.DependencyContainer();
282
282
  const loadableMock = new MockLoadable();
283
283
  parentDc.register(core_interfaces_1.IFluidLoadable, loadableMock);
284
- const dc = new index_1.DependencyContainer(parentDc);
284
+ const dc = new index_js_1.DependencyContainer(parentDc);
285
285
  const someObjectMock = new MockSomeObject();
286
286
  dc.register(ISomeObject, someObjectMock);
287
287
  const s = dc.synthesize(undefined, { IFluidLoadable: core_interfaces_1.IFluidLoadable, ISomeObject });
@@ -293,9 +293,9 @@ describe("someObjectlicious", () => {
293
293
  (0, assert_1.strict)(someObject === someObjectMock, "ISomeObject is expected");
294
294
  });
295
295
  it(`Required Provider found in Parent and Child resolves Child`, async () => {
296
- const parentDc = new index_1.DependencyContainer();
296
+ const parentDc = new index_js_1.DependencyContainer();
297
297
  parentDc.register(core_interfaces_1.IFluidLoadable, new MockLoadable());
298
- const dc = new index_1.DependencyContainer(parentDc);
298
+ const dc = new index_js_1.DependencyContainer(parentDc);
299
299
  const loadableMock = new MockLoadable();
300
300
  dc.register(core_interfaces_1.IFluidLoadable, loadableMock);
301
301
  const s = dc.synthesize(undefined, {
@@ -306,30 +306,30 @@ describe("someObjectlicious", () => {
306
306
  (0, assert_1.strict)(loadable === loadableMock, "IFluidLoadable is expected");
307
307
  });
308
308
  it(`Registering`, async () => {
309
- const dc = new index_1.DependencyContainer();
309
+ const dc = new index_js_1.DependencyContainer();
310
310
  dc.register(core_interfaces_1.IFluidLoadable, new MockLoadable());
311
311
  (0, assert_1.strict)(dc.has(core_interfaces_1.IFluidLoadable), "DependencyContainer has IFluidLoadable");
312
312
  });
313
313
  it(`Registering the same type twice throws`, async () => {
314
- const dc = new index_1.DependencyContainer();
314
+ const dc = new index_js_1.DependencyContainer();
315
315
  dc.register(core_interfaces_1.IFluidLoadable, new MockLoadable());
316
316
  assert_1.strict.throws(() => dc.register(core_interfaces_1.IFluidLoadable, new MockLoadable()), Error);
317
317
  });
318
318
  it(`Registering then Unregistering`, async () => {
319
- const dc = new index_1.DependencyContainer();
319
+ const dc = new index_js_1.DependencyContainer();
320
320
  dc.register(core_interfaces_1.IFluidLoadable, new MockLoadable());
321
321
  dc.unregister(core_interfaces_1.IFluidLoadable);
322
322
  (0, assert_1.strict)(!dc.has(core_interfaces_1.IFluidLoadable), "DependencyContainer doesn't have IFluidLoadable");
323
323
  });
324
324
  it(`Registering then Unregistering then Registering`, async () => {
325
- const dc = new index_1.DependencyContainer();
325
+ const dc = new index_js_1.DependencyContainer();
326
326
  dc.register(core_interfaces_1.IFluidLoadable, new MockLoadable());
327
327
  dc.unregister(core_interfaces_1.IFluidLoadable);
328
328
  dc.register(core_interfaces_1.IFluidLoadable, new MockLoadable());
329
329
  (0, assert_1.strict)(dc.has(core_interfaces_1.IFluidLoadable), "DependencyContainer has IFluidLoadable");
330
330
  });
331
331
  it(`has() resolves correctly in all variations`, async () => {
332
- const dc = new index_1.DependencyContainer();
332
+ const dc = new index_js_1.DependencyContainer();
333
333
  dc.register(core_interfaces_1.IFluidLoadable, new MockLoadable());
334
334
  dc.register(ISomeObject, new MockSomeObject());
335
335
  (0, assert_1.strict)(dc.has(core_interfaces_1.IFluidLoadable), "Manager has IFluidLoadable");
@@ -337,10 +337,10 @@ describe("someObjectlicious", () => {
337
337
  (0, assert_1.strict)(dc.has(core_interfaces_1.IFluidLoadable) && dc.has(ISomeObject), "Manager has IFluidLoadable & ISomeObject");
338
338
  });
339
339
  it(`Child has Parent modules`, async () => {
340
- const parentDc = new index_1.DependencyContainer();
340
+ const parentDc = new index_js_1.DependencyContainer();
341
341
  const loadableMock = new MockLoadable();
342
342
  parentDc.register(core_interfaces_1.IFluidLoadable, loadableMock);
343
- const dc = new index_1.DependencyContainer(parentDc);
343
+ const dc = new index_js_1.DependencyContainer(parentDc);
344
344
  const someObjectMock = new MockSomeObject();
345
345
  dc.register(ISomeObject, someObjectMock);
346
346
  (0, assert_1.strict)(dc.has(core_interfaces_1.IFluidLoadable), "has includes parent registered");
@@ -349,7 +349,7 @@ describe("someObjectlicious", () => {
349
349
  (0, assert_1.strict)(!dc.has(core_interfaces_1.IFluidHandle), "does not include not registered");
350
350
  });
351
351
  it(`Parent Resolved from Child`, async () => {
352
- const parentDc = new index_1.DependencyContainer();
352
+ const parentDc = new index_js_1.DependencyContainer();
353
353
  const loadableToHandle = async (fds) => {
354
354
  const loadable = fds.synthesize(undefined, {
355
355
  IFluidLoadable: core_interfaces_1.IFluidLoadable,
@@ -357,20 +357,20 @@ describe("someObjectlicious", () => {
357
357
  return (await loadable.IFluidLoadable).handle;
358
358
  };
359
359
  parentDc.register(core_interfaces_1.IFluidHandle, loadableToHandle);
360
- const dc = new index_1.DependencyContainer(parentDc);
360
+ const dc = new index_js_1.DependencyContainer(parentDc);
361
361
  const loadableMock = new MockLoadable();
362
362
  dc.register(core_interfaces_1.IFluidLoadable, loadableMock);
363
363
  const deps = dc.synthesize({ IFluidHandle: core_interfaces_1.IFluidHandle }, undefined);
364
364
  (0, assert_1.strict)((await deps.IFluidHandle) !== undefined, "handle undefined");
365
365
  });
366
366
  it(`Undefined Provider is not Undefined`, async () => {
367
- const dc = new index_1.DependencyContainer();
367
+ const dc = new index_js_1.DependencyContainer();
368
368
  const deps = dc.synthesize({ IFluidLoadable: core_interfaces_1.IFluidLoadable }, {});
369
369
  (0, assert_1.strict)(deps.IFluidLoadable !== undefined, "handle undefined");
370
370
  (0, assert_1.strict)((await deps.IFluidLoadable) === undefined, "handle undefined");
371
371
  });
372
372
  it(`test getProvider backcompat`, async () => {
373
- const dc = new index_1.DependencyContainer();
373
+ const dc = new index_js_1.DependencyContainer();
374
374
  const loadableMock = new MockLoadable();
375
375
  dc.register(core_interfaces_1.IFluidLoadable, loadableMock);
376
376
  const testGetProvider = (deps, scenario) => {
@@ -379,9 +379,9 @@ describe("someObjectlicious", () => {
379
379
  assert_1.strict.equal(provider, loadableMock, scenario);
380
380
  };
381
381
  testGetProvider(dc, "direct");
382
- testGetProvider(new index_1.DependencyContainer(dc), "parent");
382
+ testGetProvider(new index_js_1.DependencyContainer(dc), "parent");
383
383
  testGetProvider(new PassThru(dc), "pass thru");
384
- testGetProvider(new index_1.DependencyContainer(new PassThru(dc)), "pass thru as child");
384
+ testGetProvider(new index_js_1.DependencyContainer(new PassThru(dc)), "pass thru as child");
385
385
  });
386
386
  });
387
387
  });