@fluidframework/local-driver 2.0.0-internal.2.3.0 → 2.0.0-internal.2.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"localDocumentService.d.ts","sourceRoot":"","sources":["../src/localDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,wBAAwB,EACxB,4BAA4B,EAC5B,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,YAAY,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAGtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAA4B,4BAA4B,EAA+B,MAAM,GAAG,CAAC;AACxG;;GAEG;AACH,qBAAa,oBAAqB,YAAW,gBAAgB;aAQrC,WAAW,EAAE,YAAY;IACzC,OAAO,CAAC,QAAQ,CAAC,0BAA0B;IAC3C,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,2BAA2B;aAC5B,QAAQ,EAAE,wBAAwB;IAClD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC;IAd1C;;;;;OAKG;gBAEiB,WAAW,EAAE,YAAY,EACxB,0BAA0B,EAAE,2BAA2B,EACvD,aAAa,EAAE,cAAc,EAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,2BAA2B,EAAE,GAAG,CAAC,MAAM,EAAE,4BAA4B,CAAC,EACvE,QAAQ,GAAE,wBAA6B,EACtC,oBAAoB,CAAC,8BAAkB;IAGrD,OAAO;IAEd;;OAEG;IACU,gBAAgB,IAAI,OAAO,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QAAQ,CAAC,oBAAoB,CAAC;IAd1C;;;;;OAKG;gBAEiB,WAAW,EAAE,YAAY,EACxB,0BAA0B,EAAE,2BAA2B,EACvD,aAAa,EAAE,cAAc,EAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,2BAA2B,EAAE,GAAG,CAAC,MAAM,EAAE,4BAA4B,CAAC,EACvE,QAAQ,GAAE,wBAA6B,EACtC,oBAAoB,CAAC,8BAAkB;IAGrD,OAAO;IAEd;;OAEG;IACU,gBAAgB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAWjE;;OAEG;IACU,qBAAqB,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAU3E;;;OAGG;IACU,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC;CA8BxF;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACtC,WAAW,EAAE,YAAY,EACzB,0BAA0B,EAAE,2BAA2B,EACvD,aAAa,EAAE,cAAc,EAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,2BAA2B,EAAE,GAAG,CAAC,MAAM,EAAE,4BAA4B,CAAC,EACtE,QAAQ,CAAC,EAAE,wBAAwB,EACnC,oBAAoB,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,CAW7D"}
@@ -33,7 +33,10 @@ class LocalDocumentService {
33
33
  * Creates and returns a document storage service for local use.
34
34
  */
35
35
  async connectToStorage() {
36
- return new _1.LocalDocumentStorageService(this.documentId, new server_services_client_1.GitManager(new server_test_utils_1.TestHistorian(this.localDeltaConnectionServer.testDbFactory.testDatabase)), { minBlobSize: 2048 });
36
+ return new _1.LocalDocumentStorageService(this.documentId, new server_services_client_1.GitManager(new server_test_utils_1.TestHistorian(this.localDeltaConnectionServer.testDbFactory.testDatabase)), {
37
+ minBlobSize: 2048,
38
+ maximumCacheDurationMs: 432000000, // 5 days in ms. Not actually enforced but shouldn't matter for any local driver scenario
39
+ });
37
40
  }
38
41
  /**
39
42
  * Creates and returns a delta storage service for local use.
@@ -1 +1 @@
1
- {"version":3,"file":"localDocumentService.js","sourceRoot":"","sources":["../src/localDocumentService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAYH,mFAAoE;AACpE,yEAAkE;AAElE,wBAAwG;AACxG;;GAEG;AACH,MAAa,oBAAoB;IAC7B;;;;;OAKG;IACH,YACoB,WAAyB,EACxB,0BAAuD,EACvD,aAA6B,EAC7B,QAAgB,EAChB,UAAkB,EAClB,2BAAsE,EACvE,WAAqC,EAAE,EACtC,oBAAuC;QAPxC,gBAAW,GAAX,WAAW,CAAc;QACxB,+BAA0B,GAA1B,0BAA0B,CAA6B;QACvD,kBAAa,GAAb,aAAa,CAAgB;QAC7B,aAAQ,GAAR,QAAQ,CAAQ;QAChB,eAAU,GAAV,UAAU,CAAQ;QAClB,gCAA2B,GAA3B,2BAA2B,CAA2C;QACvE,aAAQ,GAAR,QAAQ,CAA+B;QACtC,yBAAoB,GAApB,oBAAoB,CAAmB;IACxD,CAAC;IAEE,OAAO,KAAK,CAAC;IAEpB;;OAEG;IACI,KAAK,CAAC,gBAAgB;QACzB,OAAO,IAAI,8BAA2B,CAClC,IAAI,CAAC,UAAU,EACf,IAAI,mCAAU,CAAC,IAAI,iCAAa,CAAC,IAAI,CAAC,0BAA0B,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,EAC7F,EAAE,WAAW,EAAE,IAAI,EAAE,CACxB,CAAC;IACN,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,qBAAqB;QAC9B,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC3B,OAAO,IAAI,CAAC,oBAAoB,CAAC,qBAAqB,EAAE,CAAC;SAC5D;QACD,OAAO,IAAI,2BAAwB,CAC/B,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,0BAA0B,CAAC,eAAe,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACI,KA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CAAC;AAnBD,gEAmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDocumentDeltaConnection,\n IDocumentDeltaStorageService,\n IDocumentService,\n IDocumentServicePolicies,\n IDocumentStorageService,\n IResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\nimport { ITokenProvider } from \"@fluidframework/routerlicious-driver\";\nimport { GitManager } from \"@fluidframework/server-services-client\";\nimport { TestHistorian } from \"@fluidframework/server-test-utils\";\nimport { ILocalDeltaConnectionServer } from \"@fluidframework/server-local-server\";\nimport { LocalDeltaStorageService, LocalDocumentDeltaConnection, LocalDocumentStorageService } from \".\";\n/**\n * Basic implementation of a document service for local use.\n */\nexport class LocalDocumentService implements IDocumentService {\n /**\n * @param localDeltaConnectionServer - delta connection server for ops\n * @param tokenProvider - token provider\n * @param tenantId - ID of tenant\n * @param documentId - ID of document\n */\n constructor(\n public readonly resolvedUrl: IResolvedUrl,\n private readonly localDeltaConnectionServer: ILocalDeltaConnectionServer,\n private readonly tokenProvider: ITokenProvider,\n private readonly tenantId: string,\n private readonly documentId: string,\n private readonly documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection>,\n public readonly policies: IDocumentServicePolicies = {},\n private readonly innerDocumentService?: IDocumentService,\n ) { }\n\n public dispose() { }\n\n /**\n * Creates and returns a document storage service for local use.\n */\n public async connectToStorage(): Promise<IDocumentStorageService> {\n return new LocalDocumentStorageService(\n this.documentId,\n new GitManager(new TestHistorian(this.localDeltaConnectionServer.testDbFactory.testDatabase)),\n { minBlobSize: 2048 }, // Test blob aggregation.\n );\n }\n\n /**\n * Creates and returns a delta storage service for local use.\n */\n public async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n if (this.innerDocumentService) {\n return this.innerDocumentService.connectToDeltaStorage();\n }\n return new LocalDeltaStorageService(\n this.tenantId,\n this.documentId,\n this.localDeltaConnectionServer.databaseManager);\n }\n\n /**\n * Creates and returns a delta stream for local use.\n * @param client - client data\n */\n public async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n if (this.policies.storageOnly === true) {\n throw new Error(\"can't connect to delta stream in storage-only mode\");\n }\n if (this.innerDocumentService) {\n return this.innerDocumentService.connectToDeltaStream(client);\n }\n const ordererToken = await this.tokenProvider.fetchOrdererToken(\n this.tenantId,\n this.documentId,\n );\n const documentDeltaConnection = await LocalDocumentDeltaConnection.create(\n this.tenantId,\n this.documentId,\n ordererToken.jwt,\n client,\n this.localDeltaConnectionServer.webSocketServer,\n );\n const clientId = documentDeltaConnection.clientId;\n\n // Add this document service for the clientId in the document service factory.\n this.documentDeltaConnectionsMap.set(clientId, documentDeltaConnection);\n\n // Add a listener to remove this document service when the client is disconnected.\n documentDeltaConnection.on(\"disconnect\", () => {\n this.documentDeltaConnectionsMap.delete(clientId);\n });\n\n return documentDeltaConnection;\n }\n}\n\n/**\n * Creates and returns a document service for local use.\n * @param localDeltaConnectionServer - delta connection server for ops\n * @param tokenProvider - token provider with a single token\n * @param tenantId - ID of tenant\n * @param documentId - ID of document\n */\nexport function createLocalDocumentService(\n resolvedUrl: IResolvedUrl,\n localDeltaConnectionServer: ILocalDeltaConnectionServer,\n tokenProvider: ITokenProvider,\n tenantId: string,\n documentId: string,\n documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection>,\n policies?: IDocumentServicePolicies,\n innerDocumentService?: IDocumentService): IDocumentService {\n return new LocalDocumentService(\n resolvedUrl,\n localDeltaConnectionServer,\n tokenProvider,\n tenantId,\n documentId,\n documentDeltaConnectionsMap,\n policies,\n innerDocumentService,\n );\n}\n"]}
1
+ {"version":3,"file":"localDocumentService.js","sourceRoot":"","sources":["../src/localDocumentService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAYH,mFAAoE;AACpE,yEAAkE;AAElE,wBAAwG;AACxG;;GAEG;AACH,MAAa,oBAAoB;IAC7B;;;;;OAKG;I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C,oBAAoB,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;SACjE;QACD,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAC3D,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,UAAU,CAClB,CAAC;QACF,MAAM,uBAAuB,GAAG,MAAM,+BAA4B,CAAC,MAAM,CACrE,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,UAAU,EACf,YAAY,CAAC,GAAG,EAChB,MAAM,EACN,IAAI,CAAC,0BAA0B,CAAC,eAAe,CAClD,CAAC;QACF,MAAM,QAAQ,GAAG,uBAAuB,CAAC,QAAQ,CAAC;QAElD,8EAA8E;QAC9E,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,QAAQ,EAAE,uBAAuB,CAAC,CAAC;QAExE,kFAAkF;QAClF,uBAAuB,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;YAC1C,IAAI,CAAC,2BAA2B,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;QAEH,OAAO,uBAAuB,CAAC;IACnC,CAAC;CACJ;AAjFD,oDAiFC;AAED;;;;;;GAMG;AACH,SAAgB,0BAA0B,CACtC,WAAyB,EACzB,0BAAuD,EACvD,aAA6B,EAC7B,QAAgB,EAChB,UAAkB,EAClB,2BAAsE,EACtE,QAAmC,EACnC,oBAAuC;IACvC,OAAO,IAAI,oBAAoB,CAC3B,WAAW,EACX,0BAA0B,EAC1B,aAAa,EACb,QAAQ,EACR,UAAU,EACV,2BAA2B,EAC3B,QAAQ,EACR,oBAAoB,CACvB,CAAC;AACN,CAAC;AAnBD,gEAmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDocumentDeltaConnection,\n IDocumentDeltaStorageService,\n IDocumentService,\n IDocumentServicePolicies,\n IDocumentStorageService,\n IResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\nimport { ITokenProvider } from \"@fluidframework/routerlicious-driver\";\nimport { GitManager } from \"@fluidframework/server-services-client\";\nimport { TestHistorian } from \"@fluidframework/server-test-utils\";\nimport { ILocalDeltaConnectionServer } from \"@fluidframework/server-local-server\";\nimport { LocalDeltaStorageService, LocalDocumentDeltaConnection, LocalDocumentStorageService } from \".\";\n/**\n * Basic implementation of a document service for local use.\n */\nexport class LocalDocumentService implements IDocumentService {\n /**\n * @param localDeltaConnectionServer - delta connection server for ops\n * @param tokenProvider - token provider\n * @param tenantId - ID of tenant\n * @param documentId - ID of document\n */\n constructor(\n public readonly resolvedUrl: IResolvedUrl,\n private readonly localDeltaConnectionServer: ILocalDeltaConnectionServer,\n private readonly tokenProvider: ITokenProvider,\n private readonly tenantId: string,\n private readonly documentId: string,\n private readonly documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection>,\n public readonly policies: IDocumentServicePolicies = {},\n private readonly innerDocumentService?: IDocumentService,\n ) { }\n\n public dispose() { }\n\n /**\n * Creates and returns a document storage service for local use.\n */\n public async connectToStorage(): Promise<IDocumentStorageService> {\n return new LocalDocumentStorageService(\n this.documentId,\n new GitManager(new TestHistorian(this.localDeltaConnectionServer.testDbFactory.testDatabase)),\n {\n minBlobSize: 2048, // Test blob aggregation\n maximumCacheDurationMs: 432_000_000, // 5 days in ms. Not actually enforced but shouldn't matter for any local driver scenario\n },\n );\n }\n\n /**\n * Creates and returns a delta storage service for local use.\n */\n public async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n if (this.innerDocumentService) {\n return this.innerDocumentService.connectToDeltaStorage();\n }\n return new LocalDeltaStorageService(\n this.tenantId,\n this.documentId,\n this.localDeltaConnectionServer.databaseManager);\n }\n\n /**\n * Creates and returns a delta stream for local use.\n * @param client - client data\n */\n public async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n if (this.policies.storageOnly === true) {\n throw new Error(\"can't connect to delta stream in storage-only mode\");\n }\n if (this.innerDocumentService) {\n return this.innerDocumentService.connectToDeltaStream(client);\n }\n const ordererToken = await this.tokenProvider.fetchOrdererToken(\n this.tenantId,\n this.documentId,\n );\n const documentDeltaConnection = await LocalDocumentDeltaConnection.create(\n this.tenantId,\n this.documentId,\n ordererToken.jwt,\n client,\n this.localDeltaConnectionServer.webSocketServer,\n );\n const clientId = documentDeltaConnection.clientId;\n\n // Add this document service for the clientId in the document service factory.\n this.documentDeltaConnectionsMap.set(clientId, documentDeltaConnection);\n\n // Add a listener to remove this document service when the client is disconnected.\n documentDeltaConnection.on(\"disconnect\", () => {\n this.documentDeltaConnectionsMap.delete(clientId);\n });\n\n return documentDeltaConnection;\n }\n}\n\n/**\n * Creates and returns a document service for local use.\n * @param localDeltaConnectionServer - delta connection server for ops\n * @param tokenProvider - token provider with a single token\n * @param tenantId - ID of tenant\n * @param documentId - ID of document\n */\nexport function createLocalDocumentService(\n resolvedUrl: IResolvedUrl,\n localDeltaConnectionServer: ILocalDeltaConnectionServer,\n tokenProvider: ITokenProvider,\n tenantId: string,\n documentId: string,\n documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection>,\n policies?: IDocumentServicePolicies,\n innerDocumentService?: IDocumentService): IDocumentService {\n return new LocalDocumentService(\n resolvedUrl,\n localDeltaConnectionServer,\n tokenProvider,\n tenantId,\n documentId,\n documentDeltaConnectionsMap,\n policies,\n innerDocumentService,\n );\n}\n"]}
@@ -12,7 +12,7 @@ export declare class LocalDocumentStorageService implements IDocumentStorageServ
12
12
  protected readonly blobsShaCache: Map<string, string>;
13
13
  private readonly summaryTreeUploadManager;
14
14
  get repositoryUrl(): string;
15
- constructor(id: string, manager: GitManager, policies?: IDocumentStorageServicePolicies);
15
+ constructor(id: string, manager: GitManager, policies: IDocumentStorageServicePolicies);
16
16
  getVersions(versionId: string | null, count: number): Promise<IVersion[]>;
17
17
  getSnapshotTree(version?: IVersion): Promise<ISnapshotTreeEx | null>;
18
18
  readBlob(blobId: string): Promise<ArrayBufferLike>;
@@ -1 +1 @@
1
- {"version":3,"file":"localDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/localDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAmD,MAAM,wCAAwC,CAAC;AAErH,qBAAa,2BAA4B,YAAW,uBAAuB;IAWzE,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,OAAO;aACR,QAAQ,EAAE,+BAA+B;IAV1D,SAAS,CAAC,QAAQ,CAAC,aAAa,sBAA6B;IAC7D,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAwB;IAEjE,IAAW,aAAa,IAAI,MAAM,CAEjC;gBAGiB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,UAAU,EACpB,QAAQ,GAAE,+BAAoC;IASlD,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAUzE,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAgBpE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAOlD,wBAAwB,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ1F,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAQ/D,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;YAI7D,uBAA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@@ const common_utils_1 = require("@fluidframework/common-utils");
9
9
  const protocol_base_1 = require("@fluidframework/protocol-base");
10
10
  const server_services_client_1 = require("@fluidframework/server-services-client");
11
11
  class LocalDocumentStorageService {
12
- constructor(id, manager, policies = {}) {
12
+ constructor(id, manager, policies) {
13
13
  this.id = id;
14
14
  this.manager = manager;
15
15
  this.policies = policies;
@@ -1 +1 @@
1
- {"version":3,"file":"localDocumentStorageService.js","sourceRoot":"","sources":["../src/localDocumentStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAkF;AAalF,iEAA+D;AAC/D,mFAAqH;AAErH,MAAa,2BAA2B;IAUvC,YACkB,EAAU,EACV,OAAmB,EACpB,WAA4C,EAAE;QAF7C,OAAE,GAAF,EAAE,CAAQ;QACV,YAAO,GAAP,OAAO,CAAY;QACpB,aAAQ,GAAR,QAAQ,CAAsC;QAZ/D,uFAAuF;QACvF,2BAA2B;QACR,kBAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;QAY5D,IAAI,CAAC,wBAAwB,GAAG,IAAI,iDAAwB,CAC3D,OAAO,EACP,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CACvC,CAAC;IACH,CAAC;IAdD,IAAW,aAAa;QACvB,OAAO,EAAE,CAAC;IACX,CAAC;IAcM,KAAK,CAAC,WAAW,CAAC,SAAwB,EAAE,KAAa;QAC/D,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACzD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI;YAC/B,EAAE,EAAE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AAU,CAAC,IAAqB;QAC5C,MAAM,cAAc,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAC7B,IAAA,iCAAkB,EACjB,cAAc,EAAE,QAAQ,CAAC,EAC1B,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrD,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAAsB;QAClD,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACrC,CAAC;IAEO,KAAK,CAAC,uBAAuB,CAAC,YAAoB;QACzD,OAAO,YAAY;YAClB,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,CAAC;iBACjC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;gBACxB,mEAAmE;gBACnE,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;gBAC3B,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1C,CAAC,CAAC;YACH,CAAC,CAAC,SAAS,CAAC;IACd,CAAC;CACD;AArFD,kEAqFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { stringToBuffer, Uint8ArrayToString } from \"@fluidframework/common-utils\";\nimport {\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTreeEx,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { buildHierarchy } from \"@fluidframework/protocol-base\";\nimport { GitManager, ISummaryUploadManager, SummaryTreeUploadManager } from \"@fluidframework/server-services-client\";\n\nexport class LocalDocumentStorageService implements IDocumentStorageService {\n\t// The values of this cache is useless. We only need the keys. So we are always putting\n\t// empty strings as values.\n\tprotected readonly blobsShaCache = new Map<string, string>();\n\tprivate readonly summaryTreeUploadManager: ISummaryUploadManager;\n\n\tpublic get repositoryUrl(): string {\n\t\treturn \"\";\n\t}\n\n\tconstructor(\n\t\tprivate readonly id: string,\n\t\tprivate readonly manager: GitManager,\n\t\tpublic readonly policies: IDocumentStorageServicePolicies = {},\n\t) {\n\t\tthis.summaryTreeUploadManager = new SummaryTreeUploadManager(\n\t\t\tmanager,\n\t\t\tthis.blobsShaCache,\n\t\t\tthis.getPreviousFullSnapshot.bind(this),\n\t\t);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tconst id = versionId ? versionId : this.id;\n\t\tconst commits = await this.manager.getCommits(id, count);\n\t\treturn commits.map((commit) => ({\n\t\t\tdate: commit.commit.author.date,\n\t\t\tid: commit.sha,\n\t\t\ttreeId: commit.commit.tree.sha,\n\t\t}));\n\t}\n\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTreeEx | null> {\n\t\tlet requestVersion = version;\n\t\tif (!requestVersion) {\n\t\t\tconst versions = await this.getVersions(this.id, 1);\n\t\t\tif (versions.length === 0) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\trequestVersion = versions[0];\n\t\t}\n\n\t\tconst rawTree = await this.manager.getTree(requestVersion.treeId);\n\t\tconst tree = buildHierarchy(rawTree, this.blobsShaCache, true);\n\t\treturn tree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tconst blob = await this.manager.getBlob(blobId);\n\t\tthis.blobsShaCache.set(blob.sha, \"\");\n\t\tconst bufferContent = stringToBuffer(blob.content, blob.encoding);\n\t\treturn bufferContent;\n\t}\n\n\tpublic async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n\t\treturn this.summaryTreeUploadManager.writeSummaryTree(\n\t\t\tsummary,\n\t\t\tcontext.ackHandle ?? \"\",\n\t\t\t\"channel\",\n\t\t);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\tconst uint8ArrayFile = new Uint8Array(file);\n\t\treturn this.manager.createBlob(\n\t\t\tUint8ArrayToString(\n\t\t\t\tuint8ArrayFile, \"base64\"),\n\t\t\t\"base64\").then((r) => ({ id: r.sha, url: r.url }));\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\tthrow new Error(\"NOT IMPLEMENTED!\");\n\t}\n\n\tprivate async getPreviousFullSnapshot(parentHandle: string): Promise<ISnapshotTreeEx | null | undefined> {\n\t\treturn parentHandle\n\t\t\t? this.getVersions(parentHandle, 1)\n\t\t\t\t.then(async (versions) => {\n\t\t\t\t\t// Clear the cache as the getSnapshotTree call will fill the cache.\n\t\t\t\t\tthis.blobsShaCache.clear();\n\t\t\t\t\treturn this.getSnapshotTree(versions[0]);\n\t\t\t\t})\n\t\t\t: undefined;\n\t}\n}\n"]}
1
+ {"version":3,"file":"localDocumentStorageService.js","sourceRoot":"","sources":["../src/localDocumentStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAkF;AAalF,iEAA+D;AAC/D,mFAAqH;AAErH,MAAa,2BAA2B;IAUvC,YACkB,EAAU,EACV,OAAmB,EACpB,QAAyC;QAFxC,OAAE,GAAF,EAAE,CAAQ;QACV,YAAO,GAAP,OAAO,CAAY;QACpB,aAAQ,GAAR,QAAQ,CAAiC;QAZ1D,uFAAuF;QACvF,2BAA2B;QACR,kBAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;QAY5D,IAAI,CAAC,wBAAwB,GAAG,IAAI,iDAAwB,CAC3D,OAAO,EACP,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CACvC,C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CAAC;YAC1C,CAAC,CAAC;YACH,CAAC,CAAC,SAAS,CAAC;IACd,CAAC;CACD;AArFD,kEAqFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { stringToBuffer, Uint8ArrayToString } from \"@fluidframework/common-utils\";\nimport {\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTreeEx,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { buildHierarchy } from \"@fluidframework/protocol-base\";\nimport { GitManager, ISummaryUploadManager, SummaryTreeUploadManager } from \"@fluidframework/server-services-client\";\n\nexport class LocalDocumentStorageService implements IDocumentStorageService {\n\t// The values of this cache is useless. We only need the keys. So we are always putting\n\t// empty strings as values.\n\tprotected readonly blobsShaCache = new Map<string, string>();\n\tprivate readonly summaryTreeUploadManager: ISummaryUploadManager;\n\n\tpublic get repositoryUrl(): string {\n\t\treturn \"\";\n\t}\n\n\tconstructor(\n\t\tprivate readonly id: string,\n\t\tprivate readonly manager: GitManager,\n\t\tpublic readonly policies: IDocumentStorageServicePolicies,\n\t) {\n\t\tthis.summaryTreeUploadManager = new SummaryTreeUploadManager(\n\t\t\tmanager,\n\t\t\tthis.blobsShaCache,\n\t\t\tthis.getPreviousFullSnapshot.bind(this),\n\t\t);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tconst id = versionId ? versionId : this.id;\n\t\tconst commits = await this.manager.getCommits(id, count);\n\t\treturn commits.map((commit) => ({\n\t\t\tdate: commit.commit.author.date,\n\t\t\tid: commit.sha,\n\t\t\ttreeId: commit.commit.tree.sha,\n\t\t}));\n\t}\n\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTreeEx | null> {\n\t\tlet requestVersion = version;\n\t\tif (!requestVersion) {\n\t\t\tconst versions = await this.getVersions(this.id, 1);\n\t\t\tif (versions.length === 0) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\trequestVersion = versions[0];\n\t\t}\n\n\t\tconst rawTree = await this.manager.getTree(requestVersion.treeId);\n\t\tconst tree = buildHierarchy(rawTree, this.blobsShaCache, true);\n\t\treturn tree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tconst blob = await this.manager.getBlob(blobId);\n\t\tthis.blobsShaCache.set(blob.sha, \"\");\n\t\tconst bufferContent = stringToBuffer(blob.content, blob.encoding);\n\t\treturn bufferContent;\n\t}\n\n\tpublic async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n\t\treturn this.summaryTreeUploadManager.writeSummaryTree(\n\t\t\tsummary,\n\t\t\tcontext.ackHandle ?? \"\",\n\t\t\t\"channel\",\n\t\t);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\tconst uint8ArrayFile = new Uint8Array(file);\n\t\treturn this.manager.createBlob(\n\t\t\tUint8ArrayToString(\n\t\t\t\tuint8ArrayFile, \"base64\"),\n\t\t\t\"base64\").then((r) => ({ id: r.sha, url: r.url }));\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\tthrow new Error(\"NOT IMPLEMENTED!\");\n\t}\n\n\tprivate async getPreviousFullSnapshot(parentHandle: string): Promise<ISnapshotTreeEx | null | undefined> {\n\t\treturn parentHandle\n\t\t\t? this.getVersions(parentHandle, 1)\n\t\t\t\t.then(async (versions) => {\n\t\t\t\t\t// Clear the cache as the getSnapshotTree call will fill the cache.\n\t\t\t\t\tthis.blobsShaCache.clear();\n\t\t\t\t\treturn this.getSnapshotTree(versions[0]);\n\t\t\t\t})\n\t\t\t: undefined;\n\t}\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/local-driver";
8
- export declare const pkgVersion = "2.0.0-internal.2.3.0";
8
+ export declare const pkgVersion = "2.0.0-internal.2.4.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/local-driver";
11
- exports.pkgVersion = "2.0.0-internal.2.3.0";
11
+ exports.pkgVersion = "2.0.0-internal.2.4.0";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,8BAA8B,CAAC;AACzC,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/local-driver\";\nexport const pkgVersion = \"2.0.0-internal.2.3.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,8BAA8B,CAAC;AACzC,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/local-driver\";\nexport const pkgVersion = \"2.0.0-internal.2.4.0\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/local-driver",
3
- "version": "2.0.0-internal.2.3.0",
3
+ "version": "2.0.0-internal.2.4.0",
4
4
  "description": "Fluid local driver",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -59,33 +59,33 @@
59
59
  "dependencies": {
60
60
  "@fluidframework/common-definitions": "^0.20.1",
61
61
  "@fluidframework/common-utils": "^1.0.0",
62
- "@fluidframework/core-interfaces": ">=2.0.0-internal.2.3.0 <2.0.0-internal.3.0.0",
63
- "@fluidframework/driver-base": ">=2.0.0-internal.2.3.0 <2.0.0-internal.3.0.0",
64
- "@fluidframework/driver-definitions": ">=2.0.0-internal.2.3.0 <2.0.0-internal.3.0.0",
65
- "@fluidframework/driver-utils": ">=2.0.0-internal.2.3.0 <2.0.0-internal.3.0.0",
62
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
63
+ "@fluidframework/driver-base": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
64
+ "@fluidframework/driver-definitions": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
65
+ "@fluidframework/driver-utils": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
66
66
  "@fluidframework/protocol-base": "^0.1038.2000",
67
67
  "@fluidframework/protocol-definitions": "^1.1.0",
68
- "@fluidframework/routerlicious-driver": ">=2.0.0-internal.2.3.0 <2.0.0-internal.3.0.0",
68
+ "@fluidframework/routerlicious-driver": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
69
69
  "@fluidframework/server-local-server": "^0.1038.2000",
70
70
  "@fluidframework/server-services-client": "^0.1038.2000",
71
71
  "@fluidframework/server-services-core": "^0.1038.2000",
72
72
  "@fluidframework/server-test-utils": "^0.1038.2000",
73
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.2.3.0 <2.0.0-internal.3.0.0",
73
+ "@fluidframework/telemetry-utils": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
74
74
  "events": "^3.1.0",
75
75
  "jsrsasign": "^10.5.25",
76
76
  "url": "^0.11.0",
77
77
  "uuid": "^8.3.1"
78
78
  },
79
79
  "devDependencies": {
80
- "@fluid-tools/build-cli": "^0.7.0",
80
+ "@fluid-tools/build-cli": "^0.8.0",
81
81
  "@fluidframework/build-common": "^1.1.0",
82
82
  "@fluidframework/eslint-config-fluid": "^2.0.0",
83
83
  "@fluidframework/local-driver-previous": "npm:@fluidframework/local-driver@2.0.0-internal.2.2.0",
84
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.2.3.0 <2.0.0-internal.3.0.0",
84
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.2.4.0 <2.0.0-internal.3.0.0",
85
85
  "@rushstack/eslint-config": "^2.5.1",
86
86
  "@types/jsrsasign": "^8.0.8",
87
87
  "@types/mocha": "^9.1.1",
88
- "@types/node": "^14.18.0",
88
+ "@types/node": "^14.18.36",
89
89
  "concurrently": "^6.2.0",
90
90
  "cross-env": "^7.0.2",
91
91
  "eslint": "~8.6.0",
@@ -47,7 +47,10 @@ export class LocalDocumentService implements IDocumentService {
47
47
  return new LocalDocumentStorageService(
48
48
  this.documentId,
49
49
  new GitManager(new TestHistorian(this.localDeltaConnectionServer.testDbFactory.testDatabase)),
50
- { minBlobSize: 2048 }, // Test blob aggregation.
50
+ {
51
+ minBlobSize: 2048, // Test blob aggregation
52
+ maximumCacheDurationMs: 432_000_000, // 5 days in ms. Not actually enforced but shouldn't matter for any local driver scenario
53
+ },
51
54
  );
52
55
  }
53
56
 
@@ -32,7 +32,7 @@ export class LocalDocumentStorageService implements IDocumentStorageService {
32
32
  constructor(
33
33
  private readonly id: string,
34
34
  private readonly manager: GitManager,
35
- public readonly policies: IDocumentStorageServicePolicies = {},
35
+ public readonly policies: IDocumentStorageServicePolicies,
36
36
  ) {
37
37
  this.summaryTreeUploadManager = new SummaryTreeUploadManager(
38
38
  manager,
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/local-driver";
9
- export const pkgVersion = "2.0.0-internal.2.3.0";
9
+ export const pkgVersion = "2.0.0-internal.2.4.0";