@fluidframework/container-loader 2.0.0-internal.7.1.0 → 2.0.0-internal.7.2.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 (98) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-report/container-loader.api.md +13 -2
  3. package/dist/connectionManager.d.ts +1 -1
  4. package/dist/connectionManager.d.ts.map +1 -1
  5. package/dist/connectionManager.js +9 -4
  6. package/dist/connectionManager.js.map +1 -1
  7. package/dist/container.d.ts +6 -5
  8. package/dist/container.d.ts.map +1 -1
  9. package/dist/container.js +21 -19
  10. package/dist/container.js.map +1 -1
  11. package/dist/containerContext.d.ts +2 -2
  12. package/dist/containerContext.d.ts.map +1 -1
  13. package/dist/containerContext.js.map +1 -1
  14. package/dist/containerStorageAdapter.d.ts +1 -1
  15. package/dist/containerStorageAdapter.d.ts.map +1 -1
  16. package/dist/containerStorageAdapter.js +3 -3
  17. package/dist/containerStorageAdapter.js.map +1 -1
  18. package/dist/contracts.d.ts +1 -1
  19. package/dist/contracts.d.ts.map +1 -1
  20. package/dist/contracts.js.map +1 -1
  21. package/dist/deltaManager.d.ts +1 -1
  22. package/dist/deltaManager.d.ts.map +1 -1
  23. package/dist/deltaManager.js +3 -8
  24. package/dist/deltaManager.js.map +1 -1
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +3 -1
  28. package/dist/index.js.map +1 -1
  29. package/dist/loader.d.ts +4 -4
  30. package/dist/loader.js +7 -7
  31. package/dist/loader.js.map +1 -1
  32. package/dist/packageVersion.d.ts +1 -1
  33. package/dist/packageVersion.js +1 -1
  34. package/dist/packageVersion.js.map +1 -1
  35. package/dist/retriableDocumentStorageService.d.ts +3 -2
  36. package/dist/retriableDocumentStorageService.d.ts.map +1 -1
  37. package/dist/retriableDocumentStorageService.js +18 -11
  38. package/dist/retriableDocumentStorageService.js.map +1 -1
  39. package/dist/utils.d.ts +23 -1
  40. package/dist/utils.d.ts.map +1 -1
  41. package/dist/utils.js +11 -3
  42. package/dist/utils.js.map +1 -1
  43. package/lib/connectionManager.d.ts +1 -1
  44. package/lib/connectionManager.d.ts.map +1 -1
  45. package/lib/connectionManager.js +9 -4
  46. package/lib/connectionManager.js.map +1 -1
  47. package/lib/container.d.ts +6 -5
  48. package/lib/container.d.ts.map +1 -1
  49. package/lib/container.js +21 -19
  50. package/lib/container.js.map +1 -1
  51. package/lib/containerContext.d.ts +2 -2
  52. package/lib/containerContext.d.ts.map +1 -1
  53. package/lib/containerContext.js.map +1 -1
  54. package/lib/containerStorageAdapter.d.ts +1 -1
  55. package/lib/containerStorageAdapter.d.ts.map +1 -1
  56. package/lib/containerStorageAdapter.js +3 -3
  57. package/lib/containerStorageAdapter.js.map +1 -1
  58. package/lib/contracts.d.ts +1 -1
  59. package/lib/contracts.d.ts.map +1 -1
  60. package/lib/contracts.js.map +1 -1
  61. package/lib/deltaManager.d.ts +1 -1
  62. package/lib/deltaManager.d.ts.map +1 -1
  63. package/lib/deltaManager.js +3 -8
  64. package/lib/deltaManager.js.map +1 -1
  65. package/lib/index.d.ts +1 -0
  66. package/lib/index.d.ts.map +1 -1
  67. package/lib/index.js +1 -0
  68. package/lib/index.js.map +1 -1
  69. package/lib/loader.d.ts +4 -4
  70. package/lib/loader.js +8 -8
  71. package/lib/loader.js.map +1 -1
  72. package/lib/packageVersion.d.ts +1 -1
  73. package/lib/packageVersion.js +1 -1
  74. package/lib/packageVersion.js.map +1 -1
  75. package/lib/retriableDocumentStorageService.d.ts +3 -2
  76. package/lib/retriableDocumentStorageService.d.ts.map +1 -1
  77. package/lib/retriableDocumentStorageService.js +18 -11
  78. package/lib/retriableDocumentStorageService.js.map +1 -1
  79. package/lib/utils.d.ts +23 -1
  80. package/lib/utils.d.ts.map +1 -1
  81. package/lib/utils.js +9 -1
  82. package/lib/utils.js.map +1 -1
  83. package/package.json +16 -17
  84. package/src/connectionManager.ts +13 -5
  85. package/src/container.ts +34 -24
  86. package/src/containerContext.ts +1 -1
  87. package/src/containerStorageAdapter.ts +3 -3
  88. package/src/contracts.ts +1 -1
  89. package/src/deltaManager.ts +6 -23
  90. package/src/index.ts +1 -0
  91. package/src/loader.ts +8 -8
  92. package/src/packageVersion.ts +1 -1
  93. package/src/retriableDocumentStorageService.ts +29 -15
  94. package/src/utils.ts +23 -1
  95. package/dist/container-loader-alpha.d.ts +0 -297
  96. package/dist/container-loader-beta.d.ts +0 -297
  97. package/dist/container-loader-public.d.ts +0 -297
  98. package/dist/container-loader.d.ts +0 -297
@@ -114,17 +114,6 @@ function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage):
114
114
  }
115
115
  }
116
116
 
117
- /**
118
- * Type is used to cast AbortController to represent new version of DOM API and prevent build issues
119
- * TODO: Remove when typescript version of the repo contains the AbortSignal.reason property (AB#5045)
120
- */
121
- type AbortControllerReal = AbortController & { abort(reason?: any): void };
122
- /**
123
- * Type is used to cast AbortSignal to represent new version of DOM API and prevent build issues
124
- * TODO: Remove when typescript version of the repo contains the AbortSignal.reason property (AB#5045)
125
- */
126
- type AbortSignalReal = AbortSignal & { reason: any };
127
-
128
117
  /**
129
118
  * Manages the flow of both inbound and outbound messages. This class ensures that shared objects receive delta
130
119
  * messages in order regardless of possible network conditions or timings causing out of order delivery.
@@ -312,8 +301,8 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
312
301
  return message.clientSequenceNumber;
313
302
  }
314
303
 
315
- public submitSignal(content: any) {
316
- return this.connectionManager.submitSignal(content);
304
+ public submitSignal(content: any, targetClientId?: string) {
305
+ return this.connectionManager.submitSignal(content, targetClientId);
317
306
  }
318
307
 
319
308
  public flush() {
@@ -667,8 +656,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
667
656
  // This is useless for known ranges (to is defined) as it means request is over either way.
668
657
  // And it will cancel unbound request too early, not allowing us to learn where the end of the file is.
669
658
  if (!opsFromFetch && cancelFetch(op)) {
670
- // TODO: Remove when typescript version of the repo contains the AbortSignal.reason property (AB#5045)
671
- (controller as AbortControllerReal).abort("DeltaManager getDeltas fetch cancelled");
659
+ controller.abort("DeltaManager getDeltas fetch cancelled");
672
660
  this._inbound.off("push", opListener);
673
661
  }
674
662
  };
@@ -677,10 +665,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
677
665
  this._inbound.on("push", opListener);
678
666
  assert(this.closeAbortController.signal.onabort === null, 0x1e8 /* "reentrancy" */);
679
667
  this.closeAbortController.signal.onabort = () =>
680
- // TODO: Remove when typescript version of the repo contains the AbortSignal.reason property (AB#5045)
681
- (controller as AbortControllerReal).abort(
682
- (this.closeAbortController.signal as AbortSignalReal).reason,
683
- );
668
+ controller.abort(this.closeAbortController.signal.reason);
684
669
 
685
670
  const stream = this.deltaStorage.fetchMessages(
686
671
  from, // inclusive
@@ -708,8 +693,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
708
693
  this.logger.sendTelemetryEvent({
709
694
  eventName: "DeltaManager_GetDeltasAborted",
710
695
  fetchReason,
711
- // TODO: Remove when typescript version of the repo contains the AbortSignal.reason property (AB#5045)
712
- reason: (controller.signal as AbortSignalReal).reason,
696
+ reason: controller.signal.reason,
713
697
  });
714
698
  }
715
699
  this.closeAbortController.signal.onabort = null;
@@ -766,8 +750,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
766
750
  }
767
751
 
768
752
  private clearQueues() {
769
- // TODO: Remove when typescript version of the repo contains the AbortSignal.reason property (AB#5045)
770
- (this.closeAbortController as AbortControllerReal).abort("DeltaManager is closed");
753
+ this.closeAbortController.abort("DeltaManager is closed");
771
754
 
772
755
  this._inbound.clear();
773
756
  this._inboundSignal.clear();
package/src/index.ts CHANGED
@@ -20,3 +20,4 @@ export {
20
20
  resolveWithLocationRedirectionHandling,
21
21
  } from "./location-redirection-utilities";
22
22
  export { IProtocolHandler, ProtocolHandlerBuilder } from "./protocol";
23
+ export { tryParseCompatibleResolvedUrl, IParsedUrl } from "./utils";
package/src/loader.ts CHANGED
@@ -41,7 +41,7 @@ import {
41
41
  } from "@fluidframework/driver-definitions";
42
42
  import { IClientDetails } from "@fluidframework/protocol-definitions";
43
43
  import { Container, IPendingContainerState } from "./container";
44
- import { IParsedUrl, parseUrl } from "./utils";
44
+ import { IParsedUrl, tryParseCompatibleResolvedUrl } from "./utils";
45
45
  import { pkgVersion } from "./packageVersion";
46
46
  import { ProtocolHandlerBuilder } from "./protocol";
47
47
  import { DebugLogger } from "./debugLogger";
@@ -63,7 +63,7 @@ export class RelativeLoader implements ILoader {
63
63
  ) {}
64
64
 
65
65
  /**
66
- * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the Container's IFluidRouter/request.
66
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the Container's IFluidRouter/request.
67
67
  */
68
68
  // eslint-disable-next-line import/no-deprecated
69
69
  public get IFluidRouter(): IFluidRouter {
@@ -94,7 +94,7 @@ export class RelativeLoader implements ILoader {
94
94
  }
95
95
 
96
96
  /**
97
- * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
97
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
98
98
  */
99
99
  public async request(request: IRequest): Promise<IResponse> {
100
100
  if (request.url.startsWith("/")) {
@@ -280,7 +280,7 @@ export async function requestResolvedObjectFromContainer(
280
280
  headers?: IRequestHeader,
281
281
  ): Promise<IResponse> {
282
282
  ensureResolvedUrlDefined(container.resolvedUrl);
283
- const parsedUrl = parseUrl(container.resolvedUrl.url);
283
+ const parsedUrl = tryParseCompatibleResolvedUrl(container.resolvedUrl.url);
284
284
 
285
285
  if (parsedUrl === undefined) {
286
286
  throw new Error(`Invalid URL ${container.resolvedUrl.url}`);
@@ -347,7 +347,7 @@ export class Loader implements IHostLoader {
347
347
  }
348
348
 
349
349
  /**
350
- * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the Container's IFluidRouter/request.
350
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the Container's IFluidRouter/request.
351
351
  */
352
352
  // eslint-disable-next-line import/no-deprecated
353
353
  public get IFluidRouter(): IFluidRouter {
@@ -398,7 +398,7 @@ export class Loader implements IHostLoader {
398
398
  }
399
399
 
400
400
  /**
401
- * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the Container's IFluidRouter/request.
401
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the Container's IFluidRouter/request.
402
402
  */
403
403
  public async request(request: IRequest): Promise<IResponse> {
404
404
  return PerformanceEvent.timedExecAsync(
@@ -422,13 +422,13 @@ export class Loader implements IHostLoader {
422
422
  ensureResolvedUrlDefined(resolvedAsFluid);
423
423
 
424
424
  // Parse URL into data stores
425
- const parsed = parseUrl(resolvedAsFluid.url);
425
+ const parsed = tryParseCompatibleResolvedUrl(resolvedAsFluid.url);
426
426
  if (parsed === undefined) {
427
427
  throw new Error(`Invalid URL ${resolvedAsFluid.url}`);
428
428
  }
429
429
 
430
430
  if (pendingLocalState !== undefined) {
431
- const parsedPendingUrl = parseUrl(pendingLocalState.url);
431
+ const parsedPendingUrl = tryParseCompatibleResolvedUrl(pendingLocalState.url);
432
432
  if (
433
433
  parsedPendingUrl?.id !== parsed.id ||
434
434
  parsedPendingUrl?.path.replace(/\/$/, "") !== parsed.path.replace(/\/$/, "")
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-loader";
9
- export const pkgVersion = "2.0.0-internal.7.1.0";
9
+ export const pkgVersion = "2.0.0-internal.7.2.0";
@@ -23,13 +23,19 @@ import { runWithRetry } from "@fluidframework/driver-utils";
23
23
 
24
24
  export class RetriableDocumentStorageService implements IDocumentStorageService, IDisposable {
25
25
  private _disposed = false;
26
+ private internalStorageService: IDocumentStorageService | undefined;
26
27
  constructor(
27
- private readonly internalStorageService: IDocumentStorageService,
28
+ private readonly internalStorageServiceP: Promise<IDocumentStorageService>,
28
29
  private readonly logger: ITelemetryLoggerExt,
29
- ) {}
30
+ ) {
31
+ this.internalStorageServiceP.then((s) => (this.internalStorageService = s)).catch(() => {});
32
+ }
30
33
 
31
34
  public get policies(): IDocumentStorageServicePolicies | undefined {
32
- return this.internalStorageService.policies;
35
+ if (this.internalStorageService) {
36
+ return this.internalStorageService.policies;
37
+ }
38
+ throw new Error("storage service not yet instantiated");
33
39
  }
34
40
  public get disposed() {
35
41
  return this._disposed;
@@ -39,7 +45,10 @@ export class RetriableDocumentStorageService implements IDocumentStorageService,
39
45
  }
40
46
 
41
47
  public get repositoryUrl(): string {
42
- return this.internalStorageService.repositoryUrl;
48
+ if (this.internalStorageService) {
49
+ return this.internalStorageService.repositoryUrl;
50
+ }
51
+ throw new Error("storage service not yet instantiated");
43
52
  }
44
53
 
45
54
  public async getSnapshotTree(
@@ -47,14 +56,17 @@ export class RetriableDocumentStorageService implements IDocumentStorageService,
47
56
  scenarioName?: string,
48
57
  ): Promise<ISnapshotTree | null> {
49
58
  return this.runWithRetry(
50
- async () => this.internalStorageService.getSnapshotTree(version, scenarioName),
59
+ async () =>
60
+ this.internalStorageServiceP.then(async (s) =>
61
+ s.getSnapshotTree(version, scenarioName),
62
+ ),
51
63
  "storage_getSnapshotTree",
52
64
  );
53
65
  }
54
66
 
55
67
  public async readBlob(id: string): Promise<ArrayBufferLike> {
56
68
  return this.runWithRetry(
57
- async () => this.internalStorageService.readBlob(id),
69
+ async () => this.internalStorageServiceP.then(async (s) => s.readBlob(id)),
58
70
  "storage_readBlob",
59
71
  );
60
72
  }
@@ -67,11 +79,8 @@ export class RetriableDocumentStorageService implements IDocumentStorageService,
67
79
  ): Promise<IVersion[]> {
68
80
  return this.runWithRetry(
69
81
  async () =>
70
- this.internalStorageService.getVersions(
71
- versionId,
72
- count,
73
- scenarioName,
74
- fetchSource,
82
+ this.internalStorageServiceP.then(async (s) =>
83
+ s.getVersions(versionId, count, scenarioName, fetchSource),
75
84
  ),
76
85
  "storage_getVersions",
77
86
  );
@@ -95,26 +104,31 @@ export class RetriableDocumentStorageService implements IDocumentStorageService,
95
104
  0x251 /* "creation summary has to have seq=0 && handle === undefined" */,
96
105
  );
97
106
  if (context.referenceSequenceNumber !== 0) {
98
- return this.internalStorageService.uploadSummaryWithContext(summary, context);
107
+ return this.internalStorageServiceP.then(async (s) =>
108
+ s.uploadSummaryWithContext(summary, context),
109
+ );
99
110
  }
100
111
 
101
112
  // Creation flow with attachment blobs - need to do retries!
102
113
  return this.runWithRetry(
103
- async () => this.internalStorageService.uploadSummaryWithContext(summary, context),
114
+ async () =>
115
+ this.internalStorageServiceP.then(async (s) =>
116
+ s.uploadSummaryWithContext(summary, context),
117
+ ),
104
118
  "storage_uploadSummaryWithContext",
105
119
  );
106
120
  }
107
121
 
108
122
  public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {
109
123
  return this.runWithRetry(
110
- async () => this.internalStorageService.downloadSummary(handle),
124
+ async () => this.internalStorageServiceP.then(async (s) => s.downloadSummary(handle)),
111
125
  "storage_downloadSummary",
112
126
  );
113
127
  }
114
128
 
115
129
  public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {
116
130
  return this.runWithRetry(
117
- async () => this.internalStorageService.createBlob(file),
131
+ async () => this.internalStorageServiceP.then(async (s) => s.createBlob(file)),
118
132
  "storage_createBlob",
119
133
  );
120
134
  }
package/src/utils.ts CHANGED
@@ -23,9 +23,23 @@ export interface ISnapshotTreeWithBlobContents extends ISnapshotTree {
23
23
  trees: { [path: string]: ISnapshotTreeWithBlobContents };
24
24
  }
25
25
 
26
+ /**
27
+ * Interface to represent the parsed parts of IResolvedUrl.url to help
28
+ * in getting info about different parts of the url.
29
+ * May not be compatible or relevant for any Url Resolver
30
+ */
26
31
  export interface IParsedUrl {
32
+ /**
33
+ * It is combination of tenantid/docId part of the url.
34
+ */
27
35
  id: string;
36
+ /**
37
+ * It is the deep link path in the url.
38
+ */
28
39
  path: string;
40
+ /**
41
+ * Query string part of the url.
42
+ */
29
43
  query: string;
30
44
  /**
31
45
  * Null means do not use snapshots, undefined means load latest snapshot
@@ -35,7 +49,15 @@ export interface IParsedUrl {
35
49
  version: string | null | undefined;
36
50
  }
37
51
 
38
- export function parseUrl(url: string): IParsedUrl | undefined {
52
+ /**
53
+ * Utility api to parse the IResolvedUrl.url into specific parts like querystring, path to get
54
+ * deep link info etc.
55
+ * Warning - This function may not be compatible with any Url Resolver's resolved url. It works
56
+ * with urls of type: protocol://<string>/.../..?<querystring>
57
+ * @param url - This is the IResolvedUrl.url part of the resolved url.
58
+ * @returns The IParsedUrl representing the input URL, or undefined if the format was not supported
59
+ */
60
+ export function tryParseCompatibleResolvedUrl(url: string): IParsedUrl | undefined {
39
61
  const parsed = parse(url, true);
40
62
  if (typeof parsed.pathname !== "string") {
41
63
  throw new LoggingError("Failed to parse pathname");
@@ -1,297 +0,0 @@
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 { }