@fluidframework/synthesize 2.0.0-dev.7.3.0.211848 → 2.0.0-dev.7.4.0.214930

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.
@@ -0,0 +1,110 @@
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>;
5
+
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
+ };
14
+
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
+ };
23
+
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
+ }
62
+
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>>);
67
+
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
+ };
82
+
83
+ export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
84
+
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
+ }
109
+
110
+ export { }
@@ -0,0 +1,110 @@
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>;
5
+
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
+ };
14
+
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
+ };
23
+
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
+ }
62
+
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>>);
67
+
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
+ };
82
+
83
+ export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
84
+
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
+ }
109
+
110
+ export { }
@@ -0,0 +1,110 @@
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>;
5
+
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
+ };
14
+
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
+ };
23
+
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
+ }
62
+
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>>);
67
+
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
+ };
82
+
83
+ export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
84
+
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
+ }
109
+
110
+ export { }
@@ -0,0 +1,110 @@
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>;
5
+
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
+ };
14
+
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
+ };
23
+
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
+ }
62
+
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>>);
67
+
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
+ };
82
+
83
+ export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
84
+
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
+ }
109
+
110
+ export { }
@@ -0,0 +1,110 @@
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>;
5
+
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
+ };
14
+
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
+ };
23
+
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
+ }
62
+
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>>);
67
+
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
+ };
82
+
83
+ export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
84
+
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
+ }
109
+
110
+ export { }
@@ -0,0 +1,110 @@
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>;
5
+
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
+ };
14
+
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
+ };
23
+
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
+ }
62
+
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>>);
67
+
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
+ };
82
+
83
+ export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
84
+
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
+ }
109
+
110
+ export { }
@@ -0,0 +1,110 @@
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>;
5
+
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
+ };
14
+
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
+ };
23
+
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
+ }
62
+
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>>);
67
+
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
+ };
82
+
83
+ export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
84
+
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
+ }
109
+
110
+ export { }
@@ -0,0 +1,110 @@
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>;
5
+
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
+ };
14
+
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
+ };
23
+
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
+ }
62
+
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>>);
67
+
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
+ };
82
+
83
+ export declare const IFluidDependencySynthesizer: keyof IProvideFluidDependencySynthesizer;
84
+
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
+ }
109
+
110
+ export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/synthesize",
3
- "version": "2.0.0-dev.7.3.0.211848",
3
+ "version": "2.0.0-dev.7.4.0.214930",
4
4
  "description": "A library for synthesizing scope objects.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -51,21 +51,22 @@
51
51
  "temp-directory": "nyc/.nyc_output"
52
52
  },
53
53
  "dependencies": {
54
- "@fluidframework/core-utils": "2.0.0-dev.7.3.0.211848"
54
+ "@fluidframework/core-utils": "2.0.0-dev.7.4.0.214930"
55
55
  },
56
56
  "devDependencies": {
57
- "@fluid-tools/build-cli": "0.28.0-210888",
57
+ "@fluid-tools/build-cli": "^0.28.0",
58
58
  "@fluidframework/build-common": "^2.0.3",
59
- "@fluidframework/build-tools": "0.28.0-210888",
60
- "@fluidframework/core-interfaces": "2.0.0-dev.7.3.0.211848",
61
- "@fluidframework/datastore": "2.0.0-dev.7.3.0.211848",
59
+ "@fluidframework/build-tools": "^0.28.0",
60
+ "@fluidframework/core-interfaces": "2.0.0-dev.7.4.0.214930",
61
+ "@fluidframework/datastore": "2.0.0-dev.7.4.0.214930",
62
62
  "@fluidframework/eslint-config-fluid": "^3.1.0",
63
- "@fluidframework/mocha-test-setup": "2.0.0-dev.7.3.0.211848",
63
+ "@fluidframework/mocha-test-setup": "2.0.0-dev.7.4.0.214930",
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",
67
67
  "@types/node": "^16.18.38",
68
68
  "c8": "^7.7.1",
69
+ "copyfiles": "^2.4.1",
69
70
  "cross-env": "^7.0.3",
70
71
  "eslint": "~8.50.0",
71
72
  "mocha": "^10.2.0",
@@ -77,14 +78,29 @@
77
78
  "tsc-multi": "^1.1.0",
78
79
  "typescript": "~5.1.6"
79
80
  },
81
+ "fluidBuild": {
82
+ "tasks": {
83
+ "build:docs": {
84
+ "dependsOn": [
85
+ "...",
86
+ "api-extractor:commonjs",
87
+ "api-extractor:esnext"
88
+ ],
89
+ "script": false
90
+ }
91
+ }
92
+ },
80
93
  "typeValidation": {
81
94
  "broken": {}
82
95
  },
83
96
  "scripts": {
97
+ "api": "fluid-build . --task api",
98
+ "api-extractor:commonjs": "api-extractor run --local",
99
+ "api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
84
100
  "build": "fluid-build . --task build",
85
101
  "build:commonjs": "fluid-build . --task commonjs",
86
102
  "build:compile": "fluid-build . --task compile",
87
- "build:docs": "api-extractor run --local",
103
+ "build:docs": "fluid-build . --task api",
88
104
  "build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
89
105
  "build:test": "tsc-multi --config ./tsc-multi.test.json",
90
106
  "ci:build:docs": "api-extractor run",
@@ -94,8 +110,8 @@
94
110
  "format": "npm run prettier:fix",
95
111
  "lint": "npm run prettier && npm run eslint",
96
112
  "lint:fix": "npm run prettier:fix && npm run eslint:fix",
97
- "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
98
- "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
113
+ "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
114
+ "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
99
115
  "test": "npm run test:mocha",
100
116
  "test:coverage": "c8 npm test",
101
117
  "test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",