@fluidframework/datastore 2.0.0-rc.2.0.1 → 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.
Files changed (110) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/api-report/datastore.api.md +7 -5
  3. package/dist/channelContext.d.ts +5 -4
  4. package/dist/channelContext.d.ts.map +1 -1
  5. package/dist/channelContext.js +10 -10
  6. package/dist/channelContext.js.map +1 -1
  7. package/dist/channelDeltaConnection.d.ts +2 -2
  8. package/dist/channelDeltaConnection.d.ts.map +1 -1
  9. package/dist/channelDeltaConnection.js +5 -5
  10. package/dist/channelDeltaConnection.js.map +1 -1
  11. package/dist/channelStorageService.d.ts +2 -2
  12. package/dist/channelStorageService.d.ts.map +1 -1
  13. package/dist/channelStorageService.js +2 -2
  14. package/dist/channelStorageService.js.map +1 -1
  15. package/dist/dataStoreRuntime.d.ts +11 -8
  16. package/dist/dataStoreRuntime.d.ts.map +1 -1
  17. package/dist/dataStoreRuntime.js +129 -104
  18. package/dist/dataStoreRuntime.js.map +1 -1
  19. package/dist/fluidHandle.d.ts +1 -1
  20. package/dist/fluidHandle.d.ts.map +1 -1
  21. package/dist/fluidHandle.js +2 -2
  22. package/dist/fluidHandle.js.map +1 -1
  23. package/dist/legacy.d.ts +19 -0
  24. package/dist/localChannelContext.d.ts +8 -7
  25. package/dist/localChannelContext.d.ts.map +1 -1
  26. package/dist/localChannelContext.js +35 -25
  27. package/dist/localChannelContext.js.map +1 -1
  28. package/dist/localChannelStorageService.d.ts.map +1 -1
  29. package/dist/localChannelStorageService.js +2 -2
  30. package/dist/localChannelStorageService.js.map +1 -1
  31. package/dist/packageVersion.d.ts +9 -0
  32. package/dist/packageVersion.d.ts.map +1 -0
  33. package/dist/packageVersion.js +12 -0
  34. package/dist/packageVersion.js.map +1 -0
  35. package/dist/public.d.ts +12 -0
  36. package/dist/remoteChannelContext.d.ts +3 -2
  37. package/dist/remoteChannelContext.d.ts.map +1 -1
  38. package/dist/remoteChannelContext.js +12 -12
  39. package/dist/remoteChannelContext.js.map +1 -1
  40. package/internal.d.ts +11 -0
  41. package/legacy.d.ts +11 -0
  42. package/lib/channelContext.d.ts +5 -4
  43. package/lib/channelContext.d.ts.map +1 -1
  44. package/lib/channelContext.js +4 -4
  45. package/lib/channelContext.js.map +1 -1
  46. package/lib/channelDeltaConnection.d.ts +2 -2
  47. package/lib/channelDeltaConnection.d.ts.map +1 -1
  48. package/lib/channelDeltaConnection.js +2 -2
  49. package/lib/channelDeltaConnection.js.map +1 -1
  50. package/lib/channelStorageService.d.ts +2 -2
  51. package/lib/channelStorageService.d.ts.map +1 -1
  52. package/lib/channelStorageService.js +1 -1
  53. package/lib/channelStorageService.js.map +1 -1
  54. package/lib/dataStoreRuntime.d.ts +11 -8
  55. package/lib/dataStoreRuntime.d.ts.map +1 -1
  56. package/lib/dataStoreRuntime.js +68 -43
  57. package/lib/dataStoreRuntime.js.map +1 -1
  58. package/lib/fluidHandle.d.ts +1 -1
  59. package/lib/fluidHandle.d.ts.map +1 -1
  60. package/lib/fluidHandle.js +1 -1
  61. package/lib/fluidHandle.js.map +1 -1
  62. package/lib/legacy.d.ts +19 -0
  63. package/lib/localChannelContext.d.ts +8 -7
  64. package/lib/localChannelContext.d.ts.map +1 -1
  65. package/lib/localChannelContext.js +21 -8
  66. package/lib/localChannelContext.js.map +1 -1
  67. package/lib/localChannelStorageService.d.ts.map +1 -1
  68. package/lib/localChannelStorageService.js +1 -1
  69. package/lib/localChannelStorageService.js.map +1 -1
  70. package/lib/packageVersion.d.ts +9 -0
  71. package/lib/packageVersion.d.ts.map +1 -0
  72. package/lib/packageVersion.js +9 -0
  73. package/lib/packageVersion.js.map +1 -0
  74. package/lib/public.d.ts +12 -0
  75. package/lib/remoteChannelContext.d.ts +3 -2
  76. package/lib/remoteChannelContext.d.ts.map +1 -1
  77. package/lib/remoteChannelContext.js +2 -2
  78. package/lib/remoteChannelContext.js.map +1 -1
  79. package/package.json +37 -58
  80. package/src/channelContext.ts +12 -12
  81. package/src/channelDeltaConnection.ts +4 -4
  82. package/src/channelStorageService.ts +3 -3
  83. package/src/dataStoreRuntime.ts +143 -96
  84. package/src/fluidHandle.ts +2 -2
  85. package/src/localChannelContext.ts +33 -16
  86. package/src/localChannelStorageService.ts +2 -2
  87. package/src/packageVersion.ts +9 -0
  88. package/src/remoteChannelContext.ts +13 -13
  89. package/api-extractor-cjs.json +0 -8
  90. package/dist/datastore-alpha.d.ts +0 -333
  91. package/dist/datastore-beta.d.ts +0 -46
  92. package/dist/datastore-public.d.ts +0 -46
  93. package/dist/datastore-untrimmed.d.ts +0 -340
  94. package/lib/datastore-alpha.d.ts +0 -333
  95. package/lib/datastore-beta.d.ts +0 -46
  96. package/lib/datastore-public.d.ts +0 -46
  97. package/lib/datastore-untrimmed.d.ts +0 -340
  98. package/lib/test/channelStorageService.spec.js +0 -70
  99. package/lib/test/channelStorageService.spec.js.map +0 -1
  100. package/lib/test/dataStoreRuntime.spec.js +0 -121
  101. package/lib/test/dataStoreRuntime.spec.js.map +0 -1
  102. package/lib/test/localChannelContext.spec.js +0 -41
  103. package/lib/test/localChannelContext.spec.js.map +0 -1
  104. package/lib/test/localChannelStorageService.spec.js +0 -72
  105. package/lib/test/localChannelStorageService.spec.js.map +0 -1
  106. package/lib/test/remoteChannelContext.spec.js +0 -33
  107. package/lib/test/remoteChannelContext.spec.js.map +0 -1
  108. package/lib/test/types/validateDatastorePrevious.generated.js +0 -16
  109. package/lib/test/types/validateDatastorePrevious.generated.js.map +0 -1
  110. /package/{dist → lib}/tsdoc-metadata.json +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"dataStoreRuntime.spec.js","sourceRoot":"","sources":["../../src/test/dataStoreRuntime.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MA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CACjB,CAAC,CAAC,SAAS,KAAK,mBAAmB,CAAC,UAAU;YAC9C,CAAC,CAAC,OAAO,KAAK,8BAA8B,SAAS,EAAE,CACxD,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;QACpD,MAAM,KAAK,GAAgB,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;QACrD,MAAM,gBAAgB,GAAG,aAAa,CACrC,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,KAAK,CAC1B,CAAC;QACF,MAAM,CACL,CAAC,MAAM,gBAAgB,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK,KAAK,EACpD,gCAAgC,CAChC,CAAC;IACH,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 { SummaryType } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIContainerRuntimeBase,\n\tIGarbageCollectionData,\n\tIFluidDataStoreContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n\tMockFluidDataStoreContext,\n\tvalidateAssertionError,\n} from \"@fluidframework/test-runtime-utils\";\nimport { ContainerErrorTypes } from \"@fluidframework/container-definitions\";\nimport { IFluidDataStoreRuntime, IChannel } from \"@fluidframework/datastore-definitions\";\nimport { IErrorBase, FluidObject } from \"@fluidframework/core-interfaces\";\nimport { FluidDataStoreRuntime, ISharedObjectRegistry } from \"../dataStoreRuntime.js\";\n\ndescribe(\"FluidDataStoreRuntime Tests\", () => {\n\tlet dataStoreContext: MockFluidDataStoreContext;\n\tlet sharedObjectRegistry: ISharedObjectRegistry;\n\tfunction createRuntime(\n\t\tcontext: IFluidDataStoreContext,\n\t\tregistry: ISharedObjectRegistry,\n\t\tentrypointInitializationFn?: (rt: IFluidDataStoreRuntime) => Promise<FluidObject>,\n\t) {\n\t\tconst runtime: FluidDataStoreRuntime = new FluidDataStoreRuntime(\n\t\t\tcontext,\n\t\t\tregistry,\n\t\t\t/* existing */ false,\n\t\t\tentrypointInitializationFn ?? (async () => runtime),\n\t\t);\n\t\treturn runtime;\n\t}\n\n\tbeforeEach(() => {\n\t\tdataStoreContext = new MockFluidDataStoreContext();\n\t\t// back-compat 0.38 - DataStoreRuntime looks in container runtime for certain properties that are unavailable\n\t\t// in the data store context.\n\t\tdataStoreContext.containerRuntime = {} as unknown as IContainerRuntimeBase;\n\t\tsharedObjectRegistry = {\n\t\t\tget(type: string) {\n\t\t\t\treturn {\n\t\t\t\t\ttype,\n\t\t\t\t\tattributes: { type, snapshotFormatVersion: \"0\" },\n\t\t\t\t\tcreate: (runtime, id: string) =>\n\t\t\t\t\t\t({\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\tattributes: { type, snapshotFormatVersion: \"0\" },\n\t\t\t\t\t\t\tclientDetails: {},\n\t\t\t\t\t\t}) as any as IChannel,\n\t\t\t\t\tload: async () => Promise.resolve({} as any as IChannel),\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t});\n\n\tit(\"constructor rejects ids with forward slashes\", () => {\n\t\tconst invalidId = \"beforeSlash/afterSlash\";\n\t\tdataStoreContext = new MockFluidDataStoreContext(invalidId);\n\t\tconst codeBlock = () =>\n\t\t\tnew FluidDataStoreRuntime(\n\t\t\t\tdataStoreContext,\n\t\t\t\tsharedObjectRegistry,\n\t\t\t\tfalse,\n\t\t\t\tasync (dataStoreRuntime) => {\n\t\t\t\t\tthrow new Error(\"This shouldn't be called during the test\");\n\t\t\t\t},\n\t\t\t);\n\t\tassert.throws(codeBlock, (e: Error) =>\n\t\t\tvalidateAssertionError(\n\t\t\t\te,\n\t\t\t\t\"Id cannot contain slashes. DataStoreContext should have validated this.\",\n\t\t\t),\n\t\t);\n\t});\n\n\tit(\"can create a data store runtime\", () => {\n\t\tlet failed: boolean = false;\n\t\tlet dataStoreRuntime: FluidDataStoreRuntime | undefined;\n\t\ttry {\n\t\t\tdataStoreRuntime = createRuntime(dataStoreContext, sharedObjectRegistry);\n\t\t} catch (error) {\n\t\t\tfailed = true;\n\t\t}\n\t\tassert.strictEqual(failed, false, \"Data store runtime creation failed\");\n\t\tassert.strictEqual(\n\t\t\tdataStoreRuntime?.id,\n\t\t\tdataStoreContext.id,\n\t\t\t\"Data store runtime's id in incorrect\",\n\t\t);\n\t});\n\n\tit(\"can summarize an empty data store runtime\", async () => {\n\t\tconst dataStoreRuntime = createRuntime(dataStoreContext, sharedObjectRegistry);\n\t\tconst summarizeResult = await dataStoreRuntime.summarize(true, false);\n\t\tassert(\n\t\t\tsummarizeResult.summary.type === SummaryType.Tree,\n\t\t\t\"Data store runtime did not return a summary tree\",\n\t\t);\n\t\tassert(\n\t\t\tObject.keys(summarizeResult.summary.tree).length === 0,\n\t\t\t\"The summary should be empty\",\n\t\t);\n\t});\n\n\tit(\"can get GC data of an empty data store runtime\", async () => {\n\t\t// The GC data should have a single node for the data store runtime with empty outbound routes.\n\t\tconst expectedGCData: IGarbageCollectionData = {\n\t\t\tgcNodes: { \"/\": [] },\n\t\t};\n\t\tconst dataStoreRuntime = createRuntime(dataStoreContext, sharedObjectRegistry);\n\t\tconst gcData = await dataStoreRuntime.getGCData();\n\t\tassert.deepStrictEqual(gcData, expectedGCData, \"The GC data is incorrect\");\n\t});\n\n\tit(\"createChannel rejects ids with slashes\", async () => {\n\t\tconst dataStoreRuntime = createRuntime(dataStoreContext, sharedObjectRegistry);\n\t\tconst invalidId = \"beforeSlash/afterSlash\";\n\t\tconst codeBlock = () => dataStoreRuntime.createChannel(invalidId, \"SomeType\");\n\t\tassert.throws(\n\t\t\tcodeBlock,\n\t\t\t(e: IErrorBase) =>\n\t\t\t\te.errorType === ContainerErrorTypes.usageError &&\n\t\t\t\te.message === `Id cannot contain slashes: ${invalidId}`,\n\t\t);\n\t});\n\n\tit(\"createChannel with default guid\", async () => {\n\t\tconst dataStoreRuntime = createRuntime(dataStoreContext, sharedObjectRegistry);\n\t\tconst type = \"SomeType\";\n\t\tconst channel = dataStoreRuntime.createChannel(undefined, type);\n\t\tassert(channel !== undefined, \"channel should be created\");\n\t\tassert(type === channel.attributes.type, \"type should be as expected\");\n\t});\n\n\tit(\"createChannel and then attach to dataStore runtime\", async () => {\n\t\tconst dataStoreRuntime = createRuntime(dataStoreContext, sharedObjectRegistry);\n\t\tconst type = \"SomeType\";\n\t\tconst channel = {\n\t\t\tid: \"id\",\n\t\t\ttype,\n\t\t\tattributes: { type, snapshotFormatVersion: \"0\" },\n\t\t\tclientDetails: {},\n\t\t} as any as IChannel;\n\t\tdataStoreRuntime.addChannel(channel);\n\t\tconst channel1 = await dataStoreRuntime.getChannel(channel.id);\n\t\tassert.deepStrictEqual(channel, channel1, \"both channel should match\");\n\t});\n\n\tit(\"createChannel rejects ids with slashes when channel is created first\", async () => {\n\t\tconst dataStoreRuntime = createRuntime(dataStoreContext, sharedObjectRegistry);\n\t\tconst invalidId = \"beforeSlash/afterSlash\";\n\t\tconst type = \"SomeType\";\n\t\tconst channel = {\n\t\t\tid: invalidId,\n\t\t\ttype,\n\t\t\tattributes: { type, snapshotFormatVersion: \"0\" },\n\t\t\tclientDetails: {},\n\t\t} as any as IChannel;\n\t\tconst codeBlock = () => dataStoreRuntime.addChannel(channel);\n\t\tassert.throws(\n\t\t\tcodeBlock,\n\t\t\t(e: IErrorBase) =>\n\t\t\t\te.errorType === ContainerErrorTypes.usageError &&\n\t\t\t\te.message === `Id cannot contain slashes: ${invalidId}`,\n\t\t);\n\t});\n\n\tit(\"entryPoint is initialized correctly\", async () => {\n\t\tconst myObj: FluidObject = { fakeProp: \"fakeValue\" };\n\t\tconst dataStoreRuntime = createRuntime(\n\t\t\tdataStoreContext,\n\t\t\tsharedObjectRegistry,\n\t\t\tasync (dsRuntime) => myObj,\n\t\t);\n\t\tassert(\n\t\t\t(await dataStoreRuntime.entryPoint?.get()) === myObj,\n\t\t\t\"entryPoint was not initialized\",\n\t\t);\n\t});\n});\n"]}
@@ -1,41 +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 { MockFluidDataStoreContext, validateAssertionError, } from "@fluidframework/test-runtime-utils";
7
- import { FluidDataStoreRuntime } from "../dataStoreRuntime.js";
8
- import { LocalChannelContext, RehydratedLocalChannelContext } from "../localChannelContext.js";
9
- describe("LocalChannelContext Tests", () => {
10
- let dataStoreContext;
11
- let sharedObjectRegistry;
12
- const loadRuntime = (context, registry) => new FluidDataStoreRuntime(context, registry, /* existing */ false, async () => ({
13
- myProp: "myValue",
14
- }));
15
- beforeEach(() => {
16
- dataStoreContext = new MockFluidDataStoreContext();
17
- sharedObjectRegistry = {
18
- get(type) {
19
- return {
20
- type,
21
- attributes: { type, snapshotFormatVersion: "0" },
22
- create: () => ({}),
23
- load: async () => Promise.resolve({}),
24
- };
25
- },
26
- };
27
- });
28
- it("LocalChannelContext rejects ids with forward slashes", () => {
29
- const invalidId = "beforeSlash/afterSlash";
30
- const dataStoreRuntime = loadRuntime(dataStoreContext, sharedObjectRegistry);
31
- const codeBlock = () => new LocalChannelContext({ id: invalidId }, dataStoreRuntime, dataStoreContext, dataStoreContext.storage, dataStoreContext.logger, () => { }, (s) => { }, (s) => { });
32
- assert.throws(codeBlock, (e) => validateAssertionError(e, "Channel context ID cannot contain slashes"), "Expected exception was not thrown");
33
- });
34
- it("RehydratedLocalChannelContext rejects ids with forward slashes", () => {
35
- const invalidId = "beforeSlash/afterSlash";
36
- const dataStoreRuntime = loadRuntime(dataStoreContext, sharedObjectRegistry);
37
- const codeBlock = () => new RehydratedLocalChannelContext(invalidId, sharedObjectRegistry, dataStoreRuntime, dataStoreContext, dataStoreContext.storage, dataStoreContext.logger, (content, localOpMetadata) => { }, (s) => { }, (s, o) => { }, null);
38
- assert.throws(codeBlock, (e) => validateAssertionError(e, "Channel context ID cannot contain slashes"), "Expected exception was not thrown");
39
- });
40
- });
41
- //# sourceMappingURL=localChannelContext.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"localChannelContext.spec.js","sourceRoot":"","sources":["../../src/test/localChannelContext.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE1C,OAAO,EACN,yBAAyB,EACzB,sBAAsB,GACtB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EAAE,qBAAqB,EAAyB,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAE/F,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IAC1C,IAAI,gBAA2C,CAAC;IAChD,IAAI,oBAA2C,CAAC;IAChD,MAAM,WAAW,GAAG,CAAC,OAA+B,EAAE,QAA+B,EAAE,EAAE,CACxF,IAAI,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAAE,cAAc,CAAC,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;QAC/E,MAAM,EAAE,SAAS;KACjB,CAAC,CAAC,CAAC;IAEL,UAAU,CAAC,GAAG,EAAE;QACf,gBAAgB,GAAG,IAAI,yBAAyB,EAAE,CAAC;QACnD,oBAAoB,GAAG;YACtB,GAAG,CAAC,IAAY;gBACf,OAAO;oBACN,IAAI;oBACJ,UAAU,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,GAAG,EAAE;oBAChD,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAoB;oBACrC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAqB,CAAC;iBACxD,CAAC;YACH,CAAC;SACD,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE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AAC;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 { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\nimport {\n\tMockFluidDataStoreContext,\n\tvalidateAssertionError,\n} from \"@fluidframework/test-runtime-utils\";\nimport { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { IChannel } from \"@fluidframework/datastore-definitions\";\nimport { FluidDataStoreRuntime, ISharedObjectRegistry } from \"../dataStoreRuntime.js\";\nimport { LocalChannelContext, RehydratedLocalChannelContext } from \"../localChannelContext.js\";\n\ndescribe(\"LocalChannelContext Tests\", () => {\n\tlet dataStoreContext: MockFluidDataStoreContext;\n\tlet sharedObjectRegistry: ISharedObjectRegistry;\n\tconst loadRuntime = (context: IFluidDataStoreContext, registry: ISharedObjectRegistry) =>\n\t\tnew FluidDataStoreRuntime(context, registry, /* existing */ false, async () => ({\n\t\t\tmyProp: \"myValue\",\n\t\t}));\n\n\tbeforeEach(() => {\n\t\tdataStoreContext = new MockFluidDataStoreContext();\n\t\tsharedObjectRegistry = {\n\t\t\tget(type: string) {\n\t\t\t\treturn {\n\t\t\t\t\ttype,\n\t\t\t\t\tattributes: { type, snapshotFormatVersion: \"0\" },\n\t\t\t\t\tcreate: () => ({}) as any as IChannel,\n\t\t\t\t\tload: async () => Promise.resolve({} as any as IChannel),\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t});\n\n\tit(\"LocalChannelContext rejects ids with forward slashes\", () => {\n\t\tconst invalidId = \"beforeSlash/afterSlash\";\n\t\tconst dataStoreRuntime = loadRuntime(dataStoreContext, sharedObjectRegistry);\n\t\tconst codeBlock = () =>\n\t\t\tnew LocalChannelContext(\n\t\t\t\t{ id: invalidId } as any as IChannel,\n\t\t\t\tdataStoreRuntime,\n\t\t\t\tdataStoreContext,\n\t\t\t\tdataStoreContext.storage,\n\t\t\t\tdataStoreContext.logger,\n\t\t\t\t() => {},\n\t\t\t\t(s: string) => {},\n\t\t\t\t(s) => {},\n\t\t\t);\n\t\tassert.throws(\n\t\t\tcodeBlock,\n\t\t\t(e: Error) => validateAssertionError(e, \"Channel context ID cannot contain slashes\"),\n\t\t\t\"Expected exception was not thrown\",\n\t\t);\n\t});\n\n\tit(\"RehydratedLocalChannelContext rejects ids with forward slashes\", () => {\n\t\tconst invalidId = \"beforeSlash/afterSlash\";\n\t\tconst dataStoreRuntime = loadRuntime(dataStoreContext, sharedObjectRegistry);\n\t\tconst codeBlock = () =>\n\t\t\tnew RehydratedLocalChannelContext(\n\t\t\t\tinvalidId,\n\t\t\t\tsharedObjectRegistry,\n\t\t\t\tdataStoreRuntime,\n\t\t\t\tdataStoreContext,\n\t\t\t\tdataStoreContext.storage,\n\t\t\t\tdataStoreContext.logger,\n\t\t\t\t(content, localOpMetadata) => {},\n\t\t\t\t(s: string) => {},\n\t\t\t\t(s, o) => {},\n\t\t\t\tnull as unknown as ISnapshotTree,\n\t\t\t);\n\t\tassert.throws(\n\t\t\tcodeBlock,\n\t\t\t(e: Error) => validateAssertionError(e, \"Channel context ID cannot contain slashes\"),\n\t\t\t\"Expected exception was not thrown\",\n\t\t);\n\t});\n});\n"]}
@@ -1,72 +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 { stringToBuffer } from "@fluid-internal/client-utils";
7
- import { FileMode, TreeEntry } from "@fluidframework/protocol-definitions";
8
- import { LocalChannelStorageService } from "../localChannelStorageService.js";
9
- describe("LocalChannelStorageService", () => {
10
- it("Empty Tree", async () => {
11
- const tree = {
12
- entries: [],
13
- };
14
- const ss = new LocalChannelStorageService(tree);
15
- assert.strictEqual(await ss.contains("/"), false);
16
- assert.deepStrictEqual(await ss.list(""), []);
17
- try {
18
- await ss.readBlob("test");
19
- }
20
- catch (error) {
21
- assert.strictEqual(error.message, "Blob Not Found");
22
- }
23
- });
24
- it("Top Level Blob", async () => {
25
- const tree = {
26
- entries: [
27
- {
28
- mode: FileMode.File,
29
- path: "foo",
30
- type: TreeEntry.Blob,
31
- value: {
32
- encoding: "utf-8",
33
- contents: "bar",
34
- },
35
- },
36
- ],
37
- };
38
- const ss = new LocalChannelStorageService(tree);
39
- assert.strictEqual(await ss.contains("foo"), true);
40
- assert.deepStrictEqual(await ss.list(""), ["foo"]);
41
- assert.deepStrictEqual(await ss.readBlob("foo"), stringToBuffer("bar", "utf8"));
42
- });
43
- it("Nested Blob", async () => {
44
- const tree = {
45
- entries: [
46
- {
47
- mode: FileMode.File,
48
- path: "nested",
49
- type: TreeEntry.Tree,
50
- value: {
51
- entries: [
52
- {
53
- mode: FileMode.File,
54
- path: "foo",
55
- type: TreeEntry.Blob,
56
- value: {
57
- encoding: "utf-8",
58
- contents: "bar",
59
- },
60
- },
61
- ],
62
- },
63
- },
64
- ],
65
- };
66
- const ss = new LocalChannelStorageService(tree);
67
- assert.strictEqual(await ss.contains("nested/foo"), true);
68
- assert.deepStrictEqual(await ss.list("nested/"), ["foo"]);
69
- assert.deepStrictEqual(await ss.readBlob("nested/foo"), stringToBuffer("bar", "utf8"));
70
- });
71
- });
72
- //# sourceMappingURL=localChannelStorageService.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"localChannelStorageService.spec.js","sourceRoot":"","sources":["../../src/test/localChannelStorageService.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAS,QAAQ,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAE9E,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC3C,EAAE,CAAC,YAAY,EAA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C;IACjF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE;QAC5B,MAAM,IAAI,GAAU;YACnB,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,QAAQ,CAAC,IAAI;oBACnB,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,SAAS,CAAC,IAAI;oBACpB,KAAK,EAAE;wBACN,OAAO,EAAE;4BACR;gCACC,IAAI,EAAE,QAAQ,CAAC,IAAI;gCACnB,IAAI,EAAE,KAAK;gCACX,IAAI,EAAE,SAAS,CAAC,IAAI;gCACpB,KAAK,EAAE;oCACN,QAAQ,EAAE,OAAO;oCACjB,QAAQ,EAAE,KAAK;iCACf;6BACD;yBACD;qBACD;iBACD;aACD;SACD,CAAC;QACF,MAAM,EAAE,GAAG,IAAI,0BAA0B,CAAC,IAAI,CAAC,CAAC;QAEhD,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,CAAC;QAC1D,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1D,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IACxF,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 { stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { ITree, FileMode, TreeEntry } from \"@fluidframework/protocol-definitions\";\nimport { LocalChannelStorageService } from \"../localChannelStorageService.js\";\n\ndescribe(\"LocalChannelStorageService\", () => {\n\tit(\"Empty Tree\", async () => {\n\t\tconst tree: ITree = {\n\t\t\tentries: [],\n\t\t};\n\n\t\tconst ss = new LocalChannelStorageService(tree);\n\n\t\tassert.strictEqual(await ss.contains(\"/\"), false);\n\t\tassert.deepStrictEqual(await ss.list(\"\"), []);\n\t\ttry {\n\t\t\tawait ss.readBlob(\"test\");\n\t\t} catch (error: any) {\n\t\t\tassert.strictEqual(error.message, \"Blob Not Found\");\n\t\t}\n\t});\n\n\tit(\"Top Level Blob\", async () => {\n\t\tconst tree: ITree = {\n\t\t\tentries: [\n\t\t\t\t{\n\t\t\t\t\tmode: FileMode.File,\n\t\t\t\t\tpath: \"foo\",\n\t\t\t\t\ttype: TreeEntry.Blob,\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t\tcontents: \"bar\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\n\t\tconst ss = new LocalChannelStorageService(tree);\n\n\t\tassert.strictEqual(await ss.contains(\"foo\"), true);\n\t\tassert.deepStrictEqual(await ss.list(\"\"), [\"foo\"]);\n\t\tassert.deepStrictEqual(await ss.readBlob(\"foo\"), stringToBuffer(\"bar\", \"utf8\"));\n\t});\n\n\tit(\"Nested Blob\", async () => {\n\t\tconst tree: ITree = {\n\t\t\tentries: [\n\t\t\t\t{\n\t\t\t\t\tmode: FileMode.File,\n\t\t\t\t\tpath: \"nested\",\n\t\t\t\t\ttype: TreeEntry.Tree,\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\tentries: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmode: FileMode.File,\n\t\t\t\t\t\t\t\tpath: \"foo\",\n\t\t\t\t\t\t\t\ttype: TreeEntry.Blob,\n\t\t\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t\t\t\t\tcontents: \"bar\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\tconst ss = new LocalChannelStorageService(tree);\n\n\t\tassert.strictEqual(await ss.contains(\"nested/foo\"), true);\n\t\tassert.deepStrictEqual(await ss.list(\"nested/\"), [\"foo\"]);\n\t\tassert.deepStrictEqual(await ss.readBlob(\"nested/foo\"), stringToBuffer(\"bar\", \"utf8\"));\n\t});\n});\n"]}
@@ -1,33 +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 { MockFluidDataStoreContext, validateAssertionError, } from "@fluidframework/test-runtime-utils";
7
- import { FluidDataStoreRuntime } from "../dataStoreRuntime.js";
8
- import { RemoteChannelContext } from "../remoteChannelContext.js";
9
- describe("RemoteChannelContext Tests", () => {
10
- let dataStoreContext;
11
- let sharedObjectRegistry;
12
- const loadRuntime = (context, registry) => new FluidDataStoreRuntime(context, registry, /* existing */ false, async () => ({
13
- myProp: "myValue",
14
- }));
15
- beforeEach(() => {
16
- dataStoreContext = new MockFluidDataStoreContext();
17
- // back-compat 0.38 - DataStoreRuntime looks in container runtime for certain properties that are unavailable
18
- // in the data store context.
19
- dataStoreContext.containerRuntime = {};
20
- sharedObjectRegistry = {
21
- get(name) {
22
- throw new Error("Not implemented");
23
- },
24
- };
25
- });
26
- it("rejects ids with forward slashes", () => {
27
- const invalidId = "beforeSlash/afterSlash";
28
- const dataStoreRuntime = loadRuntime(dataStoreContext, sharedObjectRegistry);
29
- const codeBlock = () => new RemoteChannelContext(dataStoreRuntime, dataStoreContext, dataStoreContext.storage, (c, lom) => { }, (s) => { }, (s, o) => { }, invalidId, undefined, sharedObjectRegistry, undefined, undefined, "SomeAttachMessageType");
30
- assert.throws(codeBlock, (e) => validateAssertionError(e, "Channel context ID cannot contain slashes"), "Expected exception was not thrown");
31
- });
32
- });
33
- //# sourceMappingURL=remoteChannelContext.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remoteChannelContext.sp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E,EAAE,GAAE,CAAC,EACd,CAAC,CAAS,EAAE,EAAE,GAAE,CAAC,EACjB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,GAAE,CAAC,EACZ,SAAS,EACT,SAAqC,EACrC,oBAAoB,EACpB,SAAS,EACT,SAAmD,EACnD,uBAAuB,CACvB,CAAC;QACH,MAAM,CAAC,MAAM,CACZ,SAAS,EACT,CAAC,CAAQ,EAAE,EAAE,CAAC,sBAAsB,CAAC,CAAC,EAAE,2CAA2C,CAAC,EACpF,mCAAmC,CACnC,CAAC;IACH,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 {\n\tCreateChildSummarizerNodeFn,\n\tIContainerRuntimeBase,\n\tIFluidDataStoreContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n\tMockFluidDataStoreContext,\n\tvalidateAssertionError,\n} from \"@fluidframework/test-runtime-utils\";\nimport { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { FluidDataStoreRuntime, ISharedObjectRegistry } from \"../dataStoreRuntime.js\";\nimport { RemoteChannelContext } from \"../remoteChannelContext.js\";\n\ndescribe(\"RemoteChannelContext Tests\", () => {\n\tlet dataStoreContext: MockFluidDataStoreContext;\n\tlet sharedObjectRegistry: ISharedObjectRegistry;\n\tconst loadRuntime = (context: IFluidDataStoreContext, registry: ISharedObjectRegistry) =>\n\t\tnew FluidDataStoreRuntime(context, registry, /* existing */ false, async () => ({\n\t\t\tmyProp: \"myValue\",\n\t\t}));\n\n\tbeforeEach(() => {\n\t\tdataStoreContext = new MockFluidDataStoreContext();\n\t\t// back-compat 0.38 - DataStoreRuntime looks in container runtime for certain properties that are unavailable\n\t\t// in the data store context.\n\t\tdataStoreContext.containerRuntime = {} as unknown as IContainerRuntimeBase;\n\t\tsharedObjectRegistry = {\n\t\t\tget(name: string) {\n\t\t\t\tthrow new Error(\"Not implemented\");\n\t\t\t},\n\t\t};\n\t});\n\n\tit(\"rejects ids with forward slashes\", () => {\n\t\tconst invalidId = \"beforeSlash/afterSlash\";\n\t\tconst dataStoreRuntime = loadRuntime(dataStoreContext, sharedObjectRegistry);\n\t\tconst codeBlock = () =>\n\t\t\tnew RemoteChannelContext(\n\t\t\t\tdataStoreRuntime,\n\t\t\t\tdataStoreContext,\n\t\t\t\tdataStoreContext.storage,\n\t\t\t\t(c, lom) => {},\n\t\t\t\t(s: string) => {},\n\t\t\t\t(s, o) => {},\n\t\t\t\tinvalidId,\n\t\t\t\tundefined as unknown as ISnapshotTree,\n\t\t\t\tsharedObjectRegistry,\n\t\t\t\tundefined,\n\t\t\t\tundefined as unknown as CreateChildSummarizerNodeFn,\n\t\t\t\t\"SomeAttachMessageType\",\n\t\t\t);\n\t\tassert.throws(\n\t\t\tcodeBlock,\n\t\t\t(e: Error) => validateAssertionError(e, \"Channel context ID cannot contain slashes\"),\n\t\t\t\"Expected exception was not thrown\",\n\t\t);\n\t});\n});\n"]}
@@ -1,16 +0,0 @@
1
- use_current_EnumDeclaration_DataStoreMessageType(get_old_EnumDeclaration_DataStoreMessageType());
2
- use_old_EnumDeclaration_DataStoreMessageType(get_current_EnumDeclaration_DataStoreMessageType());
3
- use_current_ClassDeclaration_FluidDataStoreRuntime(
4
- // @ts-expect-error compatibility expected to be broken
5
- get_old_ClassDeclaration_FluidDataStoreRuntime());
6
- use_old_ClassDeclaration_FluidDataStoreRuntime(get_current_ClassDeclaration_FluidDataStoreRuntime());
7
- use_current_ClassDeclaration_FluidObjectHandle(get_old_ClassDeclaration_FluidObjectHandle());
8
- use_old_ClassDeclaration_FluidObjectHandle(get_current_ClassDeclaration_FluidObjectHandle());
9
- use_current_InterfaceDeclaration_ISharedObjectRegistry(get_old_InterfaceDeclaration_ISharedObjectRegistry());
10
- use_old_InterfaceDeclaration_ISharedObjectRegistry(get_current_InterfaceDeclaration_ISharedObjectRegistry());
11
- use_current_VariableDeclaration_mixinRequestHandler(get_old_VariableDeclaration_mixinRequestHandler());
12
- use_old_VariableDeclaration_mixinRequestHandler(get_current_VariableDeclaration_mixinRequestHandler());
13
- use_current_VariableDeclaration_mixinSummaryHandler(get_old_VariableDeclaration_mixinSummaryHandler());
14
- use_old_VariableDeclaration_mixinSummaryHandler(get_current_VariableDeclaration_mixinSummaryHandler());
15
- export {};
16
- //# sourceMappingURL=validateDatastorePrevious.generated.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateDatastorePrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateDatastorePrevious.generated.ts"],"names":[],"mappings":"AAgCA,gDAAgD,CAC5C,4CAA4C,EAAE,CAAC,CAAC;AAWpD,4CAA4C,CACxC,gDAAgD,EAAE,CAAC,CAAC;AAWxD,kDAAkD;AAC9C,uDAAuD;AACvD,8CAA8C,EAAE,CAAC,CAAC;AAWtD,8CAA8C,CAC1C,kDAAkD,EAAE,CAAC,CAAC;AAW1D,8CAA8C,CAC1C,0CAA0C,EAAE,CAAC,CAAC;AAWlD,0CAA0C,CACtC,8CAA8C,EAAE,CAAC,CAAC;AAWtD,sDAAsD,CAClD,kDAAkD,EAAE,CAAC,CAAC;AAW1D,kDAAkD,CAC9C,sDAAsD,EAAE,CAAC,CAAC;AAW9D,mDAAmD,CAC/C,+CAA+C,EAAE,CAAC,CAAC;AAWvD,+CAA+C,CAC3C,mDAAmD,EAAE,CAAC,CAAC;AAW3D,mDAAmD,CAC/C,+CAA+C,EAAE,CAAC,CAAC;AAWvD,+CAA+C,CAC3C,mDAAmD,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/datastore-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* \"EnumDeclaration_DataStoreMessageType\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_EnumDeclaration_DataStoreMessageType():\n TypeOnly<old.DataStoreMessageType>;\ndeclare function use_current_EnumDeclaration_DataStoreMessageType(\n use: TypeOnly<current.DataStoreMessageType>): void;\nuse_current_EnumDeclaration_DataStoreMessageType(\n get_old_EnumDeclaration_DataStoreMessageType());\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* \"EnumDeclaration_DataStoreMessageType\": {\"backCompat\": false}\n*/\ndeclare function get_current_EnumDeclaration_DataStoreMessageType():\n TypeOnly<current.DataStoreMessageType>;\ndeclare function use_old_EnumDeclaration_DataStoreMessageType(\n use: TypeOnly<old.DataStoreMessageType>): void;\nuse_old_EnumDeclaration_DataStoreMessageType(\n get_current_EnumDeclaration_DataStoreMessageType());\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_FluidDataStoreRuntime\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_FluidDataStoreRuntime():\n TypeOnly<old.FluidDataStoreRuntime>;\ndeclare function use_current_ClassDeclaration_FluidDataStoreRuntime(\n use: TypeOnly<current.FluidDataStoreRuntime>): void;\nuse_current_ClassDeclaration_FluidDataStoreRuntime(\n // @ts-expect-error compatibility expected to be broken\n get_old_ClassDeclaration_FluidDataStoreRuntime());\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_FluidDataStoreRuntime\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_FluidDataStoreRuntime():\n TypeOnly<current.FluidDataStoreRuntime>;\ndeclare function use_old_ClassDeclaration_FluidDataStoreRuntime(\n use: TypeOnly<old.FluidDataStoreRuntime>): void;\nuse_old_ClassDeclaration_FluidDataStoreRuntime(\n get_current_ClassDeclaration_FluidDataStoreRuntime());\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_FluidObjectHandle\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_FluidObjectHandle():\n TypeOnly<old.FluidObjectHandle>;\ndeclare function use_current_ClassDeclaration_FluidObjectHandle(\n use: TypeOnly<current.FluidObjectHandle>): void;\nuse_current_ClassDeclaration_FluidObjectHandle(\n get_old_ClassDeclaration_FluidObjectHandle());\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_FluidObjectHandle\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_FluidObjectHandle():\n TypeOnly<current.FluidObjectHandle>;\ndeclare function use_old_ClassDeclaration_FluidObjectHandle(\n use: TypeOnly<old.FluidObjectHandle>): void;\nuse_old_ClassDeclaration_FluidObjectHandle(\n get_current_ClassDeclaration_FluidObjectHandle());\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_ISharedObjectRegistry\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_ISharedObjectRegistry():\n TypeOnly<old.ISharedObjectRegistry>;\ndeclare function use_current_InterfaceDeclaration_ISharedObjectRegistry(\n use: TypeOnly<current.ISharedObjectRegistry>): void;\nuse_current_InterfaceDeclaration_ISharedObjectRegistry(\n get_old_InterfaceDeclaration_ISharedObjectRegistry());\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_ISharedObjectRegistry\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_ISharedObjectRegistry():\n TypeOnly<current.ISharedObjectRegistry>;\ndeclare function use_old_InterfaceDeclaration_ISharedObjectRegistry(\n use: TypeOnly<old.ISharedObjectRegistry>): void;\nuse_old_InterfaceDeclaration_ISharedObjectRegistry(\n get_current_InterfaceDeclaration_ISharedObjectRegistry());\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* \"VariableDeclaration_mixinRequestHandler\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_VariableDeclaration_mixinRequestHandler():\n TypeOnly<typeof old.mixinRequestHandler>;\ndeclare function use_current_VariableDeclaration_mixinRequestHandler(\n use: TypeOnly<typeof current.mixinRequestHandler>): void;\nuse_current_VariableDeclaration_mixinRequestHandler(\n get_old_VariableDeclaration_mixinRequestHandler());\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* \"VariableDeclaration_mixinRequestHandler\": {\"backCompat\": false}\n*/\ndeclare function get_current_VariableDeclaration_mixinRequestHandler():\n TypeOnly<typeof current.mixinRequestHandler>;\ndeclare function use_old_VariableDeclaration_mixinRequestHandler(\n use: TypeOnly<typeof old.mixinRequestHandler>): void;\nuse_old_VariableDeclaration_mixinRequestHandler(\n get_current_VariableDeclaration_mixinRequestHandler());\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* \"VariableDeclaration_mixinSummaryHandler\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_VariableDeclaration_mixinSummaryHandler():\n TypeOnly<typeof old.mixinSummaryHandler>;\ndeclare function use_current_VariableDeclaration_mixinSummaryHandler(\n use: TypeOnly<typeof current.mixinSummaryHandler>): void;\nuse_current_VariableDeclaration_mixinSummaryHandler(\n get_old_VariableDeclaration_mixinSummaryHandler());\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* \"VariableDeclaration_mixinSummaryHandler\": {\"backCompat\": false}\n*/\ndeclare function get_current_VariableDeclaration_mixinSummaryHandler():\n TypeOnly<typeof current.mixinSummaryHandler>;\ndeclare function use_old_VariableDeclaration_mixinSummaryHandler(\n use: TypeOnly<typeof old.mixinSummaryHandler>): void;\nuse_old_VariableDeclaration_mixinSummaryHandler(\n get_current_VariableDeclaration_mixinSummaryHandler());\n"]}
File without changes