@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
package/dist/summary.d.ts CHANGED
@@ -2,11 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { TelemetryEventPropertyType } from "@fluidframework/common-definitions";
5
+ import { TelemetryEventPropertyType } from "@fluidframework/core-interfaces";
6
6
  import { SummaryTree, ISummaryTree, ISequencedDocumentMessage, ISnapshotTree, ITree } from "@fluidframework/protocol-definitions";
7
- import { IGarbageCollectionData, IGarbageCollectionDetailsBase, IGarbageCollectionSummaryDetails } from "./garbageCollection";
7
+ import { IGarbageCollectionData, IGarbageCollectionDetailsBase } from "./garbageCollection";
8
8
  /**
9
9
  * Contains the aggregation data from a Tree/Subtree.
10
+ * @public
10
11
  */
11
12
  export interface ISummaryStats {
12
13
  treeNodeCount: number;
@@ -21,9 +22,12 @@ export interface ISummaryStats {
21
22
  * each of its DDS.
22
23
  * Any component that implements IChannelContext, IFluidDataStoreChannel or extends SharedObject
23
24
  * will be taking part of the summarization process.
25
+ * @public
24
26
  */
25
27
  export interface ISummaryTreeWithStats {
26
- /** Represents an agreggation of node counts and blob sizes associated to the current summary information */
28
+ /**
29
+ * Represents an aggregation of node counts and blob sizes associated to the current summary information
30
+ */
27
31
  stats: ISummaryStats;
28
32
  /**
29
33
  * A recursive data structure that will be converted to a snapshot tree and uploaded
@@ -33,43 +37,68 @@ export interface ISummaryTreeWithStats {
33
37
  }
34
38
  /**
35
39
  * Represents a summary at a current sequence number.
40
+ * @alpha
36
41
  */
37
42
  export interface ISummarizeResult {
38
43
  stats: ISummaryStats;
39
44
  summary: SummaryTree;
40
45
  }
41
46
  /**
42
- * Contains the same data as ISummaryResult but in order to avoid naming colisions,
47
+ * Contains the same data as ISummaryResult but in order to avoid naming collisions,
43
48
  * the data store summaries are wrapped around an array of labels identified by pathPartsForChildren.
44
- * Ex: id:""
45
- pathPartsForChildren: ["path1"]
46
- stats: ...
47
- summary:
48
- ...
49
- "path1":
49
+ *
50
+ * @example
51
+ *
52
+ * ```typescript
53
+ * id:""
54
+ * pathPartsForChildren: ["path1"]
55
+ * stats: ...
56
+ * summary:
57
+ * ...
58
+ * "path1":
59
+ * ```
60
+ * @alpha
50
61
  */
51
62
  export interface ISummarizeInternalResult extends ISummarizeResult {
52
63
  id: string;
53
- /** Additional path parts between this node's ID and its children's IDs. */
64
+ /**
65
+ * Additional path parts between this node's ID and its children's IDs.
66
+ */
54
67
  pathPartsForChildren?: string[];
55
68
  }
56
- /** The garbage collection data of each node in the reference graph. */
57
- export interface IGarbageCollectionNodeData {
58
- /** The set of routes to other nodes in the graph. */
59
- outboundRoutes: string[];
60
- /** If the node is unreferenced, the timestamp of when it was marked unreferenced. */
61
- unreferencedTimestampMs?: number;
62
- }
63
69
  /**
64
- * The garbage collection state of the reference graph. It contains a list of all the nodes in the graph and their
65
- * GC data.
70
+ * @experimental - Can be deleted/changed at any time
71
+ * Contains the necessary information to allow DDSes to do incremental summaries
72
+ * @public
66
73
  */
67
- export interface IGarbageCollectionState {
68
- gcNodes: {
69
- [id: string]: IGarbageCollectionNodeData;
70
- };
74
+ export interface IExperimentalIncrementalSummaryContext {
75
+ /**
76
+ * The sequence number of the summary generated that will be sent to the server.
77
+ */
78
+ summarySequenceNumber: number;
79
+ /**
80
+ * The sequence number of the most recent summary that was acknowledged by the server.
81
+ */
82
+ latestSummarySequenceNumber: number;
83
+ /**
84
+ * The path to the runtime/datastore/dds that is used to generate summary handles
85
+ * Note: Summary handles are nodes of the summary tree that point to previous parts of the last successful summary
86
+ * instead of being a blob or tree node
87
+ *
88
+ * This path contains the id of the data store and dds which should not be leaked to layers below them. Ideally,
89
+ * a layer should not know its own id. This is important for channel unification work and there has been a lot of
90
+ * work to remove these kinds of leakages. Some still exist, which have to be fixed but we should not be adding
91
+ * more dependencies.
92
+ */
93
+ summaryPath: string;
71
94
  }
72
- export declare type SummarizeInternalFn = (fullTree: boolean, trackState: boolean, telemetryContext?: ITelemetryContext) => Promise<ISummarizeInternalResult>;
95
+ /**
96
+ * @alpha
97
+ */
98
+ export type SummarizeInternalFn = (fullTree: boolean, trackState: boolean, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext) => Promise<ISummarizeInternalResult>;
99
+ /**
100
+ * @alpha
101
+ */
73
102
  export interface ISummarizerNodeConfig {
74
103
  /**
75
104
  * True to reuse previous handle when unchanged since last acked summary.
@@ -87,6 +116,9 @@ export interface ISummarizerNodeConfig {
87
116
  */
88
117
  readonly throwOnFailure?: true;
89
118
  }
119
+ /**
120
+ * @alpha
121
+ */
90
122
  export interface ISummarizerNodeConfigWithGC extends ISummarizerNodeConfig {
91
123
  /**
92
124
  * True if GC is disabled. If so, don't track GC related state for a summary.
@@ -94,12 +126,18 @@ export interface ISummarizerNodeConfigWithGC extends ISummarizerNodeConfig {
94
126
  */
95
127
  readonly gcDisabled?: boolean;
96
128
  }
129
+ /**
130
+ * @alpha
131
+ */
97
132
  export declare enum CreateSummarizerNodeSource {
98
133
  FromSummary = 0,
99
134
  FromAttach = 1,
100
135
  Local = 2
101
136
  }
102
- export declare type CreateChildSummarizerNodeParam = {
137
+ /**
138
+ * @alpha
139
+ */
140
+ export type CreateChildSummarizerNodeParam = {
103
141
  type: CreateSummarizerNodeSource.FromSummary;
104
142
  } | {
105
143
  type: CreateSummarizerNodeSource.FromAttach;
@@ -108,8 +146,13 @@ export declare type CreateChildSummarizerNodeParam = {
108
146
  } | {
109
147
  type: CreateSummarizerNodeSource.Local;
110
148
  };
149
+ /**
150
+ * @alpha
151
+ */
111
152
  export interface ISummarizerNode {
112
- /** Latest successfully acked summary reference sequence number */
153
+ /**
154
+ * Latest successfully acked summary reference sequence number
155
+ */
113
156
  readonly referenceSequenceNumber: number;
114
157
  /**
115
158
  * Marks the node as having a change with the given sequence number.
@@ -134,29 +177,20 @@ export interface ISummarizerNode {
134
177
  * path is "/a/.channels/b", then the additional path part is ".channels".
135
178
  * @param snapshot - the base summary to parse
136
179
  */
137
- loadBaseSummaryWithoutDifferential(snapshot: ISnapshotTree): void;
138
- /**
139
- * Does all the work of loadBaseSummaryWithoutDifferential. Additionally if
140
- * the base summary is a differential summary containing handle + outstanding ops blob,
141
- * then this will return the innermost base summary, and update the state by
142
- * tracking the outstanding ops.
143
- * @param snapshot - the base summary to parse
144
- * @param readAndParseBlob - function to read and parse blobs from storage
145
- * @returns the base summary to be used
146
- */
147
- loadBaseSummary(snapshot: ISnapshotTree, readAndParseBlob: <T>(id: string) => Promise<T>): Promise<{
148
- baseSummary: ISnapshotTree;
149
- outstandingOps: ISequencedDocumentMessage[];
150
- }>;
180
+ updateBaseSummaryState(snapshot: ISnapshotTree): void;
151
181
  /**
152
182
  * Records an op representing a change to this node/subtree.
153
183
  * @param op - op of change to record
154
184
  */
155
185
  recordChange(op: ISequencedDocumentMessage): void;
156
186
  createChild(
157
- /** Summarize function */
187
+ /**
188
+ * Summarize function
189
+ */
158
190
  summarizeInternalFn: SummarizeInternalFn,
159
- /** Initial id or path part of this node */
191
+ /**
192
+ * Initial id or path part of this node
193
+ */
160
194
  id: string,
161
195
  /**
162
196
  * Information needed to create the node.
@@ -165,28 +199,46 @@ export interface ISummarizerNode {
165
199
  * If it is local, it will throw unsupported errors on calls to summarize.
166
200
  */
167
201
  createParam: CreateChildSummarizerNodeParam,
168
- /** Optional configuration affecting summarize behavior */
202
+ /**
203
+ * Optional configuration affecting summarize behavior
204
+ */
169
205
  config?: ISummarizerNodeConfig): ISummarizerNode;
170
206
  getChild(id: string): ISummarizerNode | undefined;
207
+ /** True if a summary is currently in progress */
208
+ isSummaryInProgress?(): boolean;
171
209
  }
172
210
  /**
173
- * Extends the functionality of ISummarizerNode to support garbage collection. It adds / udpates the following APIs:
174
- * - usedRoutes - The routes in this node that are currently in use.
175
- * - getGCData - A new API that can be used to get the garbage collection data for this node.
176
- * - summarize - Added a trackState flag which indicates whether the summarizer node should track the state of the
177
- * summary or not.
178
- * - createChild - Added the following params:
179
- * - getGCDataFn - This gets the GC data from the caller. This must be provided in order for getGCData to work.
180
- * - getInitialGCDetailsFn - This gets the initial GC details from the caller.
181
- * - deleteChild - Deletes a child node.
182
- * - isReferenced - This tells whether this node is referenced in the document or not.
183
- * - updateUsedRoutes - Used to notify this node of routes that are currently in use in it.
211
+ * Extends the functionality of ISummarizerNode to support garbage collection. It adds / updates the following APIs:
212
+ *
213
+ * `usedRoutes`: The routes in this node that are currently in use.
214
+ *
215
+ * `getGCData`: A new API that can be used to get the garbage collection data for this node.
216
+ *
217
+ * `summarize`: Added a trackState flag which indicates whether the summarizer node should track the state of the
218
+ * summary or not.
219
+ *
220
+ * `createChild`: Added the following params:
221
+ *
222
+ * - `getGCDataFn`: This gets the GC data from the caller. This must be provided in order for getGCData to work.
223
+ *
224
+ * - `getInitialGCDetailsFn`: This gets the initial GC details from the caller.
225
+ *
226
+ * `deleteChild`: Deletes a child node.
227
+ *
228
+ * `isReferenced`: This tells whether this node is referenced in the document or not.
229
+ *
230
+ * `updateUsedRoutes`: Used to notify this node of routes that are currently in use in it.
231
+ * @alpha
184
232
  */
185
233
  export interface ISummarizerNodeWithGC extends ISummarizerNode {
186
234
  createChild(
187
- /** Summarize function */
235
+ /**
236
+ * Summarize function
237
+ */
188
238
  summarizeInternalFn: SummarizeInternalFn,
189
- /** Initial id or path part of this node */
239
+ /**
240
+ * Initial id or path part of this node
241
+ */
190
242
  id: string,
191
243
  /**
192
244
  * Information needed to create the node.
@@ -195,8 +247,14 @@ export interface ISummarizerNodeWithGC extends ISummarizerNode {
195
247
  * If it is local, it will throw unsupported errors on calls to summarize.
196
248
  */
197
249
  createParam: CreateChildSummarizerNodeParam,
198
- /** Optional configuration affecting summarize behavior */
199
- config?: ISummarizerNodeConfigWithGC, getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>, getInitialGCSummaryDetailsFn?: () => Promise<IGarbageCollectionSummaryDetails>): ISummarizerNodeWithGC;
250
+ /**
251
+ * Optional configuration affecting summarize behavior
252
+ */
253
+ config?: ISummarizerNodeConfigWithGC, getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,
254
+ /**
255
+ * @deprecated The functionality to update child's base GC details is incorporated in the summarizer node.
256
+ */
257
+ getBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>): ISummarizerNodeWithGC;
200
258
  /**
201
259
  * Delete the child with the given id..
202
260
  */
@@ -208,7 +266,9 @@ export interface ISummarizerNodeWithGC extends ISummarizerNode {
208
266
  * @param fullGC - true to bypass optimizations and force full generation of GC data.
209
267
  */
210
268
  getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
211
- /** Tells whether this node is being referenced in this document or not. Unreferenced node will get GC'd */
269
+ /**
270
+ * Tells whether this node is being referenced in this document or not. Unreferenced node will get GC'd
271
+ */
212
272
  isReferenced(): boolean;
213
273
  /**
214
274
  * After GC has run, called to notify this node of routes that are used in it. These are used for the following:
@@ -216,22 +276,17 @@ export interface ISummarizerNodeWithGC extends ISummarizerNode {
216
276
  * 2. To identify if this node or any of its children's used routes changed since last summary.
217
277
  *
218
278
  * @param usedRoutes - The routes that are used in this node.
219
- * @param gcTimestamp - The time when GC was run that generated these used routes. If a node becomes unreferenced
220
- * as part of this GC run, this timestamp is used to update the time when it happens.
221
279
  */
222
- updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number): void;
223
- /**
224
- * @deprecated - Renamed to getBaseGCDetails.
225
- * Returns the GC details that may be added to this node's summary.
226
- */
227
- getGCSummaryDetails(): IGarbageCollectionSummaryDetails;
228
- /** Returns the GC details to be added to this node's summary and is used to initialize new nodes' GC state. */
229
- getBaseGCDetails?(): IGarbageCollectionDetailsBase;
280
+ updateUsedRoutes(usedRoutes: string[]): void;
230
281
  }
282
+ /**
283
+ * @internal
284
+ */
231
285
  export declare const channelsTreeName = ".channels";
232
286
  /**
233
287
  * Contains telemetry data relevant to summarization workflows.
234
288
  * This object is expected to be modified directly by various summarize methods.
289
+ * @public
235
290
  */
236
291
  export interface ITelemetryContext {
237
292
  /**
@@ -241,6 +296,13 @@ export interface ITelemetryContext {
241
296
  * @param value - value to attribute to this summary telemetry data
242
297
  */
243
298
  set(prefix: string, property: string, value: TelemetryEventPropertyType): void;
299
+ /**
300
+ * Sets multiple values for telemetry data being tracked.
301
+ * @param prefix - unique prefix to tag this data with (ex: "fluid:summarize:")
302
+ * @param property - property name of the telemetry data being tracked (ex: "Options")
303
+ * @param values - A set of values to attribute to this summary telemetry data.
304
+ */
305
+ setMultiple(prefix: string, property: string, values: Record<string, TelemetryEventPropertyType>): void;
244
306
  /**
245
307
  * Get the telemetry data being tracked
246
308
  * @param prefix - unique prefix for this data (ex: "fluid:map:")
@@ -254,6 +316,12 @@ export interface ITelemetryContext {
254
316
  */
255
317
  serialize(): string;
256
318
  }
319
+ /**
320
+ * @internal
321
+ */
257
322
  export declare const blobCountPropertyName = "BlobCount";
323
+ /**
324
+ * @internal
325
+ */
258
326
  export declare const totalBlobSizePropertyName = "TotalBlobSize";
259
327
  //# sourceMappingURL=summary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../src/summary.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EACH,WAAW,EACX,YAAY,EACZ,yB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G,SAAS,CAAC;IAExD;;;;OAIG;IACH,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAE7D;;OAEG;IACH,YAAY,IAAI,OAAO,CAAC;IAExB;;;;;;OAMG;IACH,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CAC7C;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAE5C;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;;OAKG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAE/E;;;;;OAKG;IACH,WAAW,CACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,GAChD,IAAI,CAAC;IAER;;;;;OAKG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,0BAA0B,CAAC;IAElE;;;OAGG;IACH,SAAS,IAAI,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,cAAc,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,yBAAyB,kBAAkB,CAAC"}
package/dist/summary.js CHANGED
@@ -5,13 +5,25 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.totalBlobSizePropertyName = exports.blobCountPropertyName = exports.channelsTreeName = exports.CreateSummarizerNodeSource = void 0;
8
+ /**
9
+ * @alpha
10
+ */
8
11
  var CreateSummarizerNodeSource;
9
12
  (function (CreateSummarizerNodeSource) {
10
13
  CreateSummarizerNodeSource[CreateSummarizerNodeSource["FromSummary"] = 0] = "FromSummary";
11
14
  CreateSummarizerNodeSource[CreateSummarizerNodeSource["FromAttach"] = 1] = "FromAttach";
12
15
  CreateSummarizerNodeSource[CreateSummarizerNodeSource["Local"] = 2] = "Local";
13
- })(CreateSummarizerNodeSource = exports.CreateSummarizerNodeSource || (exports.CreateSummarizerNodeSource = {}));
16
+ })(CreateSummarizerNodeSource || (exports.CreateSummarizerNodeSource = CreateSummarizerNodeSource = {}));
17
+ /**
18
+ * @internal
19
+ */
14
20
  exports.channelsTreeName = ".channels";
21
+ /**
22
+ * @internal
23
+ */
15
24
  exports.blobCountPropertyName = "BlobCount";
25
+ /**
26
+ * @internal
27
+ */
16
28
  exports.totalBlobSizePropertyName = "TotalBlobSize";
17
29
  //# sourceMappingURL=summary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"summary.js","sourceRoot":"","sources":["../src/summary.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAoHH,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IAClC,yFAAW,CAAA;IACX,uFAAU,CAAA;IACV,6EAAK,CAAA;AACT,CAAC,EAJW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAIrC;AAsJY,QAAA,gBAAgB,GAAG,WAAW,CAAC;AA8B/B,QAAA,qBAAqB,GAAG,WAAW,CAAC;AAEpC,QAAA,yBAAyB,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TelemetryEventPropertyType } from \"@fluidframework/common-definitions\";\nimport {\n SummaryTree,\n ISummaryTree,\n ISequencedDocumentMessage,\n ISnapshotTree,\n ITree,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IGarbageCollectionData,\n IGarbageCollectionDetailsBase,\n IGarbageCollectionSummaryDetails,\n} from \"./garbageCollection\";\n\n/**\n * Contains the aggregation data from a Tree/Subtree.\n */\nexport interface ISummaryStats {\n treeNodeCount: number;\n blobNodeCount: number;\n handleNodeCount: number;\n totalBlobSize: number;\n unreferencedBlobSize: number;\n}\n\n/**\n * Represents the summary tree for a node along with the statistics for that tree.\n * For example, for a given data store, it contains the data for data store along with a subtree for\n * each of its DDS.\n * Any component that implements IChannelContext, IFluidDataStoreChannel or extends SharedObject\n * will be taking part of the summarization process.\n */\nexport interface ISummaryTreeWithStats {\n /** Represents an agreggation of node counts and blob sizes associated to the current summary information */\n stats: ISummaryStats;\n /**\n * A recursive data structure that will be converted to a snapshot tree and uploaded\n * to the backend.\n */\n summary: ISummaryTree;\n}\n\n/**\n * Represents a summary at a current sequence number.\n */\nexport interface ISummarizeResult {\n stats: ISummaryStats;\n summary: SummaryTree;\n}\n\n/**\n * Contains the same data as ISummaryResult but in order to avoid naming colisions,\n * the data store summaries are wrapped around an array of labels identified by pathPartsForChildren.\n * Ex: id:\"\"\n pathPartsForChildren: [\"path1\"]\n stats: ...\n summary:\n ...\n \"path1\":\n */\nexport interface ISummarizeInternalResult extends ISummarizeResult {\n id: string;\n /** Additional path parts between this node's ID and its children's IDs. */\n pathPartsForChildren?: string[];\n}\n\n/** The garbage collection data of each node in the reference graph. */\nexport interface IGarbageCollectionNodeData {\n /** The set of routes to other nodes in the graph. */\n outboundRoutes: string[];\n /** If the node is unreferenced, the timestamp of when it was marked unreferenced. */\n unreferencedTimestampMs?: number;\n}\n\n/**\n * The garbage collection state of the reference graph. It contains a list of all the nodes in the graph and their\n * GC data.\n */\nexport interface IGarbageCollectionState {\n gcNodes: { [ id: string ]: IGarbageCollectionNodeData; };\n}\n\nexport type SummarizeInternalFn = (\n fullTree: boolean,\n trackState: boolean,\n telemetryContext?: ITelemetryContext,\n) => Promise<ISummarizeInternalResult>;\n\nexport interface ISummarizerNodeConfig {\n /**\n * True to reuse previous handle when unchanged since last acked summary.\n * Defaults to true.\n */\n readonly canReuseHandle?: boolean;\n /**\n * True to always stop execution on error during summarize, or false to\n * attempt creating a summary that is a pointer ot the last acked summary\n * plus outstanding ops in case of internal summarize failure.\n * Defaults to false.\n *\n * BUG BUG: Default to true while we investigate problem\n * with differential summaries\n */\n readonly throwOnFailure?: true;\n}\n\nexport interface ISummarizerNodeConfigWithGC extends ISummarizerNodeConfig {\n /**\n * True if GC is disabled. If so, don't track GC related state for a summary.\n * This is propagated to all child nodes.\n */\n readonly gcDisabled?: boolean;\n}\n\nexport enum CreateSummarizerNodeSource {\n FromSummary,\n FromAttach,\n Local,\n}\nexport type CreateChildSummarizerNodeParam = {\n type: CreateSummarizerNodeSource.FromSummary;\n} | {\n type: CreateSummarizerNodeSource.FromAttach;\n sequenceNumber: number;\n snapshot: ITree;\n} | {\n type: CreateSummarizerNodeSource.Local;\n};\n\nexport interface ISummarizerNode {\n /** Latest successfully acked summary reference sequence number */\n readonly referenceSequenceNumber: number;\n /**\n * Marks the node as having a change with the given sequence number.\n * @param sequenceNumber - sequence number of change\n */\n invalidate(sequenceNumber: number): void;\n /**\n * Calls the internal summarize function and handles internal state tracking.\n * If unchanged and fullTree is false, it will reuse previous summary subtree.\n * If an error is encountered and throwOnFailure is false, it will try to make\n * a summary with a pointer to the previous summary + a blob of outstanding ops.\n * @param fullTree - true to skip optimizations and always generate the full tree\n * @param trackState - indicates whether the summarizer node should track the state of the summary or not\n * @param telemetryContext - summary data passed through the layers for telemetry purposes\n */\n summarize(\n fullTree: boolean,\n trackState?: boolean,\n telemetryContext?: ITelemetryContext,\n ): Promise<ISummarizeResult>;\n /**\n * Checks if there are any additional path parts for children that need to\n * be loaded from the base summary. Additional path parts represent parts\n * of the path between this SummarizerNode and any child SummarizerNodes\n * that it might have. For example: if datastore \"a\" contains dds \"b\", but the\n * path is \"/a/.channels/b\", then the additional path part is \".channels\".\n * @param snapshot - the base summary to parse\n */\n loadBaseSummaryWithoutDifferential(snapshot: ISnapshotTree): void;\n /**\n * Does all the work of loadBaseSummaryWithoutDifferential. Additionally if\n * the base summary is a differential summary containing handle + outstanding ops blob,\n * then this will return the innermost base summary, and update the state by\n * tracking the outstanding ops.\n * @param snapshot - the base summary to parse\n * @param readAndParseBlob - function to read and parse blobs from storage\n * @returns the base summary to be used\n */\n loadBaseSummary(\n snapshot: ISnapshotTree,\n readAndParseBlob: <T>(id: string) => Promise<T>,\n ): Promise<{ baseSummary: ISnapshotTree; outstandingOps: ISequencedDocumentMessage[]; }>;\n /**\n * Records an op representing a change to this node/subtree.\n * @param op - op of change to record\n */\n recordChange(op: ISequencedDocumentMessage): void;\n\n createChild(\n /** Summarize function */\n summarizeInternalFn: SummarizeInternalFn,\n /** Initial id or path part of this node */\n id: string,\n /**\n * Information needed to create the node.\n * If it is from a base summary, it will assert that a summary has been seen.\n * Attach information if it is created from an attach op.\n * If it is local, it will throw unsupported errors on calls to summarize.\n */\n createParam: CreateChildSummarizerNodeParam,\n /** Optional configuration affecting summarize behavior */\n config?: ISummarizerNodeConfig,\n ): ISummarizerNode;\n\n getChild(id: string): ISummarizerNode | undefined;\n}\n\n/**\n * Extends the functionality of ISummarizerNode to support garbage collection. It adds / udpates the following APIs:\n * - usedRoutes - The routes in this node that are currently in use.\n * - getGCData - A new API that can be used to get the garbage collection data for this node.\n * - summarize - Added a trackState flag which indicates whether the summarizer node should track the state of the\n * summary or not.\n * - createChild - Added the following params:\n * - getGCDataFn - This gets the GC data from the caller. This must be provided in order for getGCData to work.\n * - getInitialGCDetailsFn - This gets the initial GC details from the caller.\n * - deleteChild - Deletes a child node.\n * - isReferenced - This tells whether this node is referenced in the document or not.\n * - updateUsedRoutes - Used to notify this node of routes that are currently in use in it.\n */\nexport interface ISummarizerNodeWithGC extends ISummarizerNode {\n createChild(\n /** Summarize function */\n summarizeInternalFn: SummarizeInternalFn,\n /** Initial id or path part of this node */\n id: string,\n /**\n * Information needed to create the node.\n * If it is from a base summary, it will assert that a summary has been seen.\n * Attach information if it is created from an attach op.\n * If it is local, it will throw unsupported errors on calls to summarize.\n */\n createParam: CreateChildSummarizerNodeParam,\n /** Optional configuration affecting summarize behavior */\n config?: ISummarizerNodeConfigWithGC,\n getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n getInitialGCSummaryDetailsFn?: () => Promise<IGarbageCollectionSummaryDetails>,\n ): ISummarizerNodeWithGC;\n\n /**\n * Delete the child with the given id..\n */\n deleteChild(id: string): void;\n\n getChild(id: string): ISummarizerNodeWithGC | undefined;\n\n /**\n * Returns this node's data that is used for garbage collection. This includes a list of GC nodes that represent\n * this node. Each node has a set of outbound routes to other GC nodes in the document.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;\n\n /** Tells whether this node is being referenced in this document or not. Unreferenced node will get GC'd */\n isReferenced(): boolean;\n\n /**\n * After GC has run, called to notify this node of routes that are used in it. These are used for the following:\n * 1. To identify if this node is being referenced in the document or not.\n * 2. To identify if this node or any of its children's used routes changed since last summary.\n *\n * @param usedRoutes - The routes that are used in this node.\n * @param gcTimestamp - The time when GC was run that generated these used routes. If a node becomes unreferenced\n * as part of this GC run, this timestamp is used to update the time when it happens.\n */\n updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number): void;\n\n /**\n * @deprecated - Renamed to getBaseGCDetails.\n * Returns the GC details that may be added to this node's summary.\n */\n getGCSummaryDetails(): IGarbageCollectionSummaryDetails;\n\n /** Returns the GC details to be added to this node's summary and is used to initialize new nodes' GC state. */\n getBaseGCDetails?(): IGarbageCollectionDetailsBase;\n}\n\nexport const channelsTreeName = \".channels\";\n\n/**\n * Contains telemetry data relevant to summarization workflows.\n * This object is expected to be modified directly by various summarize methods.\n */\nexport interface ITelemetryContext {\n /**\n * Sets value for telemetry data being tracked.\n * @param prefix - unique prefix to tag this data with (ex: \"fluid:map:\")\n * @param property - property name of the telemetry data being tracked (ex: \"DirectoryCount\")\n * @param value - value to attribute to this summary telemetry data\n */\n set(prefix: string, property: string, value: TelemetryEventPropertyType): void;\n\n /**\n * Get the telemetry data being tracked\n * @param prefix - unique prefix for this data (ex: \"fluid:map:\")\n * @param property - property name of the telemetry data being tracked (ex: \"DirectoryCount\")\n * @returns undefined if item not found\n */\n get(prefix: string, property: string): TelemetryEventPropertyType;\n\n /**\n * Returns a serialized version of all the telemetry data.\n * Should be used when logging in telemetry events.\n */\n serialize(): string;\n}\n\nexport const blobCountPropertyName = \"BlobCount\";\n\nexport const totalBlobSizePropertyName = \"TotalBlobSize\";\n"]}
1
+ {"version":3,"file":"summary.js","sourceRoot":"","sources":["../src/summary.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAmJH;;GAEG;AACH,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IACrC,yFAAW,CAAA;IACX,uFAAU,CAAA;IACV,6EAAK,CAAA;AACN,CAAC,EAJW,0BAA0B,0CAA1B,0BAA0B,QAIrC;AAuKD;;GAEG;AACU,QAAA,gBAAgB,GAAG,WAAW,CAAC;AA2C5C;;GAEG;AACU,QAAA,qBAAqB,GAAG,WAAW,CAAC;AAEjD;;GAEG;AACU,QAAA,yBAAyB,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TelemetryEventPropertyType } from \"@fluidframework/core-interfaces\";\nimport {\n\tSummaryTree,\n\tISummaryTree,\n\tISequencedDocumentMessage,\n\tISnapshotTree,\n\tITree,\n} from \"@fluidframework/protocol-definitions\";\nimport { IGarbageCollectionData, IGarbageCollectionDetailsBase } from \"./garbageCollection\";\n\n/**\n * Contains the aggregation data from a Tree/Subtree.\n * @public\n */\nexport interface ISummaryStats {\n\ttreeNodeCount: number;\n\tblobNodeCount: number;\n\thandleNodeCount: number;\n\ttotalBlobSize: number;\n\tunreferencedBlobSize: number;\n}\n\n/**\n * Represents the summary tree for a node along with the statistics for that tree.\n * For example, for a given data store, it contains the data for data store along with a subtree for\n * each of its DDS.\n * Any component that implements IChannelContext, IFluidDataStoreChannel or extends SharedObject\n * will be taking part of the summarization process.\n * @public\n */\nexport interface ISummaryTreeWithStats {\n\t/**\n\t * Represents an aggregation of node counts and blob sizes associated to the current summary information\n\t */\n\tstats: ISummaryStats;\n\t/**\n\t * A recursive data structure that will be converted to a snapshot tree and uploaded\n\t * to the backend.\n\t */\n\tsummary: ISummaryTree;\n}\n\n/**\n * Represents a summary at a current sequence number.\n * @alpha\n */\nexport interface ISummarizeResult {\n\tstats: ISummaryStats;\n\tsummary: SummaryTree;\n}\n\n/**\n * Contains the same data as ISummaryResult but in order to avoid naming collisions,\n * the data store summaries are wrapped around an array of labels identified by pathPartsForChildren.\n *\n * @example\n *\n * ```typescript\n * id:\"\"\n * pathPartsForChildren: [\"path1\"]\n * stats: ...\n * summary:\n * ...\n * \"path1\":\n * ```\n * @alpha\n */\nexport interface ISummarizeInternalResult extends ISummarizeResult {\n\tid: string;\n\t/**\n\t * Additional path parts between this node's ID and its children's IDs.\n\t */\n\tpathPartsForChildren?: string[];\n}\n\n/**\n * @experimental - Can be deleted/changed at any time\n * Contains the necessary information to allow DDSes to do incremental summaries\n * @public\n */\nexport interface IExperimentalIncrementalSummaryContext {\n\t/**\n\t * The sequence number of the summary generated that will be sent to the server.\n\t */\n\tsummarySequenceNumber: number;\n\t/**\n\t * The sequence number of the most recent summary that was acknowledged by the server.\n\t */\n\tlatestSummarySequenceNumber: number;\n\t/**\n\t * The path to the runtime/datastore/dds that is used to generate summary handles\n\t * Note: Summary handles are nodes of the summary tree that point to previous parts of the last successful summary\n\t * instead of being a blob or tree node\n\t *\n\t * This path contains the id of the data store and dds which should not be leaked to layers below them. Ideally,\n\t * a layer should not know its own id. This is important for channel unification work and there has been a lot of\n\t * work to remove these kinds of leakages. Some still exist, which have to be fixed but we should not be adding\n\t * more dependencies.\n\t */\n\t// TODO: remove summaryPath\n\tsummaryPath: string;\n}\n\n/**\n * @alpha\n */\nexport type SummarizeInternalFn = (\n\tfullTree: boolean,\n\ttrackState: boolean,\n\ttelemetryContext?: ITelemetryContext,\n\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n) => Promise<ISummarizeInternalResult>;\n\n/**\n * @alpha\n */\nexport interface ISummarizerNodeConfig {\n\t/**\n\t * True to reuse previous handle when unchanged since last acked summary.\n\t * Defaults to true.\n\t */\n\treadonly canReuseHandle?: boolean;\n\t/**\n\t * True to always stop execution on error during summarize, or false to\n\t * attempt creating a summary that is a pointer ot the last acked summary\n\t * plus outstanding ops in case of internal summarize failure.\n\t * Defaults to false.\n\t *\n\t * BUG BUG: Default to true while we investigate problem\n\t * with differential summaries\n\t */\n\treadonly throwOnFailure?: true;\n}\n\n/**\n * @alpha\n */\nexport interface ISummarizerNodeConfigWithGC extends ISummarizerNodeConfig {\n\t/**\n\t * True if GC is disabled. If so, don't track GC related state for a summary.\n\t * This is propagated to all child nodes.\n\t */\n\treadonly gcDisabled?: boolean;\n}\n\n/**\n * @alpha\n */\nexport enum CreateSummarizerNodeSource {\n\tFromSummary,\n\tFromAttach,\n\tLocal,\n}\n/**\n * @alpha\n */\nexport type CreateChildSummarizerNodeParam =\n\t| {\n\t\t\ttype: CreateSummarizerNodeSource.FromSummary;\n\t }\n\t| {\n\t\t\ttype: CreateSummarizerNodeSource.FromAttach;\n\t\t\tsequenceNumber: number;\n\t\t\tsnapshot: ITree;\n\t }\n\t| {\n\t\t\ttype: CreateSummarizerNodeSource.Local;\n\t };\n\n/**\n * @alpha\n */\nexport interface ISummarizerNode {\n\t/**\n\t * Latest successfully acked summary reference sequence number\n\t */\n\treadonly referenceSequenceNumber: number;\n\t/**\n\t * Marks the node as having a change with the given sequence number.\n\t * @param sequenceNumber - sequence number of change\n\t */\n\tinvalidate(sequenceNumber: number): void;\n\t/**\n\t * Calls the internal summarize function and handles internal state tracking.\n\t * If unchanged and fullTree is false, it will reuse previous summary subtree.\n\t * If an error is encountered and throwOnFailure is false, it will try to make\n\t * a summary with a pointer to the previous summary + a blob of outstanding ops.\n\t * @param fullTree - true to skip optimizations and always generate the full tree\n\t * @param trackState - indicates whether the summarizer node should track the state of the summary or not\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tsummarize(\n\t\tfullTree: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult>;\n\t/**\n\t * Checks if there are any additional path parts for children that need to\n\t * be loaded from the base summary. Additional path parts represent parts\n\t * of the path between this SummarizerNode and any child SummarizerNodes\n\t * that it might have. For example: if datastore \"a\" contains dds \"b\", but the\n\t * path is \"/a/.channels/b\", then the additional path part is \".channels\".\n\t * @param snapshot - the base summary to parse\n\t */\n\tupdateBaseSummaryState(snapshot: ISnapshotTree): void;\n\t/**\n\t * Records an op representing a change to this node/subtree.\n\t * @param op - op of change to record\n\t */\n\trecordChange(op: ISequencedDocumentMessage): void;\n\n\tcreateChild(\n\t\t/**\n\t\t * Summarize function\n\t\t */\n\t\tsummarizeInternalFn: SummarizeInternalFn,\n\t\t/**\n\t\t * Initial id or path part of this node\n\t\t */\n\t\tid: string,\n\t\t/**\n\t\t * Information needed to create the node.\n\t\t * If it is from a base summary, it will assert that a summary has been seen.\n\t\t * Attach information if it is created from an attach op.\n\t\t * If it is local, it will throw unsupported errors on calls to summarize.\n\t\t */\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t\t/**\n\t\t * Optional configuration affecting summarize behavior\n\t\t */\n\t\tconfig?: ISummarizerNodeConfig,\n\t): ISummarizerNode;\n\n\tgetChild(id: string): ISummarizerNode | undefined;\n\n\t/** True if a summary is currently in progress */\n\tisSummaryInProgress?(): boolean;\n}\n\n/**\n * Extends the functionality of ISummarizerNode to support garbage collection. It adds / updates the following APIs:\n *\n * `usedRoutes`: The routes in this node that are currently in use.\n *\n * `getGCData`: A new API that can be used to get the garbage collection data for this node.\n *\n * `summarize`: Added a trackState flag which indicates whether the summarizer node should track the state of the\n * summary or not.\n *\n * `createChild`: Added the following params:\n *\n * - `getGCDataFn`: This gets the GC data from the caller. This must be provided in order for getGCData to work.\n *\n * - `getInitialGCDetailsFn`: This gets the initial GC details from the caller.\n *\n * `deleteChild`: Deletes a child node.\n *\n * `isReferenced`: This tells whether this node is referenced in the document or not.\n *\n * `updateUsedRoutes`: Used to notify this node of routes that are currently in use in it.\n * @alpha\n */\nexport interface ISummarizerNodeWithGC extends ISummarizerNode {\n\tcreateChild(\n\t\t/**\n\t\t * Summarize function\n\t\t */\n\t\tsummarizeInternalFn: SummarizeInternalFn,\n\t\t/**\n\t\t * Initial id or path part of this node\n\t\t */\n\t\tid: string,\n\t\t/**\n\t\t * Information needed to create the node.\n\t\t * If it is from a base summary, it will assert that a summary has been seen.\n\t\t * Attach information if it is created from an attach op.\n\t\t * If it is local, it will throw unsupported errors on calls to summarize.\n\t\t */\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t\t/**\n\t\t * Optional configuration affecting summarize behavior\n\t\t */\n\t\tconfig?: ISummarizerNodeConfigWithGC,\n\t\tgetGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\t\t/**\n\t\t * @deprecated The functionality to update child's base GC details is incorporated in the summarizer node.\n\t\t */\n\t\tgetBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,\n\t): ISummarizerNodeWithGC;\n\n\t/**\n\t * Delete the child with the given id..\n\t */\n\tdeleteChild(id: string): void;\n\n\tgetChild(id: string): ISummarizerNodeWithGC | undefined;\n\n\t/**\n\t * Returns this node's data that is used for garbage collection. This includes a list of GC nodes that represent\n\t * this node. Each node has a set of outbound routes to other GC nodes in the document.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tgetGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;\n\n\t/**\n\t * Tells whether this node is being referenced in this document or not. Unreferenced node will get GC'd\n\t */\n\tisReferenced(): boolean;\n\n\t/**\n\t * After GC has run, called to notify this node of routes that are used in it. These are used for the following:\n\t * 1. To identify if this node is being referenced in the document or not.\n\t * 2. To identify if this node or any of its children's used routes changed since last summary.\n\t *\n\t * @param usedRoutes - The routes that are used in this node.\n\t */\n\tupdateUsedRoutes(usedRoutes: string[]): void;\n}\n\n/**\n * @internal\n */\nexport const channelsTreeName = \".channels\";\n\n/**\n * Contains telemetry data relevant to summarization workflows.\n * This object is expected to be modified directly by various summarize methods.\n * @public\n */\nexport interface ITelemetryContext {\n\t/**\n\t * Sets value for telemetry data being tracked.\n\t * @param prefix - unique prefix to tag this data with (ex: \"fluid:map:\")\n\t * @param property - property name of the telemetry data being tracked (ex: \"DirectoryCount\")\n\t * @param value - value to attribute to this summary telemetry data\n\t */\n\tset(prefix: string, property: string, value: TelemetryEventPropertyType): void;\n\n\t/**\n\t * Sets multiple values for telemetry data being tracked.\n\t * @param prefix - unique prefix to tag this data with (ex: \"fluid:summarize:\")\n\t * @param property - property name of the telemetry data being tracked (ex: \"Options\")\n\t * @param values - A set of values to attribute to this summary telemetry data.\n\t */\n\tsetMultiple(\n\t\tprefix: string,\n\t\tproperty: string,\n\t\tvalues: Record<string, TelemetryEventPropertyType>,\n\t): void;\n\n\t/**\n\t * Get the telemetry data being tracked\n\t * @param prefix - unique prefix for this data (ex: \"fluid:map:\")\n\t * @param property - property name of the telemetry data being tracked (ex: \"DirectoryCount\")\n\t * @returns undefined if item not found\n\t */\n\tget(prefix: string, property: string): TelemetryEventPropertyType;\n\n\t/**\n\t * Returns a serialized version of all the telemetry data.\n\t * Should be used when logging in telemetry events.\n\t */\n\tserialize(): string;\n}\n\n/**\n * @internal\n */\nexport const blobCountPropertyName = \"BlobCount\";\n\n/**\n * @internal\n */\nexport const totalBlobSizePropertyName = \"TotalBlobSize\";\n"]}
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.38.3"
9
+ }
10
+ ]
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/runtime-definitions",
3
- "version": "1.4.0-115997",
3
+ "version": "2.0.0-dev-rc.1.0.0.224419",
4
4
  "description": "Fluid Runtime definitions",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -11,52 +11,106 @@
11
11
  "license": "MIT",
12
12
  "author": "Microsoft and contributors",
13
13
  "sideEffects": false,
14
+ "type": "commonjs",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ }
20
+ },
14
21
  "main": "dist/index.js",
15
22
  "types": "dist/index.d.ts",
16
- "scripts": {
17
- "build": "concurrently npm:build:compile npm:lint && npm run build:docs",
18
- "build:compile": "npm run tsc && npm run typetests:gen && npm run build:test",
19
- "build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
20
- "build:full": "npm run build",
21
- "build:full:compile": "npm run build:compile",
22
- "build:test": "tsc --project ./src/test/tsconfig.json",
23
- "ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
24
- "clean": "rimraf dist *.tsbuildinfo *.build.log",
25
- "eslint": "eslint --format stylish src",
26
- "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
27
- "lint": "npm run eslint",
28
- "lint:fix": "npm run eslint:fix",
29
- "tsc": "tsc",
30
- "typetests:gen": "flub generate typetests --generate --dir . --no-generateInName",
31
- "typetests:prepare": "flub generate typetests --prepare --dir . --pin"
32
- },
33
23
  "dependencies": {
34
- "@fluidframework/common-definitions": "^0.20.1",
35
- "@fluidframework/common-utils": "^0.32.1",
36
- "@fluidframework/container-definitions": "1.4.0-115997",
37
- "@fluidframework/core-interfaces": "1.4.0-115997",
38
- "@fluidframework/driver-definitions": "1.4.0-115997",
39
- "@fluidframework/protocol-definitions": "^0.1028.2000",
40
- "@types/node": "^14.18.0"
24
+ "@fluidframework/container-definitions": "2.0.0-dev-rc.1.0.0.224419",
25
+ "@fluidframework/core-interfaces": "2.0.0-dev-rc.1.0.0.224419",
26
+ "@fluidframework/driver-definitions": "2.0.0-dev-rc.1.0.0.224419",
27
+ "@fluidframework/id-compressor": "2.0.0-dev-rc.1.0.0.224419",
28
+ "@fluidframework/protocol-definitions": "^3.1.0-223007"
41
29
  },
42
30
  "devDependencies": {
43
- "@fluidframework/build-common": "^0.24.0",
44
- "@fluidframework/build-tools": "^0.6.0-110101",
45
- "@fluidframework/eslint-config-fluid": "^0.28.2000",
46
- "@fluidframework/runtime-definitions-previous": "npm:@fluidframework/runtime-definitions@1.3.1",
47
- "@microsoft/api-extractor": "^7.22.2",
48
- "@rushstack/eslint-config": "^2.5.1",
49
- "concurrently": "^6.2.0",
50
- "copyfiles": "^2.1.0",
51
- "eslint": "~8.6.0",
52
- "rimraf": "^2.6.2",
53
- "typescript": "~4.5.5",
54
- "typescript-formatter": "7.1.0"
31
+ "@arethetypeswrong/cli": "^0.13.3",
32
+ "@fluid-tools/build-cli": "0.29.0-222379",
33
+ "@fluidframework/build-common": "^2.0.3",
34
+ "@fluidframework/build-tools": "0.29.0-222379",
35
+ "@fluidframework/eslint-config-fluid": "^3.1.0",
36
+ "@fluidframework/runtime-definitions-previous": "npm:@fluidframework/runtime-definitions@2.0.0-internal.7.2.0",
37
+ "@microsoft/api-extractor": "^7.38.3",
38
+ "copyfiles": "^2.4.1",
39
+ "eslint": "~8.50.0",
40
+ "eslint-plugin-deprecation": "~2.0.0",
41
+ "prettier": "~3.0.3",
42
+ "rimraf": "^4.4.0",
43
+ "typescript": "~5.1.6"
44
+ },
45
+ "fluidBuild": {
46
+ "tasks": {
47
+ "build:docs": {
48
+ "dependsOn": [
49
+ "...",
50
+ "api-extractor:commonjs"
51
+ ],
52
+ "script": false
53
+ }
54
+ }
55
55
  },
56
56
  "typeValidation": {
57
- "version": "1.4.0",
58
- "baselineRange": "~1.3.0",
59
- "baselineVersion": "1.3.1",
60
- "broken": {}
57
+ "broken": {
58
+ "TypeAliasDeclaration_IdCreationRangeWithStashedState": {
59
+ "forwardCompat": false,
60
+ "backCompat": false
61
+ },
62
+ "RemovedTypeAliasDeclaration_IdCreationRangeWithStashedState": {
63
+ "forwardCompat": false,
64
+ "backCompat": false
65
+ },
66
+ "InterfaceDeclaration_IdCreationRange": {
67
+ "forwardCompat": false
68
+ },
69
+ "VariableDeclaration_initialClusterCapacity": {
70
+ "backCompat": false,
71
+ "forwardCompat": false
72
+ },
73
+ "RemovedVariableDeclaration_initialClusterCapacity": {
74
+ "forwardCompat": false,
75
+ "backCompat": false
76
+ },
77
+ "InterfaceDeclaration_IContainerRuntimeBase": {
78
+ "backCompat": false
79
+ },
80
+ "InterfaceDeclaration_IFluidDataStoreContext": {
81
+ "backCompat": false
82
+ },
83
+ "InterfaceDeclaration_IFluidDataStoreContextDetached": {
84
+ "backCompat": false
85
+ },
86
+ "InterfaceDeclaration_IDataStore": {
87
+ "backCompat": false
88
+ },
89
+ "InterfaceDeclaration_IFluidDataStoreChannel": {
90
+ "backCompat": false
91
+ }
92
+ }
93
+ },
94
+ "scripts": {
95
+ "api": "fluid-build . --task api",
96
+ "api-extractor:commonjs": "api-extractor run --local",
97
+ "build": "fluid-build . --task build",
98
+ "build:compile": "fluid-build . --task compile",
99
+ "build:docs": "fluid-build . --task api",
100
+ "build:test": "tsc --project ./src/test/tsconfig.json",
101
+ "check:are-the-types-wrong": "attw --pack",
102
+ "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
103
+ "ci:build:docs": "api-extractor run",
104
+ "clean": "rimraf --glob dist \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp",
105
+ "eslint": "eslint --format stylish src",
106
+ "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
107
+ "format": "npm run prettier:fix",
108
+ "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
109
+ "lint:fix": "npm run prettier:fix && npm run eslint:fix",
110
+ "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
111
+ "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
112
+ "tsc": "tsc",
113
+ "typetests:gen": "fluid-type-test-generator",
114
+ "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
61
115
  }
62
- }
116
+ }
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ module.exports = {
7
+ ...require("@fluidframework/build-common/prettier.config.cjs"),
8
+ };