@fluidframework/datastore-definitions 2.0.0-rc.1.0.6 → 2.0.0-rc.2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/.eslintrc.cjs +1 -1
  2. package/CHANGELOG.md +16 -0
  3. package/api-extractor-cjs.json +8 -0
  4. package/api-extractor-lint.json +1 -1
  5. package/api-extractor.json +1 -1
  6. package/api-report/datastore-definitions.api.md +26 -27
  7. package/dist/channel.d.ts +27 -13
  8. package/dist/channel.d.ts.map +1 -1
  9. package/dist/dataStoreRuntime.d.ts +8 -8
  10. package/dist/dataStoreRuntime.d.ts.map +1 -1
  11. package/dist/datastore-definitions-alpha.d.ts +44 -31
  12. package/dist/datastore-definitions-beta.d.ts +44 -31
  13. package/dist/datastore-definitions-public.d.ts +44 -31
  14. package/dist/datastore-definitions-untrimmed.d.ts +44 -31
  15. package/dist/index.d.ts +5 -5
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/package.json +3 -0
  18. package/dist/serializable.d.ts +2 -2
  19. package/dist/serializable.d.ts.map +1 -1
  20. package/dist/tsdoc-metadata.json +1 -1
  21. package/lib/channel.d.ts +272 -0
  22. package/lib/channel.d.ts.map +1 -0
  23. package/lib/dataStoreRuntime.d.ts +95 -0
  24. package/lib/dataStoreRuntime.d.ts.map +1 -0
  25. package/lib/datastore-definitions-alpha.d.ts +496 -0
  26. package/lib/datastore-definitions-beta.d.ts +411 -0
  27. package/lib/datastore-definitions-public.d.ts +411 -0
  28. package/lib/datastore-definitions-untrimmed.d.ts +496 -0
  29. package/lib/index.d.ts +16 -0
  30. package/lib/index.d.ts.map +1 -0
  31. package/lib/jsonable.d.ts +75 -0
  32. package/lib/jsonable.d.ts.map +1 -0
  33. package/lib/serializable.d.ts +26 -0
  34. package/lib/serializable.d.ts.map +1 -0
  35. package/lib/storage.d.ts +24 -0
  36. package/lib/storage.d.ts.map +1 -0
  37. package/package.json +55 -33
  38. package/src/channel.ts +27 -13
  39. package/src/dataStoreRuntime.ts +10 -14
  40. package/src/index.ts +10 -6
  41. package/src/serializable.ts +2 -2
  42. package/tsconfig.cjs.json +7 -0
  43. package/tsconfig.json +3 -5
  44. package/dist/channel.js +0 -7
  45. package/dist/channel.js.map +0 -1
  46. package/dist/dataStoreRuntime.js +0 -7
  47. package/dist/dataStoreRuntime.js.map +0 -1
  48. package/dist/index.js +0 -7
  49. package/dist/index.js.map +0 -1
  50. package/dist/jsonable.js +0 -7
  51. package/dist/jsonable.js.map +0 -1
  52. package/dist/serializable.js +0 -7
  53. package/dist/serializable.js.map +0 -1
  54. package/dist/storage.js +0 -7
  55. package/dist/storage.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/datastore-definitions",
3
- "version": "2.0.0-rc.1.0.6",
3
+ "version": "2.0.0-rc.2.0.1",
4
4
  "description": "Fluid data store definitions",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -11,48 +11,60 @@
11
11
  "license": "MIT",
12
12
  "author": "Microsoft and contributors",
13
13
  "sideEffects": false,
14
- "type": "commonjs",
14
+ "type": "module",
15
15
  "exports": {
16
16
  ".": {
17
- "types": "./dist/index.d.ts",
18
- "default": "./dist/index.js"
17
+ "import": {
18
+ "types": "./lib/index.d.ts"
19
+ },
20
+ "require": {
21
+ "types": "./dist/index.d.ts"
22
+ }
19
23
  },
20
- "./alpha": {
21
- "types": "./dist/datastore-definitions-alpha.d.ts",
22
- "default": "./dist/index.js"
24
+ "./public": {
25
+ "import": {
26
+ "types": "./lib/datastore-definitions-public.d.ts"
27
+ },
28
+ "require": {
29
+ "types": "./dist/datastore-definitions-public.d.ts"
30
+ }
23
31
  },
24
- "./beta": {
25
- "types": "./dist/datastore-definitions-beta.d.ts",
26
- "default": "./dist/index.js"
32
+ "./alpha": {
33
+ "import": {
34
+ "types": "./lib/datastore-definitions-alpha.d.ts"
35
+ },
36
+ "require": {
37
+ "types": "./dist/datastore-definitions-alpha.d.ts"
38
+ }
27
39
  },
28
40
  "./internal": {
29
- "types": "./dist/index.d.ts",
30
- "default": "./dist/index.js"
31
- },
32
- "./public": {
33
- "types": "./dist/datastore-definitions-public.d.ts",
34
- "default": "./dist/index.js"
41
+ "import": {
42
+ "types": "./lib/index.d.ts"
43
+ },
44
+ "require": {
45
+ "types": "./dist/index.d.ts"
46
+ }
35
47
  }
36
48
  },
37
- "main": "dist/index.js",
49
+ "main": "",
38
50
  "types": "dist/index.d.ts",
39
51
  "dependencies": {
40
- "@fluidframework/container-definitions": ">=2.0.0-rc.1.0.6 <2.0.0-rc.1.1.0",
41
- "@fluidframework/core-interfaces": ">=2.0.0-rc.1.0.6 <2.0.0-rc.1.1.0",
42
- "@fluidframework/id-compressor": ">=2.0.0-rc.1.0.6 <2.0.0-rc.1.1.0",
43
- "@fluidframework/protocol-definitions": "^3.1.0",
44
- "@fluidframework/runtime-definitions": ">=2.0.0-rc.1.0.6 <2.0.0-rc.1.1.0"
52
+ "@fluidframework/container-definitions": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
53
+ "@fluidframework/core-interfaces": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
54
+ "@fluidframework/id-compressor": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
55
+ "@fluidframework/protocol-definitions": "^3.2.0",
56
+ "@fluidframework/runtime-definitions": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0"
45
57
  },
46
58
  "devDependencies": {
47
59
  "@arethetypeswrong/cli": "^0.13.3",
48
- "@fluid-tools/build-cli": "^0.29.0",
60
+ "@fluid-tools/build-cli": "^0.34.0",
49
61
  "@fluidframework/build-common": "^2.0.3",
50
- "@fluidframework/build-tools": "^0.29.0",
62
+ "@fluidframework/build-tools": "^0.34.0",
51
63
  "@fluidframework/datastore-definitions-previous": "npm:@fluidframework/datastore-definitions@2.0.0-internal.8.0.0",
52
- "@fluidframework/eslint-config-fluid": "^3.2.0",
53
- "@microsoft/api-extractor": "^7.38.3",
64
+ "@fluidframework/eslint-config-fluid": "^4.0.0",
65
+ "@microsoft/api-extractor": "^7.42.3",
54
66
  "copyfiles": "^2.4.1",
55
- "eslint": "~8.50.0",
67
+ "eslint": "~8.55.0",
56
68
  "prettier": "~3.0.3",
57
69
  "rimraf": "^4.4.0",
58
70
  "typescript": "~5.1.6"
@@ -62,26 +74,36 @@
62
74
  "build:docs": {
63
75
  "dependsOn": [
64
76
  "...",
65
- "api-extractor:commonjs"
77
+ "api-extractor:commonjs",
78
+ "api-extractor:esnext"
66
79
  ],
67
80
  "script": false
68
81
  }
69
82
  }
70
83
  },
71
84
  "typeValidation": {
72
- "broken": {}
85
+ "broken": {
86
+ "InterfaceDeclaration_IFluidDataStoreRuntime": {
87
+ "forwardCompat": false,
88
+ "backCompat": false
89
+ }
90
+ }
73
91
  },
74
92
  "scripts": {
75
93
  "api": "fluid-build . --task api",
76
- "api-extractor:commonjs": "api-extractor run --local",
94
+ "api-extractor:commonjs": "api-extractor run --config ./api-extractor-cjs.json",
95
+ "api-extractor:esnext": "api-extractor run --local",
77
96
  "build": "fluid-build . --task build",
78
97
  "build:compile": "fluid-build . --task compile",
79
98
  "build:docs": "fluid-build . --task api",
80
- "build:test": "tsc --project ./src/test/tsconfig.json",
99
+ "build:esnext": "tsc --project ./tsconfig.json",
100
+ "build:test": "npm run build:test:esm && npm run build:test:cjs",
101
+ "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
102
+ "build:test:esm": "tsc --project ./src/test/tsconfig.json",
81
103
  "check:are-the-types-wrong": "attw --pack . --entrypoints .",
82
104
  "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
83
105
  "ci:build:docs": "api-extractor run",
84
- "clean": "rimraf --glob dist \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp",
106
+ "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp",
85
107
  "eslint": "eslint --format stylish src",
86
108
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
87
109
  "format": "npm run prettier:fix",
@@ -89,7 +111,7 @@
89
111
  "lint:fix": "npm run prettier:fix && npm run eslint:fix",
90
112
  "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
91
113
  "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
92
- "tsc": "tsc",
114
+ "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
93
115
  "typetests:gen": "fluid-type-test-generator",
94
116
  "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
95
117
  }
package/src/channel.ts CHANGED
@@ -3,16 +3,16 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { IFluidHandle, IFluidLoadable } from "@fluidframework/core-interfaces";
7
- import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
8
- import {
6
+ import type { IFluidHandle, IFluidLoadable } from "@fluidframework/core-interfaces";
7
+ import type { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
8
+ import type {
9
9
  IGarbageCollectionData,
10
10
  IExperimentalIncrementalSummaryContext,
11
11
  ISummaryTreeWithStats,
12
12
  ITelemetryContext,
13
13
  } from "@fluidframework/runtime-definitions";
14
- import { IChannelAttributes } from "./storage";
15
- import { IFluidDataStoreRuntime } from "./dataStoreRuntime";
14
+ import type { IChannelAttributes } from "./storage.js";
15
+ import type { IFluidDataStoreRuntime } from "./dataStoreRuntime.js";
16
16
 
17
17
  /**
18
18
  * @public
@@ -147,14 +147,21 @@ export interface IDeltaHandler {
147
147
  reSubmit(message: any, localOpMetadata: unknown): void;
148
148
 
149
149
  /**
150
- * Apply changes from an op. Used when rehydrating an attached container
150
+ * Apply changes from an op just as if a local client has made the change,
151
+ * including submitting the op. Used when rehydrating an attached container
151
152
  * with pending changes. This prepares the SharedObject for seeing an ACK
152
153
  * for the op or resubmitting the op upon reconnection.
153
- * @param message - Contents of a stashed op.
154
- * @returns localMetadata of the op, to be passed to process() or resubmit()
155
- * when the op is ACKed or resubmitted, respectively
154
+ * @param content - Contents of a stashed op.
155
+ * @returns Should return void.
156
+ *
157
+ * @privateRemarks
158
+ * This interface is undergoing changes. Right now it support both the old
159
+ * flow, where just local metadata is returned, and a more ergonomic flow
160
+ * where operations are applied just like local edits, including
161
+ * submission of the op if attached. Soon the old flow will be removed
162
+ * and only the new flow will be supported.
156
163
  */
157
- applyStashedOp(message: any): unknown;
164
+ applyStashedOp(message: any): void;
158
165
 
159
166
  /**
160
167
  * Revert a local op.
@@ -253,9 +260,16 @@ export interface IChannelServices {
253
260
  *
254
261
  * If a collaboration includes a {@link https://fluidframework.com/docs/data-structures/map/ | SharedMap},
255
262
  * the collaborating clients will need to have access to a factory that can produce the `SharedMap` object.
263
+ *
264
+ * @privateRemarks
265
+ * TChannel extends IFluidLoadable instead of TChannel since doing so enables LoadableObjectClass to be covariant over its input parameter.
266
+ * This means that code like fluid-static's `InitialObjects` can be simple and type safe and LoadableObjectClass<any> is not needed.
267
+ * This approach (not requiring TChannel to extend IChannel) also makes it possible for SharedObject's public interfaces to not include IChannel if desired
268
+ * (while still requiring the implementation to implement it).
269
+ *
256
270
  * @public
257
271
  */
258
- export interface IChannelFactory {
272
+ export interface IChannelFactory<out TChannel extends IFluidLoadable = IFluidLoadable> {
259
273
  /**
260
274
  * String representing the type of the factory.
261
275
  */
@@ -286,7 +300,7 @@ export interface IChannelFactory {
286
300
  id: string,
287
301
  services: IChannelServices,
288
302
  channelAttributes: Readonly<IChannelAttributes>,
289
- ): Promise<IChannel>;
303
+ ): Promise<TChannel & IChannel>;
290
304
 
291
305
  /**
292
306
  * Creates a local version of the channel.
@@ -299,5 +313,5 @@ export interface IChannelFactory {
299
313
  * NOTE here - When we attach we need to submit all the pending ops prior to actually doing the attach
300
314
  * for consistency.
301
315
  */
302
- create(runtime: IFluidDataStoreRuntime, id: string): IChannel;
316
+ create(runtime: IFluidDataStoreRuntime, id: string): TChannel & IChannel;
303
317
  }
@@ -3,29 +3,24 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import {
6
+ import type {
7
7
  IEvent,
8
8
  IEventProvider,
9
- ITelemetryLogger,
10
9
  IDisposable,
11
10
  IFluidHandleContext,
12
11
  IFluidHandle,
13
12
  FluidObject,
13
+ ITelemetryBaseLogger,
14
14
  } from "@fluidframework/core-interfaces";
15
- import {
16
- IAudience,
17
- IDeltaManager,
18
- AttachState,
19
- ILoaderOptions,
20
- } from "@fluidframework/container-definitions";
21
- import {
15
+ import type { IAudience, IDeltaManager, AttachState } from "@fluidframework/container-definitions";
16
+ import type {
22
17
  IDocumentMessage,
23
18
  IQuorumClients,
24
19
  ISequencedDocumentMessage,
25
20
  } from "@fluidframework/protocol-definitions";
26
- import { IInboundSignalMessage } from "@fluidframework/runtime-definitions";
27
- import { IIdCompressor } from "@fluidframework/id-compressor";
28
- import { IChannel } from "./channel";
21
+ import type { IInboundSignalMessage } from "@fluidframework/runtime-definitions";
22
+ import type { IIdCompressor } from "@fluidframework/id-compressor";
23
+ import type { IChannel } from "./channel.js";
29
24
 
30
25
  /**
31
26
  * Events emitted by {@link IFluidDataStoreRuntime}.
@@ -53,7 +48,8 @@ export interface IFluidDataStoreRuntime
53
48
  readonly channelsRoutingContext: IFluidHandleContext;
54
49
  readonly objectsRoutingContext: IFluidHandleContext;
55
50
 
56
- readonly options: ILoaderOptions;
51
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
+ readonly options: Record<string | number, any>;
57
53
 
58
54
  readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
59
55
 
@@ -61,7 +57,7 @@ export interface IFluidDataStoreRuntime
61
57
 
62
58
  readonly connected: boolean;
63
59
 
64
- readonly logger: ITelemetryLogger;
60
+ readonly logger: ITelemetryBaseLogger;
65
61
 
66
62
  /**
67
63
  * Indicates the attachment state of the data store to a host service.
package/src/index.ts CHANGED
@@ -10,15 +10,19 @@
10
10
  * @packageDocumentation
11
11
  */
12
12
 
13
- export {
13
+ export type {
14
14
  IChannel,
15
15
  IChannelFactory,
16
16
  IChannelServices,
17
17
  IChannelStorageService,
18
18
  IDeltaConnection,
19
19
  IDeltaHandler,
20
- } from "./channel";
21
- export { IFluidDataStoreRuntime, IFluidDataStoreRuntimeEvents } from "./dataStoreRuntime";
22
- export type { Jsonable, JsonableTypeWith, Internal_InterfaceOfJsonableTypesWith } from "./jsonable";
23
- export { Serializable } from "./serializable";
24
- export { IChannelAttributes } from "./storage";
20
+ } from "./channel.js";
21
+ export type { IFluidDataStoreRuntime, IFluidDataStoreRuntimeEvents } from "./dataStoreRuntime.js";
22
+ export type {
23
+ Jsonable,
24
+ JsonableTypeWith,
25
+ Internal_InterfaceOfJsonableTypesWith,
26
+ } from "./jsonable.js";
27
+ export type { Serializable } from "./serializable.js";
28
+ export type { IChannelAttributes } from "./storage.js";
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { IFluidHandle } from "@fluidframework/core-interfaces";
7
- import { Jsonable } from "./jsonable";
6
+ import type { IFluidHandle } from "@fluidframework/core-interfaces";
7
+ import type { Jsonable } from "./jsonable.js";
8
8
 
9
9
  /**
10
10
  * Used to constrain a type 'T' to types that Fluid can intrinsically serialize. Produces a
@@ -0,0 +1,7 @@
1
+ {
2
+ // This config must be used in a "type": "commonjs" environment. (Use fluid-tsc commonjs.)
3
+ "extends": "./tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "./dist",
6
+ },
7
+ }
package/tsconfig.json CHANGED
@@ -1,12 +1,10 @@
1
1
  {
2
- "extends": [
3
- "../../../common/build/build-common/tsconfig.base.json",
4
- "../../../common/build/build-common/tsconfig.esm-only.json",
5
- ],
2
+ "extends": "../../../common/build/build-common/tsconfig.node16.json",
6
3
  "include": ["src/**/*"],
7
4
  "exclude": ["src/test/**/*"],
8
5
  "compilerOptions": {
9
6
  "rootDir": "./src",
10
- "outDir": "./dist",
7
+ "outDir": "./lib",
8
+ "emitDeclarationOnly": true,
11
9
  },
12
10
  }
package/dist/channel.js DELETED
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=channel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"channel.js","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle, IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIGarbageCollectionData,\n\tIExperimentalIncrementalSummaryContext,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { IChannelAttributes } from \"./storage\";\nimport { IFluidDataStoreRuntime } from \"./dataStoreRuntime\";\n\n/**\n * @public\n */\nexport interface IChannel extends IFluidLoadable {\n\t/**\n\t * A readonly identifier for the channel\n\t */\n\treadonly id: string;\n\n\treadonly attributes: IChannelAttributes;\n\n\t/**\n\t * Generates summary of the channel synchronously. It is called when an `attach message`\n\t * for a local channel is generated. In other words, when the channel is being attached\n\t * to make it visible to other clients.\n\t *\n\t * @remarks\n\t *\n\t * Note: Since the Attach Summary is generated for local channels when making them visible to\n\t * remote clients, they don't have any previous summaries to compare against. For this reason,\n\t * the attach summary cannot contain summary handles (paths to sub-trees or blobs).\n\t * It can, however, contain {@link @fluidframework/protocol-definitions#ISummaryAttachment}\n\t * (handles to blobs uploaded async via the blob manager).\n\t *\n\t * @param fullTree - A flag indicating whether the attempt should generate a full\n\t * summary tree without any handles for unchanged subtrees.\n\t *\n\t * Default: `false`\n\t *\n\t * @param trackState - An optimization for tracking state of objects across summaries. If the state\n\t * of an object did not change since last successful summary, an\n\t * {@link @fluidframework/protocol-definitions#ISummaryHandle} can be used\n\t * instead of re-summarizing it. If this is `false`, the expectation is that you should never\n\t * send an `ISummaryHandle`, since you are not expected to track state.\n\t *\n\t * Note: The goal is to remove the trackState and automatically decided whether the\n\t * handles will be used or not: {@link https://github.com/microsoft/FluidFramework/issues/10455}\n\t *\n\t * Default: `false`\n\t *\n\t * @param telemetryContext - See {@link @fluidframework/runtime-definitions#ITelemetryContext}.\n\t *\n\t * @returns A summary capturing the current state of the channel.\n\t */\n\tgetAttachSummary(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats;\n\n\t/**\n\t * Generates summary of the channel asynchronously.\n\t * This should not be called where the channel can be modified while summarization is in progress.\n\t *\n\t * @param fullTree - flag indicating whether the attempt should generate a full\n\t * summary tree without any handles for unchanged subtrees. It should only be set to true when generating\n\t * a summary from the entire container.\n\t *\n\t * Default: `false`\n\t *\n\t * @param trackState - An optimization for tracking state of objects across summaries. If the state\n\t * of an object did not change since last successful summary, an\n\t * {@link @fluidframework/protocol-definitions#ISummaryHandle} can be used\n\t * instead of re-summarizing it. If this is `false`, the expectation is that you should never\n\t * send an `ISummaryHandle`, since you are not expected to track state.\n\t *\n\t * Default: `false`\n\t *\n\t * Note: The goal is to remove the trackState and automatically decided whether the\n\t * handles will be used or not: {@link https://github.com/microsoft/FluidFramework/issues/10455}\n\t *\n\t * @param telemetryContext - See {@link @fluidframework/runtime-definitions#ITelemetryContext}.\n\t *\n\t * @returns A summary capturing the current state of the channel.\n\t */\n\tsummarize(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): Promise<ISummaryTreeWithStats>;\n\n\t/**\n\t * Checks if the channel is attached to storage.\n\t * @returns True iff the channel is attached.\n\t */\n\tisAttached(): boolean;\n\n\t/**\n\t * Enables the channel to send and receive ops.\n\t * @param services - The services to connect to.\n\t */\n\tconnect(services: IChannelServices): void;\n\n\t/**\n\t * Returns the GC data for this channel. It contains a list of GC nodes that contains references to\n\t * other GC nodes.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tgetGCData(fullGC?: boolean): IGarbageCollectionData;\n}\n\n/**\n * Handler provided by shared data structure to process requests from the runtime.\n * @public\n */\nexport interface IDeltaHandler {\n\t/**\n\t * Processes the op.\n\t * @param message - The message to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprocess: (message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) => void;\n\n\t/**\n\t * State change events to indicate changes to the delta connection\n\t * @param connected - true if connected, false otherwise\n\t */\n\tsetConnectionState(connected: boolean): void;\n\n\t/**\n\t * Called when the runtime asks the client to resubmit an op. This may be because the Container reconnected and\n\t * this op was not acked.\n\t * The client can choose to resubmit the same message, submit different / multiple messages or not submit anything\n\t * at all.\n\t * @param message - The original message that was submitted.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\treSubmit(message: any, localOpMetadata: unknown): void;\n\n\t/**\n\t * Apply changes from an op. Used when rehydrating an attached container\n\t * with pending changes. This prepares the SharedObject for seeing an ACK\n\t * for the op or resubmitting the op upon reconnection.\n\t * @param message - Contents of a stashed op.\n\t * @returns localMetadata of the op, to be passed to process() or resubmit()\n\t * when the op is ACKed or resubmitted, respectively\n\t */\n\tapplyStashedOp(message: any): unknown;\n\n\t/**\n\t * Revert a local op.\n\t * @param message - The original message that was submitted.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\trollback?(message: any, localOpMetadata: unknown): void;\n}\n\n/**\n * Interface to represent a connection to a delta notification stream.\n * @public\n */\nexport interface IDeltaConnection {\n\tconnected: boolean;\n\n\t/**\n\t * Send new messages to the server.\n\t * @param messageContent - The content of the message to be sent.\n\t * @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime\n\t * and not sent to the server. It will be provided back when this message is acknowledged by the server. It will\n\t * also be provided back when asked to resubmit the message.\n\t */\n\tsubmit(messageContent: any, localOpMetadata: unknown): void;\n\n\t/**\n\t * Attaches a message handler to the delta connection\n\t */\n\tattach(handler: IDeltaHandler): void;\n\n\t/**\n\t * Indicates that the channel is dirty and needs to be part of the summary. It is called by a SharedSummaryBlock\n\t * that needs to be part of the summary but does not generate ops.\n\t */\n\tdirty(): void;\n\n\t/**\n\t * @deprecated There is no replacement for this, its functionality is no longer needed at this layer.\n\t * It will be removed in a future release, sometime after 2.0.0-internal.8.0.0\n\t *\n\t * Called when a new outbound reference is added to another node. This is used by garbage collection to identify\n\t * all references added in the system.\n\t * @param srcHandle - The handle of the node that added the reference.\n\t * @param outboundHandle - The handle of the outbound node that is referenced.\n\t */\n\taddedGCOutboundReference?(srcHandle: IFluidHandle, outboundHandle: IFluidHandle): void;\n}\n\n/**\n * Storage services to read the objects at a given path.\n * @public\n */\nexport interface IChannelStorageService {\n\t/**\n\t * Reads the object contained at the given path. Returns a buffer representation for the object.\n\t */\n\treadBlob(path: string): Promise<ArrayBufferLike>;\n\n\t/**\n\t * Determines if there is an object contained at the given path.\n\t */\n\tcontains(path: string): Promise<boolean>;\n\n\t/**\n\t * Lists the blobs that exist at a specific path.\n\t */\n\tlist(path: string): Promise<string[]>;\n}\n\n/**\n * Storage services to read the objects at a given path using the given delta connection.\n * @public\n */\nexport interface IChannelServices {\n\tdeltaConnection: IDeltaConnection;\n\n\tobjectStorage: IChannelStorageService;\n}\n\n/**\n * Definitions of a channel factory.\n *\n * @remarks\n *\n * The runtime must be able to produce \"channels\" of the correct in-memory object type for the collaborative session.\n * Here \"channels\" are typically distributed data structures (DDSs).\n *\n * The runtime will consult with a registry of such factories during\n * {@link https://fluidframework.com/docs/build/containers/ | Container} load and when receiving \"attach\" operations\n * (ops), which indicate a new instance of a channel being introduced to the collaboration session, to produce the\n * appropriate in-memory object.\n *\n * Factories follow a common model but enable custom behavior.\n *\n * @example\n *\n * If a collaboration includes a {@link https://fluidframework.com/docs/data-structures/map/ | SharedMap},\n * the collaborating clients will need to have access to a factory that can produce the `SharedMap` object.\n * @public\n */\nexport interface IChannelFactory {\n\t/**\n\t * String representing the type of the factory.\n\t */\n\treadonly type: string;\n\n\t/**\n\t * Attributes of the channel.\n\t */\n\treadonly attributes: IChannelAttributes;\n\n\t/**\n\t * Loads the given channel. This call is only ever invoked internally as the only thing\n\t * that is ever directly loaded is the document itself. Load will then only be called on documents that\n\t * were created and added to a channel.\n\t * @param runtime - Data store runtime containing state/info/helper methods about the data store.\n\t * @param id - ID of the channel.\n\t * @param services - Services to read objects at a given path using the delta connection.\n\t * @param channelAttributes - The attributes for the the channel to be loaded.\n\t * @returns The loaded object\n\t *\n\t * @privateRemarks\n\t * Thought: should the storage object include the version information and limit access to just files\n\t * for the given object? The latter seems good in general. But both are probably good things. We then just\n\t * need a way to allow the document to provide later storage for the object.\n\t */\n\tload(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tchannelAttributes: Readonly<IChannelAttributes>,\n\t): Promise<IChannel>;\n\n\t/**\n\t * Creates a local version of the channel.\n\t * Calling attach on the object later will insert it into the object stream.\n\t * @param runtime - The runtime the new object will be associated with\n\t * @param id - The unique ID of the new object\n\t * @returns The newly created object.\n\t *\n\t * @privateRemarks\n\t * NOTE here - When we attach we need to submit all the pending ops prior to actually doing the attach\n\t * for consistency.\n\t */\n\tcreate(runtime: IFluidDataStoreRuntime, id: string): IChannel;\n}\n"]}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=dataStoreRuntime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dataStoreRuntime.js","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIEvent,\n\tIEventProvider,\n\tITelemetryLogger,\n\tIDisposable,\n\tIFluidHandleContext,\n\tIFluidHandle,\n\tFluidObject,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tIAudience,\n\tIDeltaManager,\n\tAttachState,\n\tILoaderOptions,\n} from \"@fluidframework/container-definitions\";\nimport {\n\tIDocumentMessage,\n\tIQuorumClients,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport { IInboundSignalMessage } from \"@fluidframework/runtime-definitions\";\nimport { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport { IChannel } from \"./channel\";\n\n/**\n * Events emitted by {@link IFluidDataStoreRuntime}.\n * @public\n */\nexport interface IFluidDataStoreRuntimeEvents extends IEvent {\n\t(event: \"disconnected\" | \"dispose\" | \"attaching\" | \"attached\", listener: () => void);\n\t(event: \"op\", listener: (message: ISequencedDocumentMessage) => void);\n\t(event: \"signal\", listener: (message: IInboundSignalMessage, local: boolean) => void);\n\t(event: \"connected\", listener: (clientId: string) => void);\n}\n\n/**\n * Represents the runtime for the data store. Contains helper functions/state of the data store.\n * @public\n */\nexport interface IFluidDataStoreRuntime\n\textends IEventProvider<IFluidDataStoreRuntimeEvents>,\n\t\tIDisposable {\n\treadonly id: string;\n\n\treadonly IFluidHandleContext: IFluidHandleContext;\n\n\treadonly rootRoutingContext: IFluidHandleContext;\n\treadonly channelsRoutingContext: IFluidHandleContext;\n\treadonly objectsRoutingContext: IFluidHandleContext;\n\n\treadonly options: ILoaderOptions;\n\n\treadonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n\n\treadonly clientId: string | undefined;\n\n\treadonly connected: boolean;\n\n\treadonly logger: ITelemetryLogger;\n\n\t/**\n\t * Indicates the attachment state of the data store to a host service.\n\t */\n\treadonly attachState: AttachState;\n\n\treadonly idCompressor?: IIdCompressor;\n\n\t/**\n\t * Returns the channel with the given id\n\t */\n\tgetChannel(id: string): Promise<IChannel>;\n\n\t/**\n\t * Invokes the given callback and expects that no ops are submitted\n\t * until execution finishes. If an op is submitted, an error will be raised.\n\t *\n\t * Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`\n\t *\n\t * @param callback - the callback to be invoked\n\t */\n\tensureNoDataModelChanges<T>(callback: () => T): T;\n\n\t/**\n\t * Creates a new channel of the given type.\n\t * @param id - ID of the channel to be created. A unique ID will be generated if left undefined.\n\t * @param type - Type of the channel.\n\t */\n\tcreateChannel(id: string | undefined, type: string): IChannel;\n\n\t/**\n\t * Bind the channel with the data store runtime. If the runtime\n\t * is attached then we attach the channel to make it live.\n\t */\n\tbindChannel(channel: IChannel): void;\n\n\t// Blob related calls\n\t/**\n\t * Api to upload a blob of data.\n\t * @param blob - blob to be uploaded.\n\t */\n\tuploadBlob(blob: ArrayBufferLike, signal?: AbortSignal): Promise<IFluidHandle<ArrayBufferLike>>;\n\n\t/**\n\t * Submits the signal to be sent to other clients.\n\t * @param type - Type of the signal.\n\t * @param content - Content of the signal.\n\t * @param targetClientId - When specified, the signal is only sent to the provided client id.\n\t */\n\tsubmitSignal(type: string, content: any, targetClientId?: string): void;\n\n\t/**\n\t * Returns the current quorum.\n\t */\n\tgetQuorum(): IQuorumClients;\n\n\t/**\n\t * Returns the current audience.\n\t */\n\tgetAudience(): IAudience;\n\n\t/**\n\t * Resolves when a local data store is attached.\n\t */\n\twaitAttached(): Promise<void>;\n\n\t/**\n\t * Exposes a handle to the root object / entryPoint of the data store. Use this as the primary way of interacting\n\t * with it.\n\t */\n\treadonly entryPoint: IFluidHandle<FluidObject>;\n}\n"]}
package/dist/index.js DELETED
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This library defines the interfaces required to implement and/or communicate\n * with a data store.\n *\n * @packageDocumentation\n */\n\nexport {\n\tIChannel,\n\tIChannelFactory,\n\tIChannelServices,\n\tIChannelStorageService,\n\tIDeltaConnection,\n\tIDeltaHandler,\n} from \"./channel\";\nexport { IFluidDataStoreRuntime, IFluidDataStoreRuntimeEvents } from \"./dataStoreRuntime\";\nexport type { Jsonable, JsonableTypeWith, Internal_InterfaceOfJsonableTypesWith } from \"./jsonable\";\nexport { Serializable } from \"./serializable\";\nexport { IChannelAttributes } from \"./storage\";\n"]}
package/dist/jsonable.js DELETED
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=jsonable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsonable.js","sourceRoot":"","sources":["../src/jsonable.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Type constraint for types that are likely serializable as JSON or have a custom\n * alternate type.\n *\n * @remarks\n * Use `JsonableTypeWith<never>` for just JSON serializable types.\n * See {@link Jsonable} for serialization pitfalls.\n *\n * @privateRemarks\n * Perfer using `Jsonable<unknown>` over this type that is an implementation detail.\n * @alpha\n */\nexport type JsonableTypeWith<T> =\n\t| undefined\n\t| null\n\t| boolean\n\t| number\n\t| string\n\t| T\n\t| Internal_InterfaceOfJsonableTypesWith<T>\n\t| ArrayLike<JsonableTypeWith<T>>;\n\n/**\n * @remarks\n * This type is a kludge and not intended for general use.\n *\n * @privateRemarks\n * Internal type testing for compatibility uses TypeOnly filter which cannot handle recursive \"pure\" types.\n * This interface along with ArrayLike above avoids pure type recursion issues, but introduces a limitation on\n * the ability of {@link Jsonable} to detect array-like types that are not handled naively ({@link JSON.stringify}).\n * The TypeOnly filter is not useful for {@link JsonableTypeWith}; so, if type testing improves, this can be removed.\n * @alpha\n */\nexport interface Internal_InterfaceOfJsonableTypesWith<T> {\n\t[index: string | number]: JsonableTypeWith<T>;\n}\n\n/**\n * Used to constrain a type `T` to types that are serializable as JSON.\n * Produces a compile-time error if `T` contains non-Jsonable members.\n *\n * @remarks\n * Note that this does NOT prevent using of values with non-json compatible data,\n * it only prevents using values with types that include non-json compatible data.\n * This means that one can, for example, pass in a value typed with json compatible\n * interface into this function,\n * that could actually be a class with lots on non-json compatible fields and methods.\n *\n * Important: `T extends Jsonable<T>` is incorrect (does not even compile).\n *\n * The optional 'TReplaced' parameter may be used to permit additional leaf types to support\n * situations where a `replacer` is used to handle special values (e.g., `Jsonable<{ x: IFluidHandle }, IFluidHandle>`).\n *\n * Note that `Jsonable<T>` does not protect against the following pitfalls when serializing with JSON.stringify():\n *\n * - `undefined` properties on objects are omitted (i.e., properties become undefined instead of equal to undefined).\n *\n * - When `undefined` appears as the root object or as an array element it is coerced to `null`.\n *\n * - Non-finite numbers (`NaN`, `+/-Infinity`) are also coerced to `null`.\n *\n * - prototypes and non-enumerable properties are lost.\n *\n * - `ArrayLike` types that are not arrays and are serialized as `{ length: number }`.\n *\n * Also, `Jsonable<T>` does not prevent the construction of circular references.\n *\n * Using `Jsonable<unknown>` or `Jsonable<any>` is a type alias for\n * {@link JsonableTypeWith}`<never>` and should not be used if precise type safety is desired.\n *\n * @example Typical usage\n *\n * ```typescript\n * function foo<T>(value: Jsonable<T>) { ... }\n * ```\n * @alpha\n */\nexport type Jsonable<T, TReplaced = never> = /* test for 'any' */ boolean extends (\n\tT extends never ? true : false\n)\n\t? /* 'any' => */ JsonableTypeWith<TReplaced>\n\t: /* test for 'unknown' */ unknown extends T\n\t? /* 'unknown' => */ JsonableTypeWith<TReplaced>\n\t: /* test for Jsonable primitive types */ T extends\n\t\t\t| undefined /* is not serialized */\n\t\t\t| null\n\t\t\t| boolean\n\t\t\t| number\n\t\t\t| string\n\t\t\t| TReplaced\n\t? /* primitive types => */ T\n\t: // eslint-disable-next-line @typescript-eslint/ban-types\n\t/* test for not a function */ Extract<T, Function> extends never\n\t? /* not a function => => test for object */ T extends object\n\t\t? /* object => test for array */ T extends (infer U)[] // prefer ArrayLike test to catch non-array array-like types\n\t\t\t? /* array => */ Jsonable<U, TReplaced>[]\n\t\t\t: /* property bag => */ {\n\t\t\t\t\t[K in keyof T]: Extract<K, symbol> extends never\n\t\t\t\t\t\t? Jsonable<T[K], TReplaced>\n\t\t\t\t\t\t: never;\n\t\t\t }\n\t\t: /* not an object => */ never\n\t: /* function => */ never;\n"]}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=serializable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serializable.js","sourceRoot":"","sources":["../src/serializable.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { Jsonable } from \"./jsonable\";\n\n/**\n * Used to constrain a type 'T' to types that Fluid can intrinsically serialize. Produces a\n * compile-time error if `T` contains non-serializable members.\n *\n * @remarks\n * See Jsonable for caveats regarding serialization of `undefined`, non-finite numbers,\n * and circular references.\n *\n * Important: `T extends Serializable<T>` is generally incorrect.\n * (Any value of `T` extends the serializable subset of itself.)\n *\n * @example Typical usage\n *\n * ```typescript\n * function serialize<T>(value: Serializable<T>) { ... }\n * ```\n * @alpha\n */\nexport type Serializable<T> = Jsonable<T, IFluidHandle>;\n"]}
package/dist/storage.js DELETED
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=storage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Represents the attributes of a channel/DDS.\n * @public\n */\nexport interface IChannelAttributes {\n\t/**\n\t * Type name of the DDS for factory look up with ISharedObjectRegistry\n\t */\n\treadonly type: string;\n\n\t/**\n\t * Format version of the snapshot\n\t * Currently, only use to display a debug message if the version is incompatible\n\t */\n\treadonly snapshotFormatVersion: string;\n\n\t/**\n\t * The package version of the code of the DDS, for debug only\n\t */\n\treadonly packageVersion?: string;\n}\n"]}