@fluidframework/container-runtime-definitions 2.41.0-338401 → 2.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/container-runtime-definitions
2
2
 
3
+ ## 2.41.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.40.0
4
8
 
5
9
  Dependency updates only.
@@ -0,0 +1,225 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { IAudience } from "@fluidframework/container-definitions/internal";
6
+ import type { BrandedType, InternalUtilityTypes, ITelemetryBaseLogger, JsonDeserialized, JsonSerializable, Listenable, TypedMessage } from "@fluidframework/core-interfaces/internal";
7
+ import type { IQuorumClients } from "@fluidframework/driver-definitions/internal";
8
+ /**
9
+ * While connected, the id of a client within a session.
10
+ *
11
+ * @internal
12
+ */
13
+ export type ClientConnectionId = string;
14
+ /**
15
+ * Common structure between incoming and outgoing extension signals.
16
+ *
17
+ * @remarks
18
+ * Do not use directly, use {@link OutboundExtensionMessage} or {@link InboundExtensionMessage} instead.
19
+ *
20
+ * @sealed
21
+ * @internal
22
+ */
23
+ export type ExtensionMessage<TMessage extends TypedMessage = {
24
+ type: string;
25
+ content: JsonSerializable<unknown> | JsonDeserialized<unknown>;
26
+ }> = TMessage extends TypedMessage ? InternalUtilityTypes.FlattenIntersection<TMessage & {
27
+ /**
28
+ * Client ID of the singular client the message is being (or has been) sent to.
29
+ * May only be specified when IConnect.supportedFeatures['submit_signals_v2'] is true, will throw otherwise.
30
+ */
31
+ targetClientId?: ClientConnectionId;
32
+ }> : never;
33
+ /**
34
+ * Outgoing extension signals.
35
+ *
36
+ * @sealed
37
+ * @internal
38
+ */
39
+ export type OutboundExtensionMessage<TMessage extends TypedMessage = TypedMessage> = ExtensionMessage<{
40
+ type: TMessage["type"];
41
+ content: JsonSerializable<TMessage["content"]>;
42
+ }>;
43
+ /**
44
+ * Brand for value that has not been verified.
45
+ *
46
+ * Usage:
47
+ *
48
+ * - Cast to with `as unknown as UnverifiedBrand<T>` when value of or containing expected type `T` is yet unknown.
49
+ *
50
+ * - Cast from with `as unknown` when "instance" will be parsed to `T`.
51
+ *
52
+ * @sealed
53
+ * @internal
54
+ */
55
+ export declare class UnverifiedBrand<T> extends BrandedType<T> {
56
+ private readonly UnverifiedValue;
57
+ private constructor();
58
+ }
59
+ /**
60
+ * Unverified incoming extension signals.
61
+ *
62
+ * @sealed
63
+ * @internal
64
+ */
65
+ export type RawInboundExtensionMessage<TMessage extends TypedMessage = TypedMessage> = TMessage extends TypedMessage ? InternalUtilityTypes.FlattenIntersection<ExtensionMessage<{
66
+ type: string;
67
+ content: JsonDeserialized<unknown>;
68
+ }> & {
69
+ /**
70
+ * The client ID that submitted the message.
71
+ * For server generated messages the clientId will be null.
72
+ */
73
+ clientId: ClientConnectionId | null;
74
+ }> & UnverifiedBrand<TMessage> : never;
75
+ /**
76
+ * Verified incoming extension signals.
77
+ *
78
+ * @sealed
79
+ * @internal
80
+ */
81
+ export type VerifiedInboundExtensionMessage<TMessage extends TypedMessage = TypedMessage> = TMessage extends TypedMessage ? InternalUtilityTypes.FlattenIntersection<ExtensionMessage<{
82
+ type: TMessage["type"];
83
+ content: JsonDeserialized<TMessage["content"]>;
84
+ }> & {
85
+ /**
86
+ * The client ID that submitted the message.
87
+ * For server generated messages the clientId will be null.
88
+ */
89
+ clientId: ClientConnectionId | null;
90
+ }> : never;
91
+ /**
92
+ * Incoming extension signal that may be of the known type or has not yet been validated.
93
+ *
94
+ * @sealed
95
+ * @internal
96
+ */
97
+ export type InboundExtensionMessage<TMessage extends TypedMessage = TypedMessage> = RawInboundExtensionMessage<TMessage> | VerifiedInboundExtensionMessage<TMessage>;
98
+ /**
99
+ * @internal
100
+ */
101
+ export interface ExtensionRuntimeProperties {
102
+ SignalMessages: TypedMessage;
103
+ }
104
+ /**
105
+ * Defines requirements for a component to register with container as an extension.
106
+ *
107
+ * @internal
108
+ */
109
+ export interface ContainerExtension<TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[] = []> {
110
+ /**
111
+ * Notifies the extension of a new use context.
112
+ *
113
+ * @param useContext - Context new reference to extension is acquired within.
114
+ *
115
+ * @remarks
116
+ * This is called when a secondary reference to the extension is acquired.
117
+ * useContext is the array of arguments that would otherwise be passed to
118
+ * the factory during first acquisition request.
119
+ */
120
+ onNewUse(...useContext: TUseContext): void;
121
+ /**
122
+ * Callback for signal sent by this extension.
123
+ *
124
+ * @param addressChain - Address chain of the signal
125
+ * @param signalMessage - Signal unverified content and metadata
126
+ * @param local - True if signal was sent by this client
127
+ *
128
+ */
129
+ processSignal?: (addressChain: string[], signalMessage: InboundExtensionMessage<TRuntimeProperties["SignalMessages"]>, local: boolean) => void;
130
+ }
131
+ /**
132
+ * Events emitted by the {@link ExtensionHost}.
133
+ *
134
+ * @internal
135
+ */
136
+ export interface ExtensionHostEvents {
137
+ "disconnected": () => void;
138
+ "connected": (clientId: ClientConnectionId) => void;
139
+ }
140
+ /**
141
+ * Defines the runtime aspects an extension may access.
142
+ *
143
+ * @remarks
144
+ * In most cases this is a logical subset of {@link @fluidframework/container-runtime-definitions#IContainerRuntime}.
145
+ *
146
+ * @sealed
147
+ * @internal
148
+ */
149
+ export interface ExtensionHost<TRuntimeProperties extends ExtensionRuntimeProperties> {
150
+ readonly isConnected: () => boolean;
151
+ readonly getClientId: () => ClientConnectionId | undefined;
152
+ readonly events: Listenable<ExtensionHostEvents>;
153
+ readonly logger: ITelemetryBaseLogger;
154
+ /**
155
+ * Submits a signal to be sent to other clients.
156
+ * @param addressChain - Custom address sequence for the signal.
157
+ * @param message - Custom message content of the signal.
158
+ *
159
+ * Upon receipt of signal, {@link ContainerExtension.processSignal} will be called with the same
160
+ * address and message (less any non-{@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify|JSON.stringify}-able data).
161
+ */
162
+ submitAddressedSignal: (addressChain: string[], message: OutboundExtensionMessage<TRuntimeProperties["SignalMessages"]>) => void;
163
+ /**
164
+ * The collection of write clients which were connected as of the current sequence number.
165
+ * Also contains a map of key-value pairs that must be agreed upon by all clients before being accepted.
166
+ */
167
+ getQuorum: () => IQuorumClients;
168
+ getAudience: () => IAudience;
169
+ }
170
+ /**
171
+ * Factory method to create an extension instance.
172
+ *
173
+ * Any such method provided to {@link ContainerExtensionStore.acquireExtension}
174
+ * must use the same value for a given {@link ContainerExtensionId} so that an
175
+ * `instanceof` check may be performed at runtime.
176
+ *
177
+ * @typeParam T - Type of extension to create
178
+ * @typeParam TRuntimeProperties - Extension runtime properties
179
+ * @typeParam TUseContext - Array of custom use context passed to factory or onNewUse
180
+ *
181
+ * @param host - Host runtime for extension to work against
182
+ * @param useContext - Custom use context for extension.
183
+ * @returns Record providing:
184
+ * `interface` instance (type `T`) that is provided to caller of
185
+ * {@link ContainerExtensionStore.acquireExtension} and
186
+ * `extension` store/runtime uses to interact with extension.
187
+ *
188
+ * @internal
189
+ */
190
+ export type ContainerExtensionFactory<T, TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[] = []> = new (host: ExtensionHost<TRuntimeProperties>, ...useContext: TUseContext) => {
191
+ readonly interface: T;
192
+ readonly extension: ContainerExtension<TRuntimeProperties, TUseContext>;
193
+ };
194
+ /**
195
+ * Unique identifier for extension
196
+ *
197
+ * @remarks
198
+ * A string known to all clients working with a certain ContainerExtension and unique
199
+ * among ContainerExtensions. Not `/` may be used in the string. Recommend using
200
+ * concatenation of: type of unique identifier, `:` (required), and unique identifier.
201
+ *
202
+ * @example Examples
203
+ * ```typescript
204
+ * "guid:g0fl001d-1415-5000-c00l-g0fa54g0b1g1"
205
+ * "name:@foo-scope_bar:v1"
206
+ * ```
207
+ *
208
+ * @internal
209
+ */
210
+ export type ContainerExtensionId = `${string}:${string}`;
211
+ /**
212
+ * @sealed
213
+ * @internal
214
+ */
215
+ export interface ContainerExtensionStore {
216
+ /**
217
+ * Acquires an extension from store or adds new one.
218
+ *
219
+ * @param id - Identifier for the requested extension
220
+ * @param factory - Factory to create the extension if not found
221
+ * @returns The extension
222
+ */
223
+ acquireExtension<T, TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[] = []>(id: ContainerExtensionId, factory: ContainerExtensionFactory<T, TRuntimeProperties, TUseContext>, ...context: TUseContext): T;
224
+ }
225
+ //# sourceMappingURL=containerExtension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"containerExtension.d.ts","sourceRoot":"","sources":["../src/containerExtension.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;AAEhF,OAAO,KAAK,EACX,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAElF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAExC;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,CAC3B,QAAQ,SAAS,YAAY,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;CAC/D,IAED,QAAQ,SAAS,YAAY,GAC1B,oBAAoB,CAAC,mBAAmB,CACxC,QAAQ,GAAG;IACV;;;OAGG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC;CACpC,CACD,GACA,KAAK,CAAC;AAEV;;;;;GAKG;AACH,MAAM,MAAM,wBAAwB,CAAC,QAAQ,SAAS,YAAY,GAAG,YAAY,IAChF,gBAAgB,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IA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IAAI,EAAE,aAAa,CAAC,kBAAkB,CAAC,EACvC,GAAG,UAAU,EAAE,WAAW,KACtB;IACJ,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;CACxE,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,oBAAoB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;;;;OAMG;IACH,gBAAgB,CACf,CAAC,EACD,kBAAkB,SAAS,0BAA0B,EACrD,WAAW,SAAS,OAAO,EAAE,GAAG,EAAE,EAElC,EAAE,EAAE,oBAAoB,EACxB,OAAO,EAAE,yBAAyB,CAAC,CAAC,EAAE,kBAAkB,EAAE,WAAW,CAAC,EACtE,GAAG,OAAO,EAAE,WAAW,GACrB,CAAC,CAAC;CACL"}
@@ -9,6 +9,7 @@ import type { IFluidHandleContext } from "@fluidframework/core-interfaces/intern
9
9
  import type { IClientDetails } from "@fluidframework/driver-definitions";
10
10
  import type { IDocumentStorageService, IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
11
11
  import type { FlushMode, IContainerRuntimeBase, IContainerRuntimeBaseEvents, IProvideFluidDataStoreRegistry } from "@fluidframework/runtime-definitions/internal";
12
+ import type { ContainerExtensionStore } from "./containerExtension.js";
12
13
  /**
13
14
  * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
14
15
  * @legacy
@@ -150,4 +151,11 @@ export interface IContainerRuntime extends IProvideFluidDataStoreRegistry, ICont
150
151
  */
151
152
  getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
152
153
  }
154
+ /**
155
+ * Represents the internal version of the runtime of the container.
156
+ *
157
+ * @internal
158
+ */
159
+ export interface IContainerRuntimeInternal extends IContainerRuntime, ContainerExtensionStore {
160
+ }
153
161
  //# sourceMappingURL=containerRuntime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"containerRuntime.d.ts","sourceRoot":"","sources":["../src/containerRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,KAAK,EACX,WAAW,EACX,MAAM,EACN,cAAc,EACd,QAAQ,EACR,SAAS,EACT,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EACX,uBAAuB,EACvB,gBAAgB,EAChB,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EACX,SAAS,EACT,qBAAqB,EACrB,2BAA2B,EAC3B,8BAA8B,EAC9B,MAAM,8CAA8C,CAAC;AAEtD;;;;GAIG;AACH,MAAM,WAAW,6CAA8C,SAAQ,iBAAiB;IACvF,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAClD,aAAa,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CACrD;AAED;;;;;GAKG;AACH,MAAM,WAAW,uBAChB,SAAQ,2BAA2B,EAClC,iBAAiB;IAClB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,OAAO,GAAG,UAAU,EAAE,QAAQ,EAAE,MAAM,IAAI,OAAE;IAC/E,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,OAAE;CAC3D;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB;AAC/B;;GAEG;AACD,iBAAiB;AACnB;;GAEG;GACD,oBAAoB;AAC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AE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,aAAa,EAAE,cAAc,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,CAAC;IAClF,QAAQ,CAAC,OAAO,EAAE,uBAAuB,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACjE;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAChB,SAAQ,iBAAiB,EACxB,uBAAuB;CAAG"}
package/dist/index.d.ts CHANGED
@@ -2,5 +2,6 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export type { IContainerRuntime, IContainerRuntimeBaseWithCombinedEvents, IContainerRuntimeEvents, IContainerRuntimeWithResolveHandle_Deprecated, SummarizerStopReason, ISummarizeEventProps, ISummarizerObservabilityProps, ISummarizerEvents, } from "./containerRuntime.js";
5
+ export type { ClientConnectionId, ContainerExtensionFactory, ContainerExtensionId, ContainerExtensionStore, ContainerExtension, ExtensionHost, ExtensionHostEvents, ExtensionMessage, ExtensionRuntimeProperties, InboundExtensionMessage, OutboundExtensionMessage, RawInboundExtensionMessage, UnverifiedBrand, VerifiedInboundExtensionMessage, } from "./containerExtension.js";
6
+ export type { IContainerRuntime, IContainerRuntimeBaseWithCombinedEvents, IContainerRuntimeEvents, IContainerRuntimeInternal, IContainerRuntimeWithResolveHandle_Deprecated, SummarizerStopReason, ISummarizeEventProps, ISummarizerObservabilityProps, ISummarizerEvents, } from "./containerRuntime.js";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACX,iBAAiB,EACjB,uCAAuC,EACvC,uBAAuB,EACvB,6CAA6C,EAC7C,oBAAoB,EACpB,oBAAoB,EACpB,6BAA6B,EAC7B,iBAAiB,GACjB,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACX,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,eAAe,EACf,+BAA+B,GAC/B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACX,iBAAiB,EACjB,uCAAuC,EACvC,uBAAuB,EACvB,yBAAyB,EACzB,6CAA6C,EAC7C,oBAAoB,EACpB,oBAAoB,EACpB,6BAA6B,EAC7B,iBAAiB,GACjB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,225 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { IAudience } from "@fluidframework/container-definitions/internal";
6
+ import type { BrandedType, InternalUtilityTypes, ITelemetryBaseLogger, JsonDeserialized, JsonSerializable, Listenable, TypedMessage } from "@fluidframework/core-interfaces/internal";
7
+ import type { IQuorumClients } from "@fluidframework/driver-definitions/internal";
8
+ /**
9
+ * While connected, the id of a client within a session.
10
+ *
11
+ * @internal
12
+ */
13
+ export type ClientConnectionId = string;
14
+ /**
15
+ * Common structure between incoming and outgoing extension signals.
16
+ *
17
+ * @remarks
18
+ * Do not use directly, use {@link OutboundExtensionMessage} or {@link InboundExtensionMessage} instead.
19
+ *
20
+ * @sealed
21
+ * @internal
22
+ */
23
+ export type ExtensionMessage<TMessage extends TypedMessage = {
24
+ type: string;
25
+ content: JsonSerializable<unknown> | JsonDeserialized<unknown>;
26
+ }> = TMessage extends TypedMessage ? InternalUtilityTypes.FlattenIntersection<TMessage & {
27
+ /**
28
+ * Client ID of the singular client the message is being (or has been) sent to.
29
+ * May only be specified when IConnect.supportedFeatures['submit_signals_v2'] is true, will throw otherwise.
30
+ */
31
+ targetClientId?: ClientConnectionId;
32
+ }> : never;
33
+ /**
34
+ * Outgoing extension signals.
35
+ *
36
+ * @sealed
37
+ * @internal
38
+ */
39
+ export type OutboundExtensionMessage<TMessage extends TypedMessage = TypedMessage> = ExtensionMessage<{
40
+ type: TMessage["type"];
41
+ content: JsonSerializable<TMessage["content"]>;
42
+ }>;
43
+ /**
44
+ * Brand for value that has not been verified.
45
+ *
46
+ * Usage:
47
+ *
48
+ * - Cast to with `as unknown as UnverifiedBrand<T>` when value of or containing expected type `T` is yet unknown.
49
+ *
50
+ * - Cast from with `as unknown` when "instance" will be parsed to `T`.
51
+ *
52
+ * @sealed
53
+ * @internal
54
+ */
55
+ export declare class UnverifiedBrand<T> extends BrandedType<T> {
56
+ private readonly UnverifiedValue;
57
+ private constructor();
58
+ }
59
+ /**
60
+ * Unverified incoming extension signals.
61
+ *
62
+ * @sealed
63
+ * @internal
64
+ */
65
+ export type RawInboundExtensionMessage<TMessage extends TypedMessage = TypedMessage> = TMessage extends TypedMessage ? InternalUtilityTypes.FlattenIntersection<ExtensionMessage<{
66
+ type: string;
67
+ content: JsonDeserialized<unknown>;
68
+ }> & {
69
+ /**
70
+ * The client ID that submitted the message.
71
+ * For server generated messages the clientId will be null.
72
+ */
73
+ clientId: ClientConnectionId | null;
74
+ }> & UnverifiedBrand<TMessage> : never;
75
+ /**
76
+ * Verified incoming extension signals.
77
+ *
78
+ * @sealed
79
+ * @internal
80
+ */
81
+ export type VerifiedInboundExtensionMessage<TMessage extends TypedMessage = TypedMessage> = TMessage extends TypedMessage ? InternalUtilityTypes.FlattenIntersection<ExtensionMessage<{
82
+ type: TMessage["type"];
83
+ content: JsonDeserialized<TMessage["content"]>;
84
+ }> & {
85
+ /**
86
+ * The client ID that submitted the message.
87
+ * For server generated messages the clientId will be null.
88
+ */
89
+ clientId: ClientConnectionId | null;
90
+ }> : never;
91
+ /**
92
+ * Incoming extension signal that may be of the known type or has not yet been validated.
93
+ *
94
+ * @sealed
95
+ * @internal
96
+ */
97
+ export type InboundExtensionMessage<TMessage extends TypedMessage = TypedMessage> = RawInboundExtensionMessage<TMessage> | VerifiedInboundExtensionMessage<TMessage>;
98
+ /**
99
+ * @internal
100
+ */
101
+ export interface ExtensionRuntimeProperties {
102
+ SignalMessages: TypedMessage;
103
+ }
104
+ /**
105
+ * Defines requirements for a component to register with container as an extension.
106
+ *
107
+ * @internal
108
+ */
109
+ export interface ContainerExtension<TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[] = []> {
110
+ /**
111
+ * Notifies the extension of a new use context.
112
+ *
113
+ * @param useContext - Context new reference to extension is acquired within.
114
+ *
115
+ * @remarks
116
+ * This is called when a secondary reference to the extension is acquired.
117
+ * useContext is the array of arguments that would otherwise be passed to
118
+ * the factory during first acquisition request.
119
+ */
120
+ onNewUse(...useContext: TUseContext): void;
121
+ /**
122
+ * Callback for signal sent by this extension.
123
+ *
124
+ * @param addressChain - Address chain of the signal
125
+ * @param signalMessage - Signal unverified content and metadata
126
+ * @param local - True if signal was sent by this client
127
+ *
128
+ */
129
+ processSignal?: (addressChain: string[], signalMessage: InboundExtensionMessage<TRuntimeProperties["SignalMessages"]>, local: boolean) => void;
130
+ }
131
+ /**
132
+ * Events emitted by the {@link ExtensionHost}.
133
+ *
134
+ * @internal
135
+ */
136
+ export interface ExtensionHostEvents {
137
+ "disconnected": () => void;
138
+ "connected": (clientId: ClientConnectionId) => void;
139
+ }
140
+ /**
141
+ * Defines the runtime aspects an extension may access.
142
+ *
143
+ * @remarks
144
+ * In most cases this is a logical subset of {@link @fluidframework/container-runtime-definitions#IContainerRuntime}.
145
+ *
146
+ * @sealed
147
+ * @internal
148
+ */
149
+ export interface ExtensionHost<TRuntimeProperties extends ExtensionRuntimeProperties> {
150
+ readonly isConnected: () => boolean;
151
+ readonly getClientId: () => ClientConnectionId | undefined;
152
+ readonly events: Listenable<ExtensionHostEvents>;
153
+ readonly logger: ITelemetryBaseLogger;
154
+ /**
155
+ * Submits a signal to be sent to other clients.
156
+ * @param addressChain - Custom address sequence for the signal.
157
+ * @param message - Custom message content of the signal.
158
+ *
159
+ * Upon receipt of signal, {@link ContainerExtension.processSignal} will be called with the same
160
+ * address and message (less any non-{@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify|JSON.stringify}-able data).
161
+ */
162
+ submitAddressedSignal: (addressChain: string[], message: OutboundExtensionMessage<TRuntimeProperties["SignalMessages"]>) => void;
163
+ /**
164
+ * The collection of write clients which were connected as of the current sequence number.
165
+ * Also contains a map of key-value pairs that must be agreed upon by all clients before being accepted.
166
+ */
167
+ getQuorum: () => IQuorumClients;
168
+ getAudience: () => IAudience;
169
+ }
170
+ /**
171
+ * Factory method to create an extension instance.
172
+ *
173
+ * Any such method provided to {@link ContainerExtensionStore.acquireExtension}
174
+ * must use the same value for a given {@link ContainerExtensionId} so that an
175
+ * `instanceof` check may be performed at runtime.
176
+ *
177
+ * @typeParam T - Type of extension to create
178
+ * @typeParam TRuntimeProperties - Extension runtime properties
179
+ * @typeParam TUseContext - Array of custom use context passed to factory or onNewUse
180
+ *
181
+ * @param host - Host runtime for extension to work against
182
+ * @param useContext - Custom use context for extension.
183
+ * @returns Record providing:
184
+ * `interface` instance (type `T`) that is provided to caller of
185
+ * {@link ContainerExtensionStore.acquireExtension} and
186
+ * `extension` store/runtime uses to interact with extension.
187
+ *
188
+ * @internal
189
+ */
190
+ export type ContainerExtensionFactory<T, TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[] = []> = new (host: ExtensionHost<TRuntimeProperties>, ...useContext: TUseContext) => {
191
+ readonly interface: T;
192
+ readonly extension: ContainerExtension<TRuntimeProperties, TUseContext>;
193
+ };
194
+ /**
195
+ * Unique identifier for extension
196
+ *
197
+ * @remarks
198
+ * A string known to all clients working with a certain ContainerExtension and unique
199
+ * among ContainerExtensions. Not `/` may be used in the string. Recommend using
200
+ * concatenation of: type of unique identifier, `:` (required), and unique identifier.
201
+ *
202
+ * @example Examples
203
+ * ```typescript
204
+ * "guid:g0fl001d-1415-5000-c00l-g0fa54g0b1g1"
205
+ * "name:@foo-scope_bar:v1"
206
+ * ```
207
+ *
208
+ * @internal
209
+ */
210
+ export type ContainerExtensionId = `${string}:${string}`;
211
+ /**
212
+ * @sealed
213
+ * @internal
214
+ */
215
+ export interface ContainerExtensionStore {
216
+ /**
217
+ * Acquires an extension from store or adds new one.
218
+ *
219
+ * @param id - Identifier for the requested extension
220
+ * @param factory - Factory to create the extension if not found
221
+ * @returns The extension
222
+ */
223
+ acquireExtension<T, TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[] = []>(id: ContainerExtensionId, factory: ContainerExtensionFactory<T, TRuntimeProperties, TUseContext>, ...context: TUseContext): T;
224
+ }
225
+ //# sourceMappingURL=containerExtension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"containerExtension.d.ts","sourceRoot":"","sources":["../src/containerExtension.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;AAEhF,OAAO,KAAK,EACX,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAElF;;;;GAIG;AACH,MA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AAkB,GAAG,SAAS,CAAC;IAE3D,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAEjD,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAEtC;;;;;;;OAOG;IACH,qBAAqB,EAAE,CACtB,YAAY,EAAE,MAAM,EAAE,EACtB,OAAO,EAAE,wBAAwB,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,KACnE,IAAI,CAAC;IAEV;;;OAGG;IACH,SAAS,EAAE,MAAM,cAAc,CAAC;IAEhC,WAAW,EAAE,MAAM,SAAS,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,yBAAyB,CACpC,CAAC,EACD,kBAAkB,SAAS,0BAA0B,EACrD,WAAW,SAAS,OAAO,EAAE,GAAG,EAAE,IAC/B,KACH,IAAI,EAAE,aAAa,CAAC,kBAAkB,CAAC,EACvC,GAAG,UAAU,EAAE,WAAW,KACtB;IACJ,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;CACxE,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,oBAAoB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;;;;OAMG;IACH,gBAAgB,CACf,CAAC,EACD,kBAAkB,SAAS,0BAA0B,EACrD,WAAW,SAAS,OAAO,EAAE,GAAG,EAAE,EAElC,EAAE,EAAE,oBAAoB,EACxB,OAAO,EAAE,yBAAyB,CAAC,CAAC,EAAE,kBAAkB,EAAE,WAAW,CAAC,EACtE,GAAG,OAAO,EAAE,WAAW,GACrB,CAAC,CAAC;CACL"}
@@ -9,6 +9,7 @@ import type { IFluidHandleContext } from "@fluidframework/core-interfaces/intern
9
9
  import type { IClientDetails } from "@fluidframework/driver-definitions";
10
10
  import type { IDocumentStorageService, IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
11
11
  import type { FlushMode, IContainerRuntimeBase, IContainerRuntimeBaseEvents, IProvideFluidDataStoreRegistry } from "@fluidframework/runtime-definitions/internal";
12
+ import type { ContainerExtensionStore } from "./containerExtension.js";
12
13
  /**
13
14
  * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
14
15
  * @legacy
@@ -150,4 +151,11 @@ export interface IContainerRuntime extends IProvideFluidDataStoreRegistry, ICont
150
151
  */
151
152
  getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
152
153
  }
154
+ /**
155
+ * Represents the internal version of the runtime of the container.
156
+ *
157
+ * @internal
158
+ */
159
+ export interface IContainerRuntimeInternal extends IContainerRuntime, ContainerExtensionStore {
160
+ }
153
161
  //# sourceMappingURL=containerRuntime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"containerRuntime.d.ts","sourceRoot":"","sources":["../src/containerRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,KAAK,EACX,WAAW,EACX,MAAM,EACN,cAAc,EACd,QAAQ,EACR,SAAS,EACT,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EACX,uBAAuB,EACvB,gBAAgB,EAChB,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EACX,SAAS,EACT,qBAAqB,EACrB,2BAA2B,EAC3B,8BAA8B,EAC9B,MAAM,8CAA8C,CAAC;AAEtD;;;;GAIG;A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ors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export type { IContainerRuntime, IContainerRuntimeBaseWithCombinedEvents, IContainerRuntimeEvents, IContainerRuntimeWithResolveHandle_Deprecated, SummarizerStopReason, ISummarizeEventProps, ISummarizerObservabilityProps, ISummarizerEvents, } from "./containerRuntime.js";
5
+ export type { ClientConnectionId, ContainerExtensionFactory, ContainerExtensionId, ContainerExtensionStore, ContainerExtension, ExtensionHost, ExtensionHostEvents, ExtensionMessage, ExtensionRuntimeProperties, InboundExtensionMessage, OutboundExtensionMessage, RawInboundExtensionMessage, UnverifiedBrand, VerifiedInboundExtensionMessage, } from "./containerExtension.js";
6
+ export type { IContainerRuntime, IContainerRuntimeBaseWithCombinedEvents, IContainerRuntimeEvents, IContainerRuntimeInternal, IContainerRuntimeWithResolveHandle_Deprecated, SummarizerStopReason, ISummarizeEventProps, ISummarizerObservabilityProps, ISummarizerEvents, } from "./containerRuntime.js";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACX,iBAAiB,EACjB,uCAAuC,EACvC,uBAAuB,EACvB,6CAA6C,EAC7C,oBAAoB,EACpB,oBAAoB,EACpB,6BAA6B,EAC7B,iBAAiB,GACjB,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACX,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,eAAe,EACf,+BAA+B,GAC/B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACX,iBAAiB,EACjB,uCAAuC,EACvC,uBAAuB,EACvB,yBAAyB,EACzB,6CAA6C,EAC7C,oBAAoB,EACpB,oBAAoB,EACpB,6BAA6B,EAC7B,iBAAiB,GACjB,MAAM,uBAAuB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/container-runtime-definitions",
3
- "version": "2.41.0-338401",
3
+ "version": "2.41.0",
4
4
  "description": "Fluid Runtime definitions",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -41,10 +41,10 @@
41
41
  "main": "",
42
42
  "types": "lib/public.d.ts",
43
43
  "dependencies": {
44
- "@fluidframework/container-definitions": "2.41.0-338401",
45
- "@fluidframework/core-interfaces": "2.41.0-338401",
46
- "@fluidframework/driver-definitions": "2.41.0-338401",
47
- "@fluidframework/runtime-definitions": "2.41.0-338401"
44
+ "@fluidframework/container-definitions": "~2.41.0",
45
+ "@fluidframework/core-interfaces": "~2.41.0",
46
+ "@fluidframework/driver-definitions": "~2.41.0",
47
+ "@fluidframework/runtime-definitions": "~2.41.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@arethetypeswrong/cli": "^0.17.1",
@@ -53,7 +53,7 @@
53
53
  "@fluidframework/build-common": "^2.0.3",
54
54
  "@fluidframework/build-tools": "^0.55.0",
55
55
  "@fluidframework/container-runtime-definitions-previous": "npm:@fluidframework/container-runtime-definitions@2.40.0",
56
- "@fluidframework/eslint-config-fluid": "^5.7.3",
56
+ "@fluidframework/eslint-config-fluid": "^5.7.4",
57
57
  "@microsoft/api-extractor": "7.52.8",
58
58
  "concurrently": "^8.2.1",
59
59
  "copyfiles": "^2.4.1",
@@ -0,0 +1,301 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import type { IAudience } from "@fluidframework/container-definitions/internal";
7
+ // eslint-disable-next-line @typescript-eslint/consistent-type-imports -- BrandedType is a class declaration only
8
+ import type {
9
+ BrandedType,
10
+ InternalUtilityTypes,
11
+ ITelemetryBaseLogger,
12
+ JsonDeserialized,
13
+ JsonSerializable,
14
+ Listenable,
15
+ TypedMessage,
16
+ } from "@fluidframework/core-interfaces/internal";
17
+ import type { IQuorumClients } from "@fluidframework/driver-definitions/internal";
18
+
19
+ /**
20
+ * While connected, the id of a client within a session.
21
+ *
22
+ * @internal
23
+ */
24
+ export type ClientConnectionId = string;
25
+
26
+ /**
27
+ * Common structure between incoming and outgoing extension signals.
28
+ *
29
+ * @remarks
30
+ * Do not use directly, use {@link OutboundExtensionMessage} or {@link InboundExtensionMessage} instead.
31
+ *
32
+ * @sealed
33
+ * @internal
34
+ */
35
+ export type ExtensionMessage<
36
+ TMessage extends TypedMessage = {
37
+ type: string;
38
+ content: JsonSerializable<unknown> | JsonDeserialized<unknown>;
39
+ },
40
+ > = // `TMessage extends TypedMessage` encourages processing union elements individually
41
+ TMessage extends TypedMessage
42
+ ? InternalUtilityTypes.FlattenIntersection<
43
+ TMessage & {
44
+ /**
45
+ * Client ID of the singular client the message is being (or has been) sent to.
46
+ * May only be specified when IConnect.supportedFeatures['submit_signals_v2'] is true, will throw otherwise.
47
+ */
48
+ targetClientId?: ClientConnectionId;
49
+ }
50
+ >
51
+ : never;
52
+
53
+ /**
54
+ * Outgoing extension signals.
55
+ *
56
+ * @sealed
57
+ * @internal
58
+ */
59
+ export type OutboundExtensionMessage<TMessage extends TypedMessage = TypedMessage> =
60
+ ExtensionMessage<{ type: TMessage["type"]; content: JsonSerializable<TMessage["content"]> }>;
61
+
62
+ /**
63
+ * Brand for value that has not been verified.
64
+ *
65
+ * Usage:
66
+ *
67
+ * - Cast to with `as unknown as UnverifiedBrand<T>` when value of or containing expected type `T` is yet unknown.
68
+ *
69
+ * - Cast from with `as unknown` when "instance" will be parsed to `T`.
70
+ *
71
+ * @sealed
72
+ * @internal
73
+ */
74
+ export declare class UnverifiedBrand<T> extends BrandedType<T> {
75
+ private readonly UnverifiedValue: T;
76
+ private constructor();
77
+ }
78
+
79
+ /**
80
+ * Unverified incoming extension signals.
81
+ *
82
+ * @sealed
83
+ * @internal
84
+ */
85
+ export type RawInboundExtensionMessage<TMessage extends TypedMessage = TypedMessage> =
86
+ // `TMessage extends TypedMessage` encourages processing union elements individually
87
+ TMessage extends TypedMessage
88
+ ? InternalUtilityTypes.FlattenIntersection<
89
+ ExtensionMessage<{
90
+ type: string;
91
+ content: JsonDeserialized<unknown>;
92
+ }> & {
93
+ /**
94
+ * The client ID that submitted the message.
95
+ * For server generated messages the clientId will be null.
96
+ */
97
+ // eslint-disable-next-line @rushstack/no-new-null
98
+ clientId: ClientConnectionId | null;
99
+ }
100
+ > &
101
+ UnverifiedBrand<TMessage>
102
+ : never;
103
+
104
+ /**
105
+ * Verified incoming extension signals.
106
+ *
107
+ * @sealed
108
+ * @internal
109
+ */
110
+ export type VerifiedInboundExtensionMessage<TMessage extends TypedMessage = TypedMessage> =
111
+ // `TMessage extends TypedMessage` encourages processing union elements individually
112
+ TMessage extends TypedMessage
113
+ ? InternalUtilityTypes.FlattenIntersection<
114
+ ExtensionMessage<{
115
+ type: TMessage["type"];
116
+ content: JsonDeserialized<TMessage["content"]>;
117
+ }> & {
118
+ /**
119
+ * The client ID that submitted the message.
120
+ * For server generated messages the clientId will be null.
121
+ */
122
+ // eslint-disable-next-line @rushstack/no-new-null
123
+ clientId: ClientConnectionId | null;
124
+ }
125
+ >
126
+ : never;
127
+
128
+ /**
129
+ * Incoming extension signal that may be of the known type or has not yet been validated.
130
+ *
131
+ * @sealed
132
+ * @internal
133
+ */
134
+ export type InboundExtensionMessage<TMessage extends TypedMessage = TypedMessage> =
135
+ | RawInboundExtensionMessage<TMessage>
136
+ | VerifiedInboundExtensionMessage<TMessage>;
137
+
138
+ /**
139
+ * @internal
140
+ */
141
+ export interface ExtensionRuntimeProperties {
142
+ SignalMessages: TypedMessage;
143
+ }
144
+
145
+ /**
146
+ * Defines requirements for a component to register with container as an extension.
147
+ *
148
+ * @internal
149
+ */
150
+ export interface ContainerExtension<
151
+ TRuntimeProperties extends ExtensionRuntimeProperties,
152
+ TUseContext extends unknown[] = [],
153
+ > {
154
+ /**
155
+ * Notifies the extension of a new use context.
156
+ *
157
+ * @param useContext - Context new reference to extension is acquired within.
158
+ *
159
+ * @remarks
160
+ * This is called when a secondary reference to the extension is acquired.
161
+ * useContext is the array of arguments that would otherwise be passed to
162
+ * the factory during first acquisition request.
163
+ */
164
+ onNewUse(...useContext: TUseContext): void;
165
+
166
+ /**
167
+ * Callback for signal sent by this extension.
168
+ *
169
+ * @param addressChain - Address chain of the signal
170
+ * @param signalMessage - Signal unverified content and metadata
171
+ * @param local - True if signal was sent by this client
172
+ *
173
+ */
174
+ processSignal?: (
175
+ addressChain: string[],
176
+ signalMessage: InboundExtensionMessage<TRuntimeProperties["SignalMessages"]>,
177
+ local: boolean,
178
+ ) => void;
179
+ }
180
+
181
+ /**
182
+ * Events emitted by the {@link ExtensionHost}.
183
+ *
184
+ * @internal
185
+ */
186
+ export interface ExtensionHostEvents {
187
+ "disconnected": () => void;
188
+ "connected": (clientId: ClientConnectionId) => void;
189
+ }
190
+
191
+ /**
192
+ * Defines the runtime aspects an extension may access.
193
+ *
194
+ * @remarks
195
+ * In most cases this is a logical subset of {@link @fluidframework/container-runtime-definitions#IContainerRuntime}.
196
+ *
197
+ * @sealed
198
+ * @internal
199
+ */
200
+ export interface ExtensionHost<TRuntimeProperties extends ExtensionRuntimeProperties> {
201
+ readonly isConnected: () => boolean;
202
+ readonly getClientId: () => ClientConnectionId | undefined;
203
+
204
+ readonly events: Listenable<ExtensionHostEvents>;
205
+
206
+ readonly logger: ITelemetryBaseLogger;
207
+
208
+ /**
209
+ * Submits a signal to be sent to other clients.
210
+ * @param addressChain - Custom address sequence for the signal.
211
+ * @param message - Custom message content of the signal.
212
+ *
213
+ * Upon receipt of signal, {@link ContainerExtension.processSignal} will be called with the same
214
+ * address and message (less any non-{@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify|JSON.stringify}-able data).
215
+ */
216
+ submitAddressedSignal: (
217
+ addressChain: string[],
218
+ message: OutboundExtensionMessage<TRuntimeProperties["SignalMessages"]>,
219
+ ) => void;
220
+
221
+ /**
222
+ * The collection of write clients which were connected as of the current sequence number.
223
+ * Also contains a map of key-value pairs that must be agreed upon by all clients before being accepted.
224
+ */
225
+ getQuorum: () => IQuorumClients;
226
+
227
+ getAudience: () => IAudience;
228
+ }
229
+
230
+ /**
231
+ * Factory method to create an extension instance.
232
+ *
233
+ * Any such method provided to {@link ContainerExtensionStore.acquireExtension}
234
+ * must use the same value for a given {@link ContainerExtensionId} so that an
235
+ * `instanceof` check may be performed at runtime.
236
+ *
237
+ * @typeParam T - Type of extension to create
238
+ * @typeParam TRuntimeProperties - Extension runtime properties
239
+ * @typeParam TUseContext - Array of custom use context passed to factory or onNewUse
240
+ *
241
+ * @param host - Host runtime for extension to work against
242
+ * @param useContext - Custom use context for extension.
243
+ * @returns Record providing:
244
+ * `interface` instance (type `T`) that is provided to caller of
245
+ * {@link ContainerExtensionStore.acquireExtension} and
246
+ * `extension` store/runtime uses to interact with extension.
247
+ *
248
+ * @internal
249
+ */
250
+ export type ContainerExtensionFactory<
251
+ T,
252
+ TRuntimeProperties extends ExtensionRuntimeProperties,
253
+ TUseContext extends unknown[] = [],
254
+ > = new (
255
+ host: ExtensionHost<TRuntimeProperties>,
256
+ ...useContext: TUseContext
257
+ ) => {
258
+ readonly interface: T;
259
+ readonly extension: ContainerExtension<TRuntimeProperties, TUseContext>;
260
+ };
261
+
262
+ /**
263
+ * Unique identifier for extension
264
+ *
265
+ * @remarks
266
+ * A string known to all clients working with a certain ContainerExtension and unique
267
+ * among ContainerExtensions. Not `/` may be used in the string. Recommend using
268
+ * concatenation of: type of unique identifier, `:` (required), and unique identifier.
269
+ *
270
+ * @example Examples
271
+ * ```typescript
272
+ * "guid:g0fl001d-1415-5000-c00l-g0fa54g0b1g1"
273
+ * "name:@foo-scope_bar:v1"
274
+ * ```
275
+ *
276
+ * @internal
277
+ */
278
+ export type ContainerExtensionId = `${string}:${string}`;
279
+
280
+ /**
281
+ * @sealed
282
+ * @internal
283
+ */
284
+ export interface ContainerExtensionStore {
285
+ /**
286
+ * Acquires an extension from store or adds new one.
287
+ *
288
+ * @param id - Identifier for the requested extension
289
+ * @param factory - Factory to create the extension if not found
290
+ * @returns The extension
291
+ */
292
+ acquireExtension<
293
+ T,
294
+ TRuntimeProperties extends ExtensionRuntimeProperties,
295
+ TUseContext extends unknown[] = [],
296
+ >(
297
+ id: ContainerExtensionId,
298
+ factory: ContainerExtensionFactory<T, TRuntimeProperties, TUseContext>,
299
+ ...context: TUseContext
300
+ ): T;
301
+ }
@@ -26,6 +26,8 @@ import type {
26
26
  IProvideFluidDataStoreRegistry,
27
27
  } from "@fluidframework/runtime-definitions/internal";
28
28
 
29
+ import type { ContainerExtensionStore } from "./containerExtension.js";
30
+
29
31
  /**
30
32
  * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
31
33
  * @legacy
@@ -198,3 +200,12 @@ export interface IContainerRuntime
198
200
  */
199
201
  getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
200
202
  }
203
+
204
+ /**
205
+ * Represents the internal version of the runtime of the container.
206
+ *
207
+ * @internal
208
+ */
209
+ export interface IContainerRuntimeInternal
210
+ extends IContainerRuntime,
211
+ ContainerExtensionStore {}
package/src/index.ts CHANGED
@@ -3,10 +3,27 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ export type {
7
+ ClientConnectionId,
8
+ ContainerExtensionFactory,
9
+ ContainerExtensionId,
10
+ ContainerExtensionStore,
11
+ ContainerExtension,
12
+ ExtensionHost,
13
+ ExtensionHostEvents,
14
+ ExtensionMessage,
15
+ ExtensionRuntimeProperties,
16
+ InboundExtensionMessage,
17
+ OutboundExtensionMessage,
18
+ RawInboundExtensionMessage,
19
+ UnverifiedBrand,
20
+ VerifiedInboundExtensionMessage,
21
+ } from "./containerExtension.js";
6
22
  export type {
7
23
  IContainerRuntime,
8
24
  IContainerRuntimeBaseWithCombinedEvents,
9
25
  IContainerRuntimeEvents,
26
+ IContainerRuntimeInternal,
10
27
  IContainerRuntimeWithResolveHandle_Deprecated,
11
28
  SummarizerStopReason,
12
29
  ISummarizeEventProps,