@fluidframework/shared-summary-block 2.0.0-rc.2.0.2 → 2.0.0-rc.3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/api-report/shared-summary-block.api.md +2 -2
- package/dist/interfaces.d.ts +1 -1
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/legacy.d.ts +15 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +12 -0
- package/dist/sharedSummaryBlock.d.ts +4 -2
- package/dist/sharedSummaryBlock.d.ts.map +1 -1
- package/dist/sharedSummaryBlock.js +5 -5
- package/dist/sharedSummaryBlock.js.map +1 -1
- package/dist/sharedSummaryBlockFactory.d.ts +1 -1
- package/dist/sharedSummaryBlockFactory.d.ts.map +1 -1
- package/dist/sharedSummaryBlockFactory.js.map +1 -1
- package/internal.d.ts +11 -0
- package/legacy.d.ts +11 -0
- package/lib/interfaces.d.ts +1 -1
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/legacy.d.ts +15 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +12 -0
- package/lib/sharedSummaryBlock.d.ts +4 -2
- package/lib/sharedSummaryBlock.d.ts.map +1 -1
- package/lib/sharedSummaryBlock.js +2 -2
- package/lib/sharedSummaryBlock.js.map +1 -1
- package/lib/sharedSummaryBlockFactory.d.ts +1 -1
- package/lib/sharedSummaryBlockFactory.d.ts.map +1 -1
- package/lib/sharedSummaryBlockFactory.js.map +1 -1
- package/package.json +31 -52
- package/src/interfaces.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/sharedSummaryBlock.ts +9 -11
- package/src/sharedSummaryBlockFactory.ts +3 -2
- package/api-extractor-cjs.json +0 -8
- package/dist/shared-summary-block-alpha.d.ts +0 -100
- package/dist/shared-summary-block-beta.d.ts +0 -23
- package/dist/shared-summary-block-public.d.ts +0 -23
- package/dist/shared-summary-block-untrimmed.d.ts +0 -131
- package/lib/shared-summary-block-alpha.d.ts +0 -100
- package/lib/shared-summary-block-beta.d.ts +0 -23
- package/lib/shared-summary-block-public.d.ts +0 -23
- package/lib/shared-summary-block-untrimmed.d.ts +0 -131
- package/lib/test/sharedSummaryBlock.spec.js +0 -80
- package/lib/test/sharedSummaryBlock.spec.js.map +0 -1
- package/lib/test/types/validateSharedSummaryBlockPrevious.generated.js +0 -8
- package/lib/test/types/validateSharedSummaryBlockPrevious.generated.js.map +0 -1
- /package/{dist → lib}/tsdoc-metadata.json +0 -0
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { IChannelAttributes } from '@fluidframework/datastore-definitions';
|
|
2
|
-
import { IChannelFactory } from '@fluidframework/datastore-definitions';
|
|
3
|
-
import { IChannelServices } from '@fluidframework/datastore-definitions';
|
|
4
|
-
import { IChannelStorageService } from '@fluidframework/datastore-definitions';
|
|
5
|
-
import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
|
|
6
|
-
import { IFluidSerializer } from '@fluidframework/shared-object-base';
|
|
7
|
-
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
8
|
-
import { ISharedObject } from '@fluidframework/shared-object-base';
|
|
9
|
-
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
10
|
-
import { Jsonable } from '@fluidframework/datastore-definitions';
|
|
11
|
-
import { SharedObject } from '@fluidframework/shared-object-base';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Shared summary block interface. A shared summary block is part of the summary but it does not generate any ops.
|
|
15
|
-
* The set on this interface must only be called in response to a remote op. Basically, if we replay same ops,
|
|
16
|
-
* the set of calls on this interface to set data should be the same. This is critical because the object does not
|
|
17
|
-
* generate ops of its own, but relies on the above principle to maintain eventual consistency and to summarize.
|
|
18
|
-
* @alpha
|
|
19
|
-
*/
|
|
20
|
-
export declare interface ISharedSummaryBlock extends ISharedObject {
|
|
21
|
-
/**
|
|
22
|
-
* Retrieves the given key from the map.
|
|
23
|
-
* @param key - Key to retrieve from.
|
|
24
|
-
* @returns The stored value, or undefined if the key is not set.
|
|
25
|
-
*
|
|
26
|
-
* @privateRemarks
|
|
27
|
-
* The return type is underspecified to allow for the possibility of objects with function or undefined values.
|
|
28
|
-
*/
|
|
29
|
-
get<T>(key: string): Jsonable<T>;
|
|
30
|
-
/**
|
|
31
|
-
* Sets the value stored at key to the provided value.
|
|
32
|
-
* @param key - Key to set at.
|
|
33
|
-
* @param value - Jsonable type value to set.
|
|
34
|
-
*/
|
|
35
|
-
set<T>(key: string, value: Jsonable<T>): void;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Implementation of a shared summary block. It does not generate any ops. It is only part of the summary.
|
|
40
|
-
* Data should be set in this object in response to a remote op.
|
|
41
|
-
* @alpha
|
|
42
|
-
*/
|
|
43
|
-
export declare class SharedSummaryBlock extends SharedObject implements ISharedSummaryBlock {
|
|
44
|
-
/**
|
|
45
|
-
* Create a new shared summary block
|
|
46
|
-
*
|
|
47
|
-
* @param runtime - data store runtime the new shared summary block belongs to.
|
|
48
|
-
* @param id - optional name of the shared summary block.
|
|
49
|
-
* @returns newly created shared summary block (but not attached yet).
|
|
50
|
-
*/
|
|
51
|
-
static create(runtime: IFluidDataStoreRuntime, id?: string): SharedSummaryBlock;
|
|
52
|
-
/**
|
|
53
|
-
* Get a factory for SharedSummaryBlock to register with the data store.
|
|
54
|
-
*
|
|
55
|
-
* @returns a factory that creates and loads SharedSummaryBlock.
|
|
56
|
-
*/
|
|
57
|
-
static getFactory(): IChannelFactory;
|
|
58
|
-
/**
|
|
59
|
-
* The data held by this object.
|
|
60
|
-
*/
|
|
61
|
-
private readonly data;
|
|
62
|
-
/**
|
|
63
|
-
* Constructs a new SharedSummaryBlock. If the object is non-local, an id and service interfaces will
|
|
64
|
-
* be provided.
|
|
65
|
-
*
|
|
66
|
-
* @param id - optional name of the shared summary block.
|
|
67
|
-
* @param runtime - data store runtime thee object belongs to.
|
|
68
|
-
* @param attributes - The attributes for the object.
|
|
69
|
-
*/
|
|
70
|
-
constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
|
|
71
|
-
/**
|
|
72
|
-
* {@inheritDoc ISharedSummaryBlock.get}
|
|
73
|
-
*/
|
|
74
|
-
get<T>(key: string): Jsonable<T>;
|
|
75
|
-
/**
|
|
76
|
-
* {@inheritDoc ISharedSummaryBlock.set}
|
|
77
|
-
*/
|
|
78
|
-
set<T>(key: string, value: Jsonable<T>): void;
|
|
79
|
-
/**
|
|
80
|
-
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
|
|
81
|
-
*/
|
|
82
|
-
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
|
|
83
|
-
/**
|
|
84
|
-
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
|
|
85
|
-
*/
|
|
86
|
-
protected loadCore(storage: IChannelStorageService): Promise<void>;
|
|
87
|
-
/**
|
|
88
|
-
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}
|
|
89
|
-
*/
|
|
90
|
-
protected onDisconnect(): void;
|
|
91
|
-
/**
|
|
92
|
-
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}
|
|
93
|
-
*/
|
|
94
|
-
protected processCore(message: ISequencedDocumentMessage, local: boolean): void;
|
|
95
|
-
protected applyStashedOp(): void;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* The factory that defines the shared summary block.
|
|
100
|
-
*
|
|
101
|
-
* @sealed
|
|
102
|
-
* @internal
|
|
103
|
-
*/
|
|
104
|
-
export declare class SharedSummaryBlockFactory implements IChannelFactory {
|
|
105
|
-
/**
|
|
106
|
-
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory."type"}
|
|
107
|
-
*/
|
|
108
|
-
static readonly Type = "https://graph.microsoft.com/types/shared-summary-block";
|
|
109
|
-
/**
|
|
110
|
-
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}
|
|
111
|
-
*/
|
|
112
|
-
static readonly Attributes: IChannelAttributes;
|
|
113
|
-
/**
|
|
114
|
-
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory."type"}
|
|
115
|
-
*/
|
|
116
|
-
get type(): string;
|
|
117
|
-
/**
|
|
118
|
-
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}
|
|
119
|
-
*/
|
|
120
|
-
get attributes(): IChannelAttributes;
|
|
121
|
-
/**
|
|
122
|
-
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
|
|
123
|
-
*/
|
|
124
|
-
load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<ISharedObject>;
|
|
125
|
-
/**
|
|
126
|
-
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}
|
|
127
|
-
*/
|
|
128
|
-
create(runtime: IFluidDataStoreRuntime, id: string): ISharedObject;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export { }
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { strict as assert } from "assert";
|
|
6
|
-
import { MockFluidDataStoreRuntime, MockSharedObjectServices, } from "@fluidframework/test-runtime-utils";
|
|
7
|
-
import { AttachState } from "@fluidframework/container-definitions";
|
|
8
|
-
import { SharedSummaryBlockFactory } from "../sharedSummaryBlockFactory.js";
|
|
9
|
-
describe("SharedSummaryBlock", () => {
|
|
10
|
-
let dataStoreRuntime;
|
|
11
|
-
let factory;
|
|
12
|
-
let sharedSummaryBlock;
|
|
13
|
-
beforeEach(async () => {
|
|
14
|
-
// We only want to test local state of the DDS.
|
|
15
|
-
dataStoreRuntime = new MockFluidDataStoreRuntime({ attachState: AttachState.Detached });
|
|
16
|
-
factory = new SharedSummaryBlockFactory();
|
|
17
|
-
sharedSummaryBlock = factory.create(dataStoreRuntime, "root");
|
|
18
|
-
});
|
|
19
|
-
describe("Api", () => {
|
|
20
|
-
it("can create a shared summary block", () => {
|
|
21
|
-
assert.ok(sharedSummaryBlock);
|
|
22
|
-
});
|
|
23
|
-
it("can set and get shared summary block data", async () => {
|
|
24
|
-
const key1 = "testKey1";
|
|
25
|
-
const value1 = "testValue1";
|
|
26
|
-
sharedSummaryBlock.set(key1, value1);
|
|
27
|
-
assert.equal(sharedSummaryBlock.get(key1), value1, "The retrieved value must match the set value");
|
|
28
|
-
const key2 = "testKey2";
|
|
29
|
-
const value2 = { value: "testValue2" };
|
|
30
|
-
sharedSummaryBlock.set(key2, value2);
|
|
31
|
-
assert.deepEqual(sharedSummaryBlock.get(key2), value2, "The retrieved value must match the set value");
|
|
32
|
-
const key3 = "testKey3";
|
|
33
|
-
const value3 = {
|
|
34
|
-
value1: "outer string",
|
|
35
|
-
value2: 2,
|
|
36
|
-
value3: [true, false],
|
|
37
|
-
value4: {
|
|
38
|
-
value1: "inner string",
|
|
39
|
-
value2: 500,
|
|
40
|
-
value3: [false, false, true],
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
sharedSummaryBlock.set(key3, value3);
|
|
44
|
-
assert.deepEqual(sharedSummaryBlock.get(key3), value3, "The retrieved value must match the set value");
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
describe("Summarize", () => {
|
|
48
|
-
it("can generate summary of the shared summary block data and load from it", async () => {
|
|
49
|
-
const key1 = "testKey1";
|
|
50
|
-
const value1 = "testValue1";
|
|
51
|
-
sharedSummaryBlock.set(key1, value1);
|
|
52
|
-
const key2 = "testKey2";
|
|
53
|
-
const value2 = "testValue2";
|
|
54
|
-
sharedSummaryBlock.set(key2, value2);
|
|
55
|
-
const key3 = "testKey3";
|
|
56
|
-
const value3 = { value: "testValue3" };
|
|
57
|
-
sharedSummaryBlock.set(key3, value3);
|
|
58
|
-
const summaryTree = sharedSummaryBlock.getAttachSummary().summary;
|
|
59
|
-
const contents = JSON.stringify({
|
|
60
|
-
testKey1: value1,
|
|
61
|
-
testKey2: value2,
|
|
62
|
-
testKey3: value3,
|
|
63
|
-
});
|
|
64
|
-
// Verify that the generated summary is correct.
|
|
65
|
-
const summaryObjectKeys = Object.keys(summaryTree.tree);
|
|
66
|
-
assert(summaryObjectKeys.length === 1, "summarize should return a tree with single blob");
|
|
67
|
-
assert(summaryObjectKeys[0] === "header", "summary should have a header blob");
|
|
68
|
-
assert(summaryTree.tree.header.content === contents, "The summary content is incorrect");
|
|
69
|
-
const services = new MockSharedObjectServices({
|
|
70
|
-
header: contents,
|
|
71
|
-
});
|
|
72
|
-
// Load another object from the snapshot and ensure that it has loaded the data from the original object.
|
|
73
|
-
const sharedSummaryBlock2 = (await factory.load(dataStoreRuntime, "mapId", services, factory.attributes));
|
|
74
|
-
assert.equal(sharedSummaryBlock2.get(key1), value1);
|
|
75
|
-
assert.equal(sharedSummaryBlock2.get(key2), value2);
|
|
76
|
-
assert.deepEqual(sharedSummaryBlock2.get(key3), value3);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
//# sourceMappingURL=sharedSummaryBlock.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sharedSummaryBlock.spec.js","sourceRoot":"","sources":["../../src/test/sharedSummaryBlock.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE1C,OAAO,EACN,yBAAyB,EACzB,wBAAwB,GACxB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEpE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;YAEH,gDAAgD;YAChD,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACxD,MAAM,CACL,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAC9B,iDAAiD,CACjD,CAAC;YACF,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,mCAAmC,CAAC,CAAC;YAC/E,MAAM,CACJ,WAAW,CAAC,IAAI,CAAC,MAAuB,CAAC,OAAO,KAAK,QAAQ,EAC9D,kCAAkC,CAClC,CAAC;YAEF,MAAM,QAAQ,GAAG,IAAI,wBAAwB,CAAC;gBAC7C,MAAM,EAAE,QAAQ;aAChB,CAAC,CAAC;YAEH,yGAAyG;YACzG,MAAM,mBAAmB,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,CAC9C,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,OAAO,CAAC,UAAU,CAClB,CAAwB,CAAC;YAC1B,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;YACpD,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;YACpD,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"assert\";\nimport { ISummaryBlob } from \"@fluidframework/protocol-definitions\";\nimport {\n\tMockFluidDataStoreRuntime,\n\tMockSharedObjectServices,\n} from \"@fluidframework/test-runtime-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { ISharedSummaryBlock } from \"../interfaces.js\";\nimport { SharedSummaryBlockFactory } from \"../sharedSummaryBlockFactory.js\";\n\ninterface ITestInterface {\n\tvalue1: string;\n\tvalue2: number;\n\tvalue3: boolean[];\n\tvalue4?: ITestInterface;\n}\n\ndescribe(\"SharedSummaryBlock\", () => {\n\tlet dataStoreRuntime: MockFluidDataStoreRuntime;\n\tlet factory: SharedSummaryBlockFactory;\n\tlet sharedSummaryBlock: ISharedSummaryBlock;\n\n\tbeforeEach(async () => {\n\t\t// We only want to test local state of the DDS.\n\t\tdataStoreRuntime = new MockFluidDataStoreRuntime({ attachState: AttachState.Detached });\n\t\tfactory = new SharedSummaryBlockFactory();\n\t\tsharedSummaryBlock = factory.create(dataStoreRuntime, \"root\") as ISharedSummaryBlock;\n\t});\n\n\tdescribe(\"Api\", () => {\n\t\tit(\"can create a shared summary block\", () => {\n\t\t\tassert.ok(sharedSummaryBlock);\n\t\t});\n\n\t\tit(\"can set and get shared summary block data\", async () => {\n\t\t\tconst key1 = \"testKey1\";\n\t\t\tconst value1 = \"testValue1\";\n\t\t\tsharedSummaryBlock.set(key1, value1);\n\t\t\tassert.equal(\n\t\t\t\tsharedSummaryBlock.get(key1),\n\t\t\t\tvalue1,\n\t\t\t\t\"The retrieved value must match the set value\",\n\t\t\t);\n\n\t\t\tconst key2 = \"testKey2\";\n\t\t\tconst value2 = { value: \"testValue2\" };\n\t\t\tsharedSummaryBlock.set(key2, value2);\n\t\t\tassert.deepEqual(\n\t\t\t\tsharedSummaryBlock.get(key2),\n\t\t\t\tvalue2,\n\t\t\t\t\"The retrieved value must match the set value\",\n\t\t\t);\n\n\t\t\tconst key3 = \"testKey3\";\n\t\t\tconst value3: ITestInterface = {\n\t\t\t\tvalue1: \"outer string\",\n\t\t\t\tvalue2: 2,\n\t\t\t\tvalue3: [true, false],\n\t\t\t\tvalue4: {\n\t\t\t\t\tvalue1: \"inner string\",\n\t\t\t\t\tvalue2: 500,\n\t\t\t\t\tvalue3: [false, false, true],\n\t\t\t\t},\n\t\t\t};\n\t\t\tsharedSummaryBlock.set(key3, value3);\n\t\t\tassert.deepEqual(\n\t\t\t\tsharedSummaryBlock.get(key3),\n\t\t\t\tvalue3,\n\t\t\t\t\"The retrieved value must match the set value\",\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe(\"Summarize\", () => {\n\t\tit(\"can generate summary of the shared summary block data and load from it\", async () => {\n\t\t\tconst key1 = \"testKey1\";\n\t\t\tconst value1 = \"testValue1\";\n\t\t\tsharedSummaryBlock.set(key1, value1);\n\n\t\t\tconst key2 = \"testKey2\";\n\t\t\tconst value2 = \"testValue2\";\n\t\t\tsharedSummaryBlock.set(key2, value2);\n\n\t\t\tconst key3 = \"testKey3\";\n\t\t\tconst value3 = { value: \"testValue3\" };\n\t\t\tsharedSummaryBlock.set(key3, value3);\n\n\t\t\tconst summaryTree = sharedSummaryBlock.getAttachSummary().summary;\n\t\t\tconst contents = JSON.stringify({\n\t\t\t\ttestKey1: value1,\n\t\t\t\ttestKey2: value2,\n\t\t\t\ttestKey3: value3,\n\t\t\t});\n\n\t\t\t// Verify that the generated summary is correct.\n\t\t\tconst summaryObjectKeys = Object.keys(summaryTree.tree);\n\t\t\tassert(\n\t\t\t\tsummaryObjectKeys.length === 1,\n\t\t\t\t\"summarize should return a tree with single blob\",\n\t\t\t);\n\t\t\tassert(summaryObjectKeys[0] === \"header\", \"summary should have a header blob\");\n\t\t\tassert(\n\t\t\t\t(summaryTree.tree.header as ISummaryBlob).content === contents,\n\t\t\t\t\"The summary content is incorrect\",\n\t\t\t);\n\n\t\t\tconst services = new MockSharedObjectServices({\n\t\t\t\theader: contents,\n\t\t\t});\n\n\t\t\t// Load another object from the snapshot and ensure that it has loaded the data from the original object.\n\t\t\tconst sharedSummaryBlock2 = (await factory.load(\n\t\t\t\tdataStoreRuntime,\n\t\t\t\t\"mapId\",\n\t\t\t\tservices,\n\t\t\t\tfactory.attributes,\n\t\t\t)) as ISharedSummaryBlock;\n\t\t\tassert.equal(sharedSummaryBlock2.get(key1), value1);\n\t\t\tassert.equal(sharedSummaryBlock2.get(key2), value2);\n\t\t\tassert.deepEqual(sharedSummaryBlock2.get(key3), value3);\n\t\t});\n\t});\n});\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
use_current_InterfaceDeclaration_ISharedSummaryBlock(get_old_InterfaceDeclaration_ISharedSummaryBlock());
|
|
2
|
-
use_old_InterfaceDeclaration_ISharedSummaryBlock(get_current_InterfaceDeclaration_ISharedSummaryBlock());
|
|
3
|
-
use_current_ClassDeclaration_SharedSummaryBlock(get_old_ClassDeclaration_SharedSummaryBlock());
|
|
4
|
-
use_old_ClassDeclaration_SharedSummaryBlock(get_current_ClassDeclaration_SharedSummaryBlock());
|
|
5
|
-
use_current_ClassDeclaration_SharedSummaryBlockFactory(get_old_ClassDeclaration_SharedSummaryBlockFactory());
|
|
6
|
-
use_old_ClassDeclaration_SharedSummaryBlockFactory(get_current_ClassDeclaration_SharedSummaryBlockFactory());
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=validateSharedSummaryBlockPrevious.generated.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateSharedSummaryBlockPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateSharedSummaryBlockPrevious.generated.ts"],"names":[],"mappings":"AAgCA,oDAAoD,CAChD,gDAAgD,EAAE,CAAC,CAAC;AAWxD,gDAAgD,CAC5C,oDAAoD,EAAE,CAAC,CAAC;AAW5D,+CAA+C,CAC3C,2CAA2C,EAAE,CAAC,CAAC;AAWnD,2CAA2C,CACvC,+CAA+C,EAAE,CAAC,CAAC;AAWvD,sDAAsD,CAClD,kDAAkD,EAAE,CAAC,CAAC;AAW1D,kDAAkD,CAC9C,sDAAsD,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by fluid-type-test-generator in @fluidframework/build-tools.\n */\nimport type * as old from \"@fluidframework/shared-summary-block-previous\";\nimport type * as current from \"../../index.js\";\n\n\n// See 'build-tools/src/type-test-generator/compatibility.ts' for more information.\ntype TypeOnly<T> = T extends number\n\t? number\n\t: T extends string\n\t? string\n\t: T extends boolean | bigint | symbol\n\t? T\n\t: {\n\t\t\t[P in keyof T]: TypeOnly<T[P]>;\n\t };\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ISharedSummaryBlock\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_ISharedSummaryBlock():\n TypeOnly<old.ISharedSummaryBlock>;\ndeclare function use_current_InterfaceDeclaration_ISharedSummaryBlock(\n use: TypeOnly<current.ISharedSummaryBlock>): void;\nuse_current_InterfaceDeclaration_ISharedSummaryBlock(\n get_old_InterfaceDeclaration_ISharedSummaryBlock());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ISharedSummaryBlock\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_ISharedSummaryBlock():\n TypeOnly<current.ISharedSummaryBlock>;\ndeclare function use_old_InterfaceDeclaration_ISharedSummaryBlock(\n use: TypeOnly<old.ISharedSummaryBlock>): void;\nuse_old_InterfaceDeclaration_ISharedSummaryBlock(\n get_current_InterfaceDeclaration_ISharedSummaryBlock());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_SharedSummaryBlock\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_SharedSummaryBlock():\n TypeOnly<old.SharedSummaryBlock>;\ndeclare function use_current_ClassDeclaration_SharedSummaryBlock(\n use: TypeOnly<current.SharedSummaryBlock>): void;\nuse_current_ClassDeclaration_SharedSummaryBlock(\n get_old_ClassDeclaration_SharedSummaryBlock());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_SharedSummaryBlock\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_SharedSummaryBlock():\n TypeOnly<current.SharedSummaryBlock>;\ndeclare function use_old_ClassDeclaration_SharedSummaryBlock(\n use: TypeOnly<old.SharedSummaryBlock>): void;\nuse_old_ClassDeclaration_SharedSummaryBlock(\n get_current_ClassDeclaration_SharedSummaryBlock());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_SharedSummaryBlockFactory\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_SharedSummaryBlockFactory():\n TypeOnly<old.SharedSummaryBlockFactory>;\ndeclare function use_current_ClassDeclaration_SharedSummaryBlockFactory(\n use: TypeOnly<current.SharedSummaryBlockFactory>): void;\nuse_current_ClassDeclaration_SharedSummaryBlockFactory(\n get_old_ClassDeclaration_SharedSummaryBlockFactory());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_SharedSummaryBlockFactory\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_SharedSummaryBlockFactory():\n TypeOnly<current.SharedSummaryBlockFactory>;\ndeclare function use_old_ClassDeclaration_SharedSummaryBlockFactory(\n use: TypeOnly<old.SharedSummaryBlockFactory>): void;\nuse_old_ClassDeclaration_SharedSummaryBlockFactory(\n get_current_ClassDeclaration_SharedSummaryBlockFactory());\n"]}
|
|
File without changes
|