@fluidframework/odsp-driver 2.117.0 → 2.118.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 +56 -0
- package/api-extractor/api-extractor-lint-pointInTime.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-pointInTime.esm.json +5 -0
- package/api-extractor/api-extractor-report.pointInTime.json +9 -0
- package/api-report/odsp-driver.legacy.alpha.api.md +28 -1
- package/api-report/odsp-driver.legacy.beta.api.md +28 -1
- package/api-report/odsp-driver.point-in-time.legacy.beta.api.md +117 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +4 -0
- package/dist/legacyAlpha.d.ts +4 -0
- package/dist/odspDocumentServiceFactory.d.ts +46 -1
- package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactory.js +60 -1
- package/dist/odspDocumentServiceFactory.js.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.d.ts +74 -3
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.js +0 -3
- package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pointInTime.d.ts +15 -0
- package/dist/pointInTime.d.ts.map +1 -0
- package/dist/pointInTime.js +16 -0
- package/dist/pointInTime.js.map +1 -0
- package/dist/pointInTimeDriver/createPointInTimeDocumentService.d.ts +34 -0
- package/dist/pointInTimeDriver/createPointInTimeDocumentService.d.ts.map +1 -0
- package/dist/pointInTimeDriver/createPointInTimeDocumentService.js +90 -0
- package/dist/pointInTimeDriver/createPointInTimeDocumentService.js.map +1 -0
- package/legacy/point-in-time.d.ts +6 -0
- package/lib/index.d.ts +2 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -5
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +4 -0
- package/lib/legacyAlpha.d.ts +4 -0
- package/lib/odspDocumentServiceFactory.d.ts +46 -1
- package/lib/odspDocumentServiceFactory.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactory.js +58 -1
- package/lib/odspDocumentServiceFactory.js.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.d.ts +74 -3
- package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.js +0 -3
- package/lib/odspDocumentServiceFactoryCore.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pointInTime.d.ts +15 -0
- package/lib/pointInTime.d.ts.map +1 -0
- package/lib/pointInTime.js +12 -0
- package/lib/pointInTime.js.map +1 -0
- package/lib/pointInTimeDriver/createPointInTimeDocumentService.d.ts +34 -0
- package/lib/pointInTimeDriver/createPointInTimeDocumentService.d.ts.map +1 -0
- package/lib/pointInTimeDriver/createPointInTimeDocumentService.js +87 -0
- package/lib/pointInTimeDriver/createPointInTimeDocumentService.js.map +1 -0
- package/package.json +25 -11
- package/src/index.ts +7 -5
- package/src/odspDocumentServiceFactory.ts +103 -1
- package/src/odspDocumentServiceFactoryCore.ts +90 -3
- package/src/odspVersionManager/DEV.md +9 -8
- package/src/packageVersion.ts +1 -1
- package/src/pointInTime.ts +30 -0
- package/src/pointInTimeDriver/createPointInTimeDocumentService.ts +180 -0
- package/dist/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.d.ts +0 -41
- package/dist/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.d.ts.map +0 -1
- package/dist/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.js +0 -132
- package/dist/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.js.map +0 -1
- package/lib/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.d.ts +0 -41
- package/lib/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.d.ts.map +0 -1
- package/lib/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.js +0 -128
- package/lib/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.js.map +0 -1
- package/src/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.ts +0 -260
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/odsp-driver",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.118.0",
|
|
4
4
|
"description": "Socket storage implementation for SPO and ODC",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -43,6 +43,16 @@
|
|
|
43
43
|
"default": "./dist/index.js"
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
+
"./legacy/point-in-time": {
|
|
47
|
+
"import": {
|
|
48
|
+
"types": "./lib/pointInTime.d.ts",
|
|
49
|
+
"default": "./lib/pointInTime.js"
|
|
50
|
+
},
|
|
51
|
+
"require": {
|
|
52
|
+
"types": "./dist/pointInTime.d.ts",
|
|
53
|
+
"default": "./dist/pointInTime.js"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
46
56
|
"./internal": {
|
|
47
57
|
"import": {
|
|
48
58
|
"types": "./lib/index.d.ts",
|
|
@@ -79,22 +89,22 @@
|
|
|
79
89
|
"temp-directory": "nyc/.nyc_output"
|
|
80
90
|
},
|
|
81
91
|
"dependencies": {
|
|
82
|
-
"@fluid-internal/client-utils": "~2.
|
|
83
|
-
"@fluidframework/core-interfaces": "~2.
|
|
84
|
-
"@fluidframework/core-utils": "~2.
|
|
85
|
-
"@fluidframework/driver-base": "~2.
|
|
86
|
-
"@fluidframework/driver-definitions": "~2.
|
|
87
|
-
"@fluidframework/driver-utils": "~2.
|
|
88
|
-
"@fluidframework/odsp-doclib-utils": "~2.
|
|
89
|
-
"@fluidframework/odsp-driver-definitions": "~2.
|
|
90
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
92
|
+
"@fluid-internal/client-utils": "~2.118.0",
|
|
93
|
+
"@fluidframework/core-interfaces": "~2.118.0",
|
|
94
|
+
"@fluidframework/core-utils": "~2.118.0",
|
|
95
|
+
"@fluidframework/driver-base": "~2.118.0",
|
|
96
|
+
"@fluidframework/driver-definitions": "~2.118.0",
|
|
97
|
+
"@fluidframework/driver-utils": "~2.118.0",
|
|
98
|
+
"@fluidframework/odsp-doclib-utils": "~2.118.0",
|
|
99
|
+
"@fluidframework/odsp-driver-definitions": "~2.118.0",
|
|
100
|
+
"@fluidframework/telemetry-utils": "~2.118.0",
|
|
91
101
|
"socket.io-client": "^4.8.3",
|
|
92
102
|
"uuid": "^11.1.0"
|
|
93
103
|
},
|
|
94
104
|
"devDependencies": {
|
|
95
105
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
96
106
|
"@biomejs/biome": "~2.4.5",
|
|
97
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
107
|
+
"@fluid-internal/mocha-test-setup": "~2.118.0",
|
|
98
108
|
"@fluid-tools/build-cli": "^0.67.0",
|
|
99
109
|
"@fluidframework/build-common": "^2.0.3",
|
|
100
110
|
"@fluidframework/build-tools": "^0.67.0",
|
|
@@ -125,6 +135,7 @@
|
|
|
125
135
|
"build:api-reports": "concurrently \"npm:build:api-reports:*\"",
|
|
126
136
|
"build:api-reports:current": "api-extractor run --local --config api-extractor/api-extractor.current.json",
|
|
127
137
|
"build:api-reports:legacy": "api-extractor run --local --config api-extractor/api-extractor.legacy.json",
|
|
138
|
+
"build:api-reports:pointInTime": "api-extractor run --local --config api-extractor/api-extractor-report.pointInTime.json",
|
|
128
139
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
129
140
|
"build:compile": "fluid-build . --task compile",
|
|
130
141
|
"build:docs": "api-extractor run --local",
|
|
@@ -142,14 +153,17 @@
|
|
|
142
153
|
"check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
|
|
143
154
|
"check:exports:cjs:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.cjs.json",
|
|
144
155
|
"check:exports:cjs:legacyAlpha": "api-extractor run --config api-extractor/api-extractor-lint-legacyAlpha.cjs.json",
|
|
156
|
+
"check:exports:cjs:pointInTime": "api-extractor run --config api-extractor/api-extractor-lint-pointInTime.cjs.json",
|
|
145
157
|
"check:exports:cjs:public": "api-extractor run --config api-extractor/api-extractor-lint-public.cjs.json",
|
|
146
158
|
"check:exports:esm:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.esm.json",
|
|
147
159
|
"check:exports:esm:legacyAlpha": "api-extractor run --config api-extractor/api-extractor-lint-legacyAlpha.esm.json",
|
|
160
|
+
"check:exports:esm:pointInTime": "api-extractor run --config api-extractor/api-extractor-lint-pointInTime.esm.json",
|
|
148
161
|
"check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
|
|
149
162
|
"check:format": "npm run check:biome",
|
|
150
163
|
"ci:build:api-reports": "concurrently \"npm:ci:build:api-reports:*\"",
|
|
151
164
|
"ci:build:api-reports:current": "api-extractor run --config api-extractor/api-extractor.current.json",
|
|
152
165
|
"ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
|
|
166
|
+
"ci:build:api-reports:pointInTime": "api-extractor run --config api-extractor/api-extractor-report.pointInTime.json",
|
|
153
167
|
"ci:build:docs": "api-extractor run",
|
|
154
168
|
"clean": "rimraf --glob dist lib {alpha,beta,internal,legacy}.d.ts legacyAlpha.d.ts \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
155
169
|
"eslint": "eslint --quiet --format stylish src",
|
package/src/index.ts
CHANGED
|
@@ -27,15 +27,17 @@ export { prefetchLatestSnapshot } from "./prefetchLatestSnapshot.js";
|
|
|
27
27
|
// Factory
|
|
28
28
|
export {
|
|
29
29
|
createLocalOdspDocumentServiceFactory,
|
|
30
|
+
createOdspDocumentServiceFactory,
|
|
31
|
+
getOdspPointInTimeDocumentServiceFactory,
|
|
32
|
+
type IOdspDocumentServiceFactoryOptions,
|
|
30
33
|
OdspDocumentServiceFactory,
|
|
31
34
|
} from "./odspDocumentServiceFactory.js";
|
|
32
|
-
export { OdspDocumentServiceFactoryCore } from "./odspDocumentServiceFactoryCore.js";
|
|
33
|
-
/* eslint-disable import-x/no-internal-modules */
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
+
type IOdspPointInTimeDocumentServiceImplementationProps,
|
|
36
37
|
type IPointInTimeDocumentServiceFactory,
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
type OdspPointInTimeDocumentServiceImplementation,
|
|
39
|
+
OdspDocumentServiceFactoryCore,
|
|
40
|
+
} from "./odspDocumentServiceFactoryCore.js";
|
|
39
41
|
|
|
40
42
|
// File creation
|
|
41
43
|
export { createOdspCreateContainerRequest } from "./createOdspCreateContainerRequest.js";
|
|
@@ -15,7 +15,35 @@ import type {
|
|
|
15
15
|
|
|
16
16
|
// eslint-disable-next-line import-x/no-internal-modules
|
|
17
17
|
import { LocalOdspDocumentServiceFactory } from "./localOdspDriver/localOdspDocumentServiceFactory.js";
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
type IPointInTimeDocumentServiceFactory,
|
|
20
|
+
type OdspPointInTimeDocumentServiceImplementation,
|
|
21
|
+
OdspDocumentServiceFactoryCore,
|
|
22
|
+
} from "./odspDocumentServiceFactoryCore.js";
|
|
23
|
+
import { LocalPersistentCache } from "./odspCache.js";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Options for creating an ODSP document service factory.
|
|
27
|
+
*
|
|
28
|
+
* @legacy @beta
|
|
29
|
+
*/
|
|
30
|
+
export interface IOdspDocumentServiceFactoryOptions {
|
|
31
|
+
/** Fetches storage access tokens. */
|
|
32
|
+
readonly getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>;
|
|
33
|
+
/** Fetches websocket access tokens, or `undefined` when unavailable. */
|
|
34
|
+
readonly getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined;
|
|
35
|
+
/** Persisted ODSP cache. When omitted, a local in-memory cache is used. */
|
|
36
|
+
readonly persistedCache?: IPersistedCache | undefined;
|
|
37
|
+
/** Host storage policy. When omitted, the default driver policies are used. */
|
|
38
|
+
readonly hostPolicy?: HostStoragePolicy | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Enables point-in-time loading. Consumers that omit this implementation do not include the
|
|
41
|
+
* feature code in their dependency graph.
|
|
42
|
+
*/
|
|
43
|
+
readonly pointInTimeDocumentServiceImplementation?:
|
|
44
|
+
| OdspPointInTimeDocumentServiceImplementation
|
|
45
|
+
| undefined;
|
|
46
|
+
}
|
|
19
47
|
|
|
20
48
|
/**
|
|
21
49
|
* Factory for creating the sharepoint document service. Use this if you want to
|
|
@@ -34,6 +62,80 @@ export class OdspDocumentServiceFactory extends OdspDocumentServiceFactoryCore {
|
|
|
34
62
|
}
|
|
35
63
|
}
|
|
36
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Creates an ODSP document service factory with optional consumer-provided features.
|
|
67
|
+
*
|
|
68
|
+
* @param options - Tokens, cache, host policy, and optional feature implementations.
|
|
69
|
+
* @returns The configured ODSP document service factory.
|
|
70
|
+
*
|
|
71
|
+
* @legacy @beta
|
|
72
|
+
*/
|
|
73
|
+
export function createOdspDocumentServiceFactory(
|
|
74
|
+
options: IOdspDocumentServiceFactoryOptions,
|
|
75
|
+
): OdspDocumentServiceFactory {
|
|
76
|
+
const persistedCache = options.persistedCache ?? new LocalPersistentCache();
|
|
77
|
+
const pointInTimeImplementation = options.pointInTimeDocumentServiceImplementation;
|
|
78
|
+
|
|
79
|
+
class ConfiguredOdspDocumentServiceFactory extends OdspDocumentServiceFactory {
|
|
80
|
+
public override readonly createPointInTimeDocumentService:
|
|
81
|
+
| IPointInTimeDocumentServiceFactory["createPointInTimeDocumentService"]
|
|
82
|
+
| undefined =
|
|
83
|
+
pointInTimeImplementation === undefined
|
|
84
|
+
? undefined
|
|
85
|
+
: async (resolvedUrl, targetSequenceNumber, logger, clientIsSummarizer) =>
|
|
86
|
+
pointInTimeImplementation({
|
|
87
|
+
resolvedUrl,
|
|
88
|
+
targetSequenceNumber,
|
|
89
|
+
logger,
|
|
90
|
+
clientIsSummarizer,
|
|
91
|
+
persistedCache,
|
|
92
|
+
getStorageToken: options.getStorageToken,
|
|
93
|
+
createDocumentService: async (url, odspLogger, cacheAndTracker, isSummarizer) =>
|
|
94
|
+
this.createDocumentServiceCore(url, odspLogger, cacheAndTracker, isSummarizer),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return new ConfiguredOdspDocumentServiceFactory(
|
|
99
|
+
options.getStorageToken,
|
|
100
|
+
options.getWebsocketToken,
|
|
101
|
+
persistedCache,
|
|
102
|
+
options.hostPolicy,
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Creates an ODSP document service factory that supports point-in-time loading.
|
|
108
|
+
*
|
|
109
|
+
* @param getStorageToken - Fetches storage access tokens.
|
|
110
|
+
* @param getWebsocketToken - Fetches websocket access tokens, or `undefined` when unavailable.
|
|
111
|
+
* @param persistedCache - Optional persisted ODSP cache.
|
|
112
|
+
* @param hostPolicy - Optional host storage policy.
|
|
113
|
+
* @returns An ODSP document service factory with point-in-time loading capability.
|
|
114
|
+
*
|
|
115
|
+
* @deprecated Use
|
|
116
|
+
* {@link createOdspDocumentServiceFactory} with a point-in-time implementation instead.
|
|
117
|
+
* See {@link https://github.com/microsoft/FluidFramework/issues/26500} for context.
|
|
118
|
+
*
|
|
119
|
+
* @legacy @beta
|
|
120
|
+
*/
|
|
121
|
+
export function getOdspPointInTimeDocumentServiceFactory(
|
|
122
|
+
getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,
|
|
123
|
+
getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined,
|
|
124
|
+
persistedCache?: IPersistedCache,
|
|
125
|
+
hostPolicy?: HostStoragePolicy,
|
|
126
|
+
): IPointInTimeDocumentServiceFactory {
|
|
127
|
+
return createOdspDocumentServiceFactory({
|
|
128
|
+
getStorageToken,
|
|
129
|
+
getWebsocketToken,
|
|
130
|
+
persistedCache,
|
|
131
|
+
hostPolicy,
|
|
132
|
+
pointInTimeDocumentServiceImplementation: async (props) => {
|
|
133
|
+
const { createPointInTimeDocumentService } = await import("./pointInTime.js");
|
|
134
|
+
return createPointInTimeDocumentService(props);
|
|
135
|
+
},
|
|
136
|
+
}) as IPointInTimeDocumentServiceFactory;
|
|
137
|
+
}
|
|
138
|
+
|
|
37
139
|
/**
|
|
38
140
|
* Creates a factory instance for creating a sharepoint document service from a provided snapshot.
|
|
39
141
|
*
|
|
@@ -53,12 +53,83 @@ import {
|
|
|
53
53
|
toInstrumentedOdspTokenFetcher,
|
|
54
54
|
} from "./odspUtils.js";
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* An ODSP document service factory that supports point-in-time (sequence-number-based) loading.
|
|
58
|
+
*
|
|
59
|
+
* @remarks
|
|
60
|
+
* The loader detects this capability structurally, so hosts can pass this factory directly to
|
|
61
|
+
* {@link @fluidframework/container-loader#loadContainerToSequenceNumber}.
|
|
62
|
+
*
|
|
63
|
+
* @legacy @beta
|
|
64
|
+
*/
|
|
65
|
+
export interface IPointInTimeDocumentServiceFactory extends IDocumentServiceFactory {
|
|
66
|
+
/**
|
|
67
|
+
* Creates a document service that materializes the document at the requested sequence number.
|
|
68
|
+
*
|
|
69
|
+
* @param resolvedUrl - The resolved ODSP {@link @fluidframework/driver-definitions#IResolvedUrl}.
|
|
70
|
+
* @param targetSequenceNumber - The sequence number at which to materialize the document. See
|
|
71
|
+
* {@link @fluidframework/container-loader#ILoadContainerToSequenceNumberProps.loadToSequenceNumber}.
|
|
72
|
+
* @param logger - Optional {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}.
|
|
73
|
+
* @param clientIsSummarizer - Whether to apply summarizer policies and telemetry to the
|
|
74
|
+
* underlying document services. Defaults to `false`.
|
|
75
|
+
* @returns A read-only {@link @fluidframework/driver-definitions#IDocumentService} materialized
|
|
76
|
+
* at the requested sequence number.
|
|
77
|
+
*/
|
|
78
|
+
createPointInTimeDocumentService(
|
|
79
|
+
resolvedUrl: IResolvedUrl,
|
|
80
|
+
targetSequenceNumber: number,
|
|
81
|
+
logger?: ITelemetryBaseLogger,
|
|
82
|
+
clientIsSummarizer?: boolean,
|
|
83
|
+
): Promise<IDocumentService>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Inputs supplied by the ODSP document service factory to an injected point-in-time implementation.
|
|
88
|
+
*
|
|
89
|
+
* @legacy @beta
|
|
90
|
+
*/
|
|
91
|
+
export interface IOdspPointInTimeDocumentServiceImplementationProps {
|
|
92
|
+
/** The resolved ODSP URL for the document to materialize. */
|
|
93
|
+
readonly resolvedUrl: IResolvedUrl;
|
|
94
|
+
/** The sequence number at which to materialize the document. */
|
|
95
|
+
readonly targetSequenceNumber: number;
|
|
96
|
+
/** Optional telemetry logger for the point-in-time load. */
|
|
97
|
+
readonly logger?: ITelemetryBaseLogger;
|
|
98
|
+
/** Whether to apply summarizer policies and telemetry. Defaults to `false`. */
|
|
99
|
+
readonly clientIsSummarizer?: boolean;
|
|
100
|
+
/** The persisted ODSP cache supplied to the document service factory. */
|
|
101
|
+
readonly persistedCache: IPersistedCache;
|
|
102
|
+
/** Fetches storage access tokens for ODSP requests. */
|
|
103
|
+
readonly getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>;
|
|
104
|
+
/**
|
|
105
|
+
* Creates an ODSP document service for a resolved URL.
|
|
106
|
+
*
|
|
107
|
+
* @param resolvedUrl - The resolved URL for the document or file version to load.
|
|
108
|
+
* @param logger - The telemetry logger for the document service.
|
|
109
|
+
* @param cacheAndTracker - The cache and epoch tracker shared by the point-in-time load.
|
|
110
|
+
* @param clientIsSummarizer - Whether to apply summarizer policies and telemetry.
|
|
111
|
+
* @returns The document service for the resolved URL.
|
|
112
|
+
*/
|
|
113
|
+
readonly createDocumentService: (
|
|
114
|
+
resolvedUrl: IResolvedUrl,
|
|
115
|
+
logger: ITelemetryBaseLogger,
|
|
116
|
+
cacheAndTracker: ICacheAndTracker,
|
|
117
|
+
clientIsSummarizer?: boolean,
|
|
118
|
+
) => Promise<IDocumentService>;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Consumer-provided implementation of ODSP point-in-time loading.
|
|
123
|
+
*
|
|
124
|
+
* @legacy @beta
|
|
125
|
+
*/
|
|
126
|
+
export type OdspPointInTimeDocumentServiceImplementation = (
|
|
127
|
+
props: IOdspPointInTimeDocumentServiceImplementationProps,
|
|
128
|
+
) => Promise<IDocumentService>;
|
|
129
|
+
|
|
56
130
|
/**
|
|
57
131
|
* Factory for creating the sharepoint document service. Use this if you want to
|
|
58
132
|
* use the sharepoint implementation.
|
|
59
|
-
*
|
|
60
|
-
* This constructor should be used by environments that support dynamic imports and that wish
|
|
61
|
-
* to leverage code splitting as a means to keep bundles as small as possible.
|
|
62
133
|
* @legacy
|
|
63
134
|
* @beta
|
|
64
135
|
*/
|
|
@@ -269,6 +340,22 @@ export class OdspDocumentServiceFactoryCore
|
|
|
269
340
|
);
|
|
270
341
|
}
|
|
271
342
|
|
|
343
|
+
/**
|
|
344
|
+
* Creates a document service that reads its snapshot from the closest file version at or before
|
|
345
|
+
* the target and its deltas from the live document, materializing a requested sequence number
|
|
346
|
+
* through replay.
|
|
347
|
+
*
|
|
348
|
+
* @param resolvedUrl - The resolved ODSP {@link @fluidframework/driver-definitions#IResolvedUrl}.
|
|
349
|
+
* @param targetSequenceNumber - The sequence number at which to materialize the document. See
|
|
350
|
+
* {@link @fluidframework/container-loader#ILoadContainerToSequenceNumberProps.loadToSequenceNumber}.
|
|
351
|
+
* @param logger - Optional {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}.
|
|
352
|
+
* @param clientIsSummarizer - Whether to apply summarizer policies and telemetry to the
|
|
353
|
+
* underlying document services. Defaults to `false`.
|
|
354
|
+
* @returns A read-only {@link @fluidframework/driver-definitions#IDocumentService} materialized
|
|
355
|
+
* at the requested sequence number.
|
|
356
|
+
*/
|
|
357
|
+
public readonly createPointInTimeDocumentService?: IPointInTimeDocumentServiceFactory["createPointInTimeDocumentService"];
|
|
358
|
+
|
|
272
359
|
protected async createDocumentServiceCore(
|
|
273
360
|
resolvedUrl: IResolvedUrl,
|
|
274
361
|
odspLogger: ITelemetryBaseLogger,
|
|
@@ -36,8 +36,8 @@ Part 1 is built in three components:
|
|
|
36
36
|
- **Component A — the version manager**: choose which file version to load or replay from. **This
|
|
37
37
|
folder is Component A**, and this document is mostly about it.
|
|
38
38
|
- **Component B — the recomposed driver**: load the chosen version and replay ops forward to the exact
|
|
39
|
-
target. **Built** in `../pointInTimeDriver
|
|
40
|
-
`
|
|
39
|
+
target. **Built** in `../pointInTimeDriver/`, exported through the consumer-injected
|
|
40
|
+
`../pointInTime.ts` entrypoint — see [Part V](#part-v--components-b--c-as-built).
|
|
41
41
|
- **Component C — the loader hookup**: expose Component B through the container loader. **Built** in
|
|
42
42
|
`@fluidframework/container-loader` (`loadContainerToSequenceNumber`) — see
|
|
43
43
|
[Part V](#part-v--components-b--c-as-built). This is the current prototype-era package
|
|
@@ -556,9 +556,10 @@ is what ships today.
|
|
|
556
556
|
|
|
557
557
|
### Component B — how does the recomposed driver materialize the target?
|
|
558
558
|
|
|
559
|
-
The
|
|
560
|
-
|
|
561
|
-
`createPointInTimeDocumentService(resolvedUrl, targetSequenceNumber)
|
|
559
|
+
The host imports `createPointInTimeDocumentService` from the dedicated point-in-time entrypoint and
|
|
560
|
+
injects it through `createOdspDocumentServiceFactory`. The returned factory exposes the optional
|
|
561
|
+
`createPointInTimeDocumentService(resolvedUrl, targetSequenceNumber)` capability as a thin delegate.
|
|
562
|
+
The injected implementation:
|
|
562
563
|
|
|
563
564
|
1. Build a version manager (Component A), sharing the single `EpochTracker` described below, and call
|
|
564
565
|
`findBaseForSeq(target)`. It picks the closest version *and* proves that base shares the live
|
|
@@ -661,9 +662,9 @@ and the `opStream` endpoint is queried for exactly `[from, target]`.
|
|
|
661
662
|
|
|
662
663
|
1. Validates `loadToSequenceNumber` is a non-negative integer (`UsageError` otherwise).
|
|
663
664
|
2. Detects the point-in-time capability with `asPointInTimeCapableFactory`, which checks the passed
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
665
|
+
`documentServiceFactory` exposes `createPointInTimeDocumentService`. A plain factory is a
|
|
666
|
+
`UsageError` — the caller must inject the dedicated ODSP implementation through
|
|
667
|
+
`createOdspDocumentServiceFactory` options and pass that factory directly with no wrapping.
|
|
667
668
|
3. Wraps it in a `PointInTimeDocumentServiceFactory` adapter so the container's normal
|
|
668
669
|
`createDocumentService(resolvedUrl)` routes to `createPointInTimeDocumentService(resolvedUrl, target)`.
|
|
669
670
|
(`createContainer` throws — the adapter is load-only.)
|
package/src/packageVersion.ts
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Optional ODSP point-in-time loading implementation for consumer injection.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line import-x/no-internal-modules -- Dedicated entrypoint for the optional point-in-time implementation.
|
|
13
|
+
export { createPointInTimeDocumentService } from "./pointInTimeDriver/createPointInTimeDocumentService.js";
|
|
14
|
+
export type {
|
|
15
|
+
IOdspPointInTimeDocumentServiceImplementationProps,
|
|
16
|
+
OdspPointInTimeDocumentServiceImplementation,
|
|
17
|
+
} from "./odspDocumentServiceFactoryCore.js";
|
|
18
|
+
export type {
|
|
19
|
+
EpochTracker,
|
|
20
|
+
FetchType,
|
|
21
|
+
FetchTypeInternal,
|
|
22
|
+
ICacheAndTracker,
|
|
23
|
+
} from "./epochTracker.js";
|
|
24
|
+
export type {
|
|
25
|
+
INonPersistentCache,
|
|
26
|
+
IOdspCache,
|
|
27
|
+
IPersistedFileCache,
|
|
28
|
+
IPrefetchSnapshotContents,
|
|
29
|
+
} from "./odspCache.js";
|
|
30
|
+
export type { IOdspResponse } from "./odspUtils.js";
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
IDocumentService,
|
|
8
|
+
IResolvedUrl,
|
|
9
|
+
} from "@fluidframework/driver-definitions/internal";
|
|
10
|
+
import { UsageError } from "@fluidframework/driver-utils/internal";
|
|
11
|
+
import type {
|
|
12
|
+
IOdspResolvedUrl,
|
|
13
|
+
IOdspUrlParts,
|
|
14
|
+
} from "@fluidframework/odsp-driver-definitions/internal";
|
|
15
|
+
import {
|
|
16
|
+
createChildLogger,
|
|
17
|
+
type TelemetryLoggerExt,
|
|
18
|
+
} from "@fluidframework/telemetry-utils/internal";
|
|
19
|
+
|
|
20
|
+
import { createOdspCacheAndTracker, type EpochTracker } from "../epochTracker.js";
|
|
21
|
+
import { NonPersistentCache } from "../odspCache.js";
|
|
22
|
+
import { OdspDriverUrlResolver } from "../odspDriverUrlResolver.js";
|
|
23
|
+
import type { IOdspPointInTimeDocumentServiceImplementationProps } from "../odspDocumentServiceFactoryCore.js";
|
|
24
|
+
import {
|
|
25
|
+
createOdspLogger,
|
|
26
|
+
getOdspResolvedUrl,
|
|
27
|
+
toInstrumentedOdspStorageTokenFetcher,
|
|
28
|
+
} from "../odspUtils.js";
|
|
29
|
+
import {
|
|
30
|
+
createOdspVersionManager,
|
|
31
|
+
type IOdspVersionManager,
|
|
32
|
+
// eslint-disable-next-line import-x/no-internal-modules -- the feature implementation owns version selection
|
|
33
|
+
} from "../odspVersionManager/odspVersionManager.js";
|
|
34
|
+
|
|
35
|
+
import { OdspPointInTimeDocumentService } from "./odspPointInTimeDocumentService.js";
|
|
36
|
+
|
|
37
|
+
interface IPointInTimeDocumentServiceDependencies {
|
|
38
|
+
readonly createVersionManager?: (
|
|
39
|
+
odspResolvedUrl: IOdspResolvedUrl,
|
|
40
|
+
logger: TelemetryLoggerExt,
|
|
41
|
+
epochTracker: EpochTracker,
|
|
42
|
+
) => IOdspVersionManager | Promise<IOdspVersionManager>;
|
|
43
|
+
readonly resolveFileVersion?: (
|
|
44
|
+
resolvedUrl: IResolvedUrl,
|
|
45
|
+
fileVersion: string,
|
|
46
|
+
) => IResolvedUrl | Promise<IResolvedUrl>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function createVersionManager(
|
|
50
|
+
odspResolvedUrl: IOdspResolvedUrl,
|
|
51
|
+
logger: TelemetryLoggerExt,
|
|
52
|
+
epochTracker: EpochTracker,
|
|
53
|
+
getStorageToken: IOdspPointInTimeDocumentServiceImplementationProps["getStorageToken"],
|
|
54
|
+
): Promise<IOdspVersionManager> {
|
|
55
|
+
const urlParts: IOdspUrlParts = {
|
|
56
|
+
siteUrl: odspResolvedUrl.siteUrl,
|
|
57
|
+
driveId: odspResolvedUrl.driveId,
|
|
58
|
+
itemId: odspResolvedUrl.itemId,
|
|
59
|
+
};
|
|
60
|
+
const getAuthHeader = toInstrumentedOdspStorageTokenFetcher(
|
|
61
|
+
logger,
|
|
62
|
+
urlParts,
|
|
63
|
+
getStorageToken,
|
|
64
|
+
);
|
|
65
|
+
return createOdspVersionManager({
|
|
66
|
+
urlParts,
|
|
67
|
+
getAuthHeader,
|
|
68
|
+
epochTracker,
|
|
69
|
+
logger,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function resolveFileVersion(
|
|
74
|
+
resolvedUrl: IResolvedUrl,
|
|
75
|
+
fileVersion: string,
|
|
76
|
+
): Promise<IResolvedUrl> {
|
|
77
|
+
const odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);
|
|
78
|
+
const query = new URLSearchParams({
|
|
79
|
+
driveId: odspResolvedUrl.driveId,
|
|
80
|
+
itemId: odspResolvedUrl.itemId,
|
|
81
|
+
fileVersion,
|
|
82
|
+
});
|
|
83
|
+
if (odspResolvedUrl.dataStorePath !== undefined) {
|
|
84
|
+
query.set("path", odspResolvedUrl.dataStorePath);
|
|
85
|
+
}
|
|
86
|
+
if (odspResolvedUrl.codeHint?.containerPackageName !== undefined) {
|
|
87
|
+
query.set("containerPackageName", odspResolvedUrl.codeHint.containerPackageName);
|
|
88
|
+
}
|
|
89
|
+
return new OdspDriverUrlResolver().resolve({
|
|
90
|
+
url: `${odspResolvedUrl.siteUrl}?${query.toString()}`,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* ODSP's point-in-time document service implementation.
|
|
96
|
+
*
|
|
97
|
+
* @remarks Import this function from the dedicated point-in-time entrypoint and inject it through
|
|
98
|
+
* {@link IOdspDocumentServiceFactoryOptions.pointInTimeDocumentServiceImplementation}.
|
|
99
|
+
*
|
|
100
|
+
* @param props - ODSP service dependencies and point-in-time load parameters supplied by the factory.
|
|
101
|
+
* @returns A read-only ODSP document service materialized at the requested sequence number.
|
|
102
|
+
*
|
|
103
|
+
* @legacy @beta
|
|
104
|
+
*/
|
|
105
|
+
export async function createPointInTimeDocumentService(
|
|
106
|
+
props: IOdspPointInTimeDocumentServiceImplementationProps,
|
|
107
|
+
): Promise<IDocumentService> {
|
|
108
|
+
return createPointInTimeDocumentServiceCore(props);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Creates the point-in-time service with replaceable dependencies for testing.
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
export async function createPointInTimeDocumentServiceCore(
|
|
116
|
+
{
|
|
117
|
+
resolvedUrl,
|
|
118
|
+
targetSequenceNumber,
|
|
119
|
+
logger,
|
|
120
|
+
clientIsSummarizer,
|
|
121
|
+
persistedCache,
|
|
122
|
+
getStorageToken,
|
|
123
|
+
createDocumentService,
|
|
124
|
+
}: IOdspPointInTimeDocumentServiceImplementationProps,
|
|
125
|
+
dependencies: IPointInTimeDocumentServiceDependencies = {},
|
|
126
|
+
): Promise<OdspPointInTimeDocumentService> {
|
|
127
|
+
const odspLogger = createOdspLogger(logger);
|
|
128
|
+
const extLogger = createChildLogger({ logger: odspLogger });
|
|
129
|
+
const odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);
|
|
130
|
+
const cacheAndTracker = createOdspCacheAndTracker(
|
|
131
|
+
persistedCache,
|
|
132
|
+
new NonPersistentCache(),
|
|
133
|
+
{
|
|
134
|
+
resolvedUrl: odspResolvedUrl,
|
|
135
|
+
docId: odspResolvedUrl.hashedDocumentId,
|
|
136
|
+
fileVersion: odspResolvedUrl.fileVersion,
|
|
137
|
+
},
|
|
138
|
+
extLogger,
|
|
139
|
+
clientIsSummarizer,
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
const versionManager = await (
|
|
143
|
+
dependencies.createVersionManager ??
|
|
144
|
+
(async (url, versionLogger, epochTracker) =>
|
|
145
|
+
createVersionManager(url, versionLogger, epochTracker, getStorageToken))
|
|
146
|
+
)(odspResolvedUrl, extLogger, cacheAndTracker.epochTracker);
|
|
147
|
+
const baseResult = await versionManager.findBaseForSeq(targetSequenceNumber);
|
|
148
|
+
if (baseResult.kind === "noBaseVersion") {
|
|
149
|
+
const oldestResolvedSequenceDetail =
|
|
150
|
+
baseResult.oldestResolvedSeq === undefined
|
|
151
|
+
? ""
|
|
152
|
+
: ` The oldest resolved file version is at sequence number ${baseResult.oldestResolvedSeq}.`;
|
|
153
|
+
throw new UsageError(
|
|
154
|
+
`No ODSP file version is available at or before sequence number ${targetSequenceNumber}.${oldestResolvedSequenceDetail}`,
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const recoverableResolvedUrl = await (dependencies.resolveFileVersion ?? resolveFileVersion)(
|
|
159
|
+
resolvedUrl,
|
|
160
|
+
baseResult.base.versionId,
|
|
161
|
+
);
|
|
162
|
+
const recoverableDocumentService = await createDocumentService(
|
|
163
|
+
recoverableResolvedUrl,
|
|
164
|
+
odspLogger,
|
|
165
|
+
cacheAndTracker,
|
|
166
|
+
clientIsSummarizer,
|
|
167
|
+
);
|
|
168
|
+
const liveDocumentService = await createDocumentService(
|
|
169
|
+
resolvedUrl,
|
|
170
|
+
odspLogger,
|
|
171
|
+
cacheAndTracker,
|
|
172
|
+
clientIsSummarizer,
|
|
173
|
+
);
|
|
174
|
+
return new OdspPointInTimeDocumentService(
|
|
175
|
+
recoverableResolvedUrl,
|
|
176
|
+
recoverableDocumentService,
|
|
177
|
+
liveDocumentService,
|
|
178
|
+
targetSequenceNumber,
|
|
179
|
+
);
|
|
180
|
+
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
6
|
-
import type { IDocumentService, IDocumentServiceFactory, IPersistedCache, IResolvedUrl } from "@fluidframework/driver-definitions/internal";
|
|
7
|
-
import type { HostStoragePolicy, OdspResourceTokenFetchOptions, TokenFetcher } from "@fluidframework/odsp-driver-definitions/internal";
|
|
8
|
-
/**
|
|
9
|
-
* An ODSP document service factory that supports point-in-time (sequence-number-based) loading.
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
* The loader detects this capability structurally, so hosts can pass this factory directly to
|
|
13
|
-
* `loadContainerToSequenceNumber`.
|
|
14
|
-
*
|
|
15
|
-
* @legacy @beta
|
|
16
|
-
*/
|
|
17
|
-
export interface IPointInTimeDocumentServiceFactory extends IDocumentServiceFactory {
|
|
18
|
-
/**
|
|
19
|
-
* Creates a document service that materializes the document at the requested sequence number.
|
|
20
|
-
*
|
|
21
|
-
* @param resolvedUrl - The resolved ODSP document URL.
|
|
22
|
-
* @param targetSequenceNumber - The sequence number at which to materialize the document.
|
|
23
|
-
* @param logger - Optional telemetry logger.
|
|
24
|
-
* @param clientIsSummarizer - Whether the requesting client is a summarizer.
|
|
25
|
-
* @returns A read-only document service materialized at the requested sequence number.
|
|
26
|
-
*/
|
|
27
|
-
createPointInTimeDocumentService(resolvedUrl: IResolvedUrl, targetSequenceNumber: number, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Creates an ODSP document service factory that supports point-in-time loading.
|
|
31
|
-
*
|
|
32
|
-
* @param getStorageToken - Fetches storage access tokens.
|
|
33
|
-
* @param getWebsocketToken - Fetches websocket access tokens, or `undefined` when unavailable.
|
|
34
|
-
* @param persistedCache - Optional persisted ODSP cache.
|
|
35
|
-
* @param hostPolicy - Optional host storage policy.
|
|
36
|
-
* @returns An ODSP document service factory with point-in-time loading capability.
|
|
37
|
-
*
|
|
38
|
-
* @legacy @beta
|
|
39
|
-
*/
|
|
40
|
-
export declare function getOdspPointInTimeDocumentServiceFactory(getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>, getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined, persistedCache?: IPersistedCache, hostPolicy?: HostStoragePolicy): IPointInTimeDocumentServiceFactory;
|
|
41
|
-
//# sourceMappingURL=odspPointInTimeDocumentServiceFactory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"odspPointInTimeDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../../src/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,KAAK,EACX,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,YAAY,EACZ,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EACX,iBAAiB,EAGjB,6BAA6B,EAC7B,YAAY,EACZ,MAAM,kDAAkD,CAAC;AAuB1D;;;;;;;;GAQG;AACH,MAAM,WAAW,kCAAmC,SAAQ,uBAAuB;IAClF;;;;;;;;OAQG;IACH,gCAAgC,CAC/B,WAAW,EAAE,YAAY,EACzB,oBAAoB,EAAE,MAAM,EAC5B,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AA0KD;;;;;;;;;;GAUG;AACH,wBAAgB,wCAAwC,CACvD,eAAe,EAAE,YAAY,CAAC,6BAA6B,CAAC,EAC5D,iBAAiB,EAAE,YAAY,CAAC,6BAA6B,CAAC,GAAG,SAAS,EAC1E,cAAc,CAAC,EAAE,eAAe,EAChC,UAAU,CAAC,EAAE,iBAAiB,GAC5B,kCAAkC,CAOpC"}
|