@fluidframework/synthesize 2.0.0-dev.7.4.0.215930 → 2.0.0-dev.7.4.0.217212

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.
@@ -5,5 +5,8 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.IFluidDependencySynthesizer = void 0;
8
+ /**
9
+ * @internal
10
+ */
8
11
  exports.IFluidDependencySynthesizer = "IFluidDependencySynthesizer";
9
12
  //# sourceMappingURL=IFluidDependencySynthesizer.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"IFluidDependencySynthesizer.cjs","sourceRoot":"","sources":["../src/IFluidDependencySynthesizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIU,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\nexport const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer =\n\t\"IFluidDependencySynthesizer\";\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 */\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.cjs","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 * @internal\n */\nexport const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer =\n\t\"IFluidDependencySynthesizer\";\n\n/**\n * @internal\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 * @internal\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"]}
@@ -3,7 +3,13 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { AsyncFluidObjectProvider, FluidObjectSymbolProvider } from "./types";
6
+ /**
7
+ * @internal
8
+ */
6
9
  export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
10
+ /**
11
+ * @internal
12
+ */
7
13
  export interface IProvideFluidDependencySynthesizer {
8
14
  IFluidDependencySynthesizer: IFluidDependencySynthesizer;
9
15
  }
@@ -11,6 +17,7 @@ export interface IProvideFluidDependencySynthesizer {
11
17
  * IFluidDependencySynthesizer can generate FluidObjects based on the IProvideFluidObject pattern.
12
18
  * It allow for registering providers and uses synthesize to generate a new object with the optional
13
19
  * and required types.
20
+ * @internal
14
21
  */
15
22
  export interface IFluidDependencySynthesizer extends IProvideFluidDependencySynthesizer {
16
23
  /**
@@ -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,CAAC;AAE9E,eAAO,MAAM,2BAA2B,EAAE,MAAM,kCAClB,CAAC;AAE/B,MAAM,WAAW,kCAAkC;IAClD,2BAA2B,EAAE,2BAA2B,CAAC;CACzD;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA4B,SAAQ,kCAAkC;IACtF;;;;;;OAMG;IACH,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAClD,aAAa,EAAE,yBAAyB,CAAC,CAAC,CAAC,EAC3C,aAAa,EAAE,QAAQ,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,GACnD,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAElC;;;OAGG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B"}
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,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,kCAClB,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,kCAAkC;IAClD,2BAA2B,EAAE,2BAA2B,CAAC;CACzD;AAED;;;;;GAKG;AACH,MAAM,WAAW,2BAA4B,SAAQ,kCAAkC;IACtF;;;;;;OAMG;IACH,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAClD,aAAa,EAAE,yBAAyB,CAAC,CAAC,CAAC,EAC3C,aAAa,EAAE,QAAQ,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,GACnD,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAElC;;;OAGG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B"}
@@ -10,6 +10,7 @@ const IFluidDependencySynthesizer_1 = require("./IFluidDependencySynthesizer.cjs
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.
13
+ * @internal
13
14
  */
14
15
  class DependencyContainer {
15
16
  get IFluidDependencySynthesizer() {
@@ -1 +1 @@
1
- {"version":3,"file":"dependencyContainer.cjs","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAyD;AAQzD,mFAA4E;AAE5E;;;GAGG;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,GAAG,CAAC,IA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W,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 */\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.cjs","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAyD;AAQzD,mFAA4E;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,QA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AAC;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\";\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 * @internal\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"]}
@@ -7,6 +7,7 @@ import { IFluidDependencySynthesizer } from "./IFluidDependencySynthesizer";
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.
10
+ * @internal
10
11
  */
11
12
  export declare class DependencyContainer<TMap> implements IFluidDependencySynthesizer {
12
13
  private readonly providers;
@@ -1 +1 @@
1
- {"version":3,"file":"dependencyContainer.d.ts","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,wBAAwB,EACxB,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mBAAmB,EAGnB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;;;GAIG;AACH,qBAAa,mBAAmB,CAAC,IAAI,CAAE,YAAW,2BAA2B;IAC5E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmD;IAC7E,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgC;IACxD,IAAW,2BAA2B,SAErC;gBAEkB,GAAG,OAAO,EAAE,CAAC,2BAA2B,GAAG,SAAS,CAAC,EAAE;IAI1E;;;;;OAKG;IACI,QAAQ,CAAC,CAAC,SAAS,MAAM,IAAI,GAAG,MAAM,IAAI,EAChD,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAC1C,IAAI;IAUP;;;OAGG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI;IAMzC;;OAEG;IACI,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EACzD,aAAa,EAAE,yBAAyB,CAAC,CAAC,CAAC,EAC3C,aAAa,EAAE,QAAQ,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,GACnD,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC;IAQjC;;;OAGG;IACI,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO;IAS3D;;OAEG;IACH,OAAO,CAAC,WAAW;IAuBnB,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,eAAe;CA2CvB"}
@@ -1,110 +1,17 @@
1
- /**
2
- * Combined type for Optional and Required Async Fluid object Providers
3
- */
4
- export declare type AsyncFluidObjectProvider<O, R = undefined> = AsyncOptionalFluidObjectProvider<O> & AsyncRequiredFluidObjectProvider<R>;
1
+ /* Excluded from this release type: AsyncFluidObjectProvider */
5
2
 
6
- /**
7
- * This is a condensed version of Record that requires the object has all
8
- * the FluidObject properties as its type, mapped to an object that implements
9
- * the property or undefined.
10
- */
11
- export declare type AsyncOptionalFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
12
- [P in keyof T]?: Promise<T[P] | undefined>;
13
- };
3
+ /* Excluded from this release type: AsyncOptionalFluidObjectProvider */
14
4
 
15
- /**
16
- * This is a condensed version of Record that requires the object has all
17
- * the FluidObject properties as its type mapped to an object that implements
18
- * the property.
19
- */
20
- export declare type AsyncRequiredFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
21
- [P in keyof T]: Promise<NonNullable<Exclude<T[P], undefined | null>>>;
22
- };
5
+ /* Excluded from this release type: AsyncRequiredFluidObjectProvider */
23
6
 
24
- /**
25
- * DependencyContainer is similar to a IoC Container. It takes providers and will
26
- * synthesize an object based on them when requested.
27
- */
28
- export declare class DependencyContainer<TMap> implements IFluidDependencySynthesizer {
29
- private readonly providers;
30
- private readonly parents;
31
- get IFluidDependencySynthesizer(): this;
32
- constructor(...parents: (IFluidDependencySynthesizer | undefined)[]);
33
- /**
34
- * Add a new provider
35
- * @param type - Name of the Type T being provided
36
- * @param provider - A provider that will resolve the T correctly when asked
37
- * @throws - If passing a type that's already registered
38
- */
39
- register<T extends keyof TMap = keyof TMap>(type: T, provider: FluidObjectProvider<Pick<TMap, T>>): void;
40
- /**
41
- * Remove a provider
42
- * @param type - Name of the provider to remove
43
- */
44
- unregister(type: keyof TMap): void;
45
- /**
46
- * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}
47
- */
48
- synthesize<O, R = undefined | Record<string, never>>(optionalTypes: FluidObjectSymbolProvider<O>, requiredTypes: Required<FluidObjectSymbolProvider<R>>): AsyncFluidObjectProvider<O, R>;
49
- /**
50
- * {@inheritDoc (IFluidDependencySynthesizer:interface).has}
51
- * @param excludeParents - If true, exclude checking parent registries
52
- */
53
- has(type: string, excludeParents?: boolean): boolean;
54
- /**
55
- * @deprecated Needed for backwards compatability.
56
- */
57
- private getProvider;
58
- private generateRequired;
59
- private generateOptional;
60
- private resolveProvider;
61
- }
7
+ /* Excluded from this release type: DependencyContainer */
62
8
 
63
- /**
64
- * Multiple ways to provide a Fluid object.
65
- */
66
- export declare type FluidObjectProvider<T> = NonNullable<T> | Promise<NonNullable<T>> | ((dependencyContainer: IFluidDependencySynthesizer) => NonNullable<T>) | ((dependencyContainer: IFluidDependencySynthesizer) => Promise<NonNullable<T>>);
9
+ /* Excluded from this release type: FluidObjectProvider */
67
10
 
68
- /**
69
- * This is a condensed version of Record that requires the object has all
70
- * the FluidObject properties as its type mapped to a string representation
71
- * of that property.
72
- *
73
- * @example
74
- *
75
- * ```typescript
76
- * { IFoo: "IFoo" }
77
- * ```
78
- */
79
- export declare type FluidObjectSymbolProvider<T> = {
80
- [P in keyof T]?: P;
81
- };
11
+ /* Excluded from this release type: FluidObjectSymbolProvider */
82
12
 
83
- export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
13
+ /* Excluded from this release type: IFluidDependencySynthesizer */
84
14
 
85
- /**
86
- * IFluidDependencySynthesizer can generate FluidObjects based on the IProvideFluidObject pattern.
87
- * It allow for registering providers and uses synthesize to generate a new object with the optional
88
- * and required types.
89
- */
90
- export declare interface IFluidDependencySynthesizer extends IProvideFluidDependencySynthesizer {
91
- /**
92
- * synthesize takes optional and required types and returns an object that will fulfill the
93
- * defined types based off objects that has been previously registered.
94
- *
95
- * @param optionalTypes - optional types to be in the Scope object
96
- * @param requiredTypes - required types that need to be in the Scope object
97
- */
98
- synthesize<O, R = undefined | Record<string, never>>(optionalTypes: FluidObjectSymbolProvider<O>, requiredTypes: Required<FluidObjectSymbolProvider<R>>): AsyncFluidObjectProvider<O, R>;
99
- /**
100
- * Check if a given type is registered
101
- * @param type - Type to check
102
- */
103
- has(type: string): boolean;
104
- }
105
-
106
- export declare interface IProvideFluidDependencySynthesizer {
107
- IFluidDependencySynthesizer: IFluidDependencySynthesizer;
108
- }
15
+ /* Excluded from this release type: IProvideFluidDependencySynthesizer */
109
16
 
110
17
  export { }
@@ -1,110 +1,17 @@
1
- /**
2
- * Combined type for Optional and Required Async Fluid object Providers
3
- */
4
- export declare type AsyncFluidObjectProvider<O, R = undefined> = AsyncOptionalFluidObjectProvider<O> & AsyncRequiredFluidObjectProvider<R>;
1
+ /* Excluded from this release type: AsyncFluidObjectProvider */
5
2
 
6
- /**
7
- * This is a condensed version of Record that requires the object has all
8
- * the FluidObject properties as its type, mapped to an object that implements
9
- * the property or undefined.
10
- */
11
- export declare type AsyncOptionalFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
12
- [P in keyof T]?: Promise<T[P] | undefined>;
13
- };
3
+ /* Excluded from this release type: AsyncOptionalFluidObjectProvider */
14
4
 
15
- /**
16
- * This is a condensed version of Record that requires the object has all
17
- * the FluidObject properties as its type mapped to an object that implements
18
- * the property.
19
- */
20
- export declare type AsyncRequiredFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
21
- [P in keyof T]: Promise<NonNullable<Exclude<T[P], undefined | null>>>;
22
- };
5
+ /* Excluded from this release type: AsyncRequiredFluidObjectProvider */
23
6
 
24
- /**
25
- * DependencyContainer is similar to a IoC Container. It takes providers and will
26
- * synthesize an object based on them when requested.
27
- */
28
- export declare class DependencyContainer<TMap> implements IFluidDependencySynthesizer {
29
- private readonly providers;
30
- private readonly parents;
31
- get IFluidDependencySynthesizer(): this;
32
- constructor(...parents: (IFluidDependencySynthesizer | undefined)[]);
33
- /**
34
- * Add a new provider
35
- * @param type - Name of the Type T being provided
36
- * @param provider - A provider that will resolve the T correctly when asked
37
- * @throws - If passing a type that's already registered
38
- */
39
- register<T extends keyof TMap = keyof TMap>(type: T, provider: FluidObjectProvider<Pick<TMap, T>>): void;
40
- /**
41
- * Remove a provider
42
- * @param type - Name of the provider to remove
43
- */
44
- unregister(type: keyof TMap): void;
45
- /**
46
- * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}
47
- */
48
- synthesize<O, R = undefined | Record<string, never>>(optionalTypes: FluidObjectSymbolProvider<O>, requiredTypes: Required<FluidObjectSymbolProvider<R>>): AsyncFluidObjectProvider<O, R>;
49
- /**
50
- * {@inheritDoc (IFluidDependencySynthesizer:interface).has}
51
- * @param excludeParents - If true, exclude checking parent registries
52
- */
53
- has(type: string, excludeParents?: boolean): boolean;
54
- /**
55
- * @deprecated Needed for backwards compatability.
56
- */
57
- private getProvider;
58
- private generateRequired;
59
- private generateOptional;
60
- private resolveProvider;
61
- }
7
+ /* Excluded from this release type: DependencyContainer */
62
8
 
63
- /**
64
- * Multiple ways to provide a Fluid object.
65
- */
66
- export declare type FluidObjectProvider<T> = NonNullable<T> | Promise<NonNullable<T>> | ((dependencyContainer: IFluidDependencySynthesizer) => NonNullable<T>) | ((dependencyContainer: IFluidDependencySynthesizer) => Promise<NonNullable<T>>);
9
+ /* Excluded from this release type: FluidObjectProvider */
67
10
 
68
- /**
69
- * This is a condensed version of Record that requires the object has all
70
- * the FluidObject properties as its type mapped to a string representation
71
- * of that property.
72
- *
73
- * @example
74
- *
75
- * ```typescript
76
- * { IFoo: "IFoo" }
77
- * ```
78
- */
79
- export declare type FluidObjectSymbolProvider<T> = {
80
- [P in keyof T]?: P;
81
- };
11
+ /* Excluded from this release type: FluidObjectSymbolProvider */
82
12
 
83
- export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
13
+ /* Excluded from this release type: IFluidDependencySynthesizer */
84
14
 
85
- /**
86
- * IFluidDependencySynthesizer can generate FluidObjects based on the IProvideFluidObject pattern.
87
- * It allow for registering providers and uses synthesize to generate a new object with the optional
88
- * and required types.
89
- */
90
- export declare interface IFluidDependencySynthesizer extends IProvideFluidDependencySynthesizer {
91
- /**
92
- * synthesize takes optional and required types and returns an object that will fulfill the
93
- * defined types based off objects that has been previously registered.
94
- *
95
- * @param optionalTypes - optional types to be in the Scope object
96
- * @param requiredTypes - required types that need to be in the Scope object
97
- */
98
- synthesize<O, R = undefined | Record<string, never>>(optionalTypes: FluidObjectSymbolProvider<O>, requiredTypes: Required<FluidObjectSymbolProvider<R>>): AsyncFluidObjectProvider<O, R>;
99
- /**
100
- * Check if a given type is registered
101
- * @param type - Type to check
102
- */
103
- has(type: string): boolean;
104
- }
105
-
106
- export declare interface IProvideFluidDependencySynthesizer {
107
- IFluidDependencySynthesizer: IFluidDependencySynthesizer;
108
- }
15
+ /* Excluded from this release type: IProvideFluidDependencySynthesizer */
109
16
 
110
17
  export { }
@@ -1,110 +1,17 @@
1
- /**
2
- * Combined type for Optional and Required Async Fluid object Providers
3
- */
4
- export declare type AsyncFluidObjectProvider<O, R = undefined> = AsyncOptionalFluidObjectProvider<O> & AsyncRequiredFluidObjectProvider<R>;
1
+ /* Excluded from this release type: AsyncFluidObjectProvider */
5
2
 
6
- /**
7
- * This is a condensed version of Record that requires the object has all
8
- * the FluidObject properties as its type, mapped to an object that implements
9
- * the property or undefined.
10
- */
11
- export declare type AsyncOptionalFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
12
- [P in keyof T]?: Promise<T[P] | undefined>;
13
- };
3
+ /* Excluded from this release type: AsyncOptionalFluidObjectProvider */
14
4
 
15
- /**
16
- * This is a condensed version of Record that requires the object has all
17
- * the FluidObject properties as its type mapped to an object that implements
18
- * the property.
19
- */
20
- export declare type AsyncRequiredFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
21
- [P in keyof T]: Promise<NonNullable<Exclude<T[P], undefined | null>>>;
22
- };
5
+ /* Excluded from this release type: AsyncRequiredFluidObjectProvider */
23
6
 
24
- /**
25
- * DependencyContainer is similar to a IoC Container. It takes providers and will
26
- * synthesize an object based on them when requested.
27
- */
28
- export declare class DependencyContainer<TMap> implements IFluidDependencySynthesizer {
29
- private readonly providers;
30
- private readonly parents;
31
- get IFluidDependencySynthesizer(): this;
32
- constructor(...parents: (IFluidDependencySynthesizer | undefined)[]);
33
- /**
34
- * Add a new provider
35
- * @param type - Name of the Type T being provided
36
- * @param provider - A provider that will resolve the T correctly when asked
37
- * @throws - If passing a type that's already registered
38
- */
39
- register<T extends keyof TMap = keyof TMap>(type: T, provider: FluidObjectProvider<Pick<TMap, T>>): void;
40
- /**
41
- * Remove a provider
42
- * @param type - Name of the provider to remove
43
- */
44
- unregister(type: keyof TMap): void;
45
- /**
46
- * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}
47
- */
48
- synthesize<O, R = undefined | Record<string, never>>(optionalTypes: FluidObjectSymbolProvider<O>, requiredTypes: Required<FluidObjectSymbolProvider<R>>): AsyncFluidObjectProvider<O, R>;
49
- /**
50
- * {@inheritDoc (IFluidDependencySynthesizer:interface).has}
51
- * @param excludeParents - If true, exclude checking parent registries
52
- */
53
- has(type: string, excludeParents?: boolean): boolean;
54
- /**
55
- * @deprecated Needed for backwards compatability.
56
- */
57
- private getProvider;
58
- private generateRequired;
59
- private generateOptional;
60
- private resolveProvider;
61
- }
7
+ /* Excluded from this release type: DependencyContainer */
62
8
 
63
- /**
64
- * Multiple ways to provide a Fluid object.
65
- */
66
- export declare type FluidObjectProvider<T> = NonNullable<T> | Promise<NonNullable<T>> | ((dependencyContainer: IFluidDependencySynthesizer) => NonNullable<T>) | ((dependencyContainer: IFluidDependencySynthesizer) => Promise<NonNullable<T>>);
9
+ /* Excluded from this release type: FluidObjectProvider */
67
10
 
68
- /**
69
- * This is a condensed version of Record that requires the object has all
70
- * the FluidObject properties as its type mapped to a string representation
71
- * of that property.
72
- *
73
- * @example
74
- *
75
- * ```typescript
76
- * { IFoo: "IFoo" }
77
- * ```
78
- */
79
- export declare type FluidObjectSymbolProvider<T> = {
80
- [P in keyof T]?: P;
81
- };
11
+ /* Excluded from this release type: FluidObjectSymbolProvider */
82
12
 
83
- export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
13
+ /* Excluded from this release type: IFluidDependencySynthesizer */
84
14
 
85
- /**
86
- * IFluidDependencySynthesizer can generate FluidObjects based on the IProvideFluidObject pattern.
87
- * It allow for registering providers and uses synthesize to generate a new object with the optional
88
- * and required types.
89
- */
90
- export declare interface IFluidDependencySynthesizer extends IProvideFluidDependencySynthesizer {
91
- /**
92
- * synthesize takes optional and required types and returns an object that will fulfill the
93
- * defined types based off objects that has been previously registered.
94
- *
95
- * @param optionalTypes - optional types to be in the Scope object
96
- * @param requiredTypes - required types that need to be in the Scope object
97
- */
98
- synthesize<O, R = undefined | Record<string, never>>(optionalTypes: FluidObjectSymbolProvider<O>, requiredTypes: Required<FluidObjectSymbolProvider<R>>): AsyncFluidObjectProvider<O, R>;
99
- /**
100
- * Check if a given type is registered
101
- * @param type - Type to check
102
- */
103
- has(type: string): boolean;
104
- }
105
-
106
- export declare interface IProvideFluidDependencySynthesizer {
107
- IFluidDependencySynthesizer: IFluidDependencySynthesizer;
108
- }
15
+ /* Excluded from this release type: IProvideFluidDependencySynthesizer */
109
16
 
110
17
  export { }
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Combined type for Optional and Required Async Fluid object Providers
3
+ * @internal
3
4
  */
4
5
  export declare type AsyncFluidObjectProvider<O, R = undefined> = AsyncOptionalFluidObjectProvider<O> & AsyncRequiredFluidObjectProvider<R>;
5
6
 
@@ -7,6 +8,7 @@ export declare type AsyncFluidObjectProvider<O, R = undefined> = AsyncOptionalFl
7
8
  * This is a condensed version of Record that requires the object has all
8
9
  * the FluidObject properties as its type, mapped to an object that implements
9
10
  * the property or undefined.
11
+ * @internal
10
12
  */
11
13
  export declare type AsyncOptionalFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
12
14
  [P in keyof T]?: Promise<T[P] | undefined>;
@@ -16,6 +18,7 @@ export declare type AsyncOptionalFluidObjectProvider<T> = T extends undefined ?
16
18
  * This is a condensed version of Record that requires the object has all
17
19
  * the FluidObject properties as its type mapped to an object that implements
18
20
  * the property.
21
+ * @internal
19
22
  */
20
23
  export declare type AsyncRequiredFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
21
24
  [P in keyof T]: Promise<NonNullable<Exclude<T[P], undefined | null>>>;
@@ -24,6 +27,7 @@ export declare type AsyncRequiredFluidObjectProvider<T> = T extends undefined ?
24
27
  /**
25
28
  * DependencyContainer is similar to a IoC Container. It takes providers and will
26
29
  * synthesize an object based on them when requested.
30
+ * @internal
27
31
  */
28
32
  export declare class DependencyContainer<TMap> implements IFluidDependencySynthesizer {
29
33
  private readonly providers;
@@ -62,6 +66,7 @@ export declare class DependencyContainer<TMap> implements IFluidDependencySynthe
62
66
 
63
67
  /**
64
68
  * Multiple ways to provide a Fluid object.
69
+ * @internal
65
70
  */
66
71
  export declare type FluidObjectProvider<T> = NonNullable<T> | Promise<NonNullable<T>> | ((dependencyContainer: IFluidDependencySynthesizer) => NonNullable<T>) | ((dependencyContainer: IFluidDependencySynthesizer) => Promise<NonNullable<T>>);
67
72
 
@@ -75,17 +80,22 @@ export declare type FluidObjectProvider<T> = NonNullable<T> | Promise<NonNullabl
75
80
  * ```typescript
76
81
  * { IFoo: "IFoo" }
77
82
  * ```
83
+ * @internal
78
84
  */
79
85
  export declare type FluidObjectSymbolProvider<T> = {
80
86
  [P in keyof T]?: P;
81
87
  };
82
88
 
89
+ /**
90
+ * @internal
91
+ */
83
92
  export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
84
93
 
85
94
  /**
86
95
  * IFluidDependencySynthesizer can generate FluidObjects based on the IProvideFluidObject pattern.
87
96
  * It allow for registering providers and uses synthesize to generate a new object with the optional
88
97
  * and required types.
98
+ * @internal
89
99
  */
90
100
  export declare interface IFluidDependencySynthesizer extends IProvideFluidDependencySynthesizer {
91
101
  /**
@@ -103,6 +113,9 @@ export declare interface IFluidDependencySynthesizer extends IProvideFluidDepend
103
113
  has(type: string): boolean;
104
114
  }
105
115
 
116
+ /**
117
+ * @internal
118
+ */
106
119
  export declare interface IProvideFluidDependencySynthesizer {
107
120
  IFluidDependencySynthesizer: IFluidDependencySynthesizer;
108
121
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IFluidDependencySynthesizer } from \".\";\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type mapped to a string representation\n * of that property.\n *\n * @example\n *\n * ```typescript\n * { IFoo: \"IFoo\" }\n * ```\n */\nexport type FluidObjectSymbolProvider<T> = {\n\t[P in keyof T]?: P;\n};\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type mapped to an object that implements\n * the property.\n */\nexport type AsyncRequiredFluidObjectProvider<T> = T extends undefined\n\t? Record<string, never>\n\t: {\n\t\t\t[P in keyof T]: Promise<NonNullable<Exclude<T[P], undefined | null>>>;\n\t };\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type, mapped to an object that implements\n * the property or undefined.\n */\nexport type AsyncOptionalFluidObjectProvider<T> = T extends undefined\n\t? Record<string, never>\n\t: {\n\t\t\t[P in keyof T]?: Promise<T[P] | undefined>;\n\t };\n\n/**\n * Combined type for Optional and Required Async Fluid object Providers\n */\nexport type AsyncFluidObjectProvider<O, R = undefined> = AsyncOptionalFluidObjectProvider<O> &\n\tAsyncRequiredFluidObjectProvider<R>;\n\n/**\n * Multiple ways to provide a Fluid object.\n */\nexport type FluidObjectProvider<T> =\n\t| NonNullable<T>\n\t| Promise<NonNullable<T>>\n\t| ((dependencyContainer: IFluidDependencySynthesizer) => NonNullable<T>)\n\t| ((dependencyContainer: IFluidDependencySynthesizer) => Promise<NonNullable<T>>);\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IFluidDependencySynthesizer } from \".\";\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type mapped to a string representation\n * of that property.\n *\n * @example\n *\n * ```typescript\n * { IFoo: \"IFoo\" }\n * ```\n * @internal\n */\nexport type FluidObjectSymbolProvider<T> = {\n\t[P in keyof T]?: P;\n};\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type mapped to an object that implements\n * the property.\n * @internal\n */\nexport type AsyncRequiredFluidObjectProvider<T> = T extends undefined\n\t? Record<string, never>\n\t: {\n\t\t\t[P in keyof T]: Promise<NonNullable<Exclude<T[P], undefined | null>>>;\n\t };\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type, mapped to an object that implements\n * the property or undefined.\n * @internal\n */\nexport type AsyncOptionalFluidObjectProvider<T> = T extends undefined\n\t? Record<string, never>\n\t: {\n\t\t\t[P in keyof T]?: Promise<T[P] | undefined>;\n\t };\n\n/**\n * Combined type for Optional and Required Async Fluid object Providers\n * @internal\n */\nexport type AsyncFluidObjectProvider<O, R = undefined> = AsyncOptionalFluidObjectProvider<O> &\n\tAsyncRequiredFluidObjectProvider<R>;\n\n/**\n * Multiple ways to provide a Fluid object.\n * @internal\n */\nexport type FluidObjectProvider<T> =\n\t| NonNullable<T>\n\t| Promise<NonNullable<T>>\n\t| ((dependencyContainer: IFluidDependencySynthesizer) => NonNullable<T>)\n\t| ((dependencyContainer: IFluidDependencySynthesizer) => Promise<NonNullable<T>>);\n"]}
package/dist/types.d.ts CHANGED
@@ -13,6 +13,7 @@ import { IFluidDependencySynthesizer } from ".";
13
13
  * ```typescript
14
14
  * { IFoo: "IFoo" }
15
15
  * ```
16
+ * @internal
16
17
  */
17
18
  export type FluidObjectSymbolProvider<T> = {
18
19
  [P in keyof T]?: P;
@@ -21,6 +22,7 @@ export type FluidObjectSymbolProvider<T> = {
21
22
  * This is a condensed version of Record that requires the object has all
22
23
  * the FluidObject properties as its type mapped to an object that implements
23
24
  * the property.
25
+ * @internal
24
26
  */
25
27
  export type AsyncRequiredFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
26
28
  [P in keyof T]: Promise<NonNullable<Exclude<T[P], undefined | null>>>;
@@ -29,16 +31,19 @@ export type AsyncRequiredFluidObjectProvider<T> = T extends undefined ? Record<s
29
31
  * This is a condensed version of Record that requires the object has all
30
32
  * the FluidObject properties as its type, mapped to an object that implements
31
33
  * the property or undefined.
34
+ * @internal
32
35
  */
33
36
  export type AsyncOptionalFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
34
37
  [P in keyof T]?: Promise<T[P] | undefined>;
35
38
  };
36
39
  /**
37
40
  * Combined type for Optional and Required Async Fluid object Providers
41
+ * @internal
38
42
  */
39
43
  export type AsyncFluidObjectProvider<O, R = undefined> = AsyncOptionalFluidObjectProvider<O> & AsyncRequiredFluidObjectProvider<R>;
40
44
  /**
41
45
  * Multiple ways to provide a Fluid object.
46
+ * @internal
42
47
  */
43
48
  export type FluidObjectProvider<T> = NonNullable<T> | Promise<NonNullable<T>> | ((dependencyContainer: IFluidDependencySynthesizer) => NonNullable<T>) | ((dependencyContainer: IFluidDependencySynthesizer) => Promise<NonNullable<T>>);
44
49
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,2BAA2B,EAAE,MAAM,GAAG,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,IAAI;KACzC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;CAClB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gCAAgC,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAClE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACrB;KACC,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,C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CAAC,CAAC,CAAC;CACpE,CAAC;AAEL;;;;;GAKG;AACH,MAAM,MAAM,gCAAgC,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAClE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACrB;KACC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;CACzC,CAAC;AAEL;;;GAGG;AACH,MAAM,MAAM,wBAAwB,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,IAAI,gCAAgC,CAAC,CAAC,CAAC,GAC3F,gCAAgC,CAAC,CAAC,CAAC,CAAC;AAErC;;;GAGG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAC9B,WAAW,CAAC,CAAC,CAAC,GACd,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GACvB,CAAC,CAAC,mBAAmB,EAAE,2BAA2B,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,GACtE,CAAC,CAAC,mBAAmB,EAAE,2BAA2B,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -2,5 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ /**
6
+ * @internal
7
+ */
5
8
  export const IFluidDependencySynthesizer = "IFluidDependencySynthesizer";
6
9
  //# sourceMappingURL=IFluidDependencySynthesizer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"IFluidDependencySynthesizer.mjs","sourceRoot":"","sources":["../src/IFluidDependencySynthesizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,CAAC,MAAM,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\nexport const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer =\n\t\"IFluidDependencySynthesizer\";\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 */\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.mjs","sourceRoot":"","sources":["../src/IFluidDependencySynthesizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,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 * @internal\n */\nexport const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer =\n\t\"IFluidDependencySynthesizer\";\n\n/**\n * @internal\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 * @internal\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"]}
@@ -7,6 +7,7 @@ import { IFluidDependencySynthesizer } from "./IFluidDependencySynthesizer.mjs";
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.
10
+ * @internal
10
11
  */
11
12
  export class DependencyContainer {
12
13
  get IFluidDependencySynthesizer() {
@@ -1 +1 @@
1
- {"version":3,"file":"dependencyContainer.mjs","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,WAAW,EAAE,MAAM,4BAA4B;OAQjD,EAAE,2BAA2B,EAAE;AAEtC;;;GAGG;AACH,MAAM,OAAO,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,GAAG,CAAC,IAAI,CAAC,EAAE;YAC7B,MAAM,IAAI,KAAK,CACd,6CAA6C,MAAM,CAAC,IAA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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","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 */\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.mjs","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,WAAW,EAAE,MAAM,4BAA4B;OAQjD,EAAE,2BAA2B,EAAE;AAEtC;;;;GAIG;AACH,MAAM,OAAO,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,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Q,EAAE;oBACb,OAAO,IAAI,WAAW,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","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 * @internal\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,110 +1,17 @@
1
- /**
2
- * Combined type for Optional and Required Async Fluid object Providers
3
- */
4
- export declare type AsyncFluidObjectProvider<O, R = undefined> = AsyncOptionalFluidObjectProvider<O> & AsyncRequiredFluidObjectProvider<R>;
1
+ /* Excluded from this release type: AsyncFluidObjectProvider */
5
2
 
6
- /**
7
- * This is a condensed version of Record that requires the object has all
8
- * the FluidObject properties as its type, mapped to an object that implements
9
- * the property or undefined.
10
- */
11
- export declare type AsyncOptionalFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
12
- [P in keyof T]?: Promise<T[P] | undefined>;
13
- };
3
+ /* Excluded from this release type: AsyncOptionalFluidObjectProvider */
14
4
 
15
- /**
16
- * This is a condensed version of Record that requires the object has all
17
- * the FluidObject properties as its type mapped to an object that implements
18
- * the property.
19
- */
20
- export declare type AsyncRequiredFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
21
- [P in keyof T]: Promise<NonNullable<Exclude<T[P], undefined | null>>>;
22
- };
5
+ /* Excluded from this release type: AsyncRequiredFluidObjectProvider */
23
6
 
24
- /**
25
- * DependencyContainer is similar to a IoC Container. It takes providers and will
26
- * synthesize an object based on them when requested.
27
- */
28
- export declare class DependencyContainer<TMap> implements IFluidDependencySynthesizer {
29
- private readonly providers;
30
- private readonly parents;
31
- get IFluidDependencySynthesizer(): this;
32
- constructor(...parents: (IFluidDependencySynthesizer | undefined)[]);
33
- /**
34
- * Add a new provider
35
- * @param type - Name of the Type T being provided
36
- * @param provider - A provider that will resolve the T correctly when asked
37
- * @throws - If passing a type that's already registered
38
- */
39
- register<T extends keyof TMap = keyof TMap>(type: T, provider: FluidObjectProvider<Pick<TMap, T>>): void;
40
- /**
41
- * Remove a provider
42
- * @param type - Name of the provider to remove
43
- */
44
- unregister(type: keyof TMap): void;
45
- /**
46
- * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}
47
- */
48
- synthesize<O, R = undefined | Record<string, never>>(optionalTypes: FluidObjectSymbolProvider<O>, requiredTypes: Required<FluidObjectSymbolProvider<R>>): AsyncFluidObjectProvider<O, R>;
49
- /**
50
- * {@inheritDoc (IFluidDependencySynthesizer:interface).has}
51
- * @param excludeParents - If true, exclude checking parent registries
52
- */
53
- has(type: string, excludeParents?: boolean): boolean;
54
- /**
55
- * @deprecated Needed for backwards compatability.
56
- */
57
- private getProvider;
58
- private generateRequired;
59
- private generateOptional;
60
- private resolveProvider;
61
- }
7
+ /* Excluded from this release type: DependencyContainer */
62
8
 
63
- /**
64
- * Multiple ways to provide a Fluid object.
65
- */
66
- export declare type FluidObjectProvider<T> = NonNullable<T> | Promise<NonNullable<T>> | ((dependencyContainer: IFluidDependencySynthesizer) => NonNullable<T>) | ((dependencyContainer: IFluidDependencySynthesizer) => Promise<NonNullable<T>>);
9
+ /* Excluded from this release type: FluidObjectProvider */
67
10
 
68
- /**
69
- * This is a condensed version of Record that requires the object has all
70
- * the FluidObject properties as its type mapped to a string representation
71
- * of that property.
72
- *
73
- * @example
74
- *
75
- * ```typescript
76
- * { IFoo: "IFoo" }
77
- * ```
78
- */
79
- export declare type FluidObjectSymbolProvider<T> = {
80
- [P in keyof T]?: P;
81
- };
11
+ /* Excluded from this release type: FluidObjectSymbolProvider */
82
12
 
83
- export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
13
+ /* Excluded from this release type: IFluidDependencySynthesizer */
84
14
 
85
- /**
86
- * IFluidDependencySynthesizer can generate FluidObjects based on the IProvideFluidObject pattern.
87
- * It allow for registering providers and uses synthesize to generate a new object with the optional
88
- * and required types.
89
- */
90
- export declare interface IFluidDependencySynthesizer extends IProvideFluidDependencySynthesizer {
91
- /**
92
- * synthesize takes optional and required types and returns an object that will fulfill the
93
- * defined types based off objects that has been previously registered.
94
- *
95
- * @param optionalTypes - optional types to be in the Scope object
96
- * @param requiredTypes - required types that need to be in the Scope object
97
- */
98
- synthesize<O, R = undefined | Record<string, never>>(optionalTypes: FluidObjectSymbolProvider<O>, requiredTypes: Required<FluidObjectSymbolProvider<R>>): AsyncFluidObjectProvider<O, R>;
99
- /**
100
- * Check if a given type is registered
101
- * @param type - Type to check
102
- */
103
- has(type: string): boolean;
104
- }
105
-
106
- export declare interface IProvideFluidDependencySynthesizer {
107
- IFluidDependencySynthesizer: IFluidDependencySynthesizer;
108
- }
15
+ /* Excluded from this release type: IProvideFluidDependencySynthesizer */
109
16
 
110
17
  export { }
@@ -1,110 +1,17 @@
1
- /**
2
- * Combined type for Optional and Required Async Fluid object Providers
3
- */
4
- export declare type AsyncFluidObjectProvider<O, R = undefined> = AsyncOptionalFluidObjectProvider<O> & AsyncRequiredFluidObjectProvider<R>;
1
+ /* Excluded from this release type: AsyncFluidObjectProvider */
5
2
 
6
- /**
7
- * This is a condensed version of Record that requires the object has all
8
- * the FluidObject properties as its type, mapped to an object that implements
9
- * the property or undefined.
10
- */
11
- export declare type AsyncOptionalFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
12
- [P in keyof T]?: Promise<T[P] | undefined>;
13
- };
3
+ /* Excluded from this release type: AsyncOptionalFluidObjectProvider */
14
4
 
15
- /**
16
- * This is a condensed version of Record that requires the object has all
17
- * the FluidObject properties as its type mapped to an object that implements
18
- * the property.
19
- */
20
- export declare type AsyncRequiredFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
21
- [P in keyof T]: Promise<NonNullable<Exclude<T[P], undefined | null>>>;
22
- };
5
+ /* Excluded from this release type: AsyncRequiredFluidObjectProvider */
23
6
 
24
- /**
25
- * DependencyContainer is similar to a IoC Container. It takes providers and will
26
- * synthesize an object based on them when requested.
27
- */
28
- export declare class DependencyContainer<TMap> implements IFluidDependencySynthesizer {
29
- private readonly providers;
30
- private readonly parents;
31
- get IFluidDependencySynthesizer(): this;
32
- constructor(...parents: (IFluidDependencySynthesizer | undefined)[]);
33
- /**
34
- * Add a new provider
35
- * @param type - Name of the Type T being provided
36
- * @param provider - A provider that will resolve the T correctly when asked
37
- * @throws - If passing a type that's already registered
38
- */
39
- register<T extends keyof TMap = keyof TMap>(type: T, provider: FluidObjectProvider<Pick<TMap, T>>): void;
40
- /**
41
- * Remove a provider
42
- * @param type - Name of the provider to remove
43
- */
44
- unregister(type: keyof TMap): void;
45
- /**
46
- * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}
47
- */
48
- synthesize<O, R = undefined | Record<string, never>>(optionalTypes: FluidObjectSymbolProvider<O>, requiredTypes: Required<FluidObjectSymbolProvider<R>>): AsyncFluidObjectProvider<O, R>;
49
- /**
50
- * {@inheritDoc (IFluidDependencySynthesizer:interface).has}
51
- * @param excludeParents - If true, exclude checking parent registries
52
- */
53
- has(type: string, excludeParents?: boolean): boolean;
54
- /**
55
- * @deprecated Needed for backwards compatability.
56
- */
57
- private getProvider;
58
- private generateRequired;
59
- private generateOptional;
60
- private resolveProvider;
61
- }
7
+ /* Excluded from this release type: DependencyContainer */
62
8
 
63
- /**
64
- * Multiple ways to provide a Fluid object.
65
- */
66
- export declare type FluidObjectProvider<T> = NonNullable<T> | Promise<NonNullable<T>> | ((dependencyContainer: IFluidDependencySynthesizer) => NonNullable<T>) | ((dependencyContainer: IFluidDependencySynthesizer) => Promise<NonNullable<T>>);
9
+ /* Excluded from this release type: FluidObjectProvider */
67
10
 
68
- /**
69
- * This is a condensed version of Record that requires the object has all
70
- * the FluidObject properties as its type mapped to a string representation
71
- * of that property.
72
- *
73
- * @example
74
- *
75
- * ```typescript
76
- * { IFoo: "IFoo" }
77
- * ```
78
- */
79
- export declare type FluidObjectSymbolProvider<T> = {
80
- [P in keyof T]?: P;
81
- };
11
+ /* Excluded from this release type: FluidObjectSymbolProvider */
82
12
 
83
- export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
13
+ /* Excluded from this release type: IFluidDependencySynthesizer */
84
14
 
85
- /**
86
- * IFluidDependencySynthesizer can generate FluidObjects based on the IProvideFluidObject pattern.
87
- * It allow for registering providers and uses synthesize to generate a new object with the optional
88
- * and required types.
89
- */
90
- export declare interface IFluidDependencySynthesizer extends IProvideFluidDependencySynthesizer {
91
- /**
92
- * synthesize takes optional and required types and returns an object that will fulfill the
93
- * defined types based off objects that has been previously registered.
94
- *
95
- * @param optionalTypes - optional types to be in the Scope object
96
- * @param requiredTypes - required types that need to be in the Scope object
97
- */
98
- synthesize<O, R = undefined | Record<string, never>>(optionalTypes: FluidObjectSymbolProvider<O>, requiredTypes: Required<FluidObjectSymbolProvider<R>>): AsyncFluidObjectProvider<O, R>;
99
- /**
100
- * Check if a given type is registered
101
- * @param type - Type to check
102
- */
103
- has(type: string): boolean;
104
- }
105
-
106
- export declare interface IProvideFluidDependencySynthesizer {
107
- IFluidDependencySynthesizer: IFluidDependencySynthesizer;
108
- }
15
+ /* Excluded from this release type: IProvideFluidDependencySynthesizer */
109
16
 
110
17
  export { }
@@ -1,110 +1,17 @@
1
- /**
2
- * Combined type for Optional and Required Async Fluid object Providers
3
- */
4
- export declare type AsyncFluidObjectProvider<O, R = undefined> = AsyncOptionalFluidObjectProvider<O> & AsyncRequiredFluidObjectProvider<R>;
1
+ /* Excluded from this release type: AsyncFluidObjectProvider */
5
2
 
6
- /**
7
- * This is a condensed version of Record that requires the object has all
8
- * the FluidObject properties as its type, mapped to an object that implements
9
- * the property or undefined.
10
- */
11
- export declare type AsyncOptionalFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
12
- [P in keyof T]?: Promise<T[P] | undefined>;
13
- };
3
+ /* Excluded from this release type: AsyncOptionalFluidObjectProvider */
14
4
 
15
- /**
16
- * This is a condensed version of Record that requires the object has all
17
- * the FluidObject properties as its type mapped to an object that implements
18
- * the property.
19
- */
20
- export declare type AsyncRequiredFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
21
- [P in keyof T]: Promise<NonNullable<Exclude<T[P], undefined | null>>>;
22
- };
5
+ /* Excluded from this release type: AsyncRequiredFluidObjectProvider */
23
6
 
24
- /**
25
- * DependencyContainer is similar to a IoC Container. It takes providers and will
26
- * synthesize an object based on them when requested.
27
- */
28
- export declare class DependencyContainer<TMap> implements IFluidDependencySynthesizer {
29
- private readonly providers;
30
- private readonly parents;
31
- get IFluidDependencySynthesizer(): this;
32
- constructor(...parents: (IFluidDependencySynthesizer | undefined)[]);
33
- /**
34
- * Add a new provider
35
- * @param type - Name of the Type T being provided
36
- * @param provider - A provider that will resolve the T correctly when asked
37
- * @throws - If passing a type that's already registered
38
- */
39
- register<T extends keyof TMap = keyof TMap>(type: T, provider: FluidObjectProvider<Pick<TMap, T>>): void;
40
- /**
41
- * Remove a provider
42
- * @param type - Name of the provider to remove
43
- */
44
- unregister(type: keyof TMap): void;
45
- /**
46
- * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}
47
- */
48
- synthesize<O, R = undefined | Record<string, never>>(optionalTypes: FluidObjectSymbolProvider<O>, requiredTypes: Required<FluidObjectSymbolProvider<R>>): AsyncFluidObjectProvider<O, R>;
49
- /**
50
- * {@inheritDoc (IFluidDependencySynthesizer:interface).has}
51
- * @param excludeParents - If true, exclude checking parent registries
52
- */
53
- has(type: string, excludeParents?: boolean): boolean;
54
- /**
55
- * @deprecated Needed for backwards compatability.
56
- */
57
- private getProvider;
58
- private generateRequired;
59
- private generateOptional;
60
- private resolveProvider;
61
- }
7
+ /* Excluded from this release type: DependencyContainer */
62
8
 
63
- /**
64
- * Multiple ways to provide a Fluid object.
65
- */
66
- export declare type FluidObjectProvider<T> = NonNullable<T> | Promise<NonNullable<T>> | ((dependencyContainer: IFluidDependencySynthesizer) => NonNullable<T>) | ((dependencyContainer: IFluidDependencySynthesizer) => Promise<NonNullable<T>>);
9
+ /* Excluded from this release type: FluidObjectProvider */
67
10
 
68
- /**
69
- * This is a condensed version of Record that requires the object has all
70
- * the FluidObject properties as its type mapped to a string representation
71
- * of that property.
72
- *
73
- * @example
74
- *
75
- * ```typescript
76
- * { IFoo: "IFoo" }
77
- * ```
78
- */
79
- export declare type FluidObjectSymbolProvider<T> = {
80
- [P in keyof T]?: P;
81
- };
11
+ /* Excluded from this release type: FluidObjectSymbolProvider */
82
12
 
83
- export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
13
+ /* Excluded from this release type: IFluidDependencySynthesizer */
84
14
 
85
- /**
86
- * IFluidDependencySynthesizer can generate FluidObjects based on the IProvideFluidObject pattern.
87
- * It allow for registering providers and uses synthesize to generate a new object with the optional
88
- * and required types.
89
- */
90
- export declare interface IFluidDependencySynthesizer extends IProvideFluidDependencySynthesizer {
91
- /**
92
- * synthesize takes optional and required types and returns an object that will fulfill the
93
- * defined types based off objects that has been previously registered.
94
- *
95
- * @param optionalTypes - optional types to be in the Scope object
96
- * @param requiredTypes - required types that need to be in the Scope object
97
- */
98
- synthesize<O, R = undefined | Record<string, never>>(optionalTypes: FluidObjectSymbolProvider<O>, requiredTypes: Required<FluidObjectSymbolProvider<R>>): AsyncFluidObjectProvider<O, R>;
99
- /**
100
- * Check if a given type is registered
101
- * @param type - Type to check
102
- */
103
- has(type: string): boolean;
104
- }
105
-
106
- export declare interface IProvideFluidDependencySynthesizer {
107
- IFluidDependencySynthesizer: IFluidDependencySynthesizer;
108
- }
15
+ /* Excluded from this release type: IProvideFluidDependencySynthesizer */
109
16
 
110
17
  export { }
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Combined type for Optional and Required Async Fluid object Providers
3
+ * @internal
3
4
  */
4
5
  export declare type AsyncFluidObjectProvider<O, R = undefined> = AsyncOptionalFluidObjectProvider<O> & AsyncRequiredFluidObjectProvider<R>;
5
6
 
@@ -7,6 +8,7 @@ export declare type AsyncFluidObjectProvider<O, R = undefined> = AsyncOptionalFl
7
8
  * This is a condensed version of Record that requires the object has all
8
9
  * the FluidObject properties as its type, mapped to an object that implements
9
10
  * the property or undefined.
11
+ * @internal
10
12
  */
11
13
  export declare type AsyncOptionalFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
12
14
  [P in keyof T]?: Promise<T[P] | undefined>;
@@ -16,6 +18,7 @@ export declare type AsyncOptionalFluidObjectProvider<T> = T extends undefined ?
16
18
  * This is a condensed version of Record that requires the object has all
17
19
  * the FluidObject properties as its type mapped to an object that implements
18
20
  * the property.
21
+ * @internal
19
22
  */
20
23
  export declare type AsyncRequiredFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
21
24
  [P in keyof T]: Promise<NonNullable<Exclude<T[P], undefined | null>>>;
@@ -24,6 +27,7 @@ export declare type AsyncRequiredFluidObjectProvider<T> = T extends undefined ?
24
27
  /**
25
28
  * DependencyContainer is similar to a IoC Container. It takes providers and will
26
29
  * synthesize an object based on them when requested.
30
+ * @internal
27
31
  */
28
32
  export declare class DependencyContainer<TMap> implements IFluidDependencySynthesizer {
29
33
  private readonly providers;
@@ -62,6 +66,7 @@ export declare class DependencyContainer<TMap> implements IFluidDependencySynthe
62
66
 
63
67
  /**
64
68
  * Multiple ways to provide a Fluid object.
69
+ * @internal
65
70
  */
66
71
  export declare type FluidObjectProvider<T> = NonNullable<T> | Promise<NonNullable<T>> | ((dependencyContainer: IFluidDependencySynthesizer) => NonNullable<T>) | ((dependencyContainer: IFluidDependencySynthesizer) => Promise<NonNullable<T>>);
67
72
 
@@ -75,17 +80,22 @@ export declare type FluidObjectProvider<T> = NonNullable<T> | Promise<NonNullabl
75
80
  * ```typescript
76
81
  * { IFoo: "IFoo" }
77
82
  * ```
83
+ * @internal
78
84
  */
79
85
  export declare type FluidObjectSymbolProvider<T> = {
80
86
  [P in keyof T]?: P;
81
87
  };
82
88
 
89
+ /**
90
+ * @internal
91
+ */
83
92
  export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
84
93
 
85
94
  /**
86
95
  * IFluidDependencySynthesizer can generate FluidObjects based on the IProvideFluidObject pattern.
87
96
  * It allow for registering providers and uses synthesize to generate a new object with the optional
88
97
  * and required types.
98
+ * @internal
89
99
  */
90
100
  export declare interface IFluidDependencySynthesizer extends IProvideFluidDependencySynthesizer {
91
101
  /**
@@ -103,6 +113,9 @@ export declare interface IFluidDependencySynthesizer extends IProvideFluidDepend
103
113
  has(type: string): boolean;
104
114
  }
105
115
 
116
+ /**
117
+ * @internal
118
+ */
106
119
  export declare interface IProvideFluidDependencySynthesizer {
107
120
  IFluidDependencySynthesizer: IFluidDependencySynthesizer;
108
121
  }
package/lib/types.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IFluidDependencySynthesizer } from \".\";\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type mapped to a string representation\n * of that property.\n *\n * @example\n *\n * ```typescript\n * { IFoo: \"IFoo\" }\n * ```\n */\nexport type FluidObjectSymbolProvider<T> = {\n\t[P in keyof T]?: P;\n};\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type mapped to an object that implements\n * the property.\n */\nexport type AsyncRequiredFluidObjectProvider<T> = T extends undefined\n\t? Record<string, never>\n\t: {\n\t\t\t[P in keyof T]: Promise<NonNullable<Exclude<T[P], undefined | null>>>;\n\t };\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type, mapped to an object that implements\n * the property or undefined.\n */\nexport type AsyncOptionalFluidObjectProvider<T> = T extends undefined\n\t? Record<string, never>\n\t: {\n\t\t\t[P in keyof T]?: Promise<T[P] | undefined>;\n\t };\n\n/**\n * Combined type for Optional and Required Async Fluid object Providers\n */\nexport type AsyncFluidObjectProvider<O, R = undefined> = AsyncOptionalFluidObjectProvider<O> &\n\tAsyncRequiredFluidObjectProvider<R>;\n\n/**\n * Multiple ways to provide a Fluid object.\n */\nexport type FluidObjectProvider<T> =\n\t| NonNullable<T>\n\t| Promise<NonNullable<T>>\n\t| ((dependencyContainer: IFluidDependencySynthesizer) => NonNullable<T>)\n\t| ((dependencyContainer: IFluidDependencySynthesizer) => Promise<NonNullable<T>>);\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IFluidDependencySynthesizer } from \".\";\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type mapped to a string representation\n * of that property.\n *\n * @example\n *\n * ```typescript\n * { IFoo: \"IFoo\" }\n * ```\n * @internal\n */\nexport type FluidObjectSymbolProvider<T> = {\n\t[P in keyof T]?: P;\n};\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type mapped to an object that implements\n * the property.\n * @internal\n */\nexport type AsyncRequiredFluidObjectProvider<T> = T extends undefined\n\t? Record<string, never>\n\t: {\n\t\t\t[P in keyof T]: Promise<NonNullable<Exclude<T[P], undefined | null>>>;\n\t };\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type, mapped to an object that implements\n * the property or undefined.\n * @internal\n */\nexport type AsyncOptionalFluidObjectProvider<T> = T extends undefined\n\t? Record<string, never>\n\t: {\n\t\t\t[P in keyof T]?: Promise<T[P] | undefined>;\n\t };\n\n/**\n * Combined type for Optional and Required Async Fluid object Providers\n * @internal\n */\nexport type AsyncFluidObjectProvider<O, R = undefined> = AsyncOptionalFluidObjectProvider<O> &\n\tAsyncRequiredFluidObjectProvider<R>;\n\n/**\n * Multiple ways to provide a Fluid object.\n * @internal\n */\nexport type FluidObjectProvider<T> =\n\t| NonNullable<T>\n\t| Promise<NonNullable<T>>\n\t| ((dependencyContainer: IFluidDependencySynthesizer) => NonNullable<T>)\n\t| ((dependencyContainer: IFluidDependencySynthesizer) => Promise<NonNullable<T>>);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/synthesize",
3
- "version": "2.0.0-dev.7.4.0.215930",
3
+ "version": "2.0.0-dev.7.4.0.217212",
4
4
  "description": "A library for synthesizing scope objects.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -51,16 +51,16 @@
51
51
  "temp-directory": "nyc/.nyc_output"
52
52
  },
53
53
  "dependencies": {
54
- "@fluidframework/core-utils": "2.0.0-dev.7.4.0.215930"
54
+ "@fluidframework/core-utils": "2.0.0-dev.7.4.0.217212"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@fluid-tools/build-cli": "^0.28.0",
58
58
  "@fluidframework/build-common": "^2.0.3",
59
59
  "@fluidframework/build-tools": "^0.28.0",
60
- "@fluidframework/core-interfaces": "2.0.0-dev.7.4.0.215930",
61
- "@fluidframework/datastore": "2.0.0-dev.7.4.0.215930",
60
+ "@fluidframework/core-interfaces": "2.0.0-dev.7.4.0.217212",
61
+ "@fluidframework/datastore": "2.0.0-dev.7.4.0.217212",
62
62
  "@fluidframework/eslint-config-fluid": "^3.1.0",
63
- "@fluidframework/mocha-test-setup": "2.0.0-dev.7.4.0.215930",
63
+ "@fluidframework/mocha-test-setup": "2.0.0-dev.7.4.0.217212",
64
64
  "@fluidframework/synthesize-previous": "npm:@fluidframework/synthesize@2.0.0-internal.7.2.0",
65
65
  "@microsoft/api-extractor": "^7.38.3",
66
66
  "@types/mocha": "^9.1.1",
@@ -103,12 +103,13 @@
103
103
  "build:docs": "fluid-build . --task api",
104
104
  "build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
105
105
  "build:test": "tsc-multi --config ./tsc-multi.test.json",
106
+ "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
106
107
  "ci:build:docs": "api-extractor run",
107
108
  "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
108
109
  "eslint": "eslint --format stylish src",
109
110
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
110
111
  "format": "npm run prettier:fix",
111
- "lint": "npm run prettier && npm run eslint",
112
+ "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
112
113
  "lint:fix": "npm run prettier:fix && npm run eslint:fix",
113
114
  "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
114
115
  "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",