@adobe/data 0.6.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ecs/database/create-database.d.ts +1 -1
- package/dist/ecs/database/create-database.js +123 -198
- package/dist/ecs/database/create-database.js.map +1 -1
- package/dist/ecs/database/create-database.test.js +155 -684
- package/dist/ecs/database/create-database.test.js.map +1 -1
- package/dist/ecs/database/database.d.ts +1 -0
- package/dist/ecs/database/index.d.ts +5 -0
- package/dist/ecs/database/index.js +5 -0
- package/dist/ecs/database/index.js.map +1 -1
- package/dist/ecs/database/observe-select-entities.performance.test.js +6 -5
- package/dist/ecs/database/observe-select-entities.performance.test.js.map +1 -1
- package/dist/ecs/database/observed/create-observed-database.d.ts +7 -0
- package/dist/ecs/database/observed/create-observed-database.js +154 -0
- package/dist/ecs/database/observed/create-observed-database.js.map +1 -0
- package/dist/ecs/database/observed/create-observed-database.test.js +557 -0
- package/dist/ecs/database/observed/create-observed-database.test.js.map +1 -0
- package/dist/ecs/database/observed/observed-database.d.ts +36 -0
- package/dist/ecs/database/observed/observed-database.js +19 -0
- package/dist/ecs/database/observed/observed-database.js.map +1 -0
- package/dist/ecs/database/reconciling/create-reconciling-database.d.ts +8 -0
- package/dist/ecs/database/reconciling/create-reconciling-database.js +146 -0
- package/dist/ecs/database/reconciling/create-reconciling-database.js.map +1 -0
- package/dist/ecs/database/reconciling/create-reconciling-database.test.d.ts +1 -0
- package/dist/ecs/database/reconciling/create-reconciling-database.test.js +94 -0
- package/dist/ecs/database/reconciling/create-reconciling-database.test.js.map +1 -0
- package/dist/ecs/database/reconciling/reconciling-database.d.ts +21 -0
- package/dist/ecs/database/reconciling/reconciling-database.js +22 -0
- package/dist/ecs/database/reconciling/reconciling-database.js.map +1 -0
- package/dist/ecs/database/reconciling/reconciling-entry.d.ts +30 -0
- package/dist/ecs/database/reconciling/reconciling-entry.js +88 -0
- package/dist/ecs/database/reconciling/reconciling-entry.js.map +1 -0
- package/dist/ecs/database/transactional-store/entity-id-preservation.test.d.ts +1 -0
- package/dist/ecs/database/transactional-store/entity-id-preservation.test.js +106 -0
- package/dist/ecs/database/transactional-store/entity-id-preservation.test.js.map +1 -0
- package/dist/ecs/entity/entity.d.ts +8 -0
- package/dist/ecs/entity/entity.js +3 -0
- package/dist/ecs/entity/entity.js.map +1 -0
- package/dist/ecs/entity/u32.d.ts +8 -0
- package/dist/{lit/elements/service-context.js → ecs/entity/u32.js} +3 -3
- package/dist/ecs/entity/u32.js.map +1 -0
- package/dist/ecs/store/store-schema/create-store-schema-test.js +2 -2
- package/dist/ecs/store/store-schema/create-store-schema-test.js.map +1 -1
- package/dist/ecs/store/store-schema/create-store-schema.d.ts +1 -11
- package/dist/ecs/store/store-schema/create-store-schema.js +44 -30
- package/dist/ecs/store/store-schema/create-store-schema.js.map +1 -1
- package/dist/ecs/store/store-schema/index.d.ts +1 -2
- package/dist/ecs/store/store-schema/index.js +20 -23
- package/dist/ecs/store/store-schema/index.js.map +1 -1
- package/dist/ecs/store/store-schema/store-schema.d.ts +1 -12
- package/dist/ecs/store/store-schema/store-schema.js +55 -21
- package/dist/ecs/store/store-schema/store-schema.js.map +1 -1
- package/dist/functions/serialization/index.d.ts +1 -0
- package/dist/functions/serialization/index.js +1 -0
- package/dist/functions/serialization/index.js.map +1 -1
- package/dist/functions/serialization/serialize-to-json.d.ts +9 -0
- package/dist/functions/serialization/serialize-to-json.js +161 -0
- package/dist/functions/serialization/serialize-to-json.js.map +1 -0
- package/dist/functions/serialization/serialize-to-json.test.d.ts +1 -0
- package/dist/functions/serialization/serialize-to-json.test.js +244 -0
- package/dist/functions/serialization/serialize-to-json.test.js.map +1 -0
- package/dist/graphics/frame.d.ts +1 -22
- package/dist/graphics/frame.js +14 -11
- package/dist/graphics/frame.js.map +1 -1
- package/dist/graphics/get-web-gpu-device-and-context.d.ts +1 -2
- package/dist/graphics/get-web-gpu-device-and-context.js +23 -20
- package/dist/graphics/get-web-gpu-device-and-context.js.map +1 -1
- package/dist/graphics/graphics-context.d.ts +1 -5
- package/dist/graphics/graphics-context.js +5 -0
- package/dist/graphics/graphics-context.js.map +1 -1
- package/dist/math/aabb-face/face.d.ts +51 -0
- package/dist/math/aabb-face/face.js +110 -0
- package/dist/math/aabb-face/face.js.map +1 -0
- package/dist/math/aabb-face/face.test.d.ts +1 -0
- package/dist/math/aabb-face/face.test.js +94 -0
- package/dist/math/aabb-face/face.test.js.map +1 -0
- package/dist/math/box/box.d.ts +50 -0
- package/dist/math/box/box.js +23 -0
- package/dist/math/box/box.js.map +1 -0
- package/dist/math/face/face.d.ts +51 -0
- package/dist/math/face/face.js +110 -0
- package/dist/math/face/face.js.map +1 -0
- package/dist/math/face/face.test.d.ts +1 -0
- package/dist/math/face/face.test.js +94 -0
- package/dist/math/face/face.test.js.map +1 -0
- package/dist/math/picking/face.d.ts +1 -0
- package/dist/math/picking/face.js +2 -0
- package/dist/math/picking/face.js.map +1 -0
- package/dist/math/picking/get-closest-entity-to-line.js +1 -1
- package/dist/math/picking/get-closest-entity-to-line.js.map +1 -1
- package/dist/math/picking/get-closest-entity-to-point.js +1 -1
- package/dist/math/picking/get-closest-entity-to-point.js.map +1 -1
- package/dist/math/picking/getClosestEntityToLine.d.ts +4 -0
- package/dist/math/picking/getClosestEntityToLine.js +29 -0
- package/dist/math/picking/getClosestEntityToLine.js.map +1 -0
- package/dist/math/picking/getClosestEntityToPoint.d.ts +4 -0
- package/dist/math/picking/getClosestEntityToPoint.js +27 -0
- package/dist/math/picking/getClosestEntityToPoint.js.map +1 -0
- package/dist/math/picking/getIntersectingEntities.d.ts +12 -0
- package/dist/math/picking/getIntersectingEntities.js +15 -0
- package/dist/math/picking/getIntersectingEntities.js.map +1 -0
- package/dist/math/picking/pick-from-tables.js +1 -1
- package/dist/math/picking/pick-from-tables.js.map +1 -1
- package/dist/math/picking/pick-result.d.ts +4 -2
- package/dist/math/transform/debug-inverse.d.ts +1 -0
- package/dist/math/transform/debug-inverse.js +28 -0
- package/dist/math/transform/debug-inverse.js.map +1 -0
- package/dist/math/transform/debug-quat.d.ts +1 -0
- package/dist/math/transform/debug-quat.js +23 -0
- package/dist/math/transform/debug-quat.js.map +1 -0
- package/dist/math/transform/debug-test.d.ts +1 -0
- package/dist/math/transform/debug-test.js +34 -0
- package/dist/math/transform/debug-test.js.map +1 -0
- package/dist/math/transform/transform.d.ts +58 -0
- package/dist/math/transform/transform.js +101 -0
- package/dist/math/transform/transform.js.map +1 -0
- package/dist/math/transform/transform.test.d.ts +1 -0
- package/dist/math/transform/transform.test.js +309 -0
- package/dist/math/transform/transform.test.js.map +1 -0
- package/dist/samples/todo/services/state-service/create-todo-database.d.ts +1 -1
- package/dist/samples/todo/services/state-service/create-todo-store.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/lit/elements/service-application.d.ts +0 -9
- package/dist/lit/elements/service-application.js +0 -55
- package/dist/lit/elements/service-application.js.map +0 -1
- package/dist/lit/elements/service-context.d.ts +0 -1
- package/dist/lit/elements/service-context.js.map +0 -1
- package/dist/lit/elements/service-element.d.ts +0 -6
- package/dist/lit/elements/service-element.js +0 -43
- package/dist/lit/elements/service-element.js.map +0 -1
- package/dist/table/compact-table.d.ts +0 -7
- package/dist/table/compact-table.js +0 -15
- package/dist/table/compact-table.js.map +0 -1
- package/dist/table/compact-table.test.js +0 -121
- package/dist/table/compact-table.test.js.map +0 -1
- /package/dist/{table/compact-table.test.d.ts → ecs/database/observed/create-observed-database.test.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { LitElement, PropertyValues } from "lit";
|
|
2
|
-
import { Service } from "../../service/index.js";
|
|
3
|
-
export declare abstract class ServiceApplication<S extends Service> extends LitElement {
|
|
4
|
-
protected service: S;
|
|
5
|
-
protected abstract createService(): Promise<S>;
|
|
6
|
-
updated(changedProperties: PropertyValues): Promise<void>;
|
|
7
|
-
disconnectedCallback(): void;
|
|
8
|
-
render(): import("lit").TemplateResult<1>;
|
|
9
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/*MIT License
|
|
2
|
-
|
|
3
|
-
© Copyright 2025 Adobe. All rights reserved.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.*/
|
|
22
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
23
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
25
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
26
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
27
|
-
};
|
|
28
|
-
import { html, LitElement } from "lit";
|
|
29
|
-
import { property } from "lit/decorators.js";
|
|
30
|
-
import { provide } from "@lit/context";
|
|
31
|
-
import { serviceContext } from "./service-context.js";
|
|
32
|
-
import { isDisposable } from "../../service/disposable.js";
|
|
33
|
-
export class ServiceApplication extends LitElement {
|
|
34
|
-
async updated(changedProperties) {
|
|
35
|
-
super.updated(changedProperties);
|
|
36
|
-
this.service ??= await this.createService();
|
|
37
|
-
}
|
|
38
|
-
disconnectedCallback() {
|
|
39
|
-
super.disconnectedCallback();
|
|
40
|
-
if (isDisposable(this.service)) {
|
|
41
|
-
this.service.dispose();
|
|
42
|
-
}
|
|
43
|
-
this.service = null;
|
|
44
|
-
}
|
|
45
|
-
render() {
|
|
46
|
-
return html `
|
|
47
|
-
<div>Service Application Should Be Overridden</div>
|
|
48
|
-
`;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
__decorate([
|
|
52
|
-
provide({ context: serviceContext }),
|
|
53
|
-
property({ type: Object })
|
|
54
|
-
], ServiceApplication.prototype, "service", void 0);
|
|
55
|
-
//# sourceMappingURL=service-application.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service-application.js","sourceRoot":"","sources":["../../../src/lit/elements/service-application.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;;;;;;;AAEX,OAAO,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,OAAgB,kBAAsC,SAAQ,UAAU;IAQjE,KAAK,CAAC,OAAO,CAAC,iBAAiC;QACpD,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,KAAK,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;IAChD,CAAC;IAEQ,oBAAoB;QACzB,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,IAAW,CAAC;IAC/B,CAAC;IAEQ,MAAM;QACX,OAAO,IAAI,CAAA;;SAEV,CAAC;IACN,CAAC;CACJ;AAtBa;IAFT,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IACpC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDACL"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const serviceContext: import("@lit/context").Context<symbol, unknown>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service-context.js","sourceRoot":"","sources":["../../../src/lit/elements/service-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/*MIT License
|
|
2
|
-
|
|
3
|
-
© Copyright 2025 Adobe. All rights reserved.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.*/
|
|
22
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
23
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
25
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
26
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
27
|
-
};
|
|
28
|
-
import { LitElement } from "lit";
|
|
29
|
-
import { serviceContext } from "./service-context.js";
|
|
30
|
-
import { property } from "lit/decorators.js";
|
|
31
|
-
import { consume } from "@lit/context";
|
|
32
|
-
import { applyServiceDecorators } from "../decorators/apply-service-decorators.js";
|
|
33
|
-
export class ServiceElement extends LitElement {
|
|
34
|
-
constructor() {
|
|
35
|
-
super();
|
|
36
|
-
applyServiceDecorators(this);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
__decorate([
|
|
40
|
-
consume({ context: serviceContext }),
|
|
41
|
-
property({ type: Object })
|
|
42
|
-
], ServiceElement.prototype, "service", void 0);
|
|
43
|
-
//# sourceMappingURL=service-element.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service-element.js","sourceRoot":"","sources":["../../../src/lit/elements/service-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;;;;;;;AAEX,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAEnF,MAAM,OAAO,cAAkC,SAAQ,UAAU;IAM7D;QACI,KAAK,EAAE,CAAC;QACR,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;CAEJ;AAPa;IAFT,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IACpC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CACL"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Table } from "./table.js";
|
|
2
|
-
/**
|
|
3
|
-
* Compacts the table by reducing rowCapacity to match rowCount.
|
|
4
|
-
* This shrinks the underlying buffers to remove unused capacity.
|
|
5
|
-
* Useful before serialization to avoid storing unused buffer space.
|
|
6
|
-
*/
|
|
7
|
-
export declare const compactTable: <C>(table: Table<C>) => void;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compacts the table by reducing rowCapacity to match rowCount.
|
|
3
|
-
* This shrinks the underlying buffers to remove unused capacity.
|
|
4
|
-
* Useful before serialization to avoid storing unused buffer space.
|
|
5
|
-
*/
|
|
6
|
-
export const compactTable = (table) => {
|
|
7
|
-
if (table.rowCapacity > table.rowCount) {
|
|
8
|
-
for (const name in table.columns) {
|
|
9
|
-
const column = table.columns[name];
|
|
10
|
-
column.capacity = table.rowCount;
|
|
11
|
-
}
|
|
12
|
-
table.rowCapacity = table.rowCount;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=compact-table.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compact-table.js","sourceRoot":"","sources":["../../src/table/compact-table.ts"],"names":[],"mappings":"AAuBA;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAI,KAAe,EAAQ,EAAE;IACrD,IAAI,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QACrC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YAC/B,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnC,MAAM,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QACrC,CAAC;QACD,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC;IACvC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/*MIT License
|
|
2
|
-
|
|
3
|
-
© Copyright 2025 Adobe. All rights reserved.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.*/
|
|
22
|
-
import { describe, it, expect } from "vitest";
|
|
23
|
-
import { compactTable } from "./compact-table.js";
|
|
24
|
-
import { createTable } from "./create-table.js";
|
|
25
|
-
import { addRow } from "./add-row.js";
|
|
26
|
-
import { deleteRow } from "./delete-row.js";
|
|
27
|
-
import { U32Schema } from "../schema/u32.js";
|
|
28
|
-
import { F32Schema } from "../schema/f32.js";
|
|
29
|
-
describe("compactTable", () => {
|
|
30
|
-
it("should reduce rowCapacity to match rowCount after deletions", () => {
|
|
31
|
-
const table = createTable({
|
|
32
|
-
value: U32Schema,
|
|
33
|
-
});
|
|
34
|
-
// Add some rows
|
|
35
|
-
addRow(table, { value: 1 });
|
|
36
|
-
addRow(table, { value: 2 });
|
|
37
|
-
addRow(table, { value: 3 });
|
|
38
|
-
addRow(table, { value: 4 });
|
|
39
|
-
expect(table.rowCount).toBe(4);
|
|
40
|
-
const initialCapacity = table.rowCapacity;
|
|
41
|
-
expect(initialCapacity).toBeGreaterThanOrEqual(4);
|
|
42
|
-
// Delete some rows
|
|
43
|
-
deleteRow(table, 3);
|
|
44
|
-
deleteRow(table, 2);
|
|
45
|
-
expect(table.rowCount).toBe(2);
|
|
46
|
-
expect(table.rowCapacity).toBe(initialCapacity); // Capacity unchanged
|
|
47
|
-
// Compact the table
|
|
48
|
-
compactTable(table);
|
|
49
|
-
expect(table.rowCount).toBe(2);
|
|
50
|
-
expect(table.rowCapacity).toBe(2); // Capacity now matches rowCount
|
|
51
|
-
});
|
|
52
|
-
it("should compact all columns to the same capacity", () => {
|
|
53
|
-
const table = createTable({
|
|
54
|
-
value: U32Schema,
|
|
55
|
-
score: F32Schema,
|
|
56
|
-
});
|
|
57
|
-
addRow(table, { value: 1, score: 1.5 });
|
|
58
|
-
addRow(table, { value: 2, score: 2.5 });
|
|
59
|
-
addRow(table, { value: 3, score: 3.5 });
|
|
60
|
-
deleteRow(table, 2);
|
|
61
|
-
compactTable(table);
|
|
62
|
-
expect(table.columns.value.capacity).toBe(2);
|
|
63
|
-
expect(table.columns.score.capacity).toBe(2);
|
|
64
|
-
expect(table.rowCapacity).toBe(2);
|
|
65
|
-
});
|
|
66
|
-
it("should preserve data after compaction", () => {
|
|
67
|
-
const table = createTable({
|
|
68
|
-
value: U32Schema,
|
|
69
|
-
});
|
|
70
|
-
addRow(table, { value: 10 });
|
|
71
|
-
addRow(table, { value: 20 });
|
|
72
|
-
addRow(table, { value: 30 });
|
|
73
|
-
deleteRow(table, 2);
|
|
74
|
-
compactTable(table);
|
|
75
|
-
expect(table.columns.value.get(0)).toBe(10);
|
|
76
|
-
expect(table.columns.value.get(1)).toBe(20);
|
|
77
|
-
});
|
|
78
|
-
it("should do nothing if rowCapacity already equals rowCount", () => {
|
|
79
|
-
const table = createTable({
|
|
80
|
-
value: U32Schema,
|
|
81
|
-
});
|
|
82
|
-
addRow(table, { value: 1 });
|
|
83
|
-
addRow(table, { value: 2 });
|
|
84
|
-
// Compact once
|
|
85
|
-
compactTable(table);
|
|
86
|
-
const capacity = table.rowCapacity;
|
|
87
|
-
// Compact again
|
|
88
|
-
compactTable(table);
|
|
89
|
-
expect(table.rowCapacity).toBe(capacity);
|
|
90
|
-
});
|
|
91
|
-
it("should handle empty tables", () => {
|
|
92
|
-
const table = createTable({
|
|
93
|
-
value: U32Schema,
|
|
94
|
-
});
|
|
95
|
-
compactTable(table);
|
|
96
|
-
expect(table.rowCount).toBe(0);
|
|
97
|
-
expect(table.rowCapacity).toBe(0);
|
|
98
|
-
});
|
|
99
|
-
it("should handle tables that have grown and then had all rows deleted", () => {
|
|
100
|
-
const table = createTable({
|
|
101
|
-
value: U32Schema,
|
|
102
|
-
});
|
|
103
|
-
// Add many rows to trigger capacity growth
|
|
104
|
-
for (let i = 0; i < 20; i++) {
|
|
105
|
-
addRow(table, { value: i });
|
|
106
|
-
}
|
|
107
|
-
expect(table.rowCount).toBe(20);
|
|
108
|
-
const largeCapacity = table.rowCapacity;
|
|
109
|
-
expect(largeCapacity).toBeGreaterThanOrEqual(20);
|
|
110
|
-
// Delete all rows
|
|
111
|
-
for (let i = 19; i >= 0; i--) {
|
|
112
|
-
deleteRow(table, i);
|
|
113
|
-
}
|
|
114
|
-
expect(table.rowCount).toBe(0);
|
|
115
|
-
expect(table.rowCapacity).toBe(largeCapacity); // Still has large capacity
|
|
116
|
-
compactTable(table);
|
|
117
|
-
expect(table.rowCount).toBe(0);
|
|
118
|
-
expect(table.rowCapacity).toBe(0); // Capacity compacted to 0
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
//# sourceMappingURL=compact-table.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compact-table.test.js","sourceRoot":"","sources":["../../src/table/compact-table.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAA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