@fluidframework/routerlicious-driver 2.0.0-internal.7.1.0 → 2.0.0-internal.7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/gitManager.d.ts +1 -5
- package/dist/gitManager.d.ts.map +1 -1
- package/dist/gitManager.js +1 -44
- package/dist/gitManager.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/lib/gitManager.d.ts +1 -5
- package/lib/gitManager.d.ts.map +1 -1
- package/lib/gitManager.js +1 -44
- package/lib/gitManager.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/package.json +14 -15
- package/src/gitManager.ts +2 -51
- package/src/packageVersion.ts +1 -1
- package/dist/routerlicious-driver-alpha.d.ts +0 -245
- package/dist/routerlicious-driver-beta.d.ts +0 -245
- package/dist/routerlicious-driver-public.d.ts +0 -245
- package/dist/routerlicious-driver.d.ts +0 -245
package/CHANGELOG.md
CHANGED
package/dist/gitManager.d.ts
CHANGED
|
@@ -9,15 +9,11 @@ import { IR11sResponse } from "./restWrapper";
|
|
|
9
9
|
import { IWholeFlatSnapshot } from "./contracts";
|
|
10
10
|
export declare class GitManager implements IGitManager {
|
|
11
11
|
private readonly historian;
|
|
12
|
-
private readonly blobCache;
|
|
13
|
-
private readonly commitCache;
|
|
14
|
-
private readonly treeCache;
|
|
15
|
-
private readonly refCache;
|
|
16
12
|
constructor(historian: IHistorian);
|
|
17
13
|
/**
|
|
18
14
|
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
19
15
|
*/
|
|
20
|
-
getCommits(
|
|
16
|
+
getCommits(sha: string, count: number): Promise<IR11sResponse<resources.ICommitDetails[]>>;
|
|
21
17
|
/**
|
|
22
18
|
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
23
19
|
*/
|
package/dist/gitManager.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitManager.d.ts","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,SAAS,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EACN,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"gitManager.d.ts","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,SAAS,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EACN,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,qBAAa,UAAW,YAAW,WAAW;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,UAAU;IAElD;;OAEG;IACU,UAAU,CACtB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC,CAAC;IAIrD;;OAEG;IACU,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,UAAO,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAIhF,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAI7D,UAAU,CACtB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,OAAO,GAAG,QAAQ,GAC1B,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;IAQ3C,aAAa,CACzB,MAAM,EAAE,SAAS,CAAC,iBAAiB,GACjC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAK7B,aAAa,CACzB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,GAAE,OAAe,GACtB,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAInC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;CAGjF"}
|
package/dist/gitManager.js
CHANGED
|
@@ -5,66 +5,23 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.GitManager = void 0;
|
|
8
|
-
const restWrapper_1 = require("./restWrapper");
|
|
9
8
|
class GitManager {
|
|
10
9
|
constructor(historian) {
|
|
11
10
|
this.historian = historian;
|
|
12
|
-
this.blobCache = new Map();
|
|
13
|
-
this.commitCache = new Map();
|
|
14
|
-
this.treeCache = new Map();
|
|
15
|
-
this.refCache = new Map();
|
|
16
11
|
}
|
|
17
12
|
/**
|
|
18
13
|
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
19
14
|
*/
|
|
20
|
-
async getCommits(
|
|
21
|
-
let sha = shaOrRef;
|
|
22
|
-
// See if the sha is really a ref and convert
|
|
23
|
-
if (this.refCache.has(shaOrRef)) {
|
|
24
|
-
sha = this.refCache.get(shaOrRef);
|
|
25
|
-
// Delete refcache after first use
|
|
26
|
-
this.refCache.delete(shaOrRef);
|
|
27
|
-
// If null is stored for the ref then there are no commits - return an empty array
|
|
28
|
-
if (!sha) {
|
|
29
|
-
return (0, restWrapper_1.createR11sResponseFromContent)([]);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// See if the commit sha is hashed and return it if so
|
|
33
|
-
const commit = this.commitCache.get(sha);
|
|
34
|
-
if (commit !== undefined) {
|
|
35
|
-
return (0, restWrapper_1.createR11sResponseFromContent)([
|
|
36
|
-
{
|
|
37
|
-
commit: {
|
|
38
|
-
author: commit.author,
|
|
39
|
-
committer: commit.committer,
|
|
40
|
-
message: commit.message,
|
|
41
|
-
tree: commit.tree,
|
|
42
|
-
url: commit.url,
|
|
43
|
-
},
|
|
44
|
-
parents: commit.parents,
|
|
45
|
-
sha: commit.sha,
|
|
46
|
-
url: commit.url,
|
|
47
|
-
},
|
|
48
|
-
]);
|
|
49
|
-
}
|
|
50
|
-
// Otherwise fall back to the historian
|
|
15
|
+
async getCommits(sha, count) {
|
|
51
16
|
return this.historian.getCommits(sha, count);
|
|
52
17
|
}
|
|
53
18
|
/**
|
|
54
19
|
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
55
20
|
*/
|
|
56
21
|
async getTree(root, recursive = true) {
|
|
57
|
-
const tree = this.treeCache.get(root);
|
|
58
|
-
if (tree !== undefined) {
|
|
59
|
-
return (0, restWrapper_1.createR11sResponseFromContent)(tree);
|
|
60
|
-
}
|
|
61
22
|
return this.historian.getTree(root, recursive);
|
|
62
23
|
}
|
|
63
24
|
async getBlob(sha) {
|
|
64
|
-
const blob = this.blobCache.get(sha);
|
|
65
|
-
if (blob !== undefined) {
|
|
66
|
-
return (0, restWrapper_1.createR11sResponseFromContent)(blob);
|
|
67
|
-
}
|
|
68
25
|
return this.historian.getBlob(sha);
|
|
69
26
|
}
|
|
70
27
|
async createBlob(content, encoding) {
|
package/dist/gitManager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitManager.js","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"gitManager.js","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH,MAAa,UAAU;IACtB,YAA6B,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;IAAG,CAAC;IAEtD;;OAEG;IACI,KAAK,CAAC,UAAU,CACtB,GAAW,EACX,KAAa;QAEb,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,SAAS,GAAG,IAAI;QAClD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,GAAW;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;IAEM,KAAK,CAAC,UAAU,CACtB,OAAe,EACf,QAA4B;QAE5B,MAAM,IAAI,GAAgC;YACzC,OAAO;YACP,QAAQ;SACR,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,MAAmC;QAEnC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAChD,OAAO,KAAK,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,OAA6B,EAC7B,UAAmB,KAAK;QAExB,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,GAAW;QACnC,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;CACD;AApDD,gCAoDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as resources from \"@fluidframework/gitresources\";\nimport {\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\nimport { IGitManager, IHistorian } from \"./storageContracts\";\nimport { IR11sResponse } from \"./restWrapper\";\nimport { IWholeFlatSnapshot } from \"./contracts\";\n\nexport class GitManager implements IGitManager {\n\tconstructor(private readonly historian: IHistorian) {}\n\n\t/**\n\t * Reads the object with the given ID. We defer to the client implementation to do the actual read.\n\t */\n\tpublic async getCommits(\n\t\tsha: string,\n\t\tcount: number,\n\t): Promise<IR11sResponse<resources.ICommitDetails[]>> {\n\t\treturn this.historian.getCommits(sha, count);\n\t}\n\n\t/**\n\t * Reads the object with the given ID. We defer to the client implementation to do the actual read.\n\t */\n\tpublic async getTree(root: string, recursive = true): Promise<IR11sResponse<resources.ITree>> {\n\t\treturn this.historian.getTree(root, recursive);\n\t}\n\n\tpublic async getBlob(sha: string): Promise<IR11sResponse<resources.IBlob>> {\n\t\treturn this.historian.getBlob(sha);\n\t}\n\n\tpublic async createBlob(\n\t\tcontent: string,\n\t\tencoding: \"utf-8\" | \"base64\",\n\t): Promise<IR11sResponse<resources.ICreateBlobResponse>> {\n\t\tconst blob: resources.ICreateBlobParams = {\n\t\t\tcontent,\n\t\t\tencoding,\n\t\t};\n\t\treturn this.historian.createBlob(blob);\n\t}\n\n\tpublic async createGitTree(\n\t\tparams: resources.ICreateTreeParams,\n\t): Promise<IR11sResponse<resources.ITree>> {\n\t\tconst treeP = this.historian.createTree(params);\n\t\treturn treeP;\n\t}\n\n\tpublic async createSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t\tinitial: boolean = false,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>> {\n\t\treturn this.historian.createSummary(summary, initial);\n\t}\n\n\tpublic async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {\n\t\treturn this.historian.getSnapshot(sha);\n\t}\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -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/routerlicious-driver";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.7.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.7.2.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -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/routerlicious-driver";
|
|
11
|
-
exports.pkgVersion = "2.0.0-internal.7.
|
|
11
|
+
exports.pkgVersion = "2.0.0-internal.7.2.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,sCAAsC,CAAC;AACjD,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/routerlicious-driver\";\nexport const pkgVersion = \"2.0.0-internal.7.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sCAAsC,CAAC;AACjD,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/routerlicious-driver\";\nexport const pkgVersion = \"2.0.0-internal.7.2.0\";\n"]}
|
package/lib/gitManager.d.ts
CHANGED
|
@@ -9,15 +9,11 @@ import { IR11sResponse } from "./restWrapper";
|
|
|
9
9
|
import { IWholeFlatSnapshot } from "./contracts";
|
|
10
10
|
export declare class GitManager implements IGitManager {
|
|
11
11
|
private readonly historian;
|
|
12
|
-
private readonly blobCache;
|
|
13
|
-
private readonly commitCache;
|
|
14
|
-
private readonly treeCache;
|
|
15
|
-
private readonly refCache;
|
|
16
12
|
constructor(historian: IHistorian);
|
|
17
13
|
/**
|
|
18
14
|
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
19
15
|
*/
|
|
20
|
-
getCommits(
|
|
16
|
+
getCommits(sha: string, count: number): Promise<IR11sResponse<resources.ICommitDetails[]>>;
|
|
21
17
|
/**
|
|
22
18
|
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
23
19
|
*/
|
package/lib/gitManager.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitManager.d.ts","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,SAAS,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EACN,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"gitManager.d.ts","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,SAAS,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EACN,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,qBAAa,UAAW,YAAW,WAAW;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,UAAU;IAElD;;OAEG;IACU,UAAU,CACtB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC,CAAC;IAIrD;;OAEG;IACU,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,UAAO,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAIhF,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAI7D,UAAU,CACtB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,OAAO,GAAG,QAAQ,GAC1B,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;IAQ3C,aAAa,CACzB,MAAM,EAAE,SAAS,CAAC,iBAAiB,GACjC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAK7B,aAAa,CACzB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,GAAE,OAAe,GACtB,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAInC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;CAGjF"}
|
package/lib/gitManager.js
CHANGED
|
@@ -2,66 +2,23 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { createR11sResponseFromContent } from "./restWrapper";
|
|
6
5
|
export class GitManager {
|
|
7
6
|
constructor(historian) {
|
|
8
7
|
this.historian = historian;
|
|
9
|
-
this.blobCache = new Map();
|
|
10
|
-
this.commitCache = new Map();
|
|
11
|
-
this.treeCache = new Map();
|
|
12
|
-
this.refCache = new Map();
|
|
13
8
|
}
|
|
14
9
|
/**
|
|
15
10
|
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
16
11
|
*/
|
|
17
|
-
async getCommits(
|
|
18
|
-
let sha = shaOrRef;
|
|
19
|
-
// See if the sha is really a ref and convert
|
|
20
|
-
if (this.refCache.has(shaOrRef)) {
|
|
21
|
-
sha = this.refCache.get(shaOrRef);
|
|
22
|
-
// Delete refcache after first use
|
|
23
|
-
this.refCache.delete(shaOrRef);
|
|
24
|
-
// If null is stored for the ref then there are no commits - return an empty array
|
|
25
|
-
if (!sha) {
|
|
26
|
-
return createR11sResponseFromContent([]);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
// See if the commit sha is hashed and return it if so
|
|
30
|
-
const commit = this.commitCache.get(sha);
|
|
31
|
-
if (commit !== undefined) {
|
|
32
|
-
return createR11sResponseFromContent([
|
|
33
|
-
{
|
|
34
|
-
commit: {
|
|
35
|
-
author: commit.author,
|
|
36
|
-
committer: commit.committer,
|
|
37
|
-
message: commit.message,
|
|
38
|
-
tree: commit.tree,
|
|
39
|
-
url: commit.url,
|
|
40
|
-
},
|
|
41
|
-
parents: commit.parents,
|
|
42
|
-
sha: commit.sha,
|
|
43
|
-
url: commit.url,
|
|
44
|
-
},
|
|
45
|
-
]);
|
|
46
|
-
}
|
|
47
|
-
// Otherwise fall back to the historian
|
|
12
|
+
async getCommits(sha, count) {
|
|
48
13
|
return this.historian.getCommits(sha, count);
|
|
49
14
|
}
|
|
50
15
|
/**
|
|
51
16
|
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
52
17
|
*/
|
|
53
18
|
async getTree(root, recursive = true) {
|
|
54
|
-
const tree = this.treeCache.get(root);
|
|
55
|
-
if (tree !== undefined) {
|
|
56
|
-
return createR11sResponseFromContent(tree);
|
|
57
|
-
}
|
|
58
19
|
return this.historian.getTree(root, recursive);
|
|
59
20
|
}
|
|
60
21
|
async getBlob(sha) {
|
|
61
|
-
const blob = this.blobCache.get(sha);
|
|
62
|
-
if (blob !== undefined) {
|
|
63
|
-
return createR11sResponseFromContent(blob);
|
|
64
|
-
}
|
|
65
22
|
return this.historian.getBlob(sha);
|
|
66
23
|
}
|
|
67
24
|
async createBlob(content, encoding) {
|
package/lib/gitManager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitManager.js","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"gitManager.js","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,MAAM,OAAO,UAAU;IACtB,YAA6B,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;IAAG,CAAC;IAEtD;;OAEG;IACI,KAAK,CAAC,UAAU,CACtB,GAAW,EACX,KAAa;QAEb,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,SAAS,GAAG,IAAI;QAClD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,GAAW;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;IAEM,KAAK,CAAC,UAAU,CACtB,OAAe,EACf,QAA4B;QAE5B,MAAM,IAAI,GAAgC;YACzC,OAAO;YACP,QAAQ;SACR,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,MAAmC;QAEnC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAChD,OAAO,KAAK,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,OAA6B,EAC7B,UAAmB,KAAK;QAExB,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,GAAW;QACnC,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as resources from \"@fluidframework/gitresources\";\nimport {\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\nimport { IGitManager, IHistorian } from \"./storageContracts\";\nimport { IR11sResponse } from \"./restWrapper\";\nimport { IWholeFlatSnapshot } from \"./contracts\";\n\nexport class GitManager implements IGitManager {\n\tconstructor(private readonly historian: IHistorian) {}\n\n\t/**\n\t * Reads the object with the given ID. We defer to the client implementation to do the actual read.\n\t */\n\tpublic async getCommits(\n\t\tsha: string,\n\t\tcount: number,\n\t): Promise<IR11sResponse<resources.ICommitDetails[]>> {\n\t\treturn this.historian.getCommits(sha, count);\n\t}\n\n\t/**\n\t * Reads the object with the given ID. We defer to the client implementation to do the actual read.\n\t */\n\tpublic async getTree(root: string, recursive = true): Promise<IR11sResponse<resources.ITree>> {\n\t\treturn this.historian.getTree(root, recursive);\n\t}\n\n\tpublic async getBlob(sha: string): Promise<IR11sResponse<resources.IBlob>> {\n\t\treturn this.historian.getBlob(sha);\n\t}\n\n\tpublic async createBlob(\n\t\tcontent: string,\n\t\tencoding: \"utf-8\" | \"base64\",\n\t): Promise<IR11sResponse<resources.ICreateBlobResponse>> {\n\t\tconst blob: resources.ICreateBlobParams = {\n\t\t\tcontent,\n\t\t\tencoding,\n\t\t};\n\t\treturn this.historian.createBlob(blob);\n\t}\n\n\tpublic async createGitTree(\n\t\tparams: resources.ICreateTreeParams,\n\t): Promise<IR11sResponse<resources.ITree>> {\n\t\tconst treeP = this.historian.createTree(params);\n\t\treturn treeP;\n\t}\n\n\tpublic async createSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t\tinitial: boolean = false,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>> {\n\t\treturn this.historian.createSummary(summary, initial);\n\t}\n\n\tpublic async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {\n\t\treturn this.historian.getSnapshot(sha);\n\t}\n}\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
|
@@ -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/routerlicious-driver";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.7.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.7.2.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export const pkgName = "@fluidframework/routerlicious-driver";
|
|
8
|
-
export const pkgVersion = "2.0.0-internal.7.
|
|
8
|
+
export const pkgVersion = "2.0.0-internal.7.2.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sCAAsC,CAAC;AAC9D,MAAM,CAAC,MAAM,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/routerlicious-driver\";\nexport const pkgVersion = \"2.0.0-internal.7.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sCAAsC,CAAC;AAC9D,MAAM,CAAC,MAAM,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/routerlicious-driver\";\nexport const pkgVersion = \"2.0.0-internal.7.2.0\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/routerlicious-driver",
|
|
3
|
-
"version": "2.0.0-internal.7.
|
|
3
|
+
"version": "2.0.0-internal.7.2.0",
|
|
4
4
|
"description": "Socket.IO + Git implementation of Fluid service API",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,17 +35,17 @@
|
|
|
35
35
|
"temp-directory": "nyc/.nyc_output"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluid-internal/client-utils": ">=2.0.0-internal.7.
|
|
39
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.
|
|
40
|
-
"@fluidframework/core-utils": ">=2.0.0-internal.7.
|
|
41
|
-
"@fluidframework/driver-base": ">=2.0.0-internal.7.
|
|
42
|
-
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.
|
|
43
|
-
"@fluidframework/driver-utils": ">=2.0.0-internal.7.
|
|
38
|
+
"@fluid-internal/client-utils": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
39
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
40
|
+
"@fluidframework/core-utils": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
41
|
+
"@fluidframework/driver-base": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
42
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
43
|
+
"@fluidframework/driver-utils": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
44
44
|
"@fluidframework/gitresources": "^2.0.1",
|
|
45
45
|
"@fluidframework/protocol-base": "^2.0.1",
|
|
46
46
|
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
47
47
|
"@fluidframework/server-services-client": "^2.0.1",
|
|
48
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.
|
|
48
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
49
49
|
"cross-fetch": "^3.1.5",
|
|
50
50
|
"json-stringify-safe": "5.0.1",
|
|
51
51
|
"socket.io-client": "^4.6.1",
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"uuid": "^9.0.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@fluid-tools/build-cli": "^0.
|
|
57
|
-
"@fluidframework/build-common": "^2.0.
|
|
58
|
-
"@fluidframework/build-tools": "^0.
|
|
56
|
+
"@fluid-tools/build-cli": "^0.26.1",
|
|
57
|
+
"@fluidframework/build-common": "^2.0.3",
|
|
58
|
+
"@fluidframework/build-tools": "^0.26.1",
|
|
59
59
|
"@fluidframework/eslint-config-fluid": "^3.0.0",
|
|
60
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.
|
|
61
|
-
"@fluidframework/routerlicious-driver-previous": "npm:@fluidframework/routerlicious-driver@2.0.0-internal.7.
|
|
60
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
61
|
+
"@fluidframework/routerlicious-driver-previous": "npm:@fluidframework/routerlicious-driver@2.0.0-internal.7.1.0",
|
|
62
62
|
"@microsoft/api-extractor": "^7.37.0",
|
|
63
63
|
"@types/mocha": "^9.1.1",
|
|
64
64
|
"@types/nock": "^9.3.0",
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"@types/uuid": "^9.0.2",
|
|
69
69
|
"axios": "^0.26.0",
|
|
70
70
|
"c8": "^7.7.1",
|
|
71
|
-
"copyfiles": "^2.4.1",
|
|
72
71
|
"cross-env": "^7.0.3",
|
|
73
72
|
"eslint": "~8.50.0",
|
|
74
73
|
"mocha": "^10.2.0",
|
|
@@ -93,7 +92,7 @@
|
|
|
93
92
|
"build:genver": "gen-version",
|
|
94
93
|
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
95
94
|
"ci:build:docs": "api-extractor run",
|
|
96
|
-
"clean": "rimraf --glob
|
|
95
|
+
"clean": "rimraf --glob dist lib \"*.tsbuildinfo\" \"*.build.log\" _api-extractor-temp nyc",
|
|
97
96
|
"eslint": "eslint --format stylish src",
|
|
98
97
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
99
98
|
"format": "npm run prettier:fix",
|
package/src/gitManager.ts
CHANGED
|
@@ -9,59 +9,19 @@ import {
|
|
|
9
9
|
IWriteSummaryResponse,
|
|
10
10
|
} from "@fluidframework/server-services-client";
|
|
11
11
|
import { IGitManager, IHistorian } from "./storageContracts";
|
|
12
|
-
import { IR11sResponse
|
|
12
|
+
import { IR11sResponse } from "./restWrapper";
|
|
13
13
|
import { IWholeFlatSnapshot } from "./contracts";
|
|
14
14
|
|
|
15
15
|
export class GitManager implements IGitManager {
|
|
16
|
-
private readonly blobCache = new Map<string, resources.IBlob>();
|
|
17
|
-
private readonly commitCache = new Map<string, resources.ICommit>();
|
|
18
|
-
private readonly treeCache = new Map<string, resources.ITree>();
|
|
19
|
-
private readonly refCache = new Map<string, string>();
|
|
20
|
-
|
|
21
16
|
constructor(private readonly historian: IHistorian) {}
|
|
22
17
|
|
|
23
18
|
/**
|
|
24
19
|
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
25
20
|
*/
|
|
26
21
|
public async getCommits(
|
|
27
|
-
|
|
22
|
+
sha: string,
|
|
28
23
|
count: number,
|
|
29
24
|
): Promise<IR11sResponse<resources.ICommitDetails[]>> {
|
|
30
|
-
let sha: string | undefined = shaOrRef;
|
|
31
|
-
|
|
32
|
-
// See if the sha is really a ref and convert
|
|
33
|
-
if (this.refCache.has(shaOrRef)) {
|
|
34
|
-
sha = this.refCache.get(shaOrRef);
|
|
35
|
-
|
|
36
|
-
// Delete refcache after first use
|
|
37
|
-
this.refCache.delete(shaOrRef);
|
|
38
|
-
|
|
39
|
-
// If null is stored for the ref then there are no commits - return an empty array
|
|
40
|
-
if (!sha) {
|
|
41
|
-
return createR11sResponseFromContent([]);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// See if the commit sha is hashed and return it if so
|
|
46
|
-
const commit = this.commitCache.get(sha);
|
|
47
|
-
if (commit !== undefined) {
|
|
48
|
-
return createR11sResponseFromContent([
|
|
49
|
-
{
|
|
50
|
-
commit: {
|
|
51
|
-
author: commit.author,
|
|
52
|
-
committer: commit.committer,
|
|
53
|
-
message: commit.message,
|
|
54
|
-
tree: commit.tree,
|
|
55
|
-
url: commit.url,
|
|
56
|
-
},
|
|
57
|
-
parents: commit.parents,
|
|
58
|
-
sha: commit.sha,
|
|
59
|
-
url: commit.url,
|
|
60
|
-
},
|
|
61
|
-
]);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Otherwise fall back to the historian
|
|
65
25
|
return this.historian.getCommits(sha, count);
|
|
66
26
|
}
|
|
67
27
|
|
|
@@ -69,19 +29,10 @@ export class GitManager implements IGitManager {
|
|
|
69
29
|
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
70
30
|
*/
|
|
71
31
|
public async getTree(root: string, recursive = true): Promise<IR11sResponse<resources.ITree>> {
|
|
72
|
-
const tree = this.treeCache.get(root);
|
|
73
|
-
if (tree !== undefined) {
|
|
74
|
-
return createR11sResponseFromContent(tree);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
32
|
return this.historian.getTree(root, recursive);
|
|
78
33
|
}
|
|
79
34
|
|
|
80
35
|
public async getBlob(sha: string): Promise<IR11sResponse<resources.IBlob>> {
|
|
81
|
-
const blob = this.blobCache.get(sha);
|
|
82
|
-
if (blob !== undefined) {
|
|
83
|
-
return createR11sResponseFromContent(blob);
|
|
84
|
-
}
|
|
85
36
|
return this.historian.getBlob(sha);
|
|
86
37
|
}
|
|
87
38
|
|
package/src/packageVersion.ts
CHANGED