@fluidframework/routerlicious-driver 0.59.4000-71130 → 1.0.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/.eslintrc.js +1 -1
- package/dist/documentServiceFactory.d.ts +31 -2
- package/dist/documentServiceFactory.d.ts.map +1 -1
- package/dist/documentServiceFactory.js +38 -4
- package/dist/documentServiceFactory.js.map +1 -1
- package/dist/nullBlobStorageService.d.ts +0 -1
- package/dist/nullBlobStorageService.d.ts.map +1 -1
- package/dist/nullBlobStorageService.js +0 -3
- package/dist/nullBlobStorageService.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/restWrapper.d.ts +1 -0
- package/dist/restWrapper.d.ts.map +1 -1
- package/dist/shreddedSummaryDocumentStorageService.d.ts +1 -2
- package/dist/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/shreddedSummaryDocumentStorageService.js +0 -8
- package/dist/shreddedSummaryDocumentStorageService.js.map +1 -1
- package/dist/tokens.d.ts +3 -2
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.d.ts +1 -2
- package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.js +0 -3
- package/dist/wholeSummaryDocumentStorageService.js.map +1 -1
- package/lib/documentServiceFactory.d.ts +31 -2
- package/lib/documentServiceFactory.d.ts.map +1 -1
- package/lib/documentServiceFactory.js +36 -3
- package/lib/documentServiceFactory.js.map +1 -1
- package/lib/nullBlobStorageService.d.ts +0 -1
- package/lib/nullBlobStorageService.d.ts.map +1 -1
- package/lib/nullBlobStorageService.js +0 -3
- package/lib/nullBlobStorageService.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/restWrapper.d.ts +1 -0
- package/lib/restWrapper.d.ts.map +1 -1
- package/lib/shreddedSummaryDocumentStorageService.d.ts +1 -2
- package/lib/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
- package/lib/shreddedSummaryDocumentStorageService.js +0 -8
- package/lib/shreddedSummaryDocumentStorageService.js.map +1 -1
- package/lib/tokens.d.ts +3 -2
- package/lib/tokens.d.ts.map +1 -1
- package/lib/tokens.js.map +1 -1
- package/lib/wholeSummaryDocumentStorageService.d.ts +1 -2
- package/lib/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/lib/wholeSummaryDocumentStorageService.js +0 -3
- package/lib/wholeSummaryDocumentStorageService.js.map +1 -1
- package/package.json +21 -27
- package/src/documentServiceFactory.ts +38 -3
- package/src/nullBlobStorageService.ts +0 -4
- package/src/packageVersion.ts +1 -1
- package/src/shreddedSummaryDocumentStorageService.ts +0 -14
- package/src/tokens.ts +3 -2
- package/src/wholeSummaryDocumentStorageService.ts +0 -5
- package/tsconfig.json +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/routerlicious-driver",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Socket.IO + Git implementation of Fluid service API",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
64
64
|
"@fluidframework/common-utils": "^0.32.1",
|
|
65
|
-
"@fluidframework/driver-base": "0.
|
|
66
|
-
"@fluidframework/driver-definitions": "^0.
|
|
67
|
-
"@fluidframework/driver-utils": "0.
|
|
68
|
-
"@fluidframework/gitresources": "^0.1036.4000
|
|
69
|
-
"@fluidframework/protocol-base": "^0.1036.4000
|
|
70
|
-
"@fluidframework/protocol-definitions": "^0.1028.2000
|
|
71
|
-
"@fluidframework/server-services-client": "^0.1036.4000
|
|
72
|
-
"@fluidframework/telemetry-utils": "0.
|
|
65
|
+
"@fluidframework/driver-base": "^1.0.0",
|
|
66
|
+
"@fluidframework/driver-definitions": "^1.0.0",
|
|
67
|
+
"@fluidframework/driver-utils": "^1.0.0",
|
|
68
|
+
"@fluidframework/gitresources": "^0.1036.4000",
|
|
69
|
+
"@fluidframework/protocol-base": "^0.1036.4000",
|
|
70
|
+
"@fluidframework/protocol-definitions": "^0.1028.2000",
|
|
71
|
+
"@fluidframework/server-services-client": "^0.1036.4000",
|
|
72
|
+
"@fluidframework/telemetry-utils": "^1.0.0",
|
|
73
73
|
"cross-fetch": "^3.1.5",
|
|
74
74
|
"json-stringify-safe": "5.0.1",
|
|
75
75
|
"querystring": "^0.2.0",
|
|
@@ -79,34 +79,21 @@
|
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@fluidframework/build-common": "^0.23.0",
|
|
82
|
-
"@fluidframework/build-tools": "^0.2.
|
|
82
|
+
"@fluidframework/build-tools": "^0.2.71273",
|
|
83
83
|
"@fluidframework/eslint-config-fluid": "^0.28.2000",
|
|
84
|
-
"@fluidframework/mocha-test-setup": "0.
|
|
85
|
-
"@fluidframework/routerlicious-driver-previous": "npm:@fluidframework/routerlicious-driver
|
|
84
|
+
"@fluidframework/mocha-test-setup": "^1.0.0",
|
|
85
|
+
"@fluidframework/routerlicious-driver-previous": "npm:@fluidframework/routerlicious-driver@^0.59.0",
|
|
86
86
|
"@microsoft/api-extractor": "^7.22.2",
|
|
87
87
|
"@rushstack/eslint-config": "^2.5.1",
|
|
88
88
|
"@types/mocha": "^9.1.1",
|
|
89
89
|
"@types/nock": "^9.3.0",
|
|
90
90
|
"@types/url-parse": "1.4.4",
|
|
91
91
|
"@types/uuid": "^8.3.0",
|
|
92
|
-
"@typescript-eslint/eslint-plugin": "~5.9.0",
|
|
93
|
-
"@typescript-eslint/parser": "~5.9.0",
|
|
94
92
|
"axios": "^0.26.0",
|
|
95
93
|
"concurrently": "^6.2.0",
|
|
96
94
|
"copyfiles": "^2.1.0",
|
|
97
95
|
"cross-env": "^7.0.2",
|
|
98
96
|
"eslint": "~8.6.0",
|
|
99
|
-
"eslint-plugin-editorconfig": "~3.2.0",
|
|
100
|
-
"eslint-plugin-eslint-comments": "~3.2.0",
|
|
101
|
-
"eslint-plugin-import": "~2.25.4",
|
|
102
|
-
"eslint-plugin-jest": "~26.1.3",
|
|
103
|
-
"eslint-plugin-jsdoc": "~39.3.0",
|
|
104
|
-
"eslint-plugin-mocha": "~10.0.3",
|
|
105
|
-
"eslint-plugin-promise": "~6.0.0",
|
|
106
|
-
"eslint-plugin-react": "~7.28.0",
|
|
107
|
-
"eslint-plugin-tsdoc": "~0.2.14",
|
|
108
|
-
"eslint-plugin-unicorn": "~40.0.0",
|
|
109
|
-
"eslint-plugin-unused-imports": "~2.0.0",
|
|
110
97
|
"mocha": "^10.0.0",
|
|
111
98
|
"nock": "^10.0.1",
|
|
112
99
|
"nyc": "^15.0.0",
|
|
@@ -115,7 +102,14 @@
|
|
|
115
102
|
"typescript-formatter": "7.1.0"
|
|
116
103
|
},
|
|
117
104
|
"typeValidation": {
|
|
118
|
-
"version": "0.
|
|
119
|
-
"broken": {
|
|
105
|
+
"version": "1.0.0",
|
|
106
|
+
"broken": {
|
|
107
|
+
"ClassDeclaration_DocumentStorageService": {
|
|
108
|
+
"backCompat": false
|
|
109
|
+
},
|
|
110
|
+
"ClassDeclaration_NullBlobStorageService": {
|
|
111
|
+
"backCompat": false
|
|
112
|
+
}
|
|
113
|
+
}
|
|
120
114
|
}
|
|
121
115
|
}
|
|
@@ -59,6 +59,12 @@ export class RouterliciousDocumentServiceFactory implements IDocumentServiceFact
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* {@inheritDoc @fluidframework/driver-definitions#IDocumentServiceFactory.createContainer}
|
|
64
|
+
*
|
|
65
|
+
* @throws {@link DocumentPostCreateError}
|
|
66
|
+
* If an exception is thrown while invoking the provided {@link ITokenProvider.documentPostCreateCallback}.
|
|
67
|
+
*/
|
|
62
68
|
public async createContainer(
|
|
63
69
|
createNewSummary: ISummaryTree | undefined,
|
|
64
70
|
resolvedUrl: IResolvedUrl,
|
|
@@ -133,7 +139,11 @@ export class RouterliciousDocumentServiceFactory implements IDocumentServiceFact
|
|
|
133
139
|
// @TODO: Remove token from the condition, checking the documentPostCreateCallback !== undefined
|
|
134
140
|
// is sufficient to determine if the token will be undefined or not.
|
|
135
141
|
if (token && this.tokenProvider.documentPostCreateCallback !== undefined) {
|
|
136
|
-
|
|
142
|
+
try {
|
|
143
|
+
await this.tokenProvider.documentPostCreateCallback(documentId, token);
|
|
144
|
+
} catch (error: any) {
|
|
145
|
+
throw new DocumentPostCreateError(error);
|
|
146
|
+
}
|
|
137
147
|
}
|
|
138
148
|
|
|
139
149
|
parsedUrl.set("pathname", replaceDocumentIdInPath(parsedUrl.pathname, documentId));
|
|
@@ -162,9 +172,8 @@ export class RouterliciousDocumentServiceFactory implements IDocumentServiceFact
|
|
|
162
172
|
}
|
|
163
173
|
|
|
164
174
|
/**
|
|
165
|
-
*
|
|
175
|
+
* {@inheritDoc @fluidframework/driver-definitions#IDocumentServiceFactory.createContainer}
|
|
166
176
|
*
|
|
167
|
-
* @param resolvedUrl - URL containing different endpoint URLs.
|
|
168
177
|
* @returns Routerlicious document service.
|
|
169
178
|
*/
|
|
170
179
|
public async createDocumentService(
|
|
@@ -227,3 +236,29 @@ export class RouterliciousDocumentServiceFactory implements IDocumentServiceFact
|
|
|
227
236
|
this.snapshotTreeCache);
|
|
228
237
|
}
|
|
229
238
|
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Error returned by {@link RouterliciousDocumentServiceFactory.createContainer} when an error is thrown
|
|
242
|
+
* in {@link ITokenProvider.documentPostCreateCallback}.
|
|
243
|
+
* It is the consumer's responsibility to ensure that any state related to container creation is appropriately
|
|
244
|
+
* cleaned up in the event of failure.
|
|
245
|
+
* This includes the document itself, which will have been created by the time this error was thrown.
|
|
246
|
+
*
|
|
247
|
+
* @remarks TODO: examples of suggested actions for recovery.
|
|
248
|
+
* - How would a user delete the created document?
|
|
249
|
+
* - What would a retry pattern look like here?
|
|
250
|
+
*/
|
|
251
|
+
export class DocumentPostCreateError extends Error {
|
|
252
|
+
public constructor(
|
|
253
|
+
/**
|
|
254
|
+
* Inner error being wrapped.
|
|
255
|
+
*/
|
|
256
|
+
private readonly innerError: Error,
|
|
257
|
+
) {
|
|
258
|
+
super(innerError.message);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
public readonly name = "DocumentPostCreateError";
|
|
262
|
+
|
|
263
|
+
public get stack() { return this.innerError.stack; }
|
|
264
|
+
}
|
|
@@ -23,10 +23,6 @@ export class NullBlobStorageService implements IDocumentStorageService {
|
|
|
23
23
|
return [];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
public async write(tree: api.ITree, parents: string[], message: string, ref: string): Promise<api.IVersion> {
|
|
27
|
-
return Promise.reject(new Error("Null blob storage can not write commit"));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
26
|
public async uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string> {
|
|
31
27
|
return Promise.reject(new Error("Invalid operation"));
|
|
32
28
|
}
|
package/src/packageVersion.ts
CHANGED
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
ISnapshotTreeEx,
|
|
20
20
|
ISummaryHandle,
|
|
21
21
|
ISummaryTree,
|
|
22
|
-
ITree,
|
|
23
22
|
IVersion,
|
|
24
23
|
} from "@fluidframework/protocol-definitions";
|
|
25
24
|
import {
|
|
@@ -150,19 +149,6 @@ export class ShreddedSummaryDocumentStorageService implements IDocumentStorageSe
|
|
|
150
149
|
return bufferContent;
|
|
151
150
|
}
|
|
152
151
|
|
|
153
|
-
public async write(tree: ITree, parents: string[], message: string, ref: string): Promise<IVersion> {
|
|
154
|
-
const branch = ref ? `datastores/${this.id}/${ref}` : this.id;
|
|
155
|
-
const commit = await PerformanceEvent.timedExecAsync(
|
|
156
|
-
this.logger,
|
|
157
|
-
{
|
|
158
|
-
eventName: "write",
|
|
159
|
-
id: branch,
|
|
160
|
-
},
|
|
161
|
-
async () => this.manager.write(branch, tree, parents, message),
|
|
162
|
-
);
|
|
163
|
-
return { date: commit.committer.date, id: commit.sha, treeId: commit.tree.sha };
|
|
164
|
-
}
|
|
165
|
-
|
|
166
152
|
public async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {
|
|
167
153
|
const summaryHandle = await PerformanceEvent.timedExecAsync(
|
|
168
154
|
this.logger,
|
package/src/tokens.ts
CHANGED
|
@@ -50,9 +50,10 @@ export interface ITokenProvider {
|
|
|
50
50
|
* verify against an authorization service, if the user who claims to create the document is the same user who
|
|
51
51
|
* created it.
|
|
52
52
|
*
|
|
53
|
-
*
|
|
53
|
+
* Notes:
|
|
54
54
|
* * Using the callback may have performance impact on the document creation process.
|
|
55
|
-
* * Any exceptions thrown in the callback would fail the creation workflow
|
|
55
|
+
* * Any exceptions thrown in the callback would fail the creation workflow
|
|
56
|
+
* (see {@link RouterliciousDocumentServiceFactory.createContainer} for more details).
|
|
56
57
|
* @param documentId - Document ID.
|
|
57
58
|
* @param creationToken - A special token that doesn't provide any kind of access, but it has the user's payload
|
|
58
59
|
* and document id. It can be used to validate the identity of the document creator.
|
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
ISnapshotTree,
|
|
23
23
|
ISummaryHandle,
|
|
24
24
|
ISummaryTree,
|
|
25
|
-
ITree,
|
|
26
25
|
IVersion,
|
|
27
26
|
} from "@fluidframework/protocol-definitions";
|
|
28
27
|
import {
|
|
@@ -169,10 +168,6 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
|
|
|
169
168
|
return convertSnapshotAndBlobsToSummaryTree(snapshotTree, blobs);
|
|
170
169
|
}
|
|
171
170
|
|
|
172
|
-
public async write(tree: ITree, parents: string[], message: string, ref: string): Promise<IVersion> {
|
|
173
|
-
throw new Error("NOT IMPLEMENTED!");
|
|
174
|
-
}
|
|
175
|
-
|
|
176
171
|
public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {
|
|
177
172
|
const uint8ArrayFile = new Uint8Array(file);
|
|
178
173
|
return PerformanceEvent.timedExecAsync(
|