@fluidframework/container-runtime-definitions 2.70.0 → 2.71.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 +4 -0
- package/dist/containerExtension.d.ts +46 -30
- package/dist/containerExtension.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/lib/containerExtension.d.ts +46 -30
- package/lib/containerExtension.d.ts.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/package.json +11 -18
- package/src/containerExtension.ts +76 -38
- package/src/index.ts +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,7 @@ import type { ILayerCompatDetails } from "@fluid-internal/client-utils";
|
|
|
6
6
|
import type { IAudience } from "@fluidframework/container-definitions/internal";
|
|
7
7
|
import type { BrandedType, InternalUtilityTypes, ITelemetryBaseLogger, JsonDeserialized, JsonSerializable, Listenable, OpaqueJsonDeserialized, TypedMessage } from "@fluidframework/core-interfaces/internal";
|
|
8
8
|
import type { IQuorumClients } from "@fluidframework/driver-definitions/internal";
|
|
9
|
+
import type { ContainerExtensionId, ContainerExtensionExpectations, ExtensionCompatibilityDetails, UnknownExtensionInstantiation } from "@fluidframework/runtime-definitions/internal";
|
|
9
10
|
/**
|
|
10
11
|
* While connected, the id of a client within a session.
|
|
11
12
|
*
|
|
@@ -136,12 +137,37 @@ export type InboundExtensionMessage<TMessage extends TypedMessage = TypedMessage
|
|
|
136
137
|
export interface ExtensionRuntimeProperties {
|
|
137
138
|
SignalMessages: TypedMessage;
|
|
138
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Collection of properties resulting from instantiating an extension via its
|
|
142
|
+
* factory.
|
|
143
|
+
*
|
|
144
|
+
* @remarks
|
|
145
|
+
* All of the members are mutable to allow for handling version or capability
|
|
146
|
+
* mismatches via replacement of interface or extension instances. That is the
|
|
147
|
+
* only time mutation is expected to occur.
|
|
148
|
+
*
|
|
149
|
+
* @internal
|
|
150
|
+
*/
|
|
151
|
+
export interface ExtensionInstantiationResult<TInterface, TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[]> extends UnknownExtensionInstantiation {
|
|
152
|
+
interface: TInterface;
|
|
153
|
+
extension: ContainerExtension<TRuntimeProperties, TUseContext>;
|
|
154
|
+
}
|
|
139
155
|
/**
|
|
140
156
|
* Defines requirements for a component to register with container as an extension.
|
|
141
157
|
*
|
|
142
158
|
* @internal
|
|
143
159
|
*/
|
|
144
160
|
export interface ContainerExtension<TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[] = []> {
|
|
161
|
+
/**
|
|
162
|
+
* Called when a new request is made for an extension with different version
|
|
163
|
+
* or capabilities than were registered for this extension instance.
|
|
164
|
+
*
|
|
165
|
+
* @typeParam TInterface - interface type of new request
|
|
166
|
+
*
|
|
167
|
+
* @param thisExistingInstantiation - registration of this extension in store
|
|
168
|
+
* @param newCompatibilityRequest - compatibility details of the new request
|
|
169
|
+
*/
|
|
170
|
+
handleVersionOrCapabilitiesMismatch<TRequestedInterface>(thisExistingInstantiation: Readonly<ExtensionInstantiationResult<unknown, TRuntimeProperties, TUseContext>>, newCompatibilityRequest: ExtensionCompatibilityDetails): Readonly<ExtensionInstantiationResult<TRequestedInterface, TRuntimeProperties, TUseContext>>;
|
|
145
171
|
/**
|
|
146
172
|
* Notifies the extension of a new use context.
|
|
147
173
|
*
|
|
@@ -259,43 +285,32 @@ export interface ExtensionHost<TRuntimeProperties extends ExtensionRuntimeProper
|
|
|
259
285
|
* Factory method to create an extension instance.
|
|
260
286
|
*
|
|
261
287
|
* Any such method provided to {@link ContainerExtensionStore.acquireExtension}
|
|
262
|
-
* must use the same value for a given {@link ContainerExtensionId} so that an
|
|
288
|
+
* must use the same value for a given {@link @fluidframework/runtime-definitions#ContainerExtensionId} so that an
|
|
263
289
|
* `instanceof` check may be performed at runtime.
|
|
264
290
|
*
|
|
265
291
|
* @typeParam T - Type of extension to create
|
|
266
292
|
* @typeParam TRuntimeProperties - Extension runtime properties
|
|
267
293
|
* @typeParam TUseContext - Array of custom use context passed to factory or onNewUse
|
|
268
294
|
*
|
|
269
|
-
* @param host - Host runtime for extension to work against
|
|
270
|
-
* @param useContext - Custom use context for extension.
|
|
271
|
-
* @returns Record providing:
|
|
272
|
-
* `interface` instance (type `T`) that is provided to caller of
|
|
273
|
-
* {@link ContainerExtensionStore.acquireExtension} and
|
|
274
|
-
* `extension` store/runtime uses to interact with extension.
|
|
275
|
-
*
|
|
276
|
-
* @internal
|
|
277
|
-
*/
|
|
278
|
-
export type ContainerExtensionFactory<T, TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[] = []> = new (host: ExtensionHost<TRuntimeProperties>, ...useContext: TUseContext) => {
|
|
279
|
-
readonly interface: T;
|
|
280
|
-
readonly extension: ContainerExtension<TRuntimeProperties, TUseContext>;
|
|
281
|
-
};
|
|
282
|
-
/**
|
|
283
|
-
* Unique identifier for extension
|
|
284
|
-
*
|
|
285
|
-
* @remarks
|
|
286
|
-
* A string known to all clients working with a certain ContainerExtension and unique
|
|
287
|
-
* among ContainerExtensions. Not `/` may be used in the string. Recommend using
|
|
288
|
-
* concatenation of: type of unique identifier, `:` (required), and unique identifier.
|
|
289
|
-
*
|
|
290
|
-
* @example Examples
|
|
291
|
-
* ```typescript
|
|
292
|
-
* "guid:g0fl001d-1415-5000-c00l-g0fa54g0b1g1"
|
|
293
|
-
* "name:@foo-scope_bar:v1"
|
|
294
|
-
* ```
|
|
295
|
-
*
|
|
296
295
|
* @internal
|
|
297
296
|
*/
|
|
298
|
-
export
|
|
297
|
+
export interface ContainerExtensionFactory<TInterface, TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[] = []> extends ContainerExtensionExpectations {
|
|
298
|
+
resolvePriorInstantiation(priorInstantiation: UnknownExtensionInstantiation): Readonly<ExtensionInstantiationResult<TInterface, TRuntimeProperties, TUseContext>>;
|
|
299
|
+
/**
|
|
300
|
+
* @param host - Host runtime for extension to work against
|
|
301
|
+
* @param useContext - Custom use context for extension.
|
|
302
|
+
* @returns Record providing:
|
|
303
|
+
* `interface` instance (type `T`) that is provided to caller of
|
|
304
|
+
* {@link ContainerExtensionStore.acquireExtension} and
|
|
305
|
+
* `extension` store/runtime uses to interact with extension.
|
|
306
|
+
*/
|
|
307
|
+
instantiateExtension(host: ExtensionHost<TRuntimeProperties>, ...useContext: TUseContext): ExtensionInstantiationResult<TInterface, TRuntimeProperties, TUseContext>;
|
|
308
|
+
/**
|
|
309
|
+
* Determines if an `ExtensionInstantiationResult` came from `instantiateExtension`.
|
|
310
|
+
* Called by the semantics of the instanceof operator.
|
|
311
|
+
*/
|
|
312
|
+
[Symbol.hasInstance]: (instance: unknown) => instance is ExtensionInstantiationResult<TInterface, TRuntimeProperties, TUseContext>;
|
|
313
|
+
}
|
|
299
314
|
/**
|
|
300
315
|
* @sealed
|
|
301
316
|
* @internal
|
|
@@ -306,8 +321,9 @@ export interface ContainerExtensionStore {
|
|
|
306
321
|
*
|
|
307
322
|
* @param id - Identifier for the requested extension
|
|
308
323
|
* @param factory - Factory to create the extension if not found
|
|
324
|
+
* @param context - Custom use context for extension
|
|
309
325
|
* @returns The extension
|
|
310
326
|
*/
|
|
311
|
-
acquireExtension<
|
|
327
|
+
acquireExtension<TInterface, TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[] = []>(id: ContainerExtensionId, factory: ContainerExtensionFactory<TInterface, TRuntimeProperties, TUseContext>, ...context: TUseContext): TInterface;
|
|
312
328
|
}
|
|
313
329
|
//# sourceMappingURL=containerExtension.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerExtension.d.ts","sourceRoot":"","sources":["../src/containerExtension.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MA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,CAAC,EACvC,GAAG,UAAU,EAAE,WAAW,GACxB,4BAA4B,CAAC,UAAU,EAAE,kBAAkB,EAAE,WAAW,CAAC,CAAC;IAE7E;;;OAGG;IACH,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CACrB,QAAQ,EAAE,OAAO,KACb,QAAQ,IAAI,4BAA4B,CAAC,UAAU,EAAE,kBAAkB,EAAE,WAAW,CAAC,CAAC;CAC3F;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;;;;;OAOG;IACH,gBAAgB,CACf,UAAU,EACV,kBAAkB,SAAS,0BAA0B,EACrD,WAAW,SAAS,OAAO,EAAE,GAAG,EAAE,EAElC,EAAE,EAAE,oBAAoB,EACxB,OAAO,EAAE,yBAAyB,CAAC,UAAU,EAAE,kBAAkB,EAAE,WAAW,CAAC,EAC/E,GAAG,OAAO,EAAE,WAAW,GACrB,UAAU,CAAC;CACd"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export type {
|
|
5
|
+
export type { ContainerExtensionId, ExtensionCompatibilityDetails, } from "@fluidframework/runtime-definitions/internal";
|
|
6
|
+
export type { ClientConnectionId, ContainerExtensionFactory, ContainerExtensionStore, ContainerExtension, ExtensionHost, ExtensionHostEvents, ExtensionInstantiationResult, ExtensionMessage, ExtensionRuntimeProperties, InboundExtensionMessage, JoinedStatus, JoinedStatus_disconnected, JoinedStatus_joinedForReading, JoinedStatus_joinedForWriting, OutboundExtensionMessage, RawInboundExtensionMessage, UnverifiedBrand, VerifiedInboundExtensionMessage, } from "./containerExtension.js";
|
|
6
7
|
export type { IContainerRuntime, IContainerRuntimeBaseWithCombinedEvents, IContainerRuntimeEvents, IContainerRuntimeInternal, IContainerRuntimeWithResolveHandle_Deprecated, SummarizerStopReason, ISummarizeEventProps, ISummarizerObservabilityProps, ISummarizerEvents, } from "./containerRuntime.js";
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,YAAY,EACX,oBAAoB,EACpB,6BAA6B,GAC7B,MAAM,8CAA8C,CAAC;AACtD,YAAY,EACX,kBAAkB,EAClB,yBAAyB,EACzB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,4BAA4B,EAC5B,gBAAgB,EAChB,0BAA0B,EAC1B,uBAAuB,EACvB,YAAY,EACZ,yBAAyB,EACzB,6BAA6B,EAC7B,6BAA6B,EAC7B,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"}
|
|
@@ -6,6 +6,7 @@ import type { ILayerCompatDetails } from "@fluid-internal/client-utils";
|
|
|
6
6
|
import type { IAudience } from "@fluidframework/container-definitions/internal";
|
|
7
7
|
import type { BrandedType, InternalUtilityTypes, ITelemetryBaseLogger, JsonDeserialized, JsonSerializable, Listenable, OpaqueJsonDeserialized, TypedMessage } from "@fluidframework/core-interfaces/internal";
|
|
8
8
|
import type { IQuorumClients } from "@fluidframework/driver-definitions/internal";
|
|
9
|
+
import type { ContainerExtensionId, ContainerExtensionExpectations, ExtensionCompatibilityDetails, UnknownExtensionInstantiation } from "@fluidframework/runtime-definitions/internal";
|
|
9
10
|
/**
|
|
10
11
|
* While connected, the id of a client within a session.
|
|
11
12
|
*
|
|
@@ -136,12 +137,37 @@ export type InboundExtensionMessage<TMessage extends TypedMessage = TypedMessage
|
|
|
136
137
|
export interface ExtensionRuntimeProperties {
|
|
137
138
|
SignalMessages: TypedMessage;
|
|
138
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Collection of properties resulting from instantiating an extension via its
|
|
142
|
+
* factory.
|
|
143
|
+
*
|
|
144
|
+
* @remarks
|
|
145
|
+
* All of the members are mutable to allow for handling version or capability
|
|
146
|
+
* mismatches via replacement of interface or extension instances. That is the
|
|
147
|
+
* only time mutation is expected to occur.
|
|
148
|
+
*
|
|
149
|
+
* @internal
|
|
150
|
+
*/
|
|
151
|
+
export interface ExtensionInstantiationResult<TInterface, TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[]> extends UnknownExtensionInstantiation {
|
|
152
|
+
interface: TInterface;
|
|
153
|
+
extension: ContainerExtension<TRuntimeProperties, TUseContext>;
|
|
154
|
+
}
|
|
139
155
|
/**
|
|
140
156
|
* Defines requirements for a component to register with container as an extension.
|
|
141
157
|
*
|
|
142
158
|
* @internal
|
|
143
159
|
*/
|
|
144
160
|
export interface ContainerExtension<TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[] = []> {
|
|
161
|
+
/**
|
|
162
|
+
* Called when a new request is made for an extension with different version
|
|
163
|
+
* or capabilities than were registered for this extension instance.
|
|
164
|
+
*
|
|
165
|
+
* @typeParam TInterface - interface type of new request
|
|
166
|
+
*
|
|
167
|
+
* @param thisExistingInstantiation - registration of this extension in store
|
|
168
|
+
* @param newCompatibilityRequest - compatibility details of the new request
|
|
169
|
+
*/
|
|
170
|
+
handleVersionOrCapabilitiesMismatch<TRequestedInterface>(thisExistingInstantiation: Readonly<ExtensionInstantiationResult<unknown, TRuntimeProperties, TUseContext>>, newCompatibilityRequest: ExtensionCompatibilityDetails): Readonly<ExtensionInstantiationResult<TRequestedInterface, TRuntimeProperties, TUseContext>>;
|
|
145
171
|
/**
|
|
146
172
|
* Notifies the extension of a new use context.
|
|
147
173
|
*
|
|
@@ -259,43 +285,32 @@ export interface ExtensionHost<TRuntimeProperties extends ExtensionRuntimeProper
|
|
|
259
285
|
* Factory method to create an extension instance.
|
|
260
286
|
*
|
|
261
287
|
* Any such method provided to {@link ContainerExtensionStore.acquireExtension}
|
|
262
|
-
* must use the same value for a given {@link ContainerExtensionId} so that an
|
|
288
|
+
* must use the same value for a given {@link @fluidframework/runtime-definitions#ContainerExtensionId} so that an
|
|
263
289
|
* `instanceof` check may be performed at runtime.
|
|
264
290
|
*
|
|
265
291
|
* @typeParam T - Type of extension to create
|
|
266
292
|
* @typeParam TRuntimeProperties - Extension runtime properties
|
|
267
293
|
* @typeParam TUseContext - Array of custom use context passed to factory or onNewUse
|
|
268
294
|
*
|
|
269
|
-
* @param host - Host runtime for extension to work against
|
|
270
|
-
* @param useContext - Custom use context for extension.
|
|
271
|
-
* @returns Record providing:
|
|
272
|
-
* `interface` instance (type `T`) that is provided to caller of
|
|
273
|
-
* {@link ContainerExtensionStore.acquireExtension} and
|
|
274
|
-
* `extension` store/runtime uses to interact with extension.
|
|
275
|
-
*
|
|
276
|
-
* @internal
|
|
277
|
-
*/
|
|
278
|
-
export type ContainerExtensionFactory<T, TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[] = []> = new (host: ExtensionHost<TRuntimeProperties>, ...useContext: TUseContext) => {
|
|
279
|
-
readonly interface: T;
|
|
280
|
-
readonly extension: ContainerExtension<TRuntimeProperties, TUseContext>;
|
|
281
|
-
};
|
|
282
|
-
/**
|
|
283
|
-
* Unique identifier for extension
|
|
284
|
-
*
|
|
285
|
-
* @remarks
|
|
286
|
-
* A string known to all clients working with a certain ContainerExtension and unique
|
|
287
|
-
* among ContainerExtensions. Not `/` may be used in the string. Recommend using
|
|
288
|
-
* concatenation of: type of unique identifier, `:` (required), and unique identifier.
|
|
289
|
-
*
|
|
290
|
-
* @example Examples
|
|
291
|
-
* ```typescript
|
|
292
|
-
* "guid:g0fl001d-1415-5000-c00l-g0fa54g0b1g1"
|
|
293
|
-
* "name:@foo-scope_bar:v1"
|
|
294
|
-
* ```
|
|
295
|
-
*
|
|
296
295
|
* @internal
|
|
297
296
|
*/
|
|
298
|
-
export
|
|
297
|
+
export interface ContainerExtensionFactory<TInterface, TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[] = []> extends ContainerExtensionExpectations {
|
|
298
|
+
resolvePriorInstantiation(priorInstantiation: UnknownExtensionInstantiation): Readonly<ExtensionInstantiationResult<TInterface, TRuntimeProperties, TUseContext>>;
|
|
299
|
+
/**
|
|
300
|
+
* @param host - Host runtime for extension to work against
|
|
301
|
+
* @param useContext - Custom use context for extension.
|
|
302
|
+
* @returns Record providing:
|
|
303
|
+
* `interface` instance (type `T`) that is provided to caller of
|
|
304
|
+
* {@link ContainerExtensionStore.acquireExtension} and
|
|
305
|
+
* `extension` store/runtime uses to interact with extension.
|
|
306
|
+
*/
|
|
307
|
+
instantiateExtension(host: ExtensionHost<TRuntimeProperties>, ...useContext: TUseContext): ExtensionInstantiationResult<TInterface, TRuntimeProperties, TUseContext>;
|
|
308
|
+
/**
|
|
309
|
+
* Determines if an `ExtensionInstantiationResult` came from `instantiateExtension`.
|
|
310
|
+
* Called by the semantics of the instanceof operator.
|
|
311
|
+
*/
|
|
312
|
+
[Symbol.hasInstance]: (instance: unknown) => instance is ExtensionInstantiationResult<TInterface, TRuntimeProperties, TUseContext>;
|
|
313
|
+
}
|
|
299
314
|
/**
|
|
300
315
|
* @sealed
|
|
301
316
|
* @internal
|
|
@@ -306,8 +321,9 @@ export interface ContainerExtensionStore {
|
|
|
306
321
|
*
|
|
307
322
|
* @param id - Identifier for the requested extension
|
|
308
323
|
* @param factory - Factory to create the extension if not found
|
|
324
|
+
* @param context - Custom use context for extension
|
|
309
325
|
* @returns The extension
|
|
310
326
|
*/
|
|
311
|
-
acquireExtension<
|
|
327
|
+
acquireExtension<TInterface, TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[] = []>(id: ContainerExtensionId, factory: ContainerExtensionFactory<TInterface, TRuntimeProperties, TUseContext>, ...context: TUseContext): TInterface;
|
|
312
328
|
}
|
|
313
329
|
//# sourceMappingURL=containerExtension.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerExtension.d.ts","sourceRoot":"","sources":["../src/containerExtension.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"containerExtension.d.ts","sourceRoot":"","sources":["../src/containerExtension.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;AAChF,OAAO,KAAK,EACX,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,sBAAsB,EACtB,YAAY,EACZ,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,KAAK,EACX,oBAAoB,EACpB,8BAA8B,EAC9B,6BAA6B,EAC7B,6BAA6B,EAC7B,MAAM,8CAA8C,CAAC;AAEtD;;;;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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C;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,SAAS,CAAC;CAC7B;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,yBAAyB,CACzC,UAAU,EACV,kBAAkB,SAAS,0BAA0B,EACrD,WAAW,SAAS,OAAO,EAAE,GAAG,EAAE,CACjC,SAAQ,8BAA8B;IACvC,yBAAyB,CACxB,kBAAkB,EAAE,6BAA6B,GAC/C,QAAQ,CAAC,4BAA4B,CAAC,UAAU,EAAE,kBAAkB,EAAE,WAAW,CAAC,CAAC,CAAC;IAEvF;;;;;;;OAOG;IACH,oBAAoB,CACnB,IAAI,EAAE,aAAa,CAAC,kBAAkB,CAAC,EACvC,GAAG,UAAU,EAAE,WAAW,GACxB,4BAA4B,CAAC,UAAU,EAAE,kBAAkB,EAAE,WAAW,CAAC,CAAC;IAE7E;;;OAGG;IACH,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CACrB,QAAQ,EAAE,OAAO,KACb,QAAQ,IAAI,4BAA4B,CAAC,UAAU,EAAE,kBAAkB,EAAE,WAAW,CAAC,CAAC;CAC3F;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;;;;;OAOG;IACH,gBAAgB,CACf,UAAU,EACV,kBAAkB,SAAS,0BAA0B,EACrD,WAAW,SAAS,OAAO,EAAE,GAAG,EAAE,EAElC,EAAE,EAAE,oBAAoB,EACxB,OAAO,EAAE,yBAAyB,CAAC,UAAU,EAAE,kBAAkB,EAAE,WAAW,CAAC,EAC/E,GAAG,OAAO,EAAE,WAAW,GACrB,UAAU,CAAC;CACd"}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export type {
|
|
5
|
+
export type { ContainerExtensionId, ExtensionCompatibilityDetails, } from "@fluidframework/runtime-definitions/internal";
|
|
6
|
+
export type { ClientConnectionId, ContainerExtensionFactory, ContainerExtensionStore, ContainerExtension, ExtensionHost, ExtensionHostEvents, ExtensionInstantiationResult, ExtensionMessage, ExtensionRuntimeProperties, InboundExtensionMessage, JoinedStatus, JoinedStatus_disconnected, JoinedStatus_joinedForReading, JoinedStatus_joinedForWriting, OutboundExtensionMessage, RawInboundExtensionMessage, UnverifiedBrand, VerifiedInboundExtensionMessage, } from "./containerExtension.js";
|
|
6
7
|
export type { IContainerRuntime, IContainerRuntimeBaseWithCombinedEvents, IContainerRuntimeEvents, IContainerRuntimeInternal, IContainerRuntimeWithResolveHandle_Deprecated, SummarizerStopReason, ISummarizeEventProps, ISummarizerObservabilityProps, ISummarizerEvents, } from "./containerRuntime.js";
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,YAAY,EACX,oBAAoB,EACpB,6BAA6B,GAC7B,MAAM,8CAA8C,CAAC;AACtD,YAAY,EACX,kBAAkB,EAClB,yBAAyB,EACzB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,4BAA4B,EAC5B,gBAAgB,EAChB,0BAA0B,EAC1B,uBAAuB,EACvB,YAAY,EACZ,yBAAyB,EACzB,6BAA6B,EAC7B,6BAA6B,EAC7B,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.
|
|
3
|
+
"version": "2.71.0",
|
|
4
4
|
"description": "Fluid Runtime definitions",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"main": "",
|
|
42
42
|
"types": "lib/public.d.ts",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@fluid-internal/client-utils": "~2.
|
|
45
|
-
"@fluidframework/container-definitions": "~2.
|
|
46
|
-
"@fluidframework/core-interfaces": "~2.
|
|
47
|
-
"@fluidframework/driver-definitions": "~2.
|
|
48
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
44
|
+
"@fluid-internal/client-utils": "~2.71.0",
|
|
45
|
+
"@fluidframework/container-definitions": "~2.71.0",
|
|
46
|
+
"@fluidframework/core-interfaces": "~2.71.0",
|
|
47
|
+
"@fluidframework/driver-definitions": "~2.71.0",
|
|
48
|
+
"@fluidframework/runtime-definitions": "~2.71.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"@fluid-tools/build-cli": "^0.58.3",
|
|
54
54
|
"@fluidframework/build-common": "^2.0.3",
|
|
55
55
|
"@fluidframework/build-tools": "^0.58.3",
|
|
56
|
-
"@fluidframework/container-runtime-definitions-previous": "npm:@fluidframework/container-runtime-definitions@2.
|
|
57
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
56
|
+
"@fluidframework/container-runtime-definitions-previous": "npm:@fluidframework/container-runtime-definitions@2.70.0",
|
|
57
|
+
"@fluidframework/eslint-config-fluid": "^7.0.0",
|
|
58
58
|
"@microsoft/api-extractor": "7.52.11",
|
|
59
59
|
"concurrently": "^8.2.1",
|
|
60
60
|
"copyfiles": "^2.4.1",
|
|
@@ -63,14 +63,7 @@
|
|
|
63
63
|
"typescript": "~5.4.5"
|
|
64
64
|
},
|
|
65
65
|
"typeValidation": {
|
|
66
|
-
"broken": {
|
|
67
|
-
"Interface_IContainerRuntime": {
|
|
68
|
-
"backCompat": false
|
|
69
|
-
},
|
|
70
|
-
"Interface_IContainerRuntimeWithResolveHandle_Deprecated": {
|
|
71
|
-
"backCompat": false
|
|
72
|
-
}
|
|
73
|
-
},
|
|
66
|
+
"broken": {},
|
|
74
67
|
"entrypoint": "legacy"
|
|
75
68
|
},
|
|
76
69
|
"scripts": {
|
|
@@ -101,8 +94,8 @@
|
|
|
101
94
|
"ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
|
|
102
95
|
"ci:build:docs": "api-extractor run",
|
|
103
96
|
"clean": "rimraf --glob dist lib {alpha,beta,internal,legacy}.d.ts \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp",
|
|
104
|
-
"eslint": "eslint --format stylish src",
|
|
105
|
-
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
97
|
+
"eslint": "eslint --quiet --format stylish src",
|
|
98
|
+
"eslint:fix": "eslint --quiet --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
106
99
|
"format": "npm run format:biome",
|
|
107
100
|
"format:biome": "biome check . --write",
|
|
108
101
|
"lint": "fluid-build . --task lint",
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import type { ILayerCompatDetails } from "@fluid-internal/client-utils";
|
|
7
7
|
import type { IAudience } from "@fluidframework/container-definitions/internal";
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-imports -- BrandedType is a class declaration only
|
|
9
8
|
import type {
|
|
10
9
|
BrandedType,
|
|
11
10
|
InternalUtilityTypes,
|
|
@@ -17,6 +16,12 @@ import type {
|
|
|
17
16
|
TypedMessage,
|
|
18
17
|
} from "@fluidframework/core-interfaces/internal";
|
|
19
18
|
import type { IQuorumClients } from "@fluidframework/driver-definitions/internal";
|
|
19
|
+
import type {
|
|
20
|
+
ContainerExtensionId,
|
|
21
|
+
ContainerExtensionExpectations,
|
|
22
|
+
ExtensionCompatibilityDetails,
|
|
23
|
+
UnknownExtensionInstantiation,
|
|
24
|
+
} from "@fluidframework/runtime-definitions/internal";
|
|
20
25
|
|
|
21
26
|
/**
|
|
22
27
|
* While connected, the id of a client within a session.
|
|
@@ -180,6 +185,26 @@ export interface ExtensionRuntimeProperties {
|
|
|
180
185
|
SignalMessages: TypedMessage;
|
|
181
186
|
}
|
|
182
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Collection of properties resulting from instantiating an extension via its
|
|
190
|
+
* factory.
|
|
191
|
+
*
|
|
192
|
+
* @remarks
|
|
193
|
+
* All of the members are mutable to allow for handling version or capability
|
|
194
|
+
* mismatches via replacement of interface or extension instances. That is the
|
|
195
|
+
* only time mutation is expected to occur.
|
|
196
|
+
*
|
|
197
|
+
* @internal
|
|
198
|
+
*/
|
|
199
|
+
export interface ExtensionInstantiationResult<
|
|
200
|
+
TInterface,
|
|
201
|
+
TRuntimeProperties extends ExtensionRuntimeProperties,
|
|
202
|
+
TUseContext extends unknown[],
|
|
203
|
+
> extends UnknownExtensionInstantiation {
|
|
204
|
+
interface: TInterface;
|
|
205
|
+
extension: ContainerExtension<TRuntimeProperties, TUseContext>;
|
|
206
|
+
}
|
|
207
|
+
|
|
183
208
|
/**
|
|
184
209
|
* Defines requirements for a component to register with container as an extension.
|
|
185
210
|
*
|
|
@@ -189,6 +214,24 @@ export interface ContainerExtension<
|
|
|
189
214
|
TRuntimeProperties extends ExtensionRuntimeProperties,
|
|
190
215
|
TUseContext extends unknown[] = [],
|
|
191
216
|
> {
|
|
217
|
+
/**
|
|
218
|
+
* Called when a new request is made for an extension with different version
|
|
219
|
+
* or capabilities than were registered for this extension instance.
|
|
220
|
+
*
|
|
221
|
+
* @typeParam TInterface - interface type of new request
|
|
222
|
+
*
|
|
223
|
+
* @param thisExistingInstantiation - registration of this extension in store
|
|
224
|
+
* @param newCompatibilityRequest - compatibility details of the new request
|
|
225
|
+
*/
|
|
226
|
+
handleVersionOrCapabilitiesMismatch<TRequestedInterface>(
|
|
227
|
+
thisExistingInstantiation: Readonly<
|
|
228
|
+
ExtensionInstantiationResult<unknown, TRuntimeProperties, TUseContext>
|
|
229
|
+
>,
|
|
230
|
+
newCompatibilityRequest: ExtensionCompatibilityDetails,
|
|
231
|
+
): Readonly<
|
|
232
|
+
ExtensionInstantiationResult<TRequestedInterface, TRuntimeProperties, TUseContext>
|
|
233
|
+
>;
|
|
234
|
+
|
|
192
235
|
/**
|
|
193
236
|
* Notifies the extension of a new use context.
|
|
194
237
|
*
|
|
@@ -327,51 +370,45 @@ export interface ExtensionHost<TRuntimeProperties extends ExtensionRuntimeProper
|
|
|
327
370
|
* Factory method to create an extension instance.
|
|
328
371
|
*
|
|
329
372
|
* Any such method provided to {@link ContainerExtensionStore.acquireExtension}
|
|
330
|
-
* must use the same value for a given {@link ContainerExtensionId} so that an
|
|
373
|
+
* must use the same value for a given {@link @fluidframework/runtime-definitions#ContainerExtensionId} so that an
|
|
331
374
|
* `instanceof` check may be performed at runtime.
|
|
332
375
|
*
|
|
333
376
|
* @typeParam T - Type of extension to create
|
|
334
377
|
* @typeParam TRuntimeProperties - Extension runtime properties
|
|
335
378
|
* @typeParam TUseContext - Array of custom use context passed to factory or onNewUse
|
|
336
379
|
*
|
|
337
|
-
* @param host - Host runtime for extension to work against
|
|
338
|
-
* @param useContext - Custom use context for extension.
|
|
339
|
-
* @returns Record providing:
|
|
340
|
-
* `interface` instance (type `T`) that is provided to caller of
|
|
341
|
-
* {@link ContainerExtensionStore.acquireExtension} and
|
|
342
|
-
* `extension` store/runtime uses to interact with extension.
|
|
343
|
-
*
|
|
344
380
|
* @internal
|
|
345
381
|
*/
|
|
346
|
-
export
|
|
347
|
-
|
|
382
|
+
export interface ContainerExtensionFactory<
|
|
383
|
+
TInterface,
|
|
348
384
|
TRuntimeProperties extends ExtensionRuntimeProperties,
|
|
349
385
|
TUseContext extends unknown[] = [],
|
|
350
|
-
>
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
)
|
|
354
|
-
readonly interface: T;
|
|
355
|
-
readonly extension: ContainerExtension<TRuntimeProperties, TUseContext>;
|
|
356
|
-
};
|
|
386
|
+
> extends ContainerExtensionExpectations {
|
|
387
|
+
resolvePriorInstantiation(
|
|
388
|
+
priorInstantiation: UnknownExtensionInstantiation,
|
|
389
|
+
): Readonly<ExtensionInstantiationResult<TInterface, TRuntimeProperties, TUseContext>>;
|
|
357
390
|
|
|
358
|
-
/**
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
391
|
+
/**
|
|
392
|
+
* @param host - Host runtime for extension to work against
|
|
393
|
+
* @param useContext - Custom use context for extension.
|
|
394
|
+
* @returns Record providing:
|
|
395
|
+
* `interface` instance (type `T`) that is provided to caller of
|
|
396
|
+
* {@link ContainerExtensionStore.acquireExtension} and
|
|
397
|
+
* `extension` store/runtime uses to interact with extension.
|
|
398
|
+
*/
|
|
399
|
+
instantiateExtension(
|
|
400
|
+
host: ExtensionHost<TRuntimeProperties>,
|
|
401
|
+
...useContext: TUseContext
|
|
402
|
+
): ExtensionInstantiationResult<TInterface, TRuntimeProperties, TUseContext>;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Determines if an `ExtensionInstantiationResult` came from `instantiateExtension`.
|
|
406
|
+
* Called by the semantics of the instanceof operator.
|
|
407
|
+
*/
|
|
408
|
+
[Symbol.hasInstance]: (
|
|
409
|
+
instance: unknown,
|
|
410
|
+
) => instance is ExtensionInstantiationResult<TInterface, TRuntimeProperties, TUseContext>;
|
|
411
|
+
}
|
|
375
412
|
|
|
376
413
|
/**
|
|
377
414
|
* @sealed
|
|
@@ -383,15 +420,16 @@ export interface ContainerExtensionStore {
|
|
|
383
420
|
*
|
|
384
421
|
* @param id - Identifier for the requested extension
|
|
385
422
|
* @param factory - Factory to create the extension if not found
|
|
423
|
+
* @param context - Custom use context for extension
|
|
386
424
|
* @returns The extension
|
|
387
425
|
*/
|
|
388
426
|
acquireExtension<
|
|
389
|
-
|
|
427
|
+
TInterface,
|
|
390
428
|
TRuntimeProperties extends ExtensionRuntimeProperties,
|
|
391
429
|
TUseContext extends unknown[] = [],
|
|
392
430
|
>(
|
|
393
431
|
id: ContainerExtensionId,
|
|
394
|
-
factory: ContainerExtensionFactory<
|
|
432
|
+
factory: ContainerExtensionFactory<TInterface, TRuntimeProperties, TUseContext>,
|
|
395
433
|
...context: TUseContext
|
|
396
|
-
):
|
|
434
|
+
): TInterface;
|
|
397
435
|
}
|
package/src/index.ts
CHANGED
|
@@ -3,14 +3,21 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
// Re-export selected types from runtime-definitions internal module
|
|
7
|
+
// that are core to more complete container runtime extensions types
|
|
8
|
+
// maintained here.
|
|
9
|
+
export type {
|
|
10
|
+
ContainerExtensionId,
|
|
11
|
+
ExtensionCompatibilityDetails,
|
|
12
|
+
} from "@fluidframework/runtime-definitions/internal";
|
|
6
13
|
export type {
|
|
7
14
|
ClientConnectionId,
|
|
8
15
|
ContainerExtensionFactory,
|
|
9
|
-
ContainerExtensionId,
|
|
10
16
|
ContainerExtensionStore,
|
|
11
17
|
ContainerExtension,
|
|
12
18
|
ExtensionHost,
|
|
13
19
|
ExtensionHostEvents,
|
|
20
|
+
ExtensionInstantiationResult,
|
|
14
21
|
ExtensionMessage,
|
|
15
22
|
ExtensionRuntimeProperties,
|
|
16
23
|
InboundExtensionMessage,
|