@fluidframework/local-driver 2.0.0-internal.7.0.1 → 2.0.0-internal.7.1.1

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/local-driver
2
2
 
3
+ ## 2.0.0-internal.7.1.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.0.0-internal.7.0.0
4
8
 
5
9
  ### Major Changes
@@ -1,4 +1,12 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "@fluidframework/build-common/api-extractor-common-report.json"
3
+ "extends": "@fluidframework/build-common/api-extractor-base.json",
4
+ "messages": {
5
+ "extractorMessageReporting": {
6
+ "ae-missing-release-tag": {
7
+ // TODO: Fix violations and remove this rule override
8
+ "logLevel": "none"
9
+ }
10
+ }
11
+ }
4
12
  }
@@ -0,0 +1,129 @@
1
+ ## API Report File for "@fluidframework/local-driver"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { DocumentDeltaConnection } from '@fluidframework/driver-base';
8
+ import { GitManager } from '@fluidframework/server-services-client';
9
+ import { IClient } from '@fluidframework/protocol-definitions';
10
+ import { ICreateBlobResponse } from '@fluidframework/protocol-definitions';
11
+ import { IDatabaseManager } from '@fluidframework/server-services-core';
12
+ import { IDb } from '@fluidframework/server-services-core';
13
+ import { IDocumentDeltaConnection } from '@fluidframework/driver-definitions';
14
+ import { IDocumentDeltaStorageService } from '@fluidframework/driver-definitions';
15
+ import { IDocumentMessage } from '@fluidframework/protocol-definitions';
16
+ import { IDocumentService } from '@fluidframework/driver-definitions';
17
+ import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
18
+ import { IDocumentServicePolicies } from '@fluidframework/driver-definitions';
19
+ import { IDocumentStorageService } from '@fluidframework/driver-definitions';
20
+ import { IDocumentStorageServicePolicies } from '@fluidframework/driver-definitions';
21
+ import { ILocalDeltaConnectionServer } from '@fluidframework/server-local-server';
22
+ import { IRequest } from '@fluidframework/core-interfaces';
23
+ import { IResolvedUrl } from '@fluidframework/driver-definitions';
24
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
25
+ import { ISnapshotTreeEx } from '@fluidframework/protocol-definitions';
26
+ import { IStream } from '@fluidframework/driver-definitions';
27
+ import { ISummaryContext } from '@fluidframework/driver-definitions';
28
+ import { ISummaryHandle } from '@fluidframework/protocol-definitions';
29
+ import { ISummaryTree } from '@fluidframework/protocol-definitions';
30
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
31
+ import { ITestDbFactory } from '@fluidframework/server-test-utils';
32
+ import { ITokenProvider } from '@fluidframework/routerlicious-driver';
33
+ import { IUrlResolver } from '@fluidframework/driver-definitions';
34
+ import { IVersion } from '@fluidframework/protocol-definitions';
35
+ import { IWebSocketServer } from '@fluidframework/server-services-core';
36
+ import { NackErrorType } from '@fluidframework/protocol-definitions';
37
+ import type { Socket } from 'socket.io-client';
38
+
39
+ // @public
40
+ export function createLocalDocumentService(resolvedUrl: IResolvedUrl, localDeltaConnectionServer: ILocalDeltaConnectionServer, tokenProvider: ITokenProvider, tenantId: string, documentId: string, documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection>, policies?: IDocumentServicePolicies, innerDocumentService?: IDocumentService, logger?: ITelemetryBaseLogger): IDocumentService;
41
+
42
+ // @public (undocumented)
43
+ export function createLocalResolverCreateNewRequest(documentId: string): IRequest;
44
+
45
+ // @public
46
+ export class LocalDeltaStorageService implements IDocumentDeltaStorageService {
47
+ constructor(tenantId: string, id: string, databaseManager: IDatabaseManager);
48
+ // (undocumented)
49
+ fetchMessages(from: number, to: number | undefined, abortSignal?: AbortSignal, cachedOnly?: boolean): IStream<ISequencedDocumentMessage[]>;
50
+ }
51
+
52
+ // @public
53
+ export class LocalDocumentDeltaConnection extends DocumentDeltaConnection {
54
+ constructor(socket: Socket, documentId: string, logger?: ITelemetryBaseLogger);
55
+ static create(tenantId: string, id: string, token: string, client: IClient, webSocketServer: IWebSocketServer, timeoutMs?: number, logger?: ITelemetryBaseLogger): Promise<LocalDocumentDeltaConnection>;
56
+ disconnectClient(disconnectReason: string): void;
57
+ nackClient(code: number | undefined, type: NackErrorType | undefined, message: any): void;
58
+ submit(messages: IDocumentMessage[]): void;
59
+ submitSignal(message: any): void;
60
+ }
61
+
62
+ // @public
63
+ export class LocalDocumentService implements IDocumentService {
64
+ constructor(resolvedUrl: IResolvedUrl, localDeltaConnectionServer: ILocalDeltaConnectionServer, tokenProvider: ITokenProvider, tenantId: string, documentId: string, documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection>, policies?: IDocumentServicePolicies, innerDocumentService?: IDocumentService | undefined, logger?: ITelemetryBaseLogger | undefined);
65
+ connectToDeltaStorage(): Promise<IDocumentDeltaStorageService>;
66
+ connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection>;
67
+ connectToStorage(): Promise<IDocumentStorageService>;
68
+ // (undocumented)
69
+ dispose(): void;
70
+ // (undocumented)
71
+ readonly policies: IDocumentServicePolicies;
72
+ // (undocumented)
73
+ readonly resolvedUrl: IResolvedUrl;
74
+ }
75
+
76
+ // @public
77
+ export class LocalDocumentServiceFactory implements IDocumentServiceFactory {
78
+ constructor(localDeltaConnectionServer: ILocalDeltaConnectionServer, policies?: IDocumentServicePolicies | undefined, innerDocumentService?: IDocumentService | undefined);
79
+ // (undocumented)
80
+ createContainer(createNewSummary: ISummaryTree | undefined, resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
81
+ createDocumentService(resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
82
+ disconnectClient(clientId: string, disconnectReason: string): void;
83
+ nackClient(clientId: string, code?: number, type?: NackErrorType, message?: any): void;
84
+ }
85
+
86
+ // @public (undocumented)
87
+ export class LocalDocumentStorageService implements IDocumentStorageService {
88
+ constructor(id: string, manager: GitManager, policies: IDocumentStorageServicePolicies, localDeltaConnectionServer?: ILocalDeltaConnectionServer | undefined, resolvedUrl?: IResolvedUrl | undefined);
89
+ // (undocumented)
90
+ protected readonly blobsShaCache: Map<string, string>;
91
+ // (undocumented)
92
+ createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;
93
+ // (undocumented)
94
+ downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
95
+ // (undocumented)
96
+ getSnapshotTree(version?: IVersion): Promise<ISnapshotTreeEx | null>;
97
+ // (undocumented)
98
+ getVersions(versionId: string | null, count: number): Promise<IVersion[]>;
99
+ // (undocumented)
100
+ readonly policies: IDocumentStorageServicePolicies;
101
+ // (undocumented)
102
+ readBlob(blobId: string): Promise<ArrayBufferLike>;
103
+ // (undocumented)
104
+ get repositoryUrl(): string;
105
+ // (undocumented)
106
+ uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
107
+ }
108
+
109
+ // @public
110
+ export class LocalResolver implements IUrlResolver {
111
+ constructor();
112
+ // (undocumented)
113
+ createCreateNewRequest(documentId: string): IRequest;
114
+ // (undocumented)
115
+ getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
116
+ resolve(request: IRequest): Promise<IResolvedUrl>;
117
+ }
118
+
119
+ // @public
120
+ export class LocalSessionStorageDbFactory implements ITestDbFactory {
121
+ // (undocumented)
122
+ connect(): Promise<IDb>;
123
+ // (undocumented)
124
+ readonly testDatabase: IDb;
125
+ }
126
+
127
+ // (No @packageDocumentation comment for this package)
128
+
129
+ ```
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAKtF;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,EAAE,EACnB,IAAI,CAAC,EAAE,KAAK,EACZ,QAAQ,GAAE,MAAgB,EAC1B,GAAG,GAAE,MAAc,GACjB,MAAM,CA0BR;AAED,wBAAgB,YAAY,IAAI,KAAK,CAOpC"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAItF;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,EAAE,EACnB,IAAI,CAAC,EAAE,KAAK,EACZ,QAAQ,GAAE,MAAgB,EAC1B,GAAG,GAAE,MAAc,GACjB,MAAM,CA0BR;AAED,wBAAgB,YAAY,IAAI,KAAK,CAWpC"}
package/dist/auth.js CHANGED
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.generateUser = exports.generateToken = void 0;
8
8
  const jsrsasign_1 = require("jsrsasign");
9
9
  const uuid_1 = require("uuid");
10
- const server_services_client_1 = require("@fluidframework/server-services-client");
11
10
  /**
12
11
  * Generates a JWT token to authorize against. We do not use the implementation in
13
12
  * services-client since it cannot run in the browser without polyfills.
@@ -33,9 +32,12 @@ function generateToken(tenantId, documentId, key, scopes, user, lifetime = 60 *
33
32
  }
34
33
  exports.generateToken = generateToken;
35
34
  function generateUser() {
35
+ const userId = (0, uuid_1.v4)();
36
+ const match = userId.match(/^([\da-f]{8})-([\da-f]{4})/);
37
+ const userName = match !== null ? match[0] : userId; // Just use the first two segments of the (fake) userId as a fake name.
36
38
  const randomUser = {
37
- id: (0, uuid_1.v4)(),
38
- name: (0, server_services_client_1.getRandomName)(" ", true),
39
+ id: userId,
40
+ name: userName,
39
41
  };
40
42
  return randomUser;
41
43
  }
package/dist/auth.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yCAA8C;AAC9C,+BAAkC;AAClC,mFAAuE;AAEvE;;;GAGG;AACH,SAAgB,aAAa,CAC5B,QAAgB,EAChB,UAAkB,EAClB,GAAW,EACX,MAAmB,EACnB,IAAY,EACZ,WAAmB,EAAE,GAAG,EAAE,EAC1B,MAAc,KAAK;IAEnB,IAAI,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;IAC7C,IAAI,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,SAAS,CAAC,EAAE,KAAK,SAAS,EAAE;QACtD,SAAS,GAAG,YAAY,EAAE,CAAC;KAC3B;IAED,0BAA0B;IAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAEpD,MAAM,MAAM,GAAiB;QAC5B,UAAU;QACV,MAAM;QACN,QAAQ;QACR,IAAI,EAAE,SAAS;QACf,GAAG,EAAE,GAAG;QACR,GAAG,EAAE,GAAG,GAAG,QAAQ;QACnB,GAAG;KACH,CAAC;IAEF,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IAC9B,OAAO,gBAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAC5B,IAAI,EACJ,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAC5C,MAAM,EACN,OAAO,CACP,CAAC;AACH,CAAC;AAlCD,sCAkCC;AAED,SAAgB,YAAY;IAC3B,MAAM,UAAU,GAAG;QAClB,EAAE,EAAE,IAAA,SAAI,GAAE;QACV,IAAI,EAAE,IAAA,sCAAa,EAAC,GAAG,EAAE,IAAI,CAAC;KAC9B,CAAC;IAEF,OAAO,UAAU,CAAC;AACnB,CAAC;AAPD,oCAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITokenClaims, IUser, ScopeType } from \"@fluidframework/protocol-definitions\";\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\nimport { getRandomName } from \"@fluidframework/server-services-client\";\n\n/**\n * Generates a JWT token to authorize against. We do not use the implementation in\n * services-client since it cannot run in the browser without polyfills.\n */\nexport function generateToken(\n\ttenantId: string,\n\tdocumentId: string,\n\tkey: string,\n\tscopes: ScopeType[],\n\tuser?: IUser,\n\tlifetime: number = 60 * 60,\n\tver: string = \"1.0\",\n): string {\n\tlet userClaim = user ? user : generateUser();\n\tif (userClaim.id === \"\" || userClaim.id === undefined) {\n\t\tuserClaim = generateUser();\n\t}\n\n\t// Current time in seconds\n\tconst now = Math.round(new Date().getTime() / 1000);\n\n\tconst claims: ITokenClaims = {\n\t\tdocumentId,\n\t\tscopes,\n\t\ttenantId,\n\t\tuser: userClaim,\n\t\tiat: now,\n\t\texp: now + lifetime,\n\t\tver,\n\t};\n\n\tconst utf8Key = { utf8: key };\n\treturn jsrsasign.jws.JWS.sign(\n\t\tnull,\n\t\tJSON.stringify({ alg: \"HS256\", typ: \"JWT\" }),\n\t\tclaims,\n\t\tutf8Key,\n\t);\n}\n\nexport function generateUser(): IUser {\n\tconst randomUser = {\n\t\tid: uuid(),\n\t\tname: getRandomName(\" \", true),\n\t};\n\n\treturn randomUser;\n}\n"]}
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yCAA8C;AAC9C,+BAAkC;AAElC;;;GAGG;AACH,SAAgB,aAAa,CAC5B,QAAgB,EAChB,UAAkB,EAClB,GAAW,EACX,MAAmB,EACnB,IAAY,EACZ,WAAmB,EAAE,GAAG,EAAE,EAC1B,MAAc,KAAK;IAEnB,IAAI,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;IAC7C,IAAI,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,SAAS,CAAC,EAAE,KAAK,SAAS,EAAE;QACtD,SAAS,GAAG,YAAY,EAAE,CAAC;KAC3B;IAED,0BAA0B;IAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAEpD,MAAM,MAAM,GAAiB;QAC5B,UAAU;QACV,MAAM;QACN,QAAQ;QACR,IAAI,EAAE,SAAS;QACf,GAAG,EAAE,GAAG;QACR,GAAG,EAAE,GAAG,GAAG,QAAQ;QACnB,GAAG;KACH,CAAC;IAEF,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IAC9B,OAAO,gBAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAC5B,IAAI,EACJ,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAC5C,MAAM,EACN,OAAO,CACP,CAAC;AACH,CAAC;AAlCD,sCAkCC;AAED,SAAgB,YAAY;IAC3B,MAAM,MAAM,GAAG,IAAA,SAAI,GAAE,CAAC;IACtB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACzD,MAAM,QAAQ,GAAG,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,uEAAuE;IAE5H,MAAM,UAAU,GAAG;QAClB,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,QAAQ;KACd,CAAC;IAEF,OAAO,UAAU,CAAC;AACnB,CAAC;AAXD,oCAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITokenClaims, IUser, ScopeType } from \"@fluidframework/protocol-definitions\";\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * Generates a JWT token to authorize against. We do not use the implementation in\n * services-client since it cannot run in the browser without polyfills.\n */\nexport function generateToken(\n\ttenantId: string,\n\tdocumentId: string,\n\tkey: string,\n\tscopes: ScopeType[],\n\tuser?: IUser,\n\tlifetime: number = 60 * 60,\n\tver: string = \"1.0\",\n): string {\n\tlet userClaim = user ? user : generateUser();\n\tif (userClaim.id === \"\" || userClaim.id === undefined) {\n\t\tuserClaim = generateUser();\n\t}\n\n\t// Current time in seconds\n\tconst now = Math.round(new Date().getTime() / 1000);\n\n\tconst claims: ITokenClaims = {\n\t\tdocumentId,\n\t\tscopes,\n\t\ttenantId,\n\t\tuser: userClaim,\n\t\tiat: now,\n\t\texp: now + lifetime,\n\t\tver,\n\t};\n\n\tconst utf8Key = { utf8: key };\n\treturn jsrsasign.jws.JWS.sign(\n\t\tnull,\n\t\tJSON.stringify({ alg: \"HS256\", typ: \"JWT\" }),\n\t\tclaims,\n\t\tutf8Key,\n\t);\n}\n\nexport function generateUser(): IUser {\n\tconst userId = uuid();\n\tconst match = userId.match(/^([\\da-f]{8})-([\\da-f]{4})/);\n\tconst userName = match !== null ? match[0] : userId; // Just use the first two segments of the (fake) userId as a fake name.\n\n\tconst randomUser = {\n\t\tid: userId,\n\t\tname: userName,\n\t};\n\n\treturn randomUser;\n}\n"]}
@@ -0,0 +1,211 @@
1
+ import { DocumentDeltaConnection } from '@fluidframework/driver-base';
2
+ import { GitManager } from '@fluidframework/server-services-client';
3
+ import { IClient } from '@fluidframework/protocol-definitions';
4
+ import { ICreateBlobResponse } from '@fluidframework/protocol-definitions';
5
+ import { IDatabaseManager } from '@fluidframework/server-services-core';
6
+ import { IDb } from '@fluidframework/server-services-core';
7
+ import { IDocumentDeltaConnection } from '@fluidframework/driver-definitions';
8
+ import { IDocumentDeltaStorageService } from '@fluidframework/driver-definitions';
9
+ import { IDocumentMessage } from '@fluidframework/protocol-definitions';
10
+ import { IDocumentService } from '@fluidframework/driver-definitions';
11
+ import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
12
+ import { IDocumentServicePolicies } from '@fluidframework/driver-definitions';
13
+ import { IDocumentStorageService } from '@fluidframework/driver-definitions';
14
+ import { IDocumentStorageServicePolicies } from '@fluidframework/driver-definitions';
15
+ import { ILocalDeltaConnectionServer } from '@fluidframework/server-local-server';
16
+ import { IRequest } from '@fluidframework/core-interfaces';
17
+ import { IResolvedUrl } from '@fluidframework/driver-definitions';
18
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
19
+ import { ISnapshotTreeEx } from '@fluidframework/protocol-definitions';
20
+ import { IStream } from '@fluidframework/driver-definitions';
21
+ import { ISummaryContext } from '@fluidframework/driver-definitions';
22
+ import { ISummaryHandle } from '@fluidframework/protocol-definitions';
23
+ import { ISummaryTree } from '@fluidframework/protocol-definitions';
24
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
25
+ import { ITestDbFactory } from '@fluidframework/server-test-utils';
26
+ import { ITokenProvider } from '@fluidframework/routerlicious-driver';
27
+ import { IUrlResolver } from '@fluidframework/driver-definitions';
28
+ import { IVersion } from '@fluidframework/protocol-definitions';
29
+ import { IWebSocketServer } from '@fluidframework/server-services-core';
30
+ import { NackErrorType } from '@fluidframework/protocol-definitions';
31
+ import type { Socket } from 'socket.io-client';
32
+
33
+ /**
34
+ * Creates and returns a document service for local use.
35
+ * @param localDeltaConnectionServer - delta connection server for ops
36
+ * @param tokenProvider - token provider with a single token
37
+ * @param tenantId - ID of tenant
38
+ * @param documentId - ID of document
39
+ */
40
+ export declare function createLocalDocumentService(resolvedUrl: IResolvedUrl, localDeltaConnectionServer: ILocalDeltaConnectionServer, tokenProvider: ITokenProvider, tenantId: string, documentId: string, documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection>, policies?: IDocumentServicePolicies, innerDocumentService?: IDocumentService, logger?: ITelemetryBaseLogger): IDocumentService;
41
+
42
+ export declare function createLocalResolverCreateNewRequest(documentId: string): IRequest;
43
+
44
+ /**
45
+ * Provides access to the underlying delta storage on the server for local driver.
46
+ */
47
+ export declare class LocalDeltaStorageService implements IDocumentDeltaStorageService {
48
+ private readonly tenantId;
49
+ private readonly id;
50
+ private readonly databaseManager;
51
+ constructor(tenantId: string, id: string, databaseManager: IDatabaseManager);
52
+ fetchMessages(from: number, to: number | undefined, abortSignal?: AbortSignal, cachedOnly?: boolean): IStream<ISequencedDocumentMessage[]>;
53
+ private getCore;
54
+ }
55
+
56
+ /**
57
+ * Represents a connection to a stream of delta updates
58
+ */
59
+ export declare class LocalDocumentDeltaConnection extends DocumentDeltaConnection {
60
+ /**
61
+ * Create a LocalDocumentDeltaConnection
62
+ * Handle initial messages, contents or signals if they were in queue
63
+ *
64
+ * @param tenantId - the ID of the tenant
65
+ * @param id - document ID
66
+ * @param token - authorization token for storage service
67
+ * @param client - information about the client
68
+ * @param webSocketServer - web socket server to create connection
69
+ */
70
+ static create(tenantId: string, id: string, token: string, client: IClient, webSocketServer: IWebSocketServer, timeoutMs?: number, logger?: ITelemetryBaseLogger): Promise<LocalDocumentDeltaConnection>;
71
+ constructor(socket: Socket, documentId: string, logger?: ITelemetryBaseLogger);
72
+ /**
73
+ * Submits a new delta operation to the server
74
+ */
75
+ submit(messages: IDocumentMessage[]): void;
76
+ /**
77
+ * Submits a new signal to the server
78
+ */
79
+ submitSignal(message: any): void;
80
+ /**
81
+ * Send a "disconnect" message on the socket.
82
+ * @param disconnectReason - The reason of the disconnection.
83
+ */
84
+ disconnectClient(disconnectReason: string): void;
85
+ /**
86
+ * * Sends a "nack" message on the socket.
87
+ * @param code - An error code number that represents the error. It will be a valid HTTP error code.
88
+ * @param type - Type of the Nack.
89
+ * @param message - A message about the nack for debugging/logging/telemetry purposes.
90
+ */
91
+ nackClient(code: number | undefined, type: NackErrorType | undefined, message: any): void;
92
+ }
93
+
94
+ /**
95
+ * Basic implementation of a document service for local use.
96
+ */
97
+ export declare class LocalDocumentService implements IDocumentService {
98
+ readonly resolvedUrl: IResolvedUrl;
99
+ private readonly localDeltaConnectionServer;
100
+ private readonly tokenProvider;
101
+ private readonly tenantId;
102
+ private readonly documentId;
103
+ private readonly documentDeltaConnectionsMap;
104
+ readonly policies: IDocumentServicePolicies;
105
+ private readonly innerDocumentService?;
106
+ private readonly logger?;
107
+ /**
108
+ * @param localDeltaConnectionServer - delta connection server for ops
109
+ * @param tokenProvider - token provider
110
+ * @param tenantId - ID of tenant
111
+ * @param documentId - ID of document
112
+ */
113
+ constructor(resolvedUrl: IResolvedUrl, localDeltaConnectionServer: ILocalDeltaConnectionServer, tokenProvider: ITokenProvider, tenantId: string, documentId: string, documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection>, policies?: IDocumentServicePolicies, innerDocumentService?: IDocumentService | undefined, logger?: ITelemetryBaseLogger | undefined);
114
+ dispose(): void;
115
+ /**
116
+ * Creates and returns a document storage service for local use.
117
+ */
118
+ connectToStorage(): Promise<IDocumentStorageService>;
119
+ /**
120
+ * Creates and returns a delta storage service for local use.
121
+ */
122
+ connectToDeltaStorage(): Promise<IDocumentDeltaStorageService>;
123
+ /**
124
+ * Creates and returns a delta stream for local use.
125
+ * @param client - client data
126
+ */
127
+ connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection>;
128
+ }
129
+
130
+ /**
131
+ * Implementation of document service factory for local use.
132
+ */
133
+ export declare class LocalDocumentServiceFactory implements IDocumentServiceFactory {
134
+ private readonly localDeltaConnectionServer;
135
+ private readonly policies?;
136
+ private readonly innerDocumentService?;
137
+ private readonly documentDeltaConnectionsMap;
138
+ /**
139
+ * @param localDeltaConnectionServer - delta connection server for ops
140
+ */
141
+ constructor(localDeltaConnectionServer: ILocalDeltaConnectionServer, policies?: IDocumentServicePolicies | undefined, innerDocumentService?: IDocumentService | undefined);
142
+ createContainer(createNewSummary: ISummaryTree | undefined, resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
143
+ /**
144
+ * Creates and returns a document service for testing using the given resolved
145
+ * URL for the tenant ID, document ID, and token.
146
+ * @param resolvedUrl - resolved URL of document
147
+ */
148
+ createDocumentService(resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
149
+ /**
150
+ * Gets the document delta connection for the clientId and asks it to disconnect the client.
151
+ * @param clientId - The ID of the client to be disconnected.
152
+ * @param disconnectReason - The reason of the disconnection.
153
+ */
154
+ disconnectClient(clientId: string, disconnectReason: string): void;
155
+ /**
156
+ * Gets the document delta connection for the clientId and asks it to nack the client.
157
+ * @param clientId - The ID of the client to be Nack'd.
158
+ * @param code - An error code number that represents the error. It will be a valid HTTP error code.
159
+ * @param type - Type of the Nack.
160
+ * @param message - A message about the nack for debugging/logging/telemetry purposes.
161
+ */
162
+ nackClient(clientId: string, code?: number, type?: NackErrorType, message?: any): void;
163
+ }
164
+
165
+ export declare class LocalDocumentStorageService implements IDocumentStorageService {
166
+ private readonly id;
167
+ private readonly manager;
168
+ readonly policies: IDocumentStorageServicePolicies;
169
+ private readonly localDeltaConnectionServer?;
170
+ private readonly resolvedUrl?;
171
+ protected readonly blobsShaCache: Map<string, string>;
172
+ private readonly summaryTreeUploadManager;
173
+ get repositoryUrl(): string;
174
+ constructor(id: string, manager: GitManager, policies: IDocumentStorageServicePolicies, localDeltaConnectionServer?: ILocalDeltaConnectionServer | undefined, resolvedUrl?: IResolvedUrl | undefined);
175
+ getVersions(versionId: string | null, count: number): Promise<IVersion[]>;
176
+ getSnapshotTree(version?: IVersion): Promise<ISnapshotTreeEx | null>;
177
+ readBlob(blobId: string): Promise<ArrayBufferLike>;
178
+ uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
179
+ createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;
180
+ downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
181
+ private getPreviousFullSnapshot;
182
+ }
183
+
184
+ /**
185
+ * Resolves URLs by providing fake URLs which succeed with the other
186
+ * related local classes.
187
+ */
188
+ export declare class LocalResolver implements IUrlResolver {
189
+ private readonly tenantId;
190
+ private readonly tokenKey;
191
+ constructor();
192
+ /**
193
+ * Resolves URL requests by providing fake URLs with an actually generated
194
+ * token from constant test strings. The root of the URL is fake, but the
195
+ * remaining relative URL can still be parsed.
196
+ * @param request - request to handle
197
+ */
198
+ resolve(request: IRequest): Promise<IResolvedUrl>;
199
+ getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
200
+ createCreateNewRequest(documentId: string): IRequest;
201
+ }
202
+
203
+ /**
204
+ * A database factory for testing that stores data in the browsers session storage
205
+ */
206
+ export declare class LocalSessionStorageDbFactory implements ITestDbFactory {
207
+ readonly testDatabase: IDb;
208
+ connect(): Promise<IDb>;
209
+ }
210
+
211
+ export { }
@@ -0,0 +1,211 @@
1
+ import { DocumentDeltaConnection } from '@fluidframework/driver-base';
2
+ import { GitManager } from '@fluidframework/server-services-client';
3
+ import { IClient } from '@fluidframework/protocol-definitions';
4
+ import { ICreateBlobResponse } from '@fluidframework/protocol-definitions';
5
+ import { IDatabaseManager } from '@fluidframework/server-services-core';
6
+ import { IDb } from '@fluidframework/server-services-core';
7
+ import { IDocumentDeltaConnection } from '@fluidframework/driver-definitions';
8
+ import { IDocumentDeltaStorageService } from '@fluidframework/driver-definitions';
9
+ import { IDocumentMessage } from '@fluidframework/protocol-definitions';
10
+ import { IDocumentService } from '@fluidframework/driver-definitions';
11
+ import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
12
+ import { IDocumentServicePolicies } from '@fluidframework/driver-definitions';
13
+ import { IDocumentStorageService } from '@fluidframework/driver-definitions';
14
+ import { IDocumentStorageServicePolicies } from '@fluidframework/driver-definitions';
15
+ import { ILocalDeltaConnectionServer } from '@fluidframework/server-local-server';
16
+ import { IRequest } from '@fluidframework/core-interfaces';
17
+ import { IResolvedUrl } from '@fluidframework/driver-definitions';
18
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
19
+ import { ISnapshotTreeEx } from '@fluidframework/protocol-definitions';
20
+ import { IStream } from '@fluidframework/driver-definitions';
21
+ import { ISummaryContext } from '@fluidframework/driver-definitions';
22
+ import { ISummaryHandle } from '@fluidframework/protocol-definitions';
23
+ import { ISummaryTree } from '@fluidframework/protocol-definitions';
24
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
25
+ import { ITestDbFactory } from '@fluidframework/server-test-utils';
26
+ import { ITokenProvider } from '@fluidframework/routerlicious-driver';
27
+ import { IUrlResolver } from '@fluidframework/driver-definitions';
28
+ import { IVersion } from '@fluidframework/protocol-definitions';
29
+ import { IWebSocketServer } from '@fluidframework/server-services-core';
30
+ import { NackErrorType } from '@fluidframework/protocol-definitions';
31
+ import type { Socket } from 'socket.io-client';
32
+
33
+ /**
34
+ * Creates and returns a document service for local use.
35
+ * @param localDeltaConnectionServer - delta connection server for ops
36
+ * @param tokenProvider - token provider with a single token
37
+ * @param tenantId - ID of tenant
38
+ * @param documentId - ID of document
39
+ */
40
+ export declare function createLocalDocumentService(resolvedUrl: IResolvedUrl, localDeltaConnectionServer: ILocalDeltaConnectionServer, tokenProvider: ITokenProvider, tenantId: string, documentId: string, documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection>, policies?: IDocumentServicePolicies, innerDocumentService?: IDocumentService, logger?: ITelemetryBaseLogger): IDocumentService;
41
+
42
+ export declare function createLocalResolverCreateNewRequest(documentId: string): IRequest;
43
+
44
+ /**
45
+ * Provides access to the underlying delta storage on the server for local driver.
46
+ */
47
+ export declare class LocalDeltaStorageService implements IDocumentDeltaStorageService {
48
+ private readonly tenantId;
49
+ private readonly id;
50
+ private readonly databaseManager;
51
+ constructor(tenantId: string, id: string, databaseManager: IDatabaseManager);
52
+ fetchMessages(from: number, to: number | undefined, abortSignal?: AbortSignal, cachedOnly?: boolean): IStream<ISequencedDocumentMessage[]>;
53
+ private getCore;
54
+ }
55
+
56
+ /**
57
+ * Represents a connection to a stream of delta updates
58
+ */
59
+ export declare class LocalDocumentDeltaConnection extends DocumentDeltaConnection {
60
+ /**
61
+ * Create a LocalDocumentDeltaConnection
62
+ * Handle initial messages, contents or signals if they were in queue
63
+ *
64
+ * @param tenantId - the ID of the tenant
65
+ * @param id - document ID
66
+ * @param token - authorization token for storage service
67
+ * @param client - information about the client
68
+ * @param webSocketServer - web socket server to create connection
69
+ */
70
+ static create(tenantId: string, id: string, token: string, client: IClient, webSocketServer: IWebSocketServer, timeoutMs?: number, logger?: ITelemetryBaseLogger): Promise<LocalDocumentDeltaConnection>;
71
+ constructor(socket: Socket, documentId: string, logger?: ITelemetryBaseLogger);
72
+ /**
73
+ * Submits a new delta operation to the server
74
+ */
75
+ submit(messages: IDocumentMessage[]): void;
76
+ /**
77
+ * Submits a new signal to the server
78
+ */
79
+ submitSignal(message: any): void;
80
+ /**
81
+ * Send a "disconnect" message on the socket.
82
+ * @param disconnectReason - The reason of the disconnection.
83
+ */
84
+ disconnectClient(disconnectReason: string): void;
85
+ /**
86
+ * * Sends a "nack" message on the socket.
87
+ * @param code - An error code number that represents the error. It will be a valid HTTP error code.
88
+ * @param type - Type of the Nack.
89
+ * @param message - A message about the nack for debugging/logging/telemetry purposes.
90
+ */
91
+ nackClient(code: number | undefined, type: NackErrorType | undefined, message: any): void;
92
+ }
93
+
94
+ /**
95
+ * Basic implementation of a document service for local use.
96
+ */
97
+ export declare class LocalDocumentService implements IDocumentService {
98
+ readonly resolvedUrl: IResolvedUrl;
99
+ private readonly localDeltaConnectionServer;
100
+ private readonly tokenProvider;
101
+ private readonly tenantId;
102
+ private readonly documentId;
103
+ private readonly documentDeltaConnectionsMap;
104
+ readonly policies: IDocumentServicePolicies;
105
+ private readonly innerDocumentService?;
106
+ private readonly logger?;
107
+ /**
108
+ * @param localDeltaConnectionServer - delta connection server for ops
109
+ * @param tokenProvider - token provider
110
+ * @param tenantId - ID of tenant
111
+ * @param documentId - ID of document
112
+ */
113
+ constructor(resolvedUrl: IResolvedUrl, localDeltaConnectionServer: ILocalDeltaConnectionServer, tokenProvider: ITokenProvider, tenantId: string, documentId: string, documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection>, policies?: IDocumentServicePolicies, innerDocumentService?: IDocumentService | undefined, logger?: ITelemetryBaseLogger | undefined);
114
+ dispose(): void;
115
+ /**
116
+ * Creates and returns a document storage service for local use.
117
+ */
118
+ connectToStorage(): Promise<IDocumentStorageService>;
119
+ /**
120
+ * Creates and returns a delta storage service for local use.
121
+ */
122
+ connectToDeltaStorage(): Promise<IDocumentDeltaStorageService>;
123
+ /**
124
+ * Creates and returns a delta stream for local use.
125
+ * @param client - client data
126
+ */
127
+ connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection>;
128
+ }
129
+
130
+ /**
131
+ * Implementation of document service factory for local use.
132
+ */
133
+ export declare class LocalDocumentServiceFactory implements IDocumentServiceFactory {
134
+ private readonly localDeltaConnectionServer;
135
+ private readonly policies?;
136
+ private readonly innerDocumentService?;
137
+ private readonly documentDeltaConnectionsMap;
138
+ /**
139
+ * @param localDeltaConnectionServer - delta connection server for ops
140
+ */
141
+ constructor(localDeltaConnectionServer: ILocalDeltaConnectionServer, policies?: IDocumentServicePolicies | undefined, innerDocumentService?: IDocumentService | undefined);
142
+ createContainer(createNewSummary: ISummaryTree | undefined, resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
143
+ /**
144
+ * Creates and returns a document service for testing using the given resolved
145
+ * URL for the tenant ID, document ID, and token.
146
+ * @param resolvedUrl - resolved URL of document
147
+ */
148
+ createDocumentService(resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
149
+ /**
150
+ * Gets the document delta connection for the clientId and asks it to disconnect the client.
151
+ * @param clientId - The ID of the client to be disconnected.
152
+ * @param disconnectReason - The reason of the disconnection.
153
+ */
154
+ disconnectClient(clientId: string, disconnectReason: string): void;
155
+ /**
156
+ * Gets the document delta connection for the clientId and asks it to nack the client.
157
+ * @param clientId - The ID of the client to be Nack'd.
158
+ * @param code - An error code number that represents the error. It will be a valid HTTP error code.
159
+ * @param type - Type of the Nack.
160
+ * @param message - A message about the nack for debugging/logging/telemetry purposes.
161
+ */
162
+ nackClient(clientId: string, code?: number, type?: NackErrorType, message?: any): void;
163
+ }
164
+
165
+ export declare class LocalDocumentStorageService implements IDocumentStorageService {
166
+ private readonly id;
167
+ private readonly manager;
168
+ readonly policies: IDocumentStorageServicePolicies;
169
+ private readonly localDeltaConnectionServer?;
170
+ private readonly resolvedUrl?;
171
+ protected readonly blobsShaCache: Map<string, string>;
172
+ private readonly summaryTreeUploadManager;
173
+ get repositoryUrl(): string;
174
+ constructor(id: string, manager: GitManager, policies: IDocumentStorageServicePolicies, localDeltaConnectionServer?: ILocalDeltaConnectionServer | undefined, resolvedUrl?: IResolvedUrl | undefined);
175
+ getVersions(versionId: string | null, count: number): Promise<IVersion[]>;
176
+ getSnapshotTree(version?: IVersion): Promise<ISnapshotTreeEx | null>;
177
+ readBlob(blobId: string): Promise<ArrayBufferLike>;
178
+ uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
179
+ createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;
180
+ downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
181
+ private getPreviousFullSnapshot;
182
+ }
183
+
184
+ /**
185
+ * Resolves URLs by providing fake URLs which succeed with the other
186
+ * related local classes.
187
+ */
188
+ export declare class LocalResolver implements IUrlResolver {
189
+ private readonly tenantId;
190
+ private readonly tokenKey;
191
+ constructor();
192
+ /**
193
+ * Resolves URL requests by providing fake URLs with an actually generated
194
+ * token from constant test strings. The root of the URL is fake, but the
195
+ * remaining relative URL can still be parsed.
196
+ * @param request - request to handle
197
+ */
198
+ resolve(request: IRequest): Promise<IResolvedUrl>;
199
+ getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
200
+ createCreateNewRequest(documentId: string): IRequest;
201
+ }
202
+
203
+ /**
204
+ * A database factory for testing that stores data in the browsers session storage
205
+ */
206
+ export declare class LocalSessionStorageDbFactory implements ITestDbFactory {
207
+ readonly testDatabase: IDb;
208
+ connect(): Promise<IDb>;
209
+ }
210
+
211
+ export { }