@fluid-experimental/sequence-deprecated 2.0.0-dev.2.2.0.111723

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 (63) hide show
  1. package/.editorconfig +7 -0
  2. package/.eslintrc.js +17 -0
  3. package/.vscode/launch.json +14 -0
  4. package/LICENSE +21 -0
  5. package/README.md +3 -0
  6. package/api-extractor.json +12 -0
  7. package/dist/index.d.ts +8 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +24 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/packageVersion.d.ts +9 -0
  12. package/dist/packageVersion.d.ts.map +1 -0
  13. package/dist/packageVersion.js +12 -0
  14. package/dist/packageVersion.js.map +1 -0
  15. package/dist/sequenceFactory.d.ts +95 -0
  16. package/dist/sequenceFactory.d.ts.map +1 -0
  17. package/dist/sequenceFactory.js +152 -0
  18. package/dist/sequenceFactory.js.map +1 -0
  19. package/dist/sharedNumberSequence.d.ts +50 -0
  20. package/dist/sharedNumberSequence.d.ts.map +1 -0
  21. package/dist/sharedNumberSequence.js +67 -0
  22. package/dist/sharedNumberSequence.js.map +1 -0
  23. package/dist/sharedObjectSequence.d.ts +50 -0
  24. package/dist/sharedObjectSequence.d.ts.map +1 -0
  25. package/dist/sharedObjectSequence.js +61 -0
  26. package/dist/sharedObjectSequence.js.map +1 -0
  27. package/dist/sparsematrix.d.ts +152 -0
  28. package/dist/sparsematrix.d.ts.map +1 -0
  29. package/dist/sparsematrix.js +345 -0
  30. package/dist/sparsematrix.js.map +1 -0
  31. package/lib/index.d.ts +8 -0
  32. package/lib/index.d.ts.map +1 -0
  33. package/lib/index.js +8 -0
  34. package/lib/index.js.map +1 -0
  35. package/lib/packageVersion.d.ts +9 -0
  36. package/lib/packageVersion.d.ts.map +1 -0
  37. package/lib/packageVersion.js +9 -0
  38. package/lib/packageVersion.js.map +1 -0
  39. package/lib/sequenceFactory.d.ts +95 -0
  40. package/lib/sequenceFactory.d.ts.map +1 -0
  41. package/lib/sequenceFactory.js +147 -0
  42. package/lib/sequenceFactory.js.map +1 -0
  43. package/lib/sharedNumberSequence.d.ts +50 -0
  44. package/lib/sharedNumberSequence.d.ts.map +1 -0
  45. package/lib/sharedNumberSequence.js +63 -0
  46. package/lib/sharedNumberSequence.js.map +1 -0
  47. package/lib/sharedObjectSequence.d.ts +50 -0
  48. package/lib/sharedObjectSequence.d.ts.map +1 -0
  49. package/lib/sharedObjectSequence.js +57 -0
  50. package/lib/sharedObjectSequence.js.map +1 -0
  51. package/lib/sparsematrix.d.ts +152 -0
  52. package/lib/sparsematrix.d.ts.map +1 -0
  53. package/lib/sparsematrix.js +336 -0
  54. package/lib/sparsematrix.js.map +1 -0
  55. package/package.json +97 -0
  56. package/src/index.ts +22 -0
  57. package/src/packageVersion.ts +9 -0
  58. package/src/sequenceFactory.ts +181 -0
  59. package/src/sharedNumberSequence.ts +68 -0
  60. package/src/sharedObjectSequence.ts +62 -0
  61. package/src/sparsematrix.ts +434 -0
  62. package/tsconfig.esnext.json +7 -0
  63. package/tsconfig.json +14 -0
@@ -0,0 +1,61 @@
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
+ exports.SharedObjectSequence = void 0;
8
+ const sequence_1 = require("@fluidframework/sequence");
9
+ const sequenceFactory_1 = require("./sequenceFactory");
10
+ /**
11
+ * The SharedObjectSequence holds a sequence of serializable objects. Each object will be stored
12
+ * at a position within the sequence. See the
13
+ * {@link https://fluidframework.com/docs/data-structures/sequences/ | sequence documentation}
14
+ * for details on working with sequences.
15
+ *
16
+ * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.
17
+ * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
18
+ */
19
+ class SharedObjectSequence extends sequence_1.SharedSequence {
20
+ /**
21
+ * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.
22
+ * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
23
+ */
24
+ constructor(document, id, attributes) {
25
+ super(document, id, attributes, sequenceFactory_1.SharedObjectSequenceFactory.segmentFromSpec);
26
+ this.id = id;
27
+ }
28
+ /**
29
+ * Create a new shared object sequence
30
+ *
31
+ * @param runtime - data store runtime the new shared object sequence belongs to
32
+ * @param id - optional name of the shared object sequence
33
+ * @returns newly create shared object sequence (but not attached yet)
34
+ *
35
+ * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.
36
+ * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
37
+ */
38
+ static create(runtime, id) {
39
+ return runtime.createChannel(id, sequenceFactory_1.SharedObjectSequenceFactory.Type);
40
+ }
41
+ /**
42
+ * Get a factory for SharedObjectSequence to register with the data store.
43
+ *
44
+ * @returns a factory that creates and load SharedObjectSequence
45
+ *
46
+ * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.
47
+ * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
48
+ */
49
+ static getFactory() {
50
+ return new sequenceFactory_1.SharedObjectSequenceFactory();
51
+ }
52
+ /**
53
+ * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.
54
+ * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
55
+ */
56
+ getRange(start, end) {
57
+ return this.getItems(start, end);
58
+ }
59
+ }
60
+ exports.SharedObjectSequence = SharedObjectSequence;
61
+ //# sourceMappingURL=sharedObjectSequence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharedObjectSequence.js","sourceRoot":"","sources":["../src/sharedObjectSequence.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uDAA0D;AAC1D,uDAAgE;AAEhE;;;;;;;;GAQG;AACH,MAAa,oBAAwB,SAAQ,yBAAiB;IA4B1D;;;OAGG;IACH,YAAY,QAAgC,EAAS,EAAU,EAAE,UAA8B;QAC3F,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,6CAA2B,CAAC,eAAsB,CAAC,CAAC;QADnC,OAAE,GAAF,EAAE,CAAQ;IAE/D,CAAC;IAjCD;;;;;;;;;OASG;IAEI,MAAM,CAAC,MAAM,CAAI,OAA+B,EAAE,EAAW;QAChE,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,6CAA2B,CAAC,IAAI,CAA4B,CAAC;IAClG,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,UAAU;QACpB,OAAO,IAAI,6CAA2B,EAAE,CAAC;IAC7C,CAAC;IAUD;;;OAGG;IACI,QAAQ,CAAC,KAAa,EAAE,GAAY;QACvC,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACrC,CAAC;CACJ;AA3CD,oDA2CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidDataStoreRuntime, IChannelAttributes, Serializable } from \"@fluidframework/datastore-definitions\";\nimport { SharedSequence } from \"@fluidframework/sequence\";\nimport { SharedObjectSequenceFactory } from \"./sequenceFactory\";\n\n/**\n * The SharedObjectSequence holds a sequence of serializable objects. Each object will be stored\n * at a position within the sequence. See the\n * {@link https://fluidframework.com/docs/data-structures/sequences/ | sequence documentation}\n * for details on working with sequences.\n *\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\nexport class SharedObjectSequence<T> extends SharedSequence<T> {\n /**\n * Create a new shared object sequence\n *\n * @param runtime - data store runtime the new shared object sequence belongs to\n * @param id - optional name of the shared object sequence\n * @returns newly create shared object sequence (but not attached yet)\n *\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n\n public static create<T>(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, SharedObjectSequenceFactory.Type) as SharedObjectSequence<T>;\n }\n\n /**\n * Get a factory for SharedObjectSequence to register with the data store.\n *\n * @returns a factory that creates and load SharedObjectSequence\n *\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public static getFactory() {\n return new SharedObjectSequenceFactory();\n }\n\n /**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n constructor(document: IFluidDataStoreRuntime, public id: string, attributes: IChannelAttributes) {\n super(document, id, attributes, SharedObjectSequenceFactory.segmentFromSpec as any);\n }\n\n /**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public getRange(start: number, end?: number): Serializable<T>[] {\n return this.getItems(start, end);\n }\n}\n"]}
@@ -0,0 +1,152 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { IFluidHandle } from "@fluidframework/core-interfaces";
6
+ import { BaseSegment, IJSONSegment, ISegment, PropertySet } from "@fluidframework/merge-tree";
7
+ import { IChannelAttributes, IFluidDataStoreRuntime, IChannelServices, IChannelFactory, Serializable, Jsonable } from "@fluidframework/datastore-definitions";
8
+ import { SharedSegmentSequence, SubSequence } from "@fluidframework/sequence";
9
+ import { ISharedObject } from "@fluidframework/shared-object-base";
10
+ /**
11
+ * An empty segment that occupies 'cachedLength' positions.
12
+ * {@link SparseMatrix} uses `PaddingSegment` to "pad" a run of unoccupied cells.
13
+ *
14
+ * @deprecated `PaddingSegment` is part of an abandoned prototype.
15
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
16
+ */
17
+ export declare class PaddingSegment extends BaseSegment {
18
+ static readonly typeString = "PaddingSegment";
19
+ static is(segment: ISegment): segment is PaddingSegment;
20
+ static fromJSONObject(spec: any): PaddingSegment | undefined;
21
+ readonly type = "PaddingSegment";
22
+ constructor(size: number);
23
+ toJSONObject(): {
24
+ pad: number;
25
+ props: PropertySet | undefined;
26
+ };
27
+ clone(start?: number, end?: number): PaddingSegment;
28
+ canAppend(segment: ISegment): boolean;
29
+ toString(): string;
30
+ append(segment: ISegment): void;
31
+ removeRange(start: number, end: number): boolean;
32
+ protected createSplitSegmentAt(pos: number): PaddingSegment;
33
+ }
34
+ /**
35
+ * @deprecated `SparseMatrixItem` is part of an abandoned prototype.
36
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
37
+ */
38
+ export declare type SparseMatrixItem = Serializable;
39
+ /**
40
+ * @deprecated `RunSegment` is part of an abandoned prototype.
41
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
42
+ */
43
+ export declare class RunSegment extends SubSequence<SparseMatrixItem> {
44
+ items: SparseMatrixItem[];
45
+ static readonly typeString = "RunSegment";
46
+ static is(segment: ISegment): segment is RunSegment;
47
+ static fromJSONObject(spec: any): RunSegment | undefined;
48
+ readonly type = "RunSegment";
49
+ private tags;
50
+ constructor(items: SparseMatrixItem[]);
51
+ clone(start?: number, end?: number): RunSegment;
52
+ append(segment: ISegment): this;
53
+ removeRange(start: number, end: number): boolean;
54
+ getTag(pos: number): any;
55
+ setTag(pos: number, tag: any): void;
56
+ protected createSplitSegmentAt(pos: number): RunSegment | undefined;
57
+ }
58
+ /**
59
+ * @deprecated `MatrixSegment` is part of an abandoned prototype.
60
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
61
+ */
62
+ export declare type MatrixSegment = RunSegment | PaddingSegment;
63
+ /**
64
+ * @deprecated `maxCol` is part of an abandoned prototype.
65
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
66
+ */
67
+ export declare const maxCol = 2097152;
68
+ /**
69
+ * @deprecated `maxCols` is part of an abandoned prototype.
70
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
71
+ */
72
+ export declare const maxCols: number;
73
+ /**
74
+ * @deprecated `maxRow` is part of an abandoned prototype.
75
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
76
+ */
77
+ export declare const maxRow = 4294967295;
78
+ /**
79
+ * @deprecated `maxRows` is part of an abandoned prototype.
80
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
81
+ */
82
+ export declare const maxRows: number;
83
+ /**
84
+ * @deprecated `maxCellPosition` is part of an abandoned prototype.
85
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
86
+ */
87
+ export declare const maxCellPosition: number;
88
+ /**
89
+ * @deprecated `positionToRowCol` is part of an abandoned prototype.
90
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
91
+ */
92
+ export declare const rowColToPosition: (row: number, col: number) => number;
93
+ /**
94
+ * @deprecated `positionToRowCol` is part of an abandoned prototype.
95
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
96
+ */
97
+ export declare function positionToRowCol(position: number): {
98
+ row: number;
99
+ col: number;
100
+ };
101
+ /**
102
+ * @deprecated `SparseMatrix` is an abandoned prototype.
103
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
104
+ */
105
+ export declare class SparseMatrix extends SharedSegmentSequence<MatrixSegment> {
106
+ id: string;
107
+ /**
108
+ * Create a new sparse matrix
109
+ *
110
+ * @param runtime - data store runtime the new sparse matrix belongs to
111
+ * @param id - optional name of the sparse matrix
112
+ * @returns newly create sparse matrix (but not attached yet)
113
+ */
114
+ static create(runtime: IFluidDataStoreRuntime, id?: string): SparseMatrix;
115
+ /**
116
+ * Get a factory for SharedMap to register with the data store.
117
+ *
118
+ * @returns a factory that creates and load SharedMap
119
+ */
120
+ static getFactory(): IChannelFactory;
121
+ constructor(document: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes);
122
+ get numRows(): number;
123
+ setItems(row: number, col: number, values: SparseMatrixItem[], props?: PropertySet): void;
124
+ getItem(row: number, col: number): Jsonable<string | number | boolean | IFluidHandle> | undefined;
125
+ getTag(row: number, col: number): any;
126
+ setTag(row: number, col: number, tag: any): void;
127
+ insertRows(row: number, numRows: number): void;
128
+ removeRows(row: number, numRows: number): void;
129
+ insertCols(col: number, numCols: number): void;
130
+ removeCols(col: number, numCols: number): void;
131
+ annotatePosition(row: number, col: number, props: PropertySet): void;
132
+ getPositionProperties(row: number, col: number): PropertySet | undefined;
133
+ private moveAsPadding;
134
+ private getSegment;
135
+ }
136
+ /**
137
+ * @deprecated `SparseMatrixFactory` is an abandoned prototype.
138
+ * Use {@link @fluidframework/matrix#SharedMatrixFactory} instead.
139
+ */
140
+ export declare class SparseMatrixFactory implements IChannelFactory {
141
+ static Type: string;
142
+ static Attributes: IChannelAttributes;
143
+ static segmentFromSpec(spec: IJSONSegment): ISegment;
144
+ get type(): string;
145
+ get attributes(): IChannelAttributes;
146
+ /**
147
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
148
+ */
149
+ load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<ISharedObject>;
150
+ create(document: IFluidDataStoreRuntime, id: string): ISharedObject;
151
+ }
152
+ //# sourceMappingURL=sparsematrix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sparsematrix.d.ts","sourceRoot":"","sources":["../src/sparsematrix.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACH,WAAW,EAEX,YAAY,EAEZ,QAAQ,EACR,WAAW,EACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,QAAQ,EACX,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,WA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MAAM,EAAE,GAAG,EAAE,GAAG;IASzC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAWvC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAMvC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAIvC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAIvC,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;IAK7D,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAOrD,OAAO,CAAC,aAAa;IAqBrB,OAAO,CAAC,UAAU;CAIrB;AAED;;;GAGG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IACvD,OAAc,IAAI,SAA+D;IAEjF,OAAc,UAAU,EAAE,kBAAkB,CAI1C;WAEY,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ;IAc3D,IAAW,IAAI,WAEd;IAED,IAAW,UAAU,uBAEpB;IAED;;OAEG;IACU,IAAI,CACb,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC/B,OAAO,CAAC,aAAa,CAAC;IAMlB,MAAM,CAAC,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,aAAa;CAK7E"}
@@ -0,0 +1,345 @@
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
+ exports.SparseMatrixFactory = exports.SparseMatrix = exports.positionToRowCol = exports.rowColToPosition = exports.maxCellPosition = exports.maxRows = exports.maxRow = exports.maxCols = exports.maxCol = exports.RunSegment = exports.PaddingSegment = void 0;
8
+ const common_utils_1 = require("@fluidframework/common-utils");
9
+ const merge_tree_1 = require("@fluidframework/merge-tree");
10
+ const sequence_1 = require("@fluidframework/sequence");
11
+ const packageVersion_1 = require("./packageVersion");
12
+ /**
13
+ * An empty segment that occupies 'cachedLength' positions.
14
+ * {@link SparseMatrix} uses `PaddingSegment` to "pad" a run of unoccupied cells.
15
+ *
16
+ * @deprecated `PaddingSegment` is part of an abandoned prototype.
17
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
18
+ */
19
+ class PaddingSegment extends merge_tree_1.BaseSegment {
20
+ constructor(size) {
21
+ super();
22
+ this.type = PaddingSegment.typeString;
23
+ this.cachedLength = size;
24
+ }
25
+ static is(segment) {
26
+ return segment.type === PaddingSegment.typeString;
27
+ }
28
+ static fromJSONObject(spec) {
29
+ if (spec && typeof spec === "object" && "pad" in spec) {
30
+ const segment = new PaddingSegment(spec.pad);
31
+ if (spec.props) {
32
+ segment.addProperties(spec.props);
33
+ }
34
+ return segment;
35
+ }
36
+ return undefined;
37
+ }
38
+ toJSONObject() {
39
+ return { pad: this.cachedLength, props: this.properties };
40
+ }
41
+ clone(start = 0, end) {
42
+ const b = new PaddingSegment(this.cachedLength);
43
+ this.cloneInto(b);
44
+ return b;
45
+ }
46
+ canAppend(segment) {
47
+ return PaddingSegment.is(segment);
48
+ }
49
+ toString() {
50
+ return `[padding: ${this.cachedLength}]`;
51
+ }
52
+ append(segment) {
53
+ (0, common_utils_1.assert)(PaddingSegment.is(segment), "can only append padding segment");
54
+ super.append(segment);
55
+ }
56
+ // Returns true if entire run removed
57
+ removeRange(start, end) {
58
+ this.cachedLength -= (end - start);
59
+ return (this.cachedLength === 0);
60
+ }
61
+ createSplitSegmentAt(pos) {
62
+ const leftLength = pos;
63
+ const rightLength = this.cachedLength - pos;
64
+ this.cachedLength = leftLength;
65
+ return new PaddingSegment(rightLength);
66
+ }
67
+ }
68
+ exports.PaddingSegment = PaddingSegment;
69
+ PaddingSegment.typeString = "PaddingSegment";
70
+ /**
71
+ * @deprecated `RunSegment` is part of an abandoned prototype.
72
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
73
+ */
74
+ class RunSegment extends sequence_1.SubSequence {
75
+ constructor(items) {
76
+ super(items);
77
+ this.items = items;
78
+ this.type = RunSegment.typeString;
79
+ this.tags = new Array(items.length).fill(undefined);
80
+ }
81
+ static is(segment) {
82
+ return segment.type === RunSegment.typeString;
83
+ }
84
+ static fromJSONObject(spec) {
85
+ if (spec && typeof spec === "object" && "items" in spec) {
86
+ const segment = new RunSegment(spec.items);
87
+ if (spec.props) {
88
+ segment.addProperties(spec.props);
89
+ }
90
+ return segment;
91
+ }
92
+ return undefined;
93
+ }
94
+ clone(start = 0, end) {
95
+ const b = new RunSegment(this.items.slice(start, end));
96
+ if (this.tags) {
97
+ b.tags = this.tags.slice(start, end);
98
+ }
99
+ this.cloneInto(b);
100
+ return b;
101
+ }
102
+ append(segment) {
103
+ super.append(segment);
104
+ const asRun = segment;
105
+ if (asRun.tags) {
106
+ if (this.tags) {
107
+ this.tags.splice(this.items.length, 0, ...asRun.tags);
108
+ }
109
+ }
110
+ return this;
111
+ }
112
+ // TODO: retain removed items for undo
113
+ // returns true if entire run removed
114
+ removeRange(start, end) {
115
+ this.tags.splice(start, end - start);
116
+ return super.removeRange(start, end);
117
+ }
118
+ getTag(pos) {
119
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
120
+ return this.tags[pos];
121
+ }
122
+ setTag(pos, tag) {
123
+ this.tags[pos] = tag;
124
+ }
125
+ createSplitSegmentAt(pos) {
126
+ if (pos > 0) {
127
+ const remainingItems = this.items.slice(pos);
128
+ this.items = this.items.slice(0, pos);
129
+ this.cachedLength = this.items.length;
130
+ const leafSegment = new RunSegment(remainingItems);
131
+ leafSegment.tags = this.tags.slice(pos);
132
+ this.tags.length = pos;
133
+ return leafSegment;
134
+ }
135
+ }
136
+ }
137
+ exports.RunSegment = RunSegment;
138
+ RunSegment.typeString = "RunSegment";
139
+ /**
140
+ * @deprecated `maxCol` is part of an abandoned prototype.
141
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
142
+ */
143
+ exports.maxCol = 0x200000; // X128 Excel maximum of 16,384 columns
144
+ /**
145
+ * @deprecated `maxCols` is part of an abandoned prototype.
146
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
147
+ */
148
+ exports.maxCols = exports.maxCol + 1;
149
+ /**
150
+ * @deprecated `maxRow` is part of an abandoned prototype.
151
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
152
+ */
153
+ exports.maxRow = 0xFFFFFFFF; // X4096 Excel maximum of 1,048,576 rows
154
+ /**
155
+ * @deprecated `maxRows` is part of an abandoned prototype.
156
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
157
+ */
158
+ exports.maxRows = exports.maxRow + 1;
159
+ /**
160
+ * @deprecated `maxCellPosition` is part of an abandoned prototype.
161
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
162
+ */
163
+ exports.maxCellPosition = exports.maxCol * exports.maxRow;
164
+ /**
165
+ * @deprecated `positionToRowCol` is part of an abandoned prototype.
166
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
167
+ */
168
+ const rowColToPosition = (row, col) => row * exports.maxCols + col;
169
+ exports.rowColToPosition = rowColToPosition;
170
+ /**
171
+ * @deprecated `positionToRowCol` is part of an abandoned prototype.
172
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
173
+ */
174
+ function positionToRowCol(position) {
175
+ const row = Math.floor(position / exports.maxCols);
176
+ const col = position - (row * exports.maxCols);
177
+ return { row, col };
178
+ }
179
+ exports.positionToRowCol = positionToRowCol;
180
+ /**
181
+ * @deprecated `SparseMatrix` is an abandoned prototype.
182
+ * Use {@link @fluidframework/matrix#SharedMatrix} instead.
183
+ */
184
+ class SparseMatrix extends sequence_1.SharedSegmentSequence {
185
+ constructor(document, id, attributes) {
186
+ super(document, id, attributes, SparseMatrixFactory.segmentFromSpec);
187
+ this.id = id;
188
+ }
189
+ /**
190
+ * Create a new sparse matrix
191
+ *
192
+ * @param runtime - data store runtime the new sparse matrix belongs to
193
+ * @param id - optional name of the sparse matrix
194
+ * @returns newly create sparse matrix (but not attached yet)
195
+ */
196
+ static create(runtime, id) {
197
+ return runtime.createChannel(id, SparseMatrixFactory.Type);
198
+ }
199
+ /**
200
+ * Get a factory for SharedMap to register with the data store.
201
+ *
202
+ * @returns a factory that creates and load SharedMap
203
+ */
204
+ static getFactory() {
205
+ return new SparseMatrixFactory();
206
+ }
207
+ get numRows() {
208
+ return positionToRowCol(this.getLength()).row;
209
+ }
210
+ setItems(row, col, values, props) {
211
+ const start = (0, exports.rowColToPosition)(row, col);
212
+ const end = start + values.length;
213
+ const segment = new RunSegment(values);
214
+ if (props) {
215
+ segment.addProperties(props);
216
+ }
217
+ this.replaceRange(start, end, segment);
218
+ }
219
+ getItem(row, col) {
220
+ const pos = (0, exports.rowColToPosition)(row, col);
221
+ const { segment, offset } = this.getContainingSegment(pos);
222
+ if (segment && RunSegment.is(segment)) {
223
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
224
+ return segment.items[offset !== null && offset !== void 0 ? offset : 0];
225
+ }
226
+ else if (segment && PaddingSegment.is(segment)) {
227
+ return undefined;
228
+ }
229
+ throw new Error(`Unrecognized Segment type`);
230
+ }
231
+ getTag(row, col) {
232
+ const { segment, offset } = this.getSegment(row, col);
233
+ if (segment && RunSegment.is(segment)) {
234
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
235
+ return segment.getTag(offset !== null && offset !== void 0 ? offset : 0);
236
+ }
237
+ return undefined;
238
+ }
239
+ setTag(row, col, tag) {
240
+ const { segment, offset } = this.getSegment(row, col);
241
+ if (segment && RunSegment.is(segment)) {
242
+ segment.setTag(offset !== null && offset !== void 0 ? offset : 0, tag);
243
+ }
244
+ else if (tag !== undefined) {
245
+ throw new Error(`Must not attempt to set tags on '${segment === null || segment === void 0 ? void 0 : segment.constructor.name}'.`);
246
+ }
247
+ }
248
+ insertRows(row, numRows) {
249
+ const pos = (0, exports.rowColToPosition)(row, 0);
250
+ const size = exports.maxCols * numRows;
251
+ const segment = new PaddingSegment(size);
252
+ const insertOp = this.client.insertSegmentLocal(pos, segment);
253
+ if (insertOp) {
254
+ this.submitSequenceMessage(insertOp);
255
+ }
256
+ }
257
+ removeRows(row, numRows) {
258
+ const pos = (0, exports.rowColToPosition)(row, 0);
259
+ const size = exports.maxCols * numRows;
260
+ this.removeRange(pos, pos + size);
261
+ }
262
+ insertCols(col, numCols) {
263
+ this.moveAsPadding(exports.maxCol - numCols, col, numCols);
264
+ }
265
+ removeCols(col, numCols) {
266
+ this.moveAsPadding(col, exports.maxCol - numCols, numCols);
267
+ }
268
+ annotatePosition(row, col, props) {
269
+ const pos = (0, exports.rowColToPosition)(row, col);
270
+ this.annotateRange(pos, pos + 1, props);
271
+ }
272
+ getPositionProperties(row, col) {
273
+ const pos = (0, exports.rowColToPosition)(row, col);
274
+ return this.getPropertiesAtPosition(pos);
275
+ }
276
+ // For each row, moves 'numCols' items starting from 'srcCol' and inserts 'numCols' padding
277
+ // at 'destCol'. Used by insertCols and removeCols.
278
+ moveAsPadding(srcCol, destCol, numCols) {
279
+ const removeColStart = srcCol;
280
+ const removeColEnd = srcCol + numCols;
281
+ const ops = [];
282
+ for (let r = 0, rowStart = 0; r < this.numRows; r++, rowStart += exports.maxCols) {
283
+ const removeMsg = this.client.removeRangeLocal(rowStart + removeColStart, rowStart + removeColEnd);
284
+ if (removeMsg) {
285
+ ops.push(removeMsg);
286
+ }
287
+ const insertPos = rowStart + destCol;
288
+ const segment = new PaddingSegment(numCols);
289
+ const insertMsg = this.client.insertSegmentLocal(insertPos, segment);
290
+ if (insertMsg) {
291
+ ops.push(insertMsg);
292
+ }
293
+ }
294
+ this.submitSequenceMessage((0, merge_tree_1.createGroupOp)(...ops));
295
+ }
296
+ getSegment(row, col) {
297
+ const pos = (0, exports.rowColToPosition)(row, col);
298
+ return this.getContainingSegment(pos);
299
+ }
300
+ }
301
+ exports.SparseMatrix = SparseMatrix;
302
+ /**
303
+ * @deprecated `SparseMatrixFactory` is an abandoned prototype.
304
+ * Use {@link @fluidframework/matrix#SharedMatrixFactory} instead.
305
+ */
306
+ class SparseMatrixFactory {
307
+ static segmentFromSpec(spec) {
308
+ const maybePadding = PaddingSegment.fromJSONObject(spec);
309
+ if (maybePadding) {
310
+ return maybePadding;
311
+ }
312
+ const maybeRun = RunSegment.fromJSONObject(spec);
313
+ if (maybeRun) {
314
+ return maybeRun;
315
+ }
316
+ throw new Error(`Unrecognized IJSONObject: '${JSON.stringify(spec)}'`);
317
+ }
318
+ get type() {
319
+ return SparseMatrixFactory.Type;
320
+ }
321
+ get attributes() {
322
+ return SparseMatrixFactory.Attributes;
323
+ }
324
+ /**
325
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
326
+ */
327
+ async load(runtime, id, services, attributes) {
328
+ const sharedObject = new SparseMatrix(runtime, id, attributes);
329
+ await sharedObject.load(services);
330
+ return sharedObject;
331
+ }
332
+ create(document, id) {
333
+ const sharedObject = new SparseMatrix(document, id, this.attributes);
334
+ sharedObject.initializeLocal();
335
+ return sharedObject;
336
+ }
337
+ }
338
+ exports.SparseMatrixFactory = SparseMatrixFactory;
339
+ SparseMatrixFactory.Type = "https://graph.microsoft.com/types/mergeTree/sparse-matrix";
340
+ SparseMatrixFactory.Attributes = {
341
+ type: SparseMatrixFactory.Type,
342
+ snapshotFormatVersion: "0.1",
343
+ packageVersion: packageVersion_1.pkgVersion,
344
+ };
345
+ //# sourceMappingURL=sparsematrix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sparsematrix.js","sourceRoot":"","sources":["../src/sparsematrix.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AAEtD,2DAOoC;AASpC,uDAA8E;AAE9E,qDAA8C;AAE9C;;;;;;GAMG;AACH,MAAa,cAAe,SAAQ,wBAAW;IAiB3C,YAAY,IAAY;QACpB,KAAK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ributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n BaseSegment,\n createGroupOp,\n IJSONSegment,\n IMergeTreeDeltaOp,\n ISegment,\n PropertySet,\n} from \"@fluidframework/merge-tree\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelServices,\n IChannelFactory,\n Serializable,\n Jsonable,\n} from \"@fluidframework/datastore-definitions\";\nimport { SharedSegmentSequence, SubSequence } from \"@fluidframework/sequence\";\nimport { ISharedObject } from \"@fluidframework/shared-object-base\";\nimport { pkgVersion } from \"./packageVersion\";\n\n/**\n * An empty segment that occupies 'cachedLength' positions.\n * {@link SparseMatrix} uses `PaddingSegment` to \"pad\" a run of unoccupied cells.\n *\n * @deprecated `PaddingSegment` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\nexport class PaddingSegment extends BaseSegment {\n public static readonly typeString = \"PaddingSegment\";\n public static is(segment: ISegment): segment is PaddingSegment {\n return segment.type === PaddingSegment.typeString;\n }\n public static fromJSONObject(spec: any) {\n if (spec && typeof spec === \"object\" && \"pad\" in spec) {\n const segment = new PaddingSegment(spec.pad);\n if (spec.props) {\n segment.addProperties(spec.props);\n }\n return segment;\n }\n return undefined;\n }\n public readonly type = PaddingSegment.typeString;\n\n constructor(size: number) {\n super();\n this.cachedLength = size;\n }\n\n public toJSONObject() {\n return { pad: this.cachedLength, props: this.properties };\n }\n\n public clone(start = 0, end?: number) {\n const b = new PaddingSegment(this.cachedLength);\n this.cloneInto(b);\n return b;\n }\n\n public canAppend(segment: ISegment) {\n return PaddingSegment.is(segment);\n }\n\n public toString() {\n return `[padding: ${this.cachedLength}]`;\n }\n\n public append(segment: ISegment) {\n assert(PaddingSegment.is(segment), \"can only append padding segment\");\n super.append(segment);\n }\n\n // Returns true if entire run removed\n public removeRange(start: number, end: number) {\n this.cachedLength -= (end - start);\n return (this.cachedLength === 0);\n }\n\n protected createSplitSegmentAt(pos: number) {\n const leftLength = pos;\n const rightLength = this.cachedLength - pos;\n\n this.cachedLength = leftLength;\n return new PaddingSegment(rightLength);\n }\n}\n\n/**\n * @deprecated `SparseMatrixItem` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\nexport type SparseMatrixItem = Serializable;\n\n/**\n * @deprecated `RunSegment` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\nexport class RunSegment extends SubSequence<SparseMatrixItem> {\n public static readonly typeString = \"RunSegment\";\n public static is(segment: ISegment): segment is RunSegment {\n return segment.type === RunSegment.typeString;\n }\n public static fromJSONObject(spec: any) {\n if (spec && typeof spec === \"object\" && \"items\" in spec) {\n const segment = new RunSegment(spec.items);\n if (spec.props) {\n segment.addProperties(spec.props);\n }\n return segment;\n }\n return undefined;\n }\n public readonly type = RunSegment.typeString;\n\n private tags: any[];\n\n constructor(public items: SparseMatrixItem[]) {\n super(items);\n this.tags = new Array(items.length).fill(undefined);\n }\n\n public clone(start = 0, end?: number) {\n const b = new RunSegment(this.items.slice(start, end));\n if (this.tags) {\n b.tags = this.tags.slice(start, end);\n }\n this.cloneInto(b);\n return b;\n }\n\n public append(segment: ISegment) {\n super.append(segment);\n\n const asRun = segment as RunSegment;\n if (asRun.tags) {\n if (this.tags) {\n this.tags.splice(this.items.length, 0, ...asRun.tags);\n }\n }\n\n return this;\n }\n\n // TODO: retain removed items for undo\n // returns true if entire run removed\n public removeRange(start: number, end: number) {\n this.tags.splice(start, end - start);\n return super.removeRange(start, end);\n }\n\n public getTag(pos: number) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return this.tags[pos];\n }\n\n public setTag(pos: number, tag: any) {\n this.tags[pos] = tag;\n }\n\n protected createSplitSegmentAt(pos: number) {\n if (pos > 0) {\n const remainingItems = this.items.slice(pos);\n this.items = this.items.slice(0, pos);\n this.cachedLength = this.items.length;\n\n const leafSegment = new RunSegment(remainingItems);\n leafSegment.tags = this.tags.slice(pos);\n this.tags.length = pos;\n\n return leafSegment;\n }\n }\n}\n\n/**\n * @deprecated `MatrixSegment` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\nexport type MatrixSegment = RunSegment | PaddingSegment;\n\n/**\n * @deprecated `maxCol` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\nexport const maxCol = 0x200000; // X128 Excel maximum of 16,384 columns\n\n/**\n * @deprecated `maxCols` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\n export const maxCols = maxCol + 1;\n\n /**\n * @deprecated `maxRow` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\n export const maxRow = 0xFFFFFFFF; // X4096 Excel maximum of 1,048,576 rows\n\n /**\n * @deprecated `maxRows` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\n export const maxRows = maxRow + 1;\n\n /**\n * @deprecated `maxCellPosition` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\n export const maxCellPosition = maxCol * maxRow;\n\n /**\n * @deprecated `positionToRowCol` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\n export const rowColToPosition = (row: number, col: number) => row * maxCols + col;\n\n /**\n * @deprecated `positionToRowCol` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\nexport function positionToRowCol(position: number) {\n const row = Math.floor(position / maxCols);\n const col = position - (row * maxCols);\n return { row, col };\n}\n\n/**\n * @deprecated `SparseMatrix` is an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\nexport class SparseMatrix extends SharedSegmentSequence<MatrixSegment> {\n /**\n * Create a new sparse matrix\n *\n * @param runtime - data store runtime the new sparse matrix belongs to\n * @param id - optional name of the sparse matrix\n * @returns newly create sparse matrix (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, SparseMatrixFactory.Type) as SparseMatrix;\n }\n\n /**\n * Get a factory for SharedMap to register with the data store.\n *\n * @returns a factory that creates and load SharedMap\n */\n public static getFactory(): IChannelFactory {\n return new SparseMatrixFactory();\n }\n\n constructor(document: IFluidDataStoreRuntime, public id: string, attributes: IChannelAttributes) {\n super(document, id, attributes, SparseMatrixFactory.segmentFromSpec);\n }\n\n public get numRows() {\n return positionToRowCol(this.getLength()).row;\n }\n\n public setItems(\n row: number,\n col: number,\n values: SparseMatrixItem[],\n props?: PropertySet,\n ) {\n const start = rowColToPosition(row, col);\n const end = start + values.length;\n const segment = new RunSegment(values);\n if (props) {\n segment.addProperties(props);\n }\n\n this.replaceRange(start, end, segment);\n }\n\n public getItem(row: number, col: number):\n // The return type is defined explicitly here to prevent TypeScript from generating dynamic imports\n Jsonable<string | number | boolean | IFluidHandle> | undefined {\n const pos = rowColToPosition(row, col);\n const { segment, offset } = this.getContainingSegment(pos);\n if (segment && RunSegment.is(segment)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return segment.items[offset ?? 0];\n } else if (segment && PaddingSegment.is(segment)) {\n return undefined;\n }\n\n throw new Error(`Unrecognized Segment type`);\n }\n\n public getTag(row: number, col: number) {\n const { segment, offset } = this.getSegment(row, col);\n if (segment && RunSegment.is(segment)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return segment.getTag(offset ?? 0);\n }\n return undefined;\n }\n\n public setTag(row: number, col: number, tag: any) {\n const { segment, offset } = this.getSegment(row, col);\n if (segment && RunSegment.is(segment)) {\n segment.setTag(offset ?? 0, tag);\n } else if (tag !== undefined) {\n throw new Error(`Must not attempt to set tags on '${segment?.constructor.name}'.`);\n }\n }\n\n public insertRows(row: number, numRows: number) {\n const pos = rowColToPosition(row, 0);\n const size = maxCols * numRows;\n const segment = new PaddingSegment(size);\n\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n public removeRows(row: number, numRows: number) {\n const pos = rowColToPosition(row, 0);\n const size = maxCols * numRows;\n this.removeRange(pos, pos + size);\n }\n\n public insertCols(col: number, numCols: number) {\n this.moveAsPadding(maxCol - numCols, col, numCols);\n }\n\n public removeCols(col: number, numCols: number) {\n this.moveAsPadding(col, maxCol - numCols, numCols);\n }\n\n public annotatePosition(row: number, col: number, props: PropertySet) {\n const pos = rowColToPosition(row, col);\n this.annotateRange(pos, pos + 1, props);\n }\n\n public getPositionProperties(row: number, col: number) {\n const pos = rowColToPosition(row, col);\n return this.getPropertiesAtPosition(pos);\n }\n\n // For each row, moves 'numCols' items starting from 'srcCol' and inserts 'numCols' padding\n // at 'destCol'. Used by insertCols and removeCols.\n private moveAsPadding(srcCol: number, destCol: number, numCols: number) {\n const removeColStart = srcCol;\n const removeColEnd = srcCol + numCols;\n const ops: IMergeTreeDeltaOp[] = [];\n\n for (let r = 0, rowStart = 0; r < this.numRows; r++, rowStart += maxCols) {\n const removeMsg = this.client.removeRangeLocal(rowStart + removeColStart, rowStart + removeColEnd);\n if (removeMsg) {\n ops.push(removeMsg);\n }\n const insertPos = rowStart + destCol;\n const segment = new PaddingSegment(numCols);\n const insertMsg = this.client.insertSegmentLocal(insertPos, segment);\n if (insertMsg) {\n ops.push(insertMsg);\n }\n }\n\n this.submitSequenceMessage(createGroupOp(...ops));\n }\n\n private getSegment(row: number, col: number) {\n const pos = rowColToPosition(row, col);\n return this.getContainingSegment(pos);\n }\n}\n\n/**\n * @deprecated `SparseMatrixFactory` is an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrixFactory} instead.\n */\nexport class SparseMatrixFactory implements IChannelFactory {\n public static Type = \"https://graph.microsoft.com/types/mergeTree/sparse-matrix\";\n\n public static Attributes: IChannelAttributes = {\n type: SparseMatrixFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n public static segmentFromSpec(spec: IJSONSegment): ISegment {\n const maybePadding = PaddingSegment.fromJSONObject(spec);\n if (maybePadding) {\n return maybePadding;\n }\n\n const maybeRun = RunSegment.fromJSONObject(spec);\n if (maybeRun) {\n return maybeRun;\n }\n\n throw new Error(`Unrecognized IJSONObject: '${JSON.stringify(spec)}'`);\n }\n\n public get type() {\n return SparseMatrixFactory.Type;\n }\n\n public get attributes() {\n return SparseMatrixFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes,\n ): Promise<ISharedObject> {\n const sharedObject = new SparseMatrix(runtime, id, attributes);\n await sharedObject.load(services);\n return sharedObject;\n }\n\n public create(document: IFluidDataStoreRuntime, id: string): ISharedObject {\n const sharedObject = new SparseMatrix(document, id, this.attributes);\n sharedObject.initializeLocal();\n return sharedObject;\n }\n}\n"]}
package/lib/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { SharedNumberSequence } from "./sharedNumberSequence";
6
+ export { SharedObjectSequence } from "./sharedObjectSequence";
7
+ export { MatrixSegment, maxCellPosition, maxCol, maxCols, maxRow, maxRows, PaddingSegment, positionToRowCol, rowColToPosition, RunSegment, SparseMatrix, SparseMatrixFactory, SparseMatrixItem, } from "./sparsematrix";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACN,aAAa,EACb,eAAe,EACf,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,GAChB,MAAM,gBAAgB,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { SharedNumberSequence } from "./sharedNumberSequence";
6
+ export { SharedObjectSequence } from "./sharedObjectSequence";
7
+ export { maxCellPosition, maxCol, maxCols, maxRow, maxRows, PaddingSegment, positionToRowCol, rowColToPosition, RunSegment, SparseMatrix, SparseMatrixFactory, } from "./sparsematrix";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAEN,eAAe,EACf,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,mBAAmB,GAEnB,MAAM,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { SharedNumberSequence } from \"./sharedNumberSequence\";\nexport { SharedObjectSequence } from \"./sharedObjectSequence\";\nexport {\n\tMatrixSegment,\n\tmaxCellPosition,\n\tmaxCol,\n\tmaxCols,\n\tmaxRow,\n\tmaxRows,\n\tPaddingSegment,\n\tpositionToRowCol,\n\trowColToPosition,\n\tRunSegment,\n\tSparseMatrix,\n\tSparseMatrixFactory,\n\tSparseMatrixItem,\n} from \"./sparsematrix\";\n"]}