@fluidframework/container-loader 2.0.0-internal.7.0.0 → 2.0.0-internal.7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/api-extractor.json +9 -1
  3. package/api-report/container-loader.api.md +142 -0
  4. package/dist/connectionManager.d.ts +1 -0
  5. package/dist/connectionManager.d.ts.map +1 -1
  6. package/dist/connectionManager.js +20 -16
  7. package/dist/connectionManager.js.map +1 -1
  8. package/dist/container-loader-alpha.d.ts +297 -0
  9. package/dist/container-loader-beta.d.ts +297 -0
  10. package/dist/container-loader-public.d.ts +297 -0
  11. package/dist/container-loader.d.ts +297 -0
  12. package/dist/contracts.d.ts +3 -3
  13. package/dist/contracts.d.ts.map +1 -1
  14. package/dist/contracts.js.map +1 -1
  15. package/dist/debugLogger.d.ts.map +1 -1
  16. package/dist/debugLogger.js.map +1 -1
  17. package/dist/deltaManager.d.ts.map +1 -1
  18. package/dist/deltaManager.js +5 -1
  19. package/dist/deltaManager.js.map +1 -1
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +4 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/loader.d.ts +1 -1
  25. package/dist/loader.js +1 -1
  26. package/dist/loader.js.map +1 -1
  27. package/dist/location-redirection-utilities/index.d.ts +6 -0
  28. package/dist/location-redirection-utilities/index.d.ts.map +1 -0
  29. package/dist/location-redirection-utilities/index.js +11 -0
  30. package/dist/location-redirection-utilities/index.js.map +1 -0
  31. package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts +22 -0
  32. package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -0
  33. package/dist/location-redirection-utilities/resolveWithLocationRedirection.js +51 -0
  34. package/dist/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -0
  35. package/dist/packageVersion.d.ts +1 -1
  36. package/dist/packageVersion.js +1 -1
  37. package/dist/packageVersion.js.map +1 -1
  38. package/dist/tsdoc-metadata.json +1 -1
  39. package/lib/connectionManager.d.ts +1 -0
  40. package/lib/connectionManager.d.ts.map +1 -1
  41. package/lib/connectionManager.js +20 -16
  42. package/lib/connectionManager.js.map +1 -1
  43. package/lib/contracts.d.ts +3 -3
  44. package/lib/contracts.d.ts.map +1 -1
  45. package/lib/contracts.js.map +1 -1
  46. package/lib/debugLogger.d.ts.map +1 -1
  47. package/lib/debugLogger.js.map +1 -1
  48. package/lib/deltaManager.d.ts.map +1 -1
  49. package/lib/deltaManager.js +5 -1
  50. package/lib/deltaManager.js.map +1 -1
  51. package/lib/index.d.ts +1 -0
  52. package/lib/index.d.ts.map +1 -1
  53. package/lib/index.js +1 -0
  54. package/lib/index.js.map +1 -1
  55. package/lib/loader.d.ts +1 -1
  56. package/lib/loader.js +1 -1
  57. package/lib/loader.js.map +1 -1
  58. package/lib/location-redirection-utilities/index.d.ts +6 -0
  59. package/lib/location-redirection-utilities/index.d.ts.map +1 -0
  60. package/lib/location-redirection-utilities/index.js +6 -0
  61. package/lib/location-redirection-utilities/index.js.map +1 -0
  62. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts +22 -0
  63. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -0
  64. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js +46 -0
  65. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -0
  66. package/lib/packageVersion.d.ts +1 -1
  67. package/lib/packageVersion.js +1 -1
  68. package/lib/packageVersion.js.map +1 -1
  69. package/package.json +20 -27
  70. package/src/connectionManager.ts +20 -11
  71. package/src/contracts.ts +3 -3
  72. package/src/debugLogger.ts +4 -1
  73. package/src/deltaManager.ts +5 -1
  74. package/src/index.ts +4 -0
  75. package/src/loader.ts +1 -1
  76. package/src/location-redirection-utilities/index.ts +9 -0
  77. package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +59 -0
  78. package/src/packageVersion.ts +1 -1
@@ -0,0 +1,297 @@
1
+ import { FluidObject } from '@fluidframework/core-interfaces';
2
+ import { IAudienceOwner } from '@fluidframework/container-definitions';
3
+ import { IClientDetails } from '@fluidframework/protocol-definitions';
4
+ import { IConfigProviderBase } from '@fluidframework/telemetry-utils';
5
+ import { IContainer } from '@fluidframework/container-definitions';
6
+ import { IDocumentAttributes } from '@fluidframework/protocol-definitions';
7
+ import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
8
+ import { IDocumentStorageService } from '@fluidframework/driver-definitions';
9
+ import { IFluidCodeDetails } from '@fluidframework/container-definitions';
10
+ import { IFluidModule } from '@fluidframework/container-definitions';
11
+ import { IFluidRouter } from '@fluidframework/core-interfaces';
12
+ import { IHostLoader } from '@fluidframework/container-definitions';
13
+ import { ILoaderOptions as ILoaderOptions_2 } from '@fluidframework/container-definitions';
14
+ import { ILocationRedirectionError } from '@fluidframework/driver-definitions';
15
+ import { IProtocolHandler as IProtocolHandler_2 } from '@fluidframework/protocol-base';
16
+ import { IProvideFluidCodeDetailsComparer } from '@fluidframework/container-definitions';
17
+ import { IQuorumSnapshot } from '@fluidframework/protocol-base';
18
+ import { IRequest } from '@fluidframework/core-interfaces';
19
+ import { IRequestHeader } from '@fluidframework/core-interfaces';
20
+ import { IResponse } from '@fluidframework/core-interfaces';
21
+ import { ISignalMessage } from '@fluidframework/protocol-definitions';
22
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
23
+ import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
24
+ import { IUrlResolver } from '@fluidframework/driver-definitions';
25
+
26
+ export declare enum ConnectionState {
27
+ /**
28
+ * The container is not connected to the ordering service
29
+ * Note - When in this state the container may be about to reconnect,
30
+ * or may remain disconnected until explicitly told to connect.
31
+ */
32
+ Disconnected = 0,
33
+ /**
34
+ * The container is disconnected but actively trying to establish a new connection
35
+ * PLEASE NOTE that this numerical value falls out of the order you may expect for this state
36
+ */
37
+ EstablishingConnection = 3,
38
+ /**
39
+ * The container has an inbound connection only, and is catching up to the latest known state from the service.
40
+ */
41
+ CatchingUp = 1,
42
+ /**
43
+ * The container is fully connected and syncing
44
+ */
45
+ Connected = 2
46
+ }
47
+
48
+ /**
49
+ * @deprecated ICodeDetailsLoader interface is moved to {@link @fluidframework/container-definition#ICodeDetailsLoader}
50
+ * to have code loading modules in one package. #8193
51
+ * Fluid code loader resolves a code module matching the document schema, i.e. code details, such as
52
+ * a package name and package version range.
53
+ */
54
+ export declare interface ICodeDetailsLoader extends Partial<IProvideFluidCodeDetailsComparer> {
55
+ /**
56
+ * Load the code module (package) that is capable to interact with the document.
57
+ *
58
+ * @param source - Code proposal that articulates the current schema the document is written in.
59
+ * @returns Code module entry point along with the code details associated with it.
60
+ */
61
+ load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
62
+ }
63
+
64
+ /**
65
+ * IContainer interface that includes experimental features still under development.
66
+ * @experimental
67
+ */
68
+ export declare interface IContainerExperimental extends IContainer {
69
+ /**
70
+ * Get pending state from container. WARNING: misuse of this API can result in duplicate op
71
+ * submission and potential document corruption. The blob returned MUST be deleted if and when this
72
+ * container emits a "connected" event.
73
+ * @returns serialized blob that can be passed to Loader.resolve()
74
+ * @experimental misuse of this API can result in duplicate op submission and potential document corruption
75
+ * {@link https://github.com/microsoft/FluidFramework/blob/main/packages/loader/container-loader/closeAndGetPendingLocalState.md}
76
+ */
77
+ getPendingLocalState?(): Promise<string>;
78
+ /**
79
+ * Closes the container and returns serialized local state intended to be
80
+ * given to a newly loaded container.
81
+ * @experimental
82
+ * {@link https://github.com/microsoft/FluidFramework/blob/main/packages/loader/container-loader/closeAndGetPendingLocalState.md}
83
+ */
84
+ closeAndGetPendingLocalState?(): Promise<string>;
85
+ }
86
+
87
+ /**
88
+ * Subset of IDocumentStorageService which only supports createBlob() and readBlob(). This is used to support
89
+ * blobs in detached containers.
90
+ */
91
+ export declare type IDetachedBlobStorage = Pick<IDocumentStorageService, "createBlob" | "readBlob"> & {
92
+ size: number;
93
+ /**
94
+ * Return an array of all blob IDs present in storage
95
+ */
96
+ getBlobIds(): string[];
97
+ };
98
+
99
+ /**
100
+ * @deprecated IFluidModuleWithDetails interface is moved to
101
+ * {@link @fluidframework/container-definitions#IFluidModuleWithDetails}
102
+ * to have all the code loading modules in one package. #8193
103
+ * Encapsulates a module entry point with corresponding code details.
104
+ */
105
+ export declare interface IFluidModuleWithDetails {
106
+ /** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */
107
+ module: IFluidModule;
108
+ /**
109
+ * Code details associated with the module. Represents a document schema this module supports.
110
+ * If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,
111
+ * it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.
112
+ */
113
+ details: IFluidCodeDetails;
114
+ }
115
+
116
+ export declare interface ILoaderOptions extends ILoaderOptions_2 {
117
+ summarizeProtocolTree?: boolean;
118
+ }
119
+
120
+ /**
121
+ * Services and properties necessary for creating a loader
122
+ */
123
+ export declare interface ILoaderProps {
124
+ /**
125
+ * The url resolver used by the loader for resolving external urls
126
+ * into Fluid urls such that the container specified by the
127
+ * external url can be loaded.
128
+ */
129
+ readonly urlResolver: IUrlResolver;
130
+ /**
131
+ * The document service factory take the Fluid url provided
132
+ * by the resolved url and constructs all the necessary services
133
+ * for communication with the container's server.
134
+ */
135
+ readonly documentServiceFactory: IDocumentServiceFactory;
136
+ /**
137
+ * The code loader handles loading the necessary code
138
+ * for running a container once it is loaded.
139
+ */
140
+ readonly codeLoader: ICodeDetailsLoader;
141
+ /**
142
+ * A property bag of options used by various layers
143
+ * to control features
144
+ */
145
+ readonly options?: ILoaderOptions;
146
+ /**
147
+ * Scope is provided to all container and is a set of shared
148
+ * services for container's to integrate with their host environment.
149
+ */
150
+ readonly scope?: FluidObject;
151
+ /**
152
+ * The logger that all telemetry should be pushed to.
153
+ */
154
+ readonly logger?: ITelemetryBaseLogger;
155
+ /**
156
+ * Blobs storage for detached containers.
157
+ */
158
+ readonly detachedBlobStorage?: IDetachedBlobStorage;
159
+ /**
160
+ * The configuration provider which may be used to control features.
161
+ */
162
+ readonly configProvider?: IConfigProviderBase;
163
+ /**
164
+ * Optional property for allowing the container to use a custom
165
+ * protocol implementation for handling the quorum and/or the audience.
166
+ */
167
+ readonly protocolHandlerBuilder?: ProtocolHandlerBuilder;
168
+ }
169
+
170
+ /**
171
+ * Services and properties used by and exposed by the loader
172
+ */
173
+ export declare interface ILoaderServices {
174
+ /**
175
+ * The url resolver used by the loader for resolving external urls
176
+ * into Fluid urls such that the container specified by the
177
+ * external url can be loaded.
178
+ */
179
+ readonly urlResolver: IUrlResolver;
180
+ /**
181
+ * The document service factory take the Fluid url provided
182
+ * by the resolved url and constructs all the necessary services
183
+ * for communication with the container's server.
184
+ */
185
+ readonly documentServiceFactory: IDocumentServiceFactory;
186
+ /**
187
+ * The code loader handles loading the necessary code
188
+ * for running a container once it is loaded.
189
+ */
190
+ readonly codeLoader: ICodeDetailsLoader;
191
+ /**
192
+ * A property bag of options used by various layers
193
+ * to control features
194
+ */
195
+ readonly options: ILoaderOptions;
196
+ /**
197
+ * Scope is provided to all container and is a set of shared
198
+ * services for container's to integrate with their host environment.
199
+ */
200
+ readonly scope: FluidObject;
201
+ /**
202
+ * The logger downstream consumers should construct their loggers from
203
+ */
204
+ readonly subLogger: ITelemetryLoggerExt;
205
+ /**
206
+ * Blobs storage for detached containers.
207
+ */
208
+ readonly detachedBlobStorage?: IDetachedBlobStorage;
209
+ /**
210
+ * Optional property for allowing the container to use a custom
211
+ * protocol implementation for handling the quorum and/or the audience.
212
+ */
213
+ readonly protocolHandlerBuilder?: ProtocolHandlerBuilder;
214
+ }
215
+
216
+ export declare interface IProtocolHandler extends IProtocolHandler_2 {
217
+ readonly audience: IAudienceOwner;
218
+ processSignal(message: ISignalMessage): any;
219
+ }
220
+
221
+ /**
222
+ * Checks if the error is location redirection error.
223
+ * @param error - error whose type is to be determined.
224
+ * @returns `true` is the error is location redirection error, otherwise `false`.
225
+ */
226
+ export declare function isLocationRedirectionError(error: any): error is ILocationRedirectionError;
227
+
228
+ /**
229
+ * Manages Fluid resource loading
230
+ */
231
+ export declare class Loader implements IHostLoader {
232
+ readonly services: ILoaderServices;
233
+ private readonly mc;
234
+ constructor(loaderProps: ILoaderProps);
235
+ /**
236
+ * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the Container's IFluidRouter/request.
237
+ */
238
+ get IFluidRouter(): IFluidRouter;
239
+ createDetachedContainer(codeDetails: IFluidCodeDetails, createDetachedProps?: {
240
+ canReconnect?: boolean;
241
+ clientDetailsOverride?: IClientDetails;
242
+ }): Promise<IContainer>;
243
+ rehydrateDetachedContainerFromSnapshot(snapshot: string, createDetachedProps?: {
244
+ canReconnect?: boolean;
245
+ clientDetailsOverride?: IClientDetails;
246
+ }): Promise<IContainer>;
247
+ resolve(request: IRequest, pendingLocalState?: string): Promise<IContainer>;
248
+ /**
249
+ * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the Container's IFluidRouter/request.
250
+ */
251
+ request(request: IRequest): Promise<IResponse>;
252
+ private resolveCore;
253
+ private loadContainer;
254
+ }
255
+
256
+ /**
257
+ * Function to be used for creating a protocol handler.
258
+ */
259
+ export declare type ProtocolHandlerBuilder = (attributes: IDocumentAttributes, snapshot: IQuorumSnapshot, sendProposal: (key: string, value: any) => number) => IProtocolHandler;
260
+
261
+ /**
262
+ * With an already-resolved container, we can request a component directly, without loading the container again
263
+ * @param container - a resolved container
264
+ * @returns component on the container
265
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
266
+ */
267
+ export declare function requestResolvedObjectFromContainer(container: IContainer, headers?: IRequestHeader): Promise<IResponse>;
268
+
269
+ /**
270
+ * Handles location redirection while fulfilling the loader request.
271
+ * @param api - Callback in which user can wrap the loader.resolve or loader.request call.
272
+ * @param request - request to be resolved.
273
+ * @param urlResolver - resolver used to resolve the url.
274
+ * @param logger - logger to send events.
275
+ * @returns Response from the API call.
276
+ */
277
+ export declare function resolveWithLocationRedirectionHandling<T>(api: (request: IRequest) => Promise<T>, request: IRequest, urlResolver: IUrlResolver, logger?: ITelemetryBaseLogger): Promise<T>;
278
+
279
+ /**
280
+ * Waits until container connects to delta storage and gets up-to-date.
281
+ *
282
+ * Useful when resolving URIs and hitting 404, due to container being loaded from (stale) snapshot and not being
283
+ * up to date. Host may chose to wait in such case and retry resolving URI.
284
+ *
285
+ * Warning: Will wait infinitely for connection to establish if there is no connection.
286
+ * May result in deadlock if Container.disconnect() is called and never followed by a call to Container.connect().
287
+ *
288
+ * @returns `true`: container is up to date, it processed all the ops that were know at the time of first connection.
289
+ *
290
+ * `false`: storage does not provide indication of how far the client is. Container processed all the ops known to it,
291
+ * but it maybe still behind.
292
+ *
293
+ * @throws an error beginning with `"Container closed"` if the container is closed before it catches up.
294
+ */
295
+ export declare function waitContainerToCatchUp(container: IContainer): Promise<boolean>;
296
+
297
+ export { }
@@ -0,0 +1,297 @@
1
+ import { FluidObject } from '@fluidframework/core-interfaces';
2
+ import { IAudienceOwner } from '@fluidframework/container-definitions';
3
+ import { IClientDetails } from '@fluidframework/protocol-definitions';
4
+ import { IConfigProviderBase } from '@fluidframework/telemetry-utils';
5
+ import { IContainer } from '@fluidframework/container-definitions';
6
+ import { IDocumentAttributes } from '@fluidframework/protocol-definitions';
7
+ import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
8
+ import { IDocumentStorageService } from '@fluidframework/driver-definitions';
9
+ import { IFluidCodeDetails } from '@fluidframework/container-definitions';
10
+ import { IFluidModule } from '@fluidframework/container-definitions';
11
+ import { IFluidRouter } from '@fluidframework/core-interfaces';
12
+ import { IHostLoader } from '@fluidframework/container-definitions';
13
+ import { ILoaderOptions as ILoaderOptions_2 } from '@fluidframework/container-definitions';
14
+ import { ILocationRedirectionError } from '@fluidframework/driver-definitions';
15
+ import { IProtocolHandler as IProtocolHandler_2 } from '@fluidframework/protocol-base';
16
+ import { IProvideFluidCodeDetailsComparer } from '@fluidframework/container-definitions';
17
+ import { IQuorumSnapshot } from '@fluidframework/protocol-base';
18
+ import { IRequest } from '@fluidframework/core-interfaces';
19
+ import { IRequestHeader } from '@fluidframework/core-interfaces';
20
+ import { IResponse } from '@fluidframework/core-interfaces';
21
+ import { ISignalMessage } from '@fluidframework/protocol-definitions';
22
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
23
+ import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
24
+ import { IUrlResolver } from '@fluidframework/driver-definitions';
25
+
26
+ export declare enum ConnectionState {
27
+ /**
28
+ * The container is not connected to the ordering service
29
+ * Note - When in this state the container may be about to reconnect,
30
+ * or may remain disconnected until explicitly told to connect.
31
+ */
32
+ Disconnected = 0,
33
+ /**
34
+ * The container is disconnected but actively trying to establish a new connection
35
+ * PLEASE NOTE that this numerical value falls out of the order you may expect for this state
36
+ */
37
+ EstablishingConnection = 3,
38
+ /**
39
+ * The container has an inbound connection only, and is catching up to the latest known state from the service.
40
+ */
41
+ CatchingUp = 1,
42
+ /**
43
+ * The container is fully connected and syncing
44
+ */
45
+ Connected = 2
46
+ }
47
+
48
+ /**
49
+ * @deprecated ICodeDetailsLoader interface is moved to {@link @fluidframework/container-definition#ICodeDetailsLoader}
50
+ * to have code loading modules in one package. #8193
51
+ * Fluid code loader resolves a code module matching the document schema, i.e. code details, such as
52
+ * a package name and package version range.
53
+ */
54
+ export declare interface ICodeDetailsLoader extends Partial<IProvideFluidCodeDetailsComparer> {
55
+ /**
56
+ * Load the code module (package) that is capable to interact with the document.
57
+ *
58
+ * @param source - Code proposal that articulates the current schema the document is written in.
59
+ * @returns Code module entry point along with the code details associated with it.
60
+ */
61
+ load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
62
+ }
63
+
64
+ /**
65
+ * IContainer interface that includes experimental features still under development.
66
+ * @experimental
67
+ */
68
+ export declare interface IContainerExperimental extends IContainer {
69
+ /**
70
+ * Get pending state from container. WARNING: misuse of this API can result in duplicate op
71
+ * submission and potential document corruption. The blob returned MUST be deleted if and when this
72
+ * container emits a "connected" event.
73
+ * @returns serialized blob that can be passed to Loader.resolve()
74
+ * @experimental misuse of this API can result in duplicate op submission and potential document corruption
75
+ * {@link https://github.com/microsoft/FluidFramework/blob/main/packages/loader/container-loader/closeAndGetPendingLocalState.md}
76
+ */
77
+ getPendingLocalState?(): Promise<string>;
78
+ /**
79
+ * Closes the container and returns serialized local state intended to be
80
+ * given to a newly loaded container.
81
+ * @experimental
82
+ * {@link https://github.com/microsoft/FluidFramework/blob/main/packages/loader/container-loader/closeAndGetPendingLocalState.md}
83
+ */
84
+ closeAndGetPendingLocalState?(): Promise<string>;
85
+ }
86
+
87
+ /**
88
+ * Subset of IDocumentStorageService which only supports createBlob() and readBlob(). This is used to support
89
+ * blobs in detached containers.
90
+ */
91
+ export declare type IDetachedBlobStorage = Pick<IDocumentStorageService, "createBlob" | "readBlob"> & {
92
+ size: number;
93
+ /**
94
+ * Return an array of all blob IDs present in storage
95
+ */
96
+ getBlobIds(): string[];
97
+ };
98
+
99
+ /**
100
+ * @deprecated IFluidModuleWithDetails interface is moved to
101
+ * {@link @fluidframework/container-definitions#IFluidModuleWithDetails}
102
+ * to have all the code loading modules in one package. #8193
103
+ * Encapsulates a module entry point with corresponding code details.
104
+ */
105
+ export declare interface IFluidModuleWithDetails {
106
+ /** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */
107
+ module: IFluidModule;
108
+ /**
109
+ * Code details associated with the module. Represents a document schema this module supports.
110
+ * If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,
111
+ * it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.
112
+ */
113
+ details: IFluidCodeDetails;
114
+ }
115
+
116
+ export declare interface ILoaderOptions extends ILoaderOptions_2 {
117
+ summarizeProtocolTree?: boolean;
118
+ }
119
+
120
+ /**
121
+ * Services and properties necessary for creating a loader
122
+ */
123
+ export declare interface ILoaderProps {
124
+ /**
125
+ * The url resolver used by the loader for resolving external urls
126
+ * into Fluid urls such that the container specified by the
127
+ * external url can be loaded.
128
+ */
129
+ readonly urlResolver: IUrlResolver;
130
+ /**
131
+ * The document service factory take the Fluid url provided
132
+ * by the resolved url and constructs all the necessary services
133
+ * for communication with the container's server.
134
+ */
135
+ readonly documentServiceFactory: IDocumentServiceFactory;
136
+ /**
137
+ * The code loader handles loading the necessary code
138
+ * for running a container once it is loaded.
139
+ */
140
+ readonly codeLoader: ICodeDetailsLoader;
141
+ /**
142
+ * A property bag of options used by various layers
143
+ * to control features
144
+ */
145
+ readonly options?: ILoaderOptions;
146
+ /**
147
+ * Scope is provided to all container and is a set of shared
148
+ * services for container's to integrate with their host environment.
149
+ */
150
+ readonly scope?: FluidObject;
151
+ /**
152
+ * The logger that all telemetry should be pushed to.
153
+ */
154
+ readonly logger?: ITelemetryBaseLogger;
155
+ /**
156
+ * Blobs storage for detached containers.
157
+ */
158
+ readonly detachedBlobStorage?: IDetachedBlobStorage;
159
+ /**
160
+ * The configuration provider which may be used to control features.
161
+ */
162
+ readonly configProvider?: IConfigProviderBase;
163
+ /**
164
+ * Optional property for allowing the container to use a custom
165
+ * protocol implementation for handling the quorum and/or the audience.
166
+ */
167
+ readonly protocolHandlerBuilder?: ProtocolHandlerBuilder;
168
+ }
169
+
170
+ /**
171
+ * Services and properties used by and exposed by the loader
172
+ */
173
+ export declare interface ILoaderServices {
174
+ /**
175
+ * The url resolver used by the loader for resolving external urls
176
+ * into Fluid urls such that the container specified by the
177
+ * external url can be loaded.
178
+ */
179
+ readonly urlResolver: IUrlResolver;
180
+ /**
181
+ * The document service factory take the Fluid url provided
182
+ * by the resolved url and constructs all the necessary services
183
+ * for communication with the container's server.
184
+ */
185
+ readonly documentServiceFactory: IDocumentServiceFactory;
186
+ /**
187
+ * The code loader handles loading the necessary code
188
+ * for running a container once it is loaded.
189
+ */
190
+ readonly codeLoader: ICodeDetailsLoader;
191
+ /**
192
+ * A property bag of options used by various layers
193
+ * to control features
194
+ */
195
+ readonly options: ILoaderOptions;
196
+ /**
197
+ * Scope is provided to all container and is a set of shared
198
+ * services for container's to integrate with their host environment.
199
+ */
200
+ readonly scope: FluidObject;
201
+ /**
202
+ * The logger downstream consumers should construct their loggers from
203
+ */
204
+ readonly subLogger: ITelemetryLoggerExt;
205
+ /**
206
+ * Blobs storage for detached containers.
207
+ */
208
+ readonly detachedBlobStorage?: IDetachedBlobStorage;
209
+ /**
210
+ * Optional property for allowing the container to use a custom
211
+ * protocol implementation for handling the quorum and/or the audience.
212
+ */
213
+ readonly protocolHandlerBuilder?: ProtocolHandlerBuilder;
214
+ }
215
+
216
+ export declare interface IProtocolHandler extends IProtocolHandler_2 {
217
+ readonly audience: IAudienceOwner;
218
+ processSignal(message: ISignalMessage): any;
219
+ }
220
+
221
+ /**
222
+ * Checks if the error is location redirection error.
223
+ * @param error - error whose type is to be determined.
224
+ * @returns `true` is the error is location redirection error, otherwise `false`.
225
+ */
226
+ export declare function isLocationRedirectionError(error: any): error is ILocationRedirectionError;
227
+
228
+ /**
229
+ * Manages Fluid resource loading
230
+ */
231
+ export declare class Loader implements IHostLoader {
232
+ readonly services: ILoaderServices;
233
+ private readonly mc;
234
+ constructor(loaderProps: ILoaderProps);
235
+ /**
236
+ * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the Container's IFluidRouter/request.
237
+ */
238
+ get IFluidRouter(): IFluidRouter;
239
+ createDetachedContainer(codeDetails: IFluidCodeDetails, createDetachedProps?: {
240
+ canReconnect?: boolean;
241
+ clientDetailsOverride?: IClientDetails;
242
+ }): Promise<IContainer>;
243
+ rehydrateDetachedContainerFromSnapshot(snapshot: string, createDetachedProps?: {
244
+ canReconnect?: boolean;
245
+ clientDetailsOverride?: IClientDetails;
246
+ }): Promise<IContainer>;
247
+ resolve(request: IRequest, pendingLocalState?: string): Promise<IContainer>;
248
+ /**
249
+ * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the Container's IFluidRouter/request.
250
+ */
251
+ request(request: IRequest): Promise<IResponse>;
252
+ private resolveCore;
253
+ private loadContainer;
254
+ }
255
+
256
+ /**
257
+ * Function to be used for creating a protocol handler.
258
+ */
259
+ export declare type ProtocolHandlerBuilder = (attributes: IDocumentAttributes, snapshot: IQuorumSnapshot, sendProposal: (key: string, value: any) => number) => IProtocolHandler;
260
+
261
+ /**
262
+ * With an already-resolved container, we can request a component directly, without loading the container again
263
+ * @param container - a resolved container
264
+ * @returns component on the container
265
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
266
+ */
267
+ export declare function requestResolvedObjectFromContainer(container: IContainer, headers?: IRequestHeader): Promise<IResponse>;
268
+
269
+ /**
270
+ * Handles location redirection while fulfilling the loader request.
271
+ * @param api - Callback in which user can wrap the loader.resolve or loader.request call.
272
+ * @param request - request to be resolved.
273
+ * @param urlResolver - resolver used to resolve the url.
274
+ * @param logger - logger to send events.
275
+ * @returns Response from the API call.
276
+ */
277
+ export declare function resolveWithLocationRedirectionHandling<T>(api: (request: IRequest) => Promise<T>, request: IRequest, urlResolver: IUrlResolver, logger?: ITelemetryBaseLogger): Promise<T>;
278
+
279
+ /**
280
+ * Waits until container connects to delta storage and gets up-to-date.
281
+ *
282
+ * Useful when resolving URIs and hitting 404, due to container being loaded from (stale) snapshot and not being
283
+ * up to date. Host may chose to wait in such case and retry resolving URI.
284
+ *
285
+ * Warning: Will wait infinitely for connection to establish if there is no connection.
286
+ * May result in deadlock if Container.disconnect() is called and never followed by a call to Container.connect().
287
+ *
288
+ * @returns `true`: container is up to date, it processed all the ops that were know at the time of first connection.
289
+ *
290
+ * `false`: storage does not provide indication of how far the client is. Container processed all the ops known to it,
291
+ * but it maybe still behind.
292
+ *
293
+ * @throws an error beginning with `"Container closed"` if the container is closed before it catches up.
294
+ */
295
+ export declare function waitContainerToCatchUp(container: IContainer): Promise<boolean>;
296
+
297
+ export { }
@@ -87,10 +87,10 @@ export interface IConnectionManagerFactoryArgs {
87
87
  */
88
88
  readonly incomingOpHandler: (messages: ISequencedDocumentMessage[], reason: string) => void;
89
89
  /**
90
- * Called by connection manager for each incoming signals.
91
- * Maybe called before connectHandler is called (initial signals on socket connection)
90
+ * Called by connection manager for each incoming signal.
91
+ * May be called before connectHandler is called (due to initial signals on socket connection)
92
92
  */
93
- readonly signalHandler: (message: ISignalMessage) => void;
93
+ readonly signalHandler: (signals: ISignalMessage[]) => void;
94
94
  /**
95
95
  * Called when connection manager experiences delay in connecting to relay service.
96
96
  * This can happen because client is offline, or service is busy and asks to not connect for some time.
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EACN,kBAAkB,EAClB,uBAAuB,EACvB,WAAW,EACX,iBAAiB,EAEjB,YAAY,EACZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,aAAa,EACb,cAAc,EACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,oBAAY,aAAa;IACxB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,OAAO,YAAY;CACnB;AAED,MAAM,WAAW,4BAA4B,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,CAAC,CAAC;CACV;AAED;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;IACrE,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,MAAM,EAAE,4BAA4B,CAAC;CAC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,CAAC;KAC5C;IACD,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;AACvC,CAAC,CAAC;AAZW,QAAA,cAAc,kBAYzB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IErrorBase, ITelemetryProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tIConnectionDetails,\n\tICriticalContainerError,\n\tIDeltaQueue,\n\tIFluidCodeDetails,\n\tisFluidPackage,\n\tReadOnlyInfo,\n} from \"@fluidframework/container-definitions\";\nimport {\n\tConnectionMode,\n\tIClientConfiguration,\n\tIClientDetails,\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tISignalClient,\n\tISignalMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport { IContainerPackageInfo } from \"@fluidframework/driver-definitions\";\n\nexport enum ReconnectMode {\n\tNever = \"Never\",\n\tDisabled = \"Disabled\",\n\tEnabled = \"Enabled\",\n}\n\nexport interface IConnectionStateChangeReason<T extends IErrorBase = IErrorBase> {\n\ttext: string;\n\terror?: T;\n}\n\n/**\n * Internal version of IConnectionDetails with props are only exposed internally\n */\nexport interface IConnectionDetailsInternal extends IConnectionDetails {\n\tmode: ConnectionMode;\n\tversion: string;\n\tinitialClients: ISignalClient[];\n\treason: IConnectionStateChangeReason;\n}\n\n/**\n * Connection manager (implements this interface) is responsible for maintaining connection\n * to relay service.\n */\nexport interface IConnectionManager {\n\treadonly connected: boolean;\n\n\treadonly clientId: string | undefined;\n\n\t/** The queue of outbound delta messages */\n\treadonly outbound: IDeltaQueue<IDocumentMessage[]>;\n\n\t/** Details of client */\n\treadonly clientDetails: IClientDetails;\n\n\t/** Protocol version being used to communicate with the service */\n\treadonly version: string;\n\n\t/** Max message size allowed to the delta manager */\n\treadonly maxMessageSize: number;\n\n\t/** Service configuration provided by the service. */\n\treadonly serviceConfiguration: IClientConfiguration | undefined;\n\n\treadonly readOnlyInfo: ReadOnlyInfo;\n\n\t// Various connectivity properties for telemetry describing type of current connection\n\t// Things like connection mode, service info, etc.\n\t// Called when connection state changes (connect / disconnect)\n\treadonly connectionProps: ITelemetryProperties;\n\n\t// Verbose information about connection logged to telemetry in case of issues with\n\t// maintaining healthy connection, including op gaps, not receiving join op in time, etc.\n\t// Contains details information, like sequence numbers at connection time, initial ops info, etc.\n\treadonly connectionVerboseProps: ITelemetryProperties;\n\n\t/**\n\t * Prepares message to be sent. Fills in clientSequenceNumber.\n\t * Called only when active connection is present.\n\t */\n\tprepareMessageToSend(\n\t\tmessage: Omit<IDocumentMessage, \"clientSequenceNumber\">,\n\t): IDocumentMessage | undefined;\n\n\t/**\n\t * Called before incoming message is processed. Incoming messages can be combing from connection,\n\t * but also could come from storage.\n\t * This call allows connection manager to adjust knowledge about acked ops sent on previous connection.\n\t * Can be called at any time, including when there is no active connection.\n\t */\n\tbeforeProcessingIncomingOp(message: ISequencedDocumentMessage): void;\n\n\t/**\n\t * Submits signal to relay service.\n\t * Called only when active connection is present.\n\t */\n\tsubmitSignal(content: any): void;\n\n\t/**\n\t * Submits messages to relay service.\n\t * Called only when active connection is present.\n\t */\n\tsendMessages(messages: IDocumentMessage[]): void;\n\n\t/**\n\t * Initiates connection to relay service (noop if already connected).\n\t */\n\tconnect(reason: IConnectionStateChangeReason, connectionMode?: ConnectionMode): void;\n\n\t/**\n\t * Disposed connection manager\n\t */\n\tdispose(error?: ICriticalContainerError, switchToReadonly?: boolean): void;\n\n\tget connectionMode(): ConnectionMode;\n}\n\n/**\n * This interface represents a set of callbacks provided by DeltaManager to IConnectionManager on its creation\n * IConnectionManager instance will use them to communicate to DeltaManager about various events.\n */\nexport interface IConnectionManagerFactoryArgs {\n\t/**\n\t * Called by connection manager for each incoming op. Some ops maybe delivered before\n\t * connectHandler is called (initial ops on socket connection)\n\t */\n\treadonly incomingOpHandler: (messages: ISequencedDocumentMessage[], reason: string) => void;\n\n\t/**\n\t * Called by connection manager for each incoming signals.\n\t * Maybe called before connectHandler is called (initial signals on socket connection)\n\t */\n\treadonly signalHandler: (message: ISignalMessage) => void;\n\n\t/**\n\t * Called when connection manager experiences delay in connecting to relay service.\n\t * This can happen because client is offline, or service is busy and asks to not connect for some time.\n\t * Can be called many times while not connected.\n\t * Situation is considered resolved when connection is established and connectHandler is called.\n\t */\n\treadonly reconnectionDelayHandler: (delayMs: number, error: unknown) => void;\n\n\t/**\n\t * Called by connection manager whenever critical error happens and container should be closed.\n\t * Expects dispose() call in response to this call.\n\t */\n\treadonly closeHandler: (error?: any) => void;\n\n\t/**\n\t * Called whenever connection to relay service is lost.\n\t */\n\treadonly disconnectHandler: (reason: IConnectionStateChangeReason) => void;\n\n\t/**\n\t * Called whenever new connection to rely service is established\n\t */\n\treadonly connectHandler: (connection: IConnectionDetailsInternal) => void;\n\n\t/**\n\t * Called whenever ping/pong messages are roundtripped on connection.\n\t */\n\treadonly pongHandler: (latency: number) => void;\n\n\t/**\n\t * Called whenever connection type changes from writable to read-only or vice versa.\n\t *\n\t * @remarks\n\t *\n\t * Connection can be read-only if user has no edit permissions, or if container forced\n\t * connection to be read-only.\n\t * This should not be confused with \"read\" / \"write\"connection mode which is internal\n\t * optimization.\n\t *\n\t * @param readonly - Whether or not the container is now read-only.\n\t * `undefined` indicates that user permissions are not yet known.\n\t * @param readonlyConnectionReason - reason/error if any for the change\n\t */\n\treadonly readonlyChangeHandler: (\n\t\treadonly?: boolean,\n\t\treadonlyConnectionReason?: IConnectionStateChangeReason,\n\t) => void;\n\n\t/**\n\t * Called whenever we try to start establishing a new connection.\n\t */\n\treadonly establishConnectionHandler: (reason: IConnectionStateChangeReason) => void;\n\n\t/**\n\t * Called whenever we cancel the connection in progress.\n\t */\n\treadonly cancelConnectionHandler: (reason: IConnectionStateChangeReason) => void;\n}\n\n/**\n *\n * @param codeDetails- - Data structure used to describe the code to load on the Fluid document\n * @returns The name of the Fluid package\n */\nexport const getPackageName = (\n\tcodeDetails: IFluidCodeDetails | undefined,\n): IContainerPackageInfo => {\n\tlet containerPackageName;\n\tif (codeDetails && \"name\" in codeDetails) {\n\t\tcontainerPackageName = codeDetails;\n\t} else if (isFluidPackage(codeDetails?.package)) {\n\t\tcontainerPackageName = codeDetails?.package.name;\n\t} else {\n\t\tcontainerPackageName = codeDetails?.package;\n\t}\n\treturn { name: containerPackageName };\n};\n"]}
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,iFAO+C;AAY/C,IAAY,aAIX;AAJD,WAAY,aAAa;IACxB,gCAAe,CAAA;IACf,sCAAqB,CAAA;IACrB,oCAAmB,CAAA;AACpB,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AA0KD;;;;GAIG;AACI,MAAM,cAAc,GAAG,CAC7B,WAA0C,EAClB,EAAE;IAC1B,IAAI,oBAAoB,CAAC;IACzB,IAAI,WAAW,IAAI,MAAM,IAAI,WAAW,EAAE;QACzC,oBAAoB,GAAG,WAAW,CAAC;KACnC;SAAM,IAAI,IAAA,sCAAc,EAAC,WAAW,EAAE,OAAO,CAAC,EAAE;QAChD,oBAAoB,GAAG,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC;KACjD;SAAM;QACN,oBAAoB,GAAG,WAAW,EAAE,OAAO,CAAC;KAC5C;IACD,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;AACvC,CAAC,CAAC;AAZW,QAAA,cAAc,kBAYzB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IErrorBase, ITelemetryProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tIConnectionDetails,\n\tICriticalContainerError,\n\tIDeltaQueue,\n\tIFluidCodeDetails,\n\tisFluidPackage,\n\tReadOnlyInfo,\n} from \"@fluidframework/container-definitions\";\nimport {\n\tConnectionMode,\n\tIClientConfiguration,\n\tIClientDetails,\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tISignalClient,\n\tISignalMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport { IContainerPackageInfo } from \"@fluidframework/driver-definitions\";\n\nexport enum ReconnectMode {\n\tNever = \"Never\",\n\tDisabled = \"Disabled\",\n\tEnabled = \"Enabled\",\n}\n\nexport interface IConnectionStateChangeReason<T extends IErrorBase = IErrorBase> {\n\ttext: string;\n\terror?: T;\n}\n\n/**\n * Internal version of IConnectionDetails with props are only exposed internally\n */\nexport interface IConnectionDetailsInternal extends IConnectionDetails {\n\tmode: ConnectionMode;\n\tversion: string;\n\tinitialClients: ISignalClient[];\n\treason: IConnectionStateChangeReason;\n}\n\n/**\n * Connection manager (implements this interface) is responsible for maintaining connection\n * to relay service.\n */\nexport interface IConnectionManager {\n\treadonly connected: boolean;\n\n\treadonly clientId: string | undefined;\n\n\t/** The queue of outbound delta messages */\n\treadonly outbound: IDeltaQueue<IDocumentMessage[]>;\n\n\t/** Details of client */\n\treadonly clientDetails: IClientDetails;\n\n\t/** Protocol version being used to communicate with the service */\n\treadonly version: string;\n\n\t/** Max message size allowed to the delta manager */\n\treadonly maxMessageSize: number;\n\n\t/** Service configuration provided by the service. */\n\treadonly serviceConfiguration: IClientConfiguration | undefined;\n\n\treadonly readOnlyInfo: ReadOnlyInfo;\n\n\t// Various connectivity properties for telemetry describing type of current connection\n\t// Things like connection mode, service info, etc.\n\t// Called when connection state changes (connect / disconnect)\n\treadonly connectionProps: ITelemetryProperties;\n\n\t// Verbose information about connection logged to telemetry in case of issues with\n\t// maintaining healthy connection, including op gaps, not receiving join op in time, etc.\n\t// Contains details information, like sequence numbers at connection time, initial ops info, etc.\n\treadonly connectionVerboseProps: ITelemetryProperties;\n\n\t/**\n\t * Prepares message to be sent. Fills in clientSequenceNumber.\n\t * Called only when active connection is present.\n\t */\n\tprepareMessageToSend(\n\t\tmessage: Omit<IDocumentMessage, \"clientSequenceNumber\">,\n\t): IDocumentMessage | undefined;\n\n\t/**\n\t * Called before incoming message is processed. Incoming messages can be combing from connection,\n\t * but also could come from storage.\n\t * This call allows connection manager to adjust knowledge about acked ops sent on previous connection.\n\t * Can be called at any time, including when there is no active connection.\n\t */\n\tbeforeProcessingIncomingOp(message: ISequencedDocumentMessage): void;\n\n\t/**\n\t * Submits signal to relay service.\n\t * Called only when active connection is present.\n\t */\n\tsubmitSignal(content: any): void;\n\n\t/**\n\t * Submits messages to relay service.\n\t * Called only when active connection is present.\n\t */\n\tsendMessages(messages: IDocumentMessage[]): void;\n\n\t/**\n\t * Initiates connection to relay service (noop if already connected).\n\t */\n\tconnect(reason: IConnectionStateChangeReason, connectionMode?: ConnectionMode): void;\n\n\t/**\n\t * Disposed connection manager\n\t */\n\tdispose(error?: ICriticalContainerError, switchToReadonly?: boolean): void;\n\n\tget connectionMode(): ConnectionMode;\n}\n\n/**\n * This interface represents a set of callbacks provided by DeltaManager to IConnectionManager on its creation\n * IConnectionManager instance will use them to communicate to DeltaManager about various events.\n */\nexport interface IConnectionManagerFactoryArgs {\n\t/**\n\t * Called by connection manager for each incoming op. Some ops maybe delivered before\n\t * connectHandler is called (initial ops on socket connection)\n\t */\n\treadonly incomingOpHandler: (messages: ISequencedDocumentMessage[], reason: string) => void;\n\n\t/**\n\t * Called by connection manager for each incoming signal.\n\t * May be called before connectHandler is called (due to initial signals on socket connection)\n\t */\n\treadonly signalHandler: (signals: ISignalMessage[]) => void;\n\n\t/**\n\t * Called when connection manager experiences delay in connecting to relay service.\n\t * This can happen because client is offline, or service is busy and asks to not connect for some time.\n\t * Can be called many times while not connected.\n\t * Situation is considered resolved when connection is established and connectHandler is called.\n\t */\n\treadonly reconnectionDelayHandler: (delayMs: number, error: unknown) => void;\n\n\t/**\n\t * Called by connection manager whenever critical error happens and container should be closed.\n\t * Expects dispose() call in response to this call.\n\t */\n\treadonly closeHandler: (error?: any) => void;\n\n\t/**\n\t * Called whenever connection to relay service is lost.\n\t */\n\treadonly disconnectHandler: (reason: IConnectionStateChangeReason) => void;\n\n\t/**\n\t * Called whenever new connection to rely service is established\n\t */\n\treadonly connectHandler: (connection: IConnectionDetailsInternal) => void;\n\n\t/**\n\t * Called whenever ping/pong messages are roundtripped on connection.\n\t */\n\treadonly pongHandler: (latency: number) => void;\n\n\t/**\n\t * Called whenever connection type changes from writable to read-only or vice versa.\n\t *\n\t * @remarks\n\t *\n\t * Connection can be read-only if user has no edit permissions, or if container forced\n\t * connection to be read-only.\n\t * This should not be confused with \"read\" / \"write\"connection mode which is internal\n\t * optimization.\n\t *\n\t * @param readonly - Whether or not the container is now read-only.\n\t * `undefined` indicates that user permissions are not yet known.\n\t * @param readonlyConnectionReason - reason/error if any for the change\n\t */\n\treadonly readonlyChangeHandler: (\n\t\treadonly?: boolean,\n\t\treadonlyConnectionReason?: IConnectionStateChangeReason,\n\t) => void;\n\n\t/**\n\t * Called whenever we try to start establishing a new connection.\n\t */\n\treadonly establishConnectionHandler: (reason: IConnectionStateChangeReason) => void;\n\n\t/**\n\t * Called whenever we cancel the connection in progress.\n\t */\n\treadonly cancelConnectionHandler: (reason: IConnectionStateChangeReason) => void;\n}\n\n/**\n *\n * @param codeDetails- - Data structure used to describe the code to load on the Fluid document\n * @returns The name of the Fluid package\n */\nexport const getPackageName = (\n\tcodeDetails: IFluidCodeDetails | undefined,\n): IContainerPackageInfo => {\n\tlet containerPackageName;\n\tif (codeDetails && \"name\" in codeDetails) {\n\t\tcontainerPackageName = codeDetails;\n\t} else if (isFluidPackage(codeDetails?.package)) {\n\t\tcontainerPackageName = codeDetails?.package.name;\n\t} else {\n\t\tcontainerPackageName = codeDetails?.package;\n\t}\n\treturn { name: containerPackageName };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"debugLogger.d.ts","sourceRoot":"","sources":["../src/debugLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EACnB,oBAAoB,EAEpB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACN,mBAAmB,EACnB,4BAA4B,EAI5B,MAAM,iCAAiC,CAAC;AAEzC;;GAEG;AACH,qBAAa,WAAY,YAAW,oBAAoB;IAuCnC,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAa,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAtChF;;;;;;;OAOG;WACW,gBAAgB,CAC7B,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,oBAAoB,EACjC,UAAU,CAAC,EAAE,4BAA4B,GACvC,mBAAmB;IA0BtB,OAAO;IAEP;;;;OAIG;IACI,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;CA4C7C"}
1
+ {"version":3,"file":"debugLogger.d.ts","sourceRoot":"","sources":["../src/debugLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EACnB,oBAAoB,EAEpB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACN,mBAAmB,EACnB,4BAA4B,EAI5B,MAAM,iCAAiC,CAAC;AAEzC;;GAEG;AACH,qBAAa,WAAY,YAAW,oBAAoB;IAwCtD,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAxC1B;;;;;;;OAOG;WACW,gBAAgB,CAC7B,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,oBAAoB,EACjC,UAAU,CAAC,EAAE,4BAA4B,GACvC,mBAAmB;IA0BtB,OAAO;IAKP;;;;OAIG;IACI,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;CA4C7C"}