@fluidframework/runtime-definitions 1.4.0-115997 → 2.0.0-dev-rc.1.0.0.224419

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 +12 -0
  2. package/CHANGELOG.md +330 -0
  3. package/README.md +43 -7
  4. package/api-extractor-lint.json +4 -0
  5. package/api-extractor.json +2 -2
  6. package/api-report/runtime-definitions.api.md +474 -0
  7. package/dist/attribution.d.ts +71 -0
  8. package/dist/attribution.d.ts.map +1 -0
  9. package/dist/attribution.js +7 -0
  10. package/dist/attribution.js.map +1 -0
  11. package/dist/dataStoreContext.d.ts +114 -61
  12. package/dist/dataStoreContext.d.ts.map +1 -1
  13. package/dist/dataStoreContext.js +27 -5
  14. package/dist/dataStoreContext.js.map +1 -1
  15. package/dist/dataStoreFactory.d.ts +7 -0
  16. package/dist/dataStoreFactory.d.ts.map +1 -1
  17. package/dist/dataStoreFactory.js +3 -0
  18. package/dist/dataStoreFactory.js.map +1 -1
  19. package/dist/dataStoreRegistry.d.ts +14 -4
  20. package/dist/dataStoreRegistry.d.ts.map +1 -1
  21. package/dist/dataStoreRegistry.js +3 -0
  22. package/dist/dataStoreRegistry.js.map +1 -1
  23. package/dist/garbageCollection.d.ts +35 -10
  24. package/dist/garbageCollection.d.ts.map +1 -1
  25. package/dist/garbageCollection.js +25 -3
  26. package/dist/garbageCollection.js.map +1 -1
  27. package/dist/index.d.ts +52 -6
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +26 -16
  30. package/dist/index.js.map +1 -1
  31. package/dist/protocol.d.ts +10 -3
  32. package/dist/protocol.d.ts.map +1 -1
  33. package/dist/protocol.js.map +1 -1
  34. package/dist/runtime-definitions-alpha.d.ts +993 -0
  35. package/dist/runtime-definitions-beta.d.ts +264 -0
  36. package/dist/runtime-definitions-public.d.ts +264 -0
  37. package/dist/runtime-definitions-untrimmed.d.ts +1068 -0
  38. package/dist/summary.d.ts +138 -70
  39. package/dist/summary.d.ts.map +1 -1
  40. package/dist/summary.js +13 -1
  41. package/dist/summary.js.map +1 -1
  42. package/dist/tsdoc-metadata.json +11 -0
  43. package/package.json +96 -42
  44. package/prettier.config.cjs +8 -0
  45. package/src/aliasing.md +42 -0
  46. package/src/attribution.ts +78 -0
  47. package/src/dataStoreContext.ts +432 -388
  48. package/src/dataStoreFactory.ts +21 -11
  49. package/src/dataStoreRegistry.ts +18 -6
  50. package/src/garbageCollection.ts +38 -15
  51. package/src/index.ts +111 -6
  52. package/src/protocol.ts +46 -38
  53. package/src/summary.ts +298 -225
  54. package/tsconfig.json +10 -12
  55. package/.eslintrc.js +0 -13
@@ -0,0 +1,474 @@
1
+ ## API Report File for "@fluidframework/runtime-definitions"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { AttachState } from '@fluidframework/container-definitions';
8
+ import { FluidObject } from '@fluidframework/core-interfaces';
9
+ import { IAudience } from '@fluidframework/container-definitions';
10
+ import { IClientDetails } from '@fluidframework/protocol-definitions';
11
+ import { IdCompressor } from '@fluidframework/id-compressor';
12
+ import { IdCreationRange } from '@fluidframework/id-compressor';
13
+ import { IDeltaManager } from '@fluidframework/container-definitions';
14
+ import { IDisposable } from '@fluidframework/core-interfaces';
15
+ import { IDocumentMessage } from '@fluidframework/protocol-definitions';
16
+ import { IDocumentStorageService } from '@fluidframework/driver-definitions';
17
+ import { IEvent } from '@fluidframework/core-interfaces';
18
+ import { IEventProvider } from '@fluidframework/core-interfaces';
19
+ import { IFluidHandle } from '@fluidframework/core-interfaces';
20
+ import { IIdCompressor } from '@fluidframework/id-compressor';
21
+ import { IIdCompressorCore } from '@fluidframework/id-compressor';
22
+ import { ILoaderOptions } from '@fluidframework/container-definitions';
23
+ import { IProvideFluidHandleContext } from '@fluidframework/core-interfaces';
24
+ import { IQuorumClients } from '@fluidframework/protocol-definitions';
25
+ import { IRequest } from '@fluidframework/core-interfaces';
26
+ import { IResponse } from '@fluidframework/core-interfaces';
27
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
28
+ import { ISignalMessage } from '@fluidframework/protocol-definitions';
29
+ import { ISnapshotTree } from '@fluidframework/protocol-definitions';
30
+ import { ISummaryTree } from '@fluidframework/protocol-definitions';
31
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
32
+ import { ITree } from '@fluidframework/protocol-definitions';
33
+ import type { IUser } from '@fluidframework/protocol-definitions';
34
+ import { OpSpaceCompressedId } from '@fluidframework/id-compressor';
35
+ import { SerializedIdCompressor } from '@fluidframework/id-compressor';
36
+ import { SerializedIdCompressorWithNoSession } from '@fluidframework/id-compressor';
37
+ import { SerializedIdCompressorWithOngoingSession } from '@fluidframework/id-compressor';
38
+ import { SessionId } from '@fluidframework/id-compressor';
39
+ import { SessionSpaceCompressedId } from '@fluidframework/id-compressor';
40
+ import { StableId } from '@fluidframework/id-compressor';
41
+ import { SummaryTree } from '@fluidframework/protocol-definitions';
42
+ import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
43
+
44
+ // @alpha
45
+ export type AliasResult = "Success" | "Conflict" | "AlreadyAliased";
46
+
47
+ // @internal
48
+ export interface AttributionInfo {
49
+ timestamp: number;
50
+ user: IUser;
51
+ }
52
+
53
+ // @alpha
54
+ export type AttributionKey = OpAttributionKey | DetachedAttributionKey | LocalAttributionKey;
55
+
56
+ // @internal (undocumented)
57
+ export const blobCountPropertyName = "BlobCount";
58
+
59
+ // @internal (undocumented)
60
+ export const channelsTreeName = ".channels";
61
+
62
+ // @alpha (undocumented)
63
+ export type CreateChildSummarizerNodeFn = (summarizeInternal: SummarizeInternalFn, getGCDataFn: (fullGC?: boolean) => Promise<IGarbageCollectionData>,
64
+ getBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>) => ISummarizerNodeWithGC;
65
+
66
+ // @alpha (undocumented)
67
+ export type CreateChildSummarizerNodeParam = {
68
+ type: CreateSummarizerNodeSource.FromSummary;
69
+ } | {
70
+ type: CreateSummarizerNodeSource.FromAttach;
71
+ sequenceNumber: number;
72
+ snapshot: ITree;
73
+ } | {
74
+ type: CreateSummarizerNodeSource.Local;
75
+ };
76
+
77
+ // @alpha (undocumented)
78
+ export enum CreateSummarizerNodeSource {
79
+ // (undocumented)
80
+ FromAttach = 1,
81
+ // (undocumented)
82
+ FromSummary = 0,
83
+ // (undocumented)
84
+ Local = 2
85
+ }
86
+
87
+ // @alpha
88
+ export interface DetachedAttributionKey {
89
+ id: 0;
90
+ // (undocumented)
91
+ type: "detached";
92
+ }
93
+
94
+ // @alpha
95
+ export type FluidDataStoreRegistryEntry = Readonly<Partial<IProvideFluidDataStoreRegistry & IProvideFluidDataStoreFactory>>;
96
+
97
+ // @alpha
98
+ export enum FlushMode {
99
+ Immediate = 0,
100
+ TurnBased = 1
101
+ }
102
+
103
+ // @internal (undocumented)
104
+ export enum FlushModeExperimental {
105
+ Async = 2
106
+ }
107
+
108
+ // @internal
109
+ export const gcBlobPrefix = "__gc";
110
+
111
+ // @internal
112
+ export const gcDeletedBlobKey = "__deletedNodes";
113
+
114
+ // @internal
115
+ export const gcTombstoneBlobKey = "__tombstones";
116
+
117
+ // @internal
118
+ export const gcTreeKey = "gc";
119
+
120
+ // @alpha
121
+ export interface IAttachMessage {
122
+ id: string;
123
+ snapshot: ITree;
124
+ type: string;
125
+ }
126
+
127
+ // @alpha
128
+ export interface IContainerRuntimeBase extends IEventProvider<IContainerRuntimeBaseEvents> {
129
+ // (undocumented)
130
+ readonly clientDetails: IClientDetails;
131
+ createDataStore(pkg: string | string[]): Promise<IDataStore>;
132
+ // @deprecated (undocumented)
133
+ _createDataStoreWithProps(pkg: string | string[], props?: any, id?: string): Promise<IDataStore>;
134
+ createDetachedDataStore(pkg: Readonly<string[]>): IFluidDataStoreContextDetached;
135
+ getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
136
+ getAudience(): IAudience;
137
+ getQuorum(): IQuorumClients;
138
+ // (undocumented)
139
+ readonly logger: ITelemetryBaseLogger;
140
+ orderSequentially(callback: () => void): void;
141
+ submitSignal(type: string, content: any): void;
142
+ // (undocumented)
143
+ uploadBlob(blob: ArrayBufferLike, signal?: AbortSignal): Promise<IFluidHandle<ArrayBufferLike>>;
144
+ }
145
+
146
+ // @alpha (undocumented)
147
+ export interface IContainerRuntimeBaseEvents extends IEvent {
148
+ // (undocumented)
149
+ (event: "batchBegin", listener: (op: ISequencedDocumentMessage) => void): any;
150
+ // (undocumented)
151
+ (event: "op", listener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void): any;
152
+ // (undocumented)
153
+ (event: "batchEnd", listener: (error: any, op: ISequencedDocumentMessage) => void): any;
154
+ // (undocumented)
155
+ (event: "signal", listener: (message: IInboundSignalMessage, local: boolean) => void): any;
156
+ }
157
+
158
+ // @alpha
159
+ export interface IDataStore {
160
+ readonly entryPoint: IFluidHandle<FluidObject>;
161
+ trySetAlias(alias: string): Promise<AliasResult>;
162
+ }
163
+
164
+ export { IdCompressor }
165
+
166
+ export { IdCreationRange }
167
+
168
+ // @alpha
169
+ export interface IEnvelope {
170
+ address: string;
171
+ contents: any;
172
+ }
173
+
174
+ // @public
175
+ export interface IExperimentalIncrementalSummaryContext {
176
+ latestSummarySequenceNumber: number;
177
+ summaryPath: string;
178
+ summarySequenceNumber: number;
179
+ }
180
+
181
+ // @alpha
182
+ export interface IFluidDataStoreChannel extends IDisposable {
183
+ // (undocumented)
184
+ applyStashedOp(content: any): Promise<unknown>;
185
+ // @deprecated
186
+ attachGraph(): void;
187
+ readonly attachState: AttachState;
188
+ readonly entryPoint: IFluidHandle<FluidObject>;
189
+ getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
190
+ getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
191
+ // (undocumented)
192
+ readonly id: string;
193
+ makeVisibleAndAttachGraph(): void;
194
+ process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
195
+ processSignal(message: any, local: boolean): void;
196
+ // (undocumented)
197
+ request(request: IRequest): Promise<IResponse>;
198
+ reSubmit(type: string, content: any, localOpMetadata: unknown): any;
199
+ rollback?(type: string, content: any, localOpMetadata: unknown): void;
200
+ setConnectionState(connected: boolean, clientId?: string): any;
201
+ summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
202
+ updateUsedRoutes(usedRoutes: string[]): void;
203
+ // (undocumented)
204
+ readonly visibilityState: VisibilityState;
205
+ }
206
+
207
+ // @alpha
208
+ export interface IFluidDataStoreContext extends IEventProvider<IFluidDataStoreContextEvents>, Partial<IProvideFluidDataStoreRegistry>, IProvideFluidHandleContext {
209
+ addedGCOutboundReference?(srcHandle: IFluidHandle, outboundHandle: IFluidHandle): void;
210
+ readonly attachState: AttachState;
211
+ // (undocumented)
212
+ readonly baseSnapshot: ISnapshotTree | undefined;
213
+ // (undocumented)
214
+ readonly clientDetails: IClientDetails;
215
+ // (undocumented)
216
+ readonly clientId: string | undefined;
217
+ // (undocumented)
218
+ readonly connected: boolean;
219
+ // (undocumented)
220
+ readonly containerRuntime: IContainerRuntimeBase;
221
+ // @deprecated (undocumented)
222
+ readonly createProps?: any;
223
+ // (undocumented)
224
+ readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
225
+ ensureNoDataModelChanges<T>(callback: () => T): T;
226
+ getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
227
+ getAudience(): IAudience;
228
+ // @deprecated (undocumented)
229
+ getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;
230
+ // (undocumented)
231
+ getCreateChildSummarizerNodeFn(
232
+ id: string,
233
+ createParam: CreateChildSummarizerNodeParam): CreateChildSummarizerNodeFn;
234
+ getQuorum(): IQuorumClients;
235
+ // (undocumented)
236
+ readonly id: string;
237
+ // (undocumented)
238
+ readonly idCompressor?: IIdCompressor;
239
+ readonly isLocalDataStore: boolean;
240
+ // (undocumented)
241
+ readonly logger: ITelemetryBaseLogger;
242
+ makeLocallyVisible(): void;
243
+ // (undocumented)
244
+ readonly options: ILoaderOptions;
245
+ readonly packagePath: readonly string[];
246
+ readonly scope: FluidObject;
247
+ setChannelDirty(address: string): void;
248
+ // (undocumented)
249
+ readonly storage: IDocumentStorageService;
250
+ submitMessage(type: string, content: any, localOpMetadata: unknown): void;
251
+ submitSignal(type: string, content: any, targetClientId?: string): void;
252
+ // (undocumented)
253
+ uploadBlob(blob: ArrayBufferLike, signal?: AbortSignal): Promise<IFluidHandle<ArrayBufferLike>>;
254
+ }
255
+
256
+ // @alpha (undocumented)
257
+ export interface IFluidDataStoreContextDetached extends IFluidDataStoreContext {
258
+ attachRuntime(factory: IProvideFluidDataStoreFactory, dataStoreRuntime: IFluidDataStoreChannel): Promise<void>;
259
+ }
260
+
261
+ // @alpha (undocumented)
262
+ export interface IFluidDataStoreContextEvents extends IEvent {
263
+ // (undocumented)
264
+ (event: "attaching" | "attached", listener: () => void): any;
265
+ }
266
+
267
+ // @alpha (undocumented)
268
+ export const IFluidDataStoreFactory: keyof IProvideFluidDataStoreFactory;
269
+
270
+ // @alpha
271
+ export interface IFluidDataStoreFactory extends IProvideFluidDataStoreFactory {
272
+ instantiateDataStore(context: IFluidDataStoreContext, existing: boolean): Promise<IFluidDataStoreChannel>;
273
+ type: string;
274
+ }
275
+
276
+ // @alpha (undocumented)
277
+ export const IFluidDataStoreRegistry: keyof IProvideFluidDataStoreRegistry;
278
+
279
+ // @alpha
280
+ export interface IFluidDataStoreRegistry extends IProvideFluidDataStoreRegistry {
281
+ // (undocumented)
282
+ get(name: string): Promise<FluidDataStoreRegistryEntry | undefined>;
283
+ }
284
+
285
+ // @public
286
+ export interface IGarbageCollectionData {
287
+ gcNodes: {
288
+ [id: string]: string[];
289
+ };
290
+ }
291
+
292
+ // @alpha
293
+ export interface IGarbageCollectionDetailsBase {
294
+ gcData?: IGarbageCollectionData;
295
+ usedRoutes?: string[];
296
+ }
297
+
298
+ export { IIdCompressor }
299
+
300
+ export { IIdCompressorCore }
301
+
302
+ // @public
303
+ export interface IInboundSignalMessage extends ISignalMessage {
304
+ // (undocumented)
305
+ type: string;
306
+ }
307
+
308
+ // @alpha
309
+ export type InboundAttachMessage = Omit<IAttachMessage, "snapshot"> & {
310
+ snapshot: IAttachMessage["snapshot"] | null;
311
+ };
312
+
313
+ // @alpha (undocumented)
314
+ export interface IProvideFluidDataStoreFactory {
315
+ // (undocumented)
316
+ readonly IFluidDataStoreFactory: IFluidDataStoreFactory;
317
+ }
318
+
319
+ // @alpha (undocumented)
320
+ export interface IProvideFluidDataStoreRegistry {
321
+ // (undocumented)
322
+ readonly IFluidDataStoreRegistry: IFluidDataStoreRegistry;
323
+ }
324
+
325
+ // @internal (undocumented)
326
+ export interface ISignalEnvelope {
327
+ address?: string;
328
+ clientSignalSequenceNumber: number;
329
+ contents: {
330
+ type: string;
331
+ content: any;
332
+ };
333
+ }
334
+
335
+ // @alpha
336
+ export interface ISummarizeInternalResult extends ISummarizeResult {
337
+ // (undocumented)
338
+ id: string;
339
+ pathPartsForChildren?: string[];
340
+ }
341
+
342
+ // @alpha
343
+ export interface ISummarizeResult {
344
+ // (undocumented)
345
+ stats: ISummaryStats;
346
+ // (undocumented)
347
+ summary: SummaryTree;
348
+ }
349
+
350
+ // @alpha (undocumented)
351
+ export interface ISummarizerNode {
352
+ // (undocumented)
353
+ createChild(
354
+ summarizeInternalFn: SummarizeInternalFn,
355
+ id: string,
356
+ createParam: CreateChildSummarizerNodeParam,
357
+ config?: ISummarizerNodeConfig): ISummarizerNode;
358
+ // (undocumented)
359
+ getChild(id: string): ISummarizerNode | undefined;
360
+ invalidate(sequenceNumber: number): void;
361
+ isSummaryInProgress?(): boolean;
362
+ recordChange(op: ISequencedDocumentMessage): void;
363
+ readonly referenceSequenceNumber: number;
364
+ summarize(fullTree: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummarizeResult>;
365
+ updateBaseSummaryState(snapshot: ISnapshotTree): void;
366
+ }
367
+
368
+ // @alpha (undocumented)
369
+ export interface ISummarizerNodeConfig {
370
+ readonly canReuseHandle?: boolean;
371
+ readonly throwOnFailure?: true;
372
+ }
373
+
374
+ // @alpha (undocumented)
375
+ export interface ISummarizerNodeConfigWithGC extends ISummarizerNodeConfig {
376
+ readonly gcDisabled?: boolean;
377
+ }
378
+
379
+ // @alpha
380
+ export interface ISummarizerNodeWithGC extends ISummarizerNode {
381
+ // (undocumented)
382
+ createChild(
383
+ summarizeInternalFn: SummarizeInternalFn,
384
+ id: string,
385
+ createParam: CreateChildSummarizerNodeParam,
386
+ config?: ISummarizerNodeConfigWithGC, getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,
387
+ getBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>): ISummarizerNodeWithGC;
388
+ deleteChild(id: string): void;
389
+ // (undocumented)
390
+ getChild(id: string): ISummarizerNodeWithGC | undefined;
391
+ getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
392
+ isReferenced(): boolean;
393
+ updateUsedRoutes(usedRoutes: string[]): void;
394
+ }
395
+
396
+ // @public
397
+ export interface ISummaryStats {
398
+ // (undocumented)
399
+ blobNodeCount: number;
400
+ // (undocumented)
401
+ handleNodeCount: number;
402
+ // (undocumented)
403
+ totalBlobSize: number;
404
+ // (undocumented)
405
+ treeNodeCount: number;
406
+ // (undocumented)
407
+ unreferencedBlobSize: number;
408
+ }
409
+
410
+ // @public
411
+ export interface ISummaryTreeWithStats {
412
+ stats: ISummaryStats;
413
+ summary: ISummaryTree;
414
+ }
415
+
416
+ // @public
417
+ export interface ITelemetryContext {
418
+ get(prefix: string, property: string): TelemetryEventPropertyType;
419
+ serialize(): string;
420
+ set(prefix: string, property: string, value: TelemetryEventPropertyType): void;
421
+ setMultiple(prefix: string, property: string, values: Record<string, TelemetryEventPropertyType>): void;
422
+ }
423
+
424
+ // @alpha
425
+ export interface LocalAttributionKey {
426
+ // (undocumented)
427
+ type: "local";
428
+ }
429
+
430
+ // @alpha
431
+ export type NamedFluidDataStoreRegistryEntries = Iterable<NamedFluidDataStoreRegistryEntry>;
432
+
433
+ // @alpha
434
+ export type NamedFluidDataStoreRegistryEntry = [string, Promise<FluidDataStoreRegistryEntry>];
435
+
436
+ // @alpha
437
+ export interface OpAttributionKey {
438
+ seq: number;
439
+ type: "op";
440
+ }
441
+
442
+ export { OpSpaceCompressedId }
443
+
444
+ export { SerializedIdCompressor }
445
+
446
+ export { SerializedIdCompressorWithNoSession }
447
+
448
+ export { SerializedIdCompressorWithOngoingSession }
449
+
450
+ export { SessionId }
451
+
452
+ export { SessionSpaceCompressedId }
453
+
454
+ export { StableId }
455
+
456
+ // @alpha (undocumented)
457
+ export type SummarizeInternalFn = (fullTree: boolean, trackState: boolean, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext) => Promise<ISummarizeInternalResult>;
458
+
459
+ // @internal (undocumented)
460
+ export const totalBlobSizePropertyName = "TotalBlobSize";
461
+
462
+ // @alpha
463
+ export const VisibilityState: {
464
+ NotVisible: string;
465
+ LocallyVisible: string;
466
+ GloballyVisible: string;
467
+ };
468
+
469
+ // @alpha (undocumented)
470
+ export type VisibilityState = (typeof VisibilityState)[keyof typeof VisibilityState];
471
+
472
+ // (No @packageDocumentation comment for this package)
473
+
474
+ ```
@@ -0,0 +1,71 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { IUser } from "@fluidframework/protocol-definitions";
6
+ /**
7
+ * AttributionKey representing a reference to some op in the op stream.
8
+ * Content associated with this key aligns with content modified by that op.
9
+ * @alpha
10
+ */
11
+ export interface OpAttributionKey {
12
+ /**
13
+ * The type of attribution this key corresponds to.
14
+ *
15
+ * Keys currently all represent op-based attribution, so have the form `{ type: "op", key: sequenceNumber }`.
16
+ * Thus, they can be used with an `OpStreamAttributor` to recover timestamp/user information.
17
+ */
18
+ type: "op";
19
+ /**
20
+ * The sequenceNumber of the op this attribution key is for.
21
+ */
22
+ seq: number;
23
+ }
24
+ /**
25
+ * AttributionKey associated with content that was inserted while the container was in a detached state.
26
+ *
27
+ * @remarks Retrieving an {@link AttributionInfo} from content associated with detached attribution keys
28
+ * is currently unsupported, as applications can effectively modify content anonymously while detached.
29
+ * The runtime has no mechanism for reliably obtaining the user. It would be reasonable to start supporting
30
+ * this functionality if the host provided additional context to their attributor or attach calls.
31
+ * @alpha
32
+ */
33
+ export interface DetachedAttributionKey {
34
+ type: "detached";
35
+ /**
36
+ * Arbitrary discriminator associated with content inserted while detached.
37
+ *
38
+ * @remarks For now, the runtime assumes all content created while detached is associated
39
+ * with the same user/timestamp.
40
+ * We could weaken this assumption in the future with further API support and
41
+ * allow arbitrary strings or numbers as part of this key.
42
+ */
43
+ id: 0;
44
+ }
45
+ /**
46
+ * AttributionKey associated with content that has been made locally but not yet acked by the server.
47
+ * @alpha
48
+ */
49
+ export interface LocalAttributionKey {
50
+ type: "local";
51
+ }
52
+ /**
53
+ * Can be indexed into the ContainerRuntime in order to retrieve {@link AttributionInfo}.
54
+ * @alpha
55
+ */
56
+ export type AttributionKey = OpAttributionKey | DetachedAttributionKey | LocalAttributionKey;
57
+ /**
58
+ * Attribution information associated with a change.
59
+ * @internal
60
+ */
61
+ export interface AttributionInfo {
62
+ /**
63
+ * The user that performed the change.
64
+ */
65
+ user: IUser;
66
+ /**
67
+ * When the change happened.
68
+ */
69
+ timestamp: number;
70
+ }
71
+ //# sourceMappingURL=attribution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribution.d.ts","sourceRoot":"","sources":["../src/attribution.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAElE;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;OAKG;IACH,IAAI,EAAE,IAAI,CAAC;IAEX;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,UAAU,CAAC;IAEjB;;;;;;;OAOG;IACH,EAAE,EAAE,CAAC,CAAC;CACN;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,OAAO,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG,sBAAsB,GAAG,mBAAmB,CAAC;AAE7F;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IACZ;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,7 @@
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=attribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribution.js","sourceRoot":"","sources":["../src/attribution.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 type { IUser } from \"@fluidframework/protocol-definitions\";\n\n/**\n * AttributionKey representing a reference to some op in the op stream.\n * Content associated with this key aligns with content modified by that op.\n * @alpha\n */\nexport interface OpAttributionKey {\n\t/**\n\t * The type of attribution this key corresponds to.\n\t *\n\t * Keys currently all represent op-based attribution, so have the form `{ type: \"op\", key: sequenceNumber }`.\n\t * Thus, they can be used with an `OpStreamAttributor` to recover timestamp/user information.\n\t */\n\ttype: \"op\";\n\n\t/**\n\t * The sequenceNumber of the op this attribution key is for.\n\t */\n\tseq: number;\n}\n\n/**\n * AttributionKey associated with content that was inserted while the container was in a detached state.\n *\n * @remarks Retrieving an {@link AttributionInfo} from content associated with detached attribution keys\n * is currently unsupported, as applications can effectively modify content anonymously while detached.\n * The runtime has no mechanism for reliably obtaining the user. It would be reasonable to start supporting\n * this functionality if the host provided additional context to their attributor or attach calls.\n * @alpha\n */\nexport interface DetachedAttributionKey {\n\ttype: \"detached\";\n\n\t/**\n\t * Arbitrary discriminator associated with content inserted while detached.\n\t *\n\t * @remarks For now, the runtime assumes all content created while detached is associated\n\t * with the same user/timestamp.\n\t * We could weaken this assumption in the future with further API support and\n\t * allow arbitrary strings or numbers as part of this key.\n\t */\n\tid: 0;\n}\n\n/**\n * AttributionKey associated with content that has been made locally but not yet acked by the server.\n * @alpha\n */\nexport interface LocalAttributionKey {\n\ttype: \"local\";\n}\n\n/**\n * Can be indexed into the ContainerRuntime in order to retrieve {@link AttributionInfo}.\n * @alpha\n */\nexport type AttributionKey = OpAttributionKey | DetachedAttributionKey | LocalAttributionKey;\n\n/**\n * Attribution information associated with a change.\n * @internal\n */\nexport interface AttributionInfo {\n\t/**\n\t * The user that performed the change.\n\t */\n\tuser: IUser;\n\t/**\n\t * When the change happened.\n\t */\n\ttimestamp: number;\n}\n"]}