@fluidframework/datastore 2.0.0-internal.7.3.0 → 2.0.0-internal.7.4.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.
- package/CHANGELOG.md +4 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +9 -1
- package/api-report/datastore.api.md +7 -6
- package/dist/dataStoreRuntime.d.ts +14 -8
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +40 -11
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/datastore-alpha.d.ts +270 -0
- package/dist/datastore-beta.d.ts +87 -0
- package/dist/datastore-public.d.ts +87 -0
- package/dist/datastore-untrimmed.d.ts +337 -0
- package/dist/fluidHandle.d.ts +1 -2
- package/dist/fluidHandle.d.ts.map +1 -1
- package/dist/fluidHandle.js +1 -2
- package/dist/fluidHandle.js.map +1 -1
- package/dist/localChannelContext.d.ts +2 -2
- package/dist/localChannelContext.d.ts.map +1 -1
- package/dist/localChannelContext.js +4 -9
- package/dist/localChannelContext.js.map +1 -1
- package/lib/dataStoreRuntime.d.ts +14 -8
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +40 -11
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/datastore-alpha.d.ts +270 -0
- package/lib/datastore-beta.d.ts +87 -0
- package/lib/datastore-public.d.ts +87 -0
- package/lib/datastore-untrimmed.d.ts +337 -0
- package/lib/fluidHandle.d.ts +1 -2
- package/lib/fluidHandle.d.ts.map +1 -1
- package/lib/fluidHandle.js +1 -2
- package/lib/fluidHandle.js.map +1 -1
- package/lib/localChannelContext.d.ts +2 -2
- package/lib/localChannelContext.d.ts.map +1 -1
- package/lib/localChannelContext.js +4 -9
- package/lib/localChannelContext.js.map +1 -1
- package/package.json +42 -19
- package/src/dataStoreRuntime.ts +53 -20
- package/src/fluidHandle.ts +1 -2
- package/src/localChannelContext.ts +3 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/datastore",
|
|
3
|
-
"version": "2.0.0-internal.7.
|
|
3
|
+
"version": "2.0.0-internal.7.4.1",
|
|
4
4
|
"description": "Fluid data store implementation",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,33 +35,35 @@
|
|
|
35
35
|
"temp-directory": "nyc/.nyc_output"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluid-internal/client-utils": ">=2.0.0-internal.7.
|
|
39
|
-
"@fluidframework/container-definitions": ">=2.0.0-internal.7.
|
|
40
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.
|
|
41
|
-
"@fluidframework/core-utils": ">=2.0.0-internal.7.
|
|
42
|
-
"@fluidframework/datastore-definitions": ">=2.0.0-internal.7.
|
|
43
|
-
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.
|
|
44
|
-
"@fluidframework/driver-utils": ">=2.0.0-internal.7.
|
|
38
|
+
"@fluid-internal/client-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
39
|
+
"@fluidframework/container-definitions": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
40
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
41
|
+
"@fluidframework/core-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
42
|
+
"@fluidframework/datastore-definitions": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
43
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
44
|
+
"@fluidframework/driver-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
45
45
|
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
46
|
-
"@fluidframework/runtime-definitions": ">=2.0.0-internal.7.
|
|
47
|
-
"@fluidframework/runtime-utils": ">=2.0.0-internal.7.
|
|
48
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.
|
|
46
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
47
|
+
"@fluidframework/runtime-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
48
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
49
49
|
"lodash": "^4.17.21",
|
|
50
50
|
"uuid": "^9.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
+
"@arethetypeswrong/cli": "^0.13.3",
|
|
53
54
|
"@fluid-tools/build-cli": "^0.28.0",
|
|
54
55
|
"@fluidframework/build-common": "^2.0.3",
|
|
55
56
|
"@fluidframework/build-tools": "^0.28.0",
|
|
56
57
|
"@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.0.0-internal.7.2.0",
|
|
57
58
|
"@fluidframework/eslint-config-fluid": "^3.1.0",
|
|
58
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.
|
|
59
|
-
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.7.
|
|
59
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
60
|
+
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
60
61
|
"@microsoft/api-extractor": "^7.38.3",
|
|
61
62
|
"@types/mocha": "^9.1.1",
|
|
62
|
-
"@types/node": "^
|
|
63
|
+
"@types/node": "^18.19.0",
|
|
63
64
|
"@types/uuid": "^9.0.2",
|
|
64
65
|
"c8": "^7.7.1",
|
|
66
|
+
"copyfiles": "^2.4.1",
|
|
65
67
|
"cross-env": "^7.0.3",
|
|
66
68
|
"eslint": "~8.50.0",
|
|
67
69
|
"mocha": "^10.2.0",
|
|
@@ -72,25 +74,46 @@
|
|
|
72
74
|
"rimraf": "^4.4.0",
|
|
73
75
|
"typescript": "~5.1.6"
|
|
74
76
|
},
|
|
77
|
+
"fluidBuild": {
|
|
78
|
+
"tasks": {
|
|
79
|
+
"build:docs": {
|
|
80
|
+
"dependsOn": [
|
|
81
|
+
"...",
|
|
82
|
+
"api-extractor:commonjs",
|
|
83
|
+
"api-extractor:esnext"
|
|
84
|
+
],
|
|
85
|
+
"script": false
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
75
89
|
"typeValidation": {
|
|
76
|
-
"broken": {
|
|
90
|
+
"broken": {
|
|
91
|
+
"ClassDeclaration_FluidDataStoreRuntime": {
|
|
92
|
+
"forwardCompat": false
|
|
93
|
+
}
|
|
94
|
+
}
|
|
77
95
|
},
|
|
78
96
|
"scripts": {
|
|
97
|
+
"api": "fluid-build . --task api",
|
|
98
|
+
"api-extractor:commonjs": "api-extractor run --local",
|
|
99
|
+
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
|
|
79
100
|
"build": "fluid-build . --task build",
|
|
80
101
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
81
102
|
"build:compile": "fluid-build . --task compile",
|
|
82
|
-
"build:docs": "
|
|
103
|
+
"build:docs": "fluid-build . --task api",
|
|
83
104
|
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
84
105
|
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
106
|
+
"check:are-the-types-wrong": "attw --pack",
|
|
107
|
+
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
85
108
|
"ci:build:docs": "api-extractor run",
|
|
86
109
|
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
87
110
|
"eslint": "eslint --format stylish src",
|
|
88
111
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
89
112
|
"format": "npm run prettier:fix",
|
|
90
|
-
"lint": "npm run prettier && npm run eslint",
|
|
113
|
+
"lint": "npm run prettier && npm run check:release-tags && npm run eslint",
|
|
91
114
|
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
92
|
-
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
93
|
-
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
115
|
+
"prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
116
|
+
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
94
117
|
"test": "npm run test:mocha",
|
|
95
118
|
"test:coverage": "c8 npm test",
|
|
96
119
|
"test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test --exit -r node_modules/@fluidframework/mocha-test-setup",
|
package/src/dataStoreRuntime.ts
CHANGED
|
@@ -82,7 +82,7 @@ import { RemoteChannelContext } from "./remoteChannelContext";
|
|
|
82
82
|
import { FluidObjectHandle } from "./fluidHandle";
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
* @
|
|
85
|
+
* @alpha
|
|
86
86
|
*/
|
|
87
87
|
export enum DataStoreMessageType {
|
|
88
88
|
// Creates a new channel
|
|
@@ -91,7 +91,7 @@ export enum DataStoreMessageType {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
* @
|
|
94
|
+
* @alpha
|
|
95
95
|
*/
|
|
96
96
|
export interface ISharedObjectRegistry {
|
|
97
97
|
// TODO consider making this async. A consequence is that either the creation of a distributed data type
|
|
@@ -101,8 +101,7 @@ export interface ISharedObjectRegistry {
|
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
103
|
* Base data store class
|
|
104
|
-
*
|
|
105
|
-
* @public
|
|
104
|
+
* @alpha
|
|
106
105
|
*/
|
|
107
106
|
export class FluidDataStoreRuntime
|
|
108
107
|
extends TypedEventEmitter<IFluidDataStoreRuntimeEvents>
|
|
@@ -432,34 +431,70 @@ export class FluidDataStoreRuntime
|
|
|
432
431
|
return context.getChannel();
|
|
433
432
|
}
|
|
434
433
|
|
|
435
|
-
|
|
434
|
+
/**
|
|
435
|
+
* Api which allows caller to create the channel first and then add it to the runtime.
|
|
436
|
+
* The channel type should be present in the registry, otherwise the runtime would reject
|
|
437
|
+
* the channel. Also the runtime used to create the channel object should be same to which
|
|
438
|
+
* it is added.
|
|
439
|
+
* @param channel - channel which needs to be added to the runtime.
|
|
440
|
+
*/
|
|
441
|
+
public addChannel(channel: IChannel): void {
|
|
442
|
+
const id = channel.id;
|
|
436
443
|
if (id.includes("/")) {
|
|
437
444
|
throw new UsageError(`Id cannot contain slashes: ${id}`);
|
|
438
445
|
}
|
|
439
446
|
|
|
440
447
|
this.verifyNotClosed();
|
|
441
448
|
|
|
449
|
+
assert(!this.contexts.has(id), 0x865 /* addChannel() with existing ID */);
|
|
450
|
+
|
|
451
|
+
const type = channel.attributes.type;
|
|
452
|
+
const factory = this.sharedObjectRegistry.get(channel.attributes.type);
|
|
453
|
+
if (factory === undefined) {
|
|
454
|
+
throw new Error(`Channel Factory ${type} not registered`);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
this.createChannelContext(channel);
|
|
458
|
+
// Channels (DDS) should not be created in summarizer client.
|
|
459
|
+
this.identifyLocalChangeInSummarizer("DDSCreatedInSummarizer", id, type);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
public createChannel(id: string = uuid(), type: string): IChannel {
|
|
463
|
+
if (id.includes("/")) {
|
|
464
|
+
throw new UsageError(`Id cannot contain slashes: ${id}`);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
this.verifyNotClosed();
|
|
442
468
|
assert(!this.contexts.has(id), 0x179 /* "createChannel() with existing ID" */);
|
|
443
|
-
|
|
469
|
+
|
|
470
|
+
assert(type !== undefined, 0x209 /* "Factory Type should be defined" */);
|
|
471
|
+
const factory = this.sharedObjectRegistry.get(type);
|
|
472
|
+
if (factory === undefined) {
|
|
473
|
+
throw new Error(`Channel Factory ${type} not registered`);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
const channel = factory.create(this, id);
|
|
477
|
+
this.createChannelContext(channel);
|
|
478
|
+
// Channels (DDS) should not be created in summarizer client.
|
|
479
|
+
this.identifyLocalChangeInSummarizer("DDSCreatedInSummarizer", id, type);
|
|
480
|
+
return channel;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
private createChannelContext(channel: IChannel) {
|
|
484
|
+
this.notBoundedChannelContextSet.add(channel.id);
|
|
444
485
|
const context = new LocalChannelContext(
|
|
445
|
-
|
|
446
|
-
this.sharedObjectRegistry,
|
|
447
|
-
type,
|
|
486
|
+
channel,
|
|
448
487
|
this,
|
|
449
488
|
this.dataStoreContext,
|
|
450
489
|
this.dataStoreContext.storage,
|
|
451
490
|
this.logger,
|
|
452
|
-
(content, localOpMetadata) =>
|
|
491
|
+
(content, localOpMetadata) =>
|
|
492
|
+
this.submitChannelOp(channel.id, content, localOpMetadata),
|
|
453
493
|
(address: string) => this.setChannelDirty(address),
|
|
454
494
|
(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>
|
|
455
495
|
this.addedGCOutboundReference(srcHandle, outboundHandle),
|
|
456
496
|
);
|
|
457
|
-
this.contexts.set(id, context);
|
|
458
|
-
|
|
459
|
-
// Channels (DDS) should not be created in summarizer client.
|
|
460
|
-
this.identifyLocalChangeInSummarizer("DDSCreatedInSummarizer", id, type);
|
|
461
|
-
|
|
462
|
-
return context.channel;
|
|
497
|
+
this.contexts.set(channel.id, context);
|
|
463
498
|
}
|
|
464
499
|
|
|
465
500
|
/**
|
|
@@ -1128,8 +1163,7 @@ export class FluidDataStoreRuntime
|
|
|
1128
1163
|
* Request handler is only called when data store can't resolve request, i.e. for custom requests.
|
|
1129
1164
|
* @param Base - base class, inherits from FluidDataStoreRuntime
|
|
1130
1165
|
* @param requestHandler - request handler to mix in
|
|
1131
|
-
*
|
|
1132
|
-
* @public
|
|
1166
|
+
* @internal
|
|
1133
1167
|
*/
|
|
1134
1168
|
export const mixinRequestHandler = (
|
|
1135
1169
|
requestHandler: (request: IRequest, runtime: FluidDataStoreRuntime) => Promise<IResponse>,
|
|
@@ -1150,8 +1184,7 @@ export const mixinRequestHandler = (
|
|
|
1150
1184
|
* @param handler - handler that returns info about blob to be added to summary.
|
|
1151
1185
|
* Or undefined not to add anything to summary.
|
|
1152
1186
|
* @param Base - base class, inherits from FluidDataStoreRuntime
|
|
1153
|
-
*
|
|
1154
|
-
* @public
|
|
1187
|
+
* @internal
|
|
1155
1188
|
*/
|
|
1156
1189
|
export const mixinSummaryHandler = (
|
|
1157
1190
|
handler: (
|
package/src/fluidHandle.ts
CHANGED
|
@@ -8,8 +8,7 @@ import { generateHandleContextPath } from "@fluidframework/runtime-utils";
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Handle for a shared {@link @fluidframework/core-interfaces#FluidObject}.
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
11
|
+
* @internal
|
|
13
12
|
*/
|
|
14
13
|
export class FluidObjectHandle<T extends FluidObject = FluidObject> implements IFluidHandle {
|
|
15
14
|
private readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();
|
|
@@ -280,11 +280,8 @@ export class RehydratedLocalChannelContext extends LocalChannelContextBase {
|
|
|
280
280
|
|
|
281
281
|
export class LocalChannelContext extends LocalChannelContextBase {
|
|
282
282
|
private readonly dirtyFn: () => void;
|
|
283
|
-
public readonly channel: IChannel;
|
|
284
283
|
constructor(
|
|
285
|
-
|
|
286
|
-
registry: ISharedObjectRegistry,
|
|
287
|
-
type: string,
|
|
284
|
+
public readonly channel: IChannel,
|
|
288
285
|
runtime: IFluidDataStoreRuntime,
|
|
289
286
|
dataStoreContext: IFluidDataStoreContext,
|
|
290
287
|
storageService: IDocumentStorageService,
|
|
@@ -293,14 +290,8 @@ export class LocalChannelContext extends LocalChannelContextBase {
|
|
|
293
290
|
dirtyFn: (address: string) => void,
|
|
294
291
|
addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,
|
|
295
292
|
) {
|
|
296
|
-
assert(type !== undefined, 0x209 /* "Factory Type should be defined" */);
|
|
297
|
-
const factory = registry.get(type);
|
|
298
|
-
if (factory === undefined) {
|
|
299
|
-
throw new Error(`Channel Factory ${type} not registered`);
|
|
300
|
-
}
|
|
301
|
-
const channel = factory.create(runtime, id);
|
|
302
293
|
super(
|
|
303
|
-
id,
|
|
294
|
+
channel.id,
|
|
304
295
|
runtime,
|
|
305
296
|
new Lazy(() => {
|
|
306
297
|
return createChannelServiceEndpoints(
|
|
@@ -318,7 +309,7 @@ export class LocalChannelContext extends LocalChannelContextBase {
|
|
|
318
309
|
this.channel = channel;
|
|
319
310
|
|
|
320
311
|
this.dirtyFn = () => {
|
|
321
|
-
dirtyFn(id);
|
|
312
|
+
dirtyFn(channel.id);
|
|
322
313
|
};
|
|
323
314
|
}
|
|
324
315
|
}
|