@adobe/data 0.4.5 → 0.4.6

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 (67) hide show
  1. package/dist/ecs/database/database-schema/create-database-schema-test.js +2 -2
  2. package/dist/ecs/database/database-schema/create-database-schema-test.js.map +1 -1
  3. package/dist/ecs/database/database-schema/create-database-schema.d.ts +1 -4
  4. package/dist/ecs/database/database-schema/create-database-schema.js +2 -2
  5. package/dist/ecs/database/database-schema/create-database-schema.js.map +1 -1
  6. package/dist/ecs/database/database-schema/create-store-schema-test.d.ts +1 -0
  7. package/dist/ecs/database/database-schema/create-store-schema-test.js +36 -0
  8. package/dist/ecs/database/database-schema/create-store-schema-test.js.map +1 -0
  9. package/dist/ecs/database/database-schema/create-store-schema.d.ts +9 -0
  10. package/dist/ecs/database/database-schema/create-store-schema.js +26 -0
  11. package/dist/ecs/database/database-schema/create-store-schema.js.map +1 -0
  12. package/dist/ecs/database/database-schema/database-schema.d.ts +2 -5
  13. package/dist/ecs/database/database-schema/index.d.ts +2 -2
  14. package/dist/ecs/database/database-schema/index.js +2 -2
  15. package/dist/ecs/database/database-schema/index.js.map +1 -1
  16. package/dist/ecs/database/database-schema/store-schema.d.ts +12 -0
  17. package/dist/ecs/database/database-schema/store-schema.js +23 -0
  18. package/dist/ecs/database/database-schema/store-schema.js.map +1 -0
  19. package/dist/ecs/database/database.d.ts +3 -3
  20. package/dist/ecs/database/index.d.ts +0 -1
  21. package/dist/ecs/database/index.js +0 -1
  22. package/dist/ecs/database/index.js.map +1 -1
  23. package/dist/ecs/database/store-schema/create-store-schema-test.d.ts +1 -0
  24. package/dist/ecs/database/store-schema/create-store-schema-test.js +36 -0
  25. package/dist/ecs/database/store-schema/create-store-schema-test.js.map +1 -0
  26. package/dist/ecs/database/store-schema/create-store-schema.d.ts +9 -0
  27. package/dist/ecs/database/store-schema/create-store-schema.js +26 -0
  28. package/dist/ecs/database/store-schema/create-store-schema.js.map +1 -0
  29. package/dist/ecs/database/store-schema/index.d.ts +2 -0
  30. package/dist/ecs/database/store-schema/index.js +24 -0
  31. package/dist/ecs/database/store-schema/index.js.map +1 -0
  32. package/dist/ecs/database/store-schema/store-schema.d.ts +12 -0
  33. package/dist/ecs/database/store-schema/store-schema.js +23 -0
  34. package/dist/ecs/database/store-schema/store-schema.js.map +1 -0
  35. package/dist/ecs/database/transactional-store/apply-operations.d.ts +2 -2
  36. package/dist/ecs/database/transactional-store/apply-operations.js.map +1 -1
  37. package/dist/ecs/database/transactional-store/create-test-transaction.d.ts +0 -1
  38. package/dist/ecs/database/transactional-store/create-test-transaction.js.map +1 -1
  39. package/dist/ecs/database/transactional-store/create-transactional-store.js +5 -6
  40. package/dist/ecs/database/transactional-store/create-transactional-store.js.map +1 -1
  41. package/dist/ecs/database/transactional-store/index.d.ts +0 -1
  42. package/dist/ecs/database/transactional-store/index.js +0 -1
  43. package/dist/ecs/database/transactional-store/index.js.map +1 -1
  44. package/dist/ecs/database/transactional-store/transactional-store.d.ts +1 -6
  45. package/dist/ecs/store/create-store.js.map +1 -1
  46. package/dist/ecs/store/index.d.ts +1 -0
  47. package/dist/ecs/store/index.js +1 -0
  48. package/dist/ecs/store/index.js.map +1 -1
  49. package/dist/ecs/store/store-schema/create-store-schema-test.d.ts +1 -0
  50. package/dist/ecs/store/store-schema/create-store-schema-test.js +36 -0
  51. package/dist/ecs/store/store-schema/create-store-schema-test.js.map +1 -0
  52. package/dist/ecs/store/store-schema/create-store-schema.d.ts +9 -0
  53. package/dist/ecs/store/store-schema/create-store-schema.js +26 -0
  54. package/dist/ecs/store/store-schema/create-store-schema.js.map +1 -0
  55. package/dist/ecs/store/store-schema/index.d.ts +2 -0
  56. package/dist/ecs/store/store-schema/index.js +24 -0
  57. package/dist/ecs/store/store-schema/index.js.map +1 -0
  58. package/dist/ecs/store/store-schema/store-schema.d.ts +12 -0
  59. package/dist/ecs/store/store-schema/store-schema.js +23 -0
  60. package/dist/ecs/store/store-schema/store-schema.js.map +1 -0
  61. package/dist/ecs/store/store.d.ts +6 -0
  62. package/dist/tsconfig.tsbuildinfo +1 -1
  63. package/dist/typed-buffer/structs/get-struct-layout.js +7 -10
  64. package/dist/typed-buffer/structs/get-struct-layout.js.map +1 -1
  65. package/dist/typed-buffer/structs/get-struct-layout.test.js +148 -11
  66. package/dist/typed-buffer/structs/get-struct-layout.test.js.map +1 -1
  67. package/package.json +1 -1
@@ -0,0 +1,36 @@
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 { TrueSchema } from "../../../schema/true.js";
23
+ import { createStoreSchema } from "./create-store-schema.js";
24
+ // just a compile time test which is why we're using -test.ts extension instead of .test.ts
25
+ createStoreSchema({
26
+ velocity: { type: "number" },
27
+ particle: TrueSchema,
28
+ }, {
29
+ mousePosition: { type: "number", default: 0 },
30
+ fooPosition: { type: "number", default: 0 },
31
+ }, {
32
+ bar: ["particle", "velocity"],
33
+ // @ts-expect-error
34
+ foo: ["particle", "velocity2"] // should throw error because velocity2 is not a component
35
+ });
36
+ //# sourceMappingURL=create-store-schema-test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-store-schema-test.js","sourceRoot":"","sources":["../../../../src/ecs/store/store-schema/create-store-schema-test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,2FAA2F;AAE3F,iBAAiB,CACb;IACI,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC5B,QAAQ,EAAE,UAAU;CACvB,EACD;IACI,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE;IAC7C,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE;CAC9C,EACD;IACI,GAAG,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;IAC7B,mBAAmB;IACnB,GAAG,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,0DAA0D;CAC5F,CACJ,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { StringKeyof } from "../../../types/types.js";
2
+ import { ComponentSchemas } from "../../component-schemas.js";
3
+ import { ResourceSchemas } from "../../resource-schemas.js";
4
+ import { ArchetypeComponents } from "../archetype-components.js";
5
+ export declare function createStoreSchema<const CS extends ComponentSchemas, const RS extends ResourceSchemas, const A extends ArchetypeComponents<StringKeyof<CS>>>(components: CS, resources: RS, archetypes: A): {
6
+ readonly components: CS;
7
+ readonly resources: RS;
8
+ readonly archetypes: A;
9
+ };
@@ -0,0 +1,26 @@
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
+ export function createStoreSchema(components, resources, archetypes) {
23
+ return { components, resources, archetypes };
24
+ }
25
+ ;
26
+ //# sourceMappingURL=create-store-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-store-schema.js","sourceRoot":"","sources":["../../../../src/ecs/store/store-schema/create-store-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAQX,MAAM,UAAU,iBAAiB,CAK7B,UAAc,EACd,SAAa,EACb,UAAa;IAEb,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAA4C,CAAC;AAC3F,CAAC;AAAA,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { createStoreSchema } from "./create-store-schema.js";
2
+ export * from "./store-schema.js";
@@ -0,0 +1,24 @@
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
+ export { createStoreSchema } from "./create-store-schema.js";
23
+ export * from "./store-schema.js";
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ecs/store/store-schema/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { FromSchemas } from "@adobe/data/schema";
2
+ import { ComponentSchemas } from "../../component-schemas.js";
3
+ import { ResourceSchemas } from "../../resource-schemas.js";
4
+ import { Store } from "../store.js";
5
+ import { ArchetypeComponents } from "../archetype-components.js";
6
+ import { StringKeyof } from "../../../types/types.js";
7
+ export type StoreSchema<CS extends ComponentSchemas, RS extends ResourceSchemas, A extends ArchetypeComponents<StringKeyof<CS>>> = {
8
+ readonly components: CS;
9
+ readonly resources: RS;
10
+ readonly archetypes: A;
11
+ };
12
+ export type StoreFromSchema<T> = T extends StoreSchema<infer CS, infer RS, infer A> ? Store<FromSchemas<CS>, FromSchemas<RS>, A> : never;
@@ -0,0 +1,23 @@
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
+ export {};
23
+ //# sourceMappingURL=store-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-schema.js","sourceRoot":"","sources":["../../../../src/ecs/store/store-schema/store-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW"}
@@ -7,6 +7,7 @@ import { Components } from "./components.js";
7
7
  import { ArchetypeComponents } from "./archetype-components.js";
8
8
  import { Archetype, ReadonlyArchetype } from "../archetype/archetype.js";
9
9
  import { EntitySelectOptions } from "./entity-select-options.js";
10
+ import { Undoable } from "../database/undoable.js";
10
11
  interface BaseStore<C extends object = never> {
11
12
  select<Include extends StringKeyof<C>, T extends Include>(include: readonly Include[] | ReadonlySet<string>, options?: EntitySelectOptions<C, Pick<C & CoreComponents, T>>): readonly Entity[];
12
13
  toData(): unknown;
@@ -26,6 +27,11 @@ export type ToReadonlyStore<T extends Store<any, any>> = T extends Store<infer C
26
27
  * Store is the main interface for storing components, entities and resources.
27
28
  */
28
29
  export interface Store<C extends Components = never, R extends ResourceComponents = never, A extends ArchetypeComponents<StringKeyof<C>> = never> extends BaseStore<C>, Core<C> {
30
+ /**
31
+ * This is used when a store is used to represent a transaction.
32
+ * For most stores, this is ignored if it is set.
33
+ */
34
+ undoable?: Undoable;
29
35
  readonly resources: {
30
36
  -readonly [K in StringKeyof<R>]: R[K];
31
37
  };