@ekairos/domain 1.6.1 → 1.8.3

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/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { i } from "@instantdb/core";
2
- import type { EntitiesDef, LinksDef, RoomsDef, InstantSchemaDef } from "@instantdb/core";
3
- export type DomainDefinition<E extends EntitiesDef, L extends LinksDef<any>, R extends RoomsDef> = {
4
- entities: E;
5
- links: L;
6
- rooms: R;
7
- };
8
- export type DomainInstance<E extends EntitiesDef, L extends LinksDef<any>, R extends RoomsDef> = DomainDefinition<E, L, R> & {
9
- schema: () => ReturnType<typeof i.schema>;
10
- compose: <E2 extends EntitiesDef, L2 extends LinksDef<E2>, R2 extends RoomsDef>(other: DomainInstance<E2, L2, R2> | DomainDefinition<E2, L2, R2>) => DomainInstance<E & E2, LinksDef<E & E2>, R & R2>;
11
- };
12
- export type SchemaOf<D extends DomainDefinition<any, any, any>> = InstantSchemaDef<D["entities"], LinksDef<D["entities"]>, D["rooms"]>;
13
- export declare function domain<E extends EntitiesDef, L extends LinksDef<any>, R extends RoomsDef>(def: DomainDefinition<E, L, R>): DomainInstance<E, L, R>;
1
+ import { i } from "@instantdb/core";
2
+ import type { EntitiesDef, LinksDef, RoomsDef, InstantSchemaDef } from "@instantdb/core";
3
+ export type DomainDefinition<E extends EntitiesDef, L extends LinksDef<any>, R extends RoomsDef> = {
4
+ entities: E;
5
+ links: L;
6
+ rooms: R;
7
+ };
8
+ export type DomainInstance<E extends EntitiesDef, L extends LinksDef<any>, R extends RoomsDef> = DomainDefinition<E, L, R> & {
9
+ schema: () => ReturnType<typeof i.schema>;
10
+ compose: <E2 extends EntitiesDef, L2 extends LinksDef<E2>, R2 extends RoomsDef>(other: DomainInstance<E2, L2, R2> | DomainDefinition<E2, L2, R2>) => DomainInstance<E & E2, LinksDef<E & E2>, R & R2>;
11
+ };
12
+ export type SchemaOf<D extends DomainDefinition<any, any, any>> = InstantSchemaDef<D["entities"], LinksDef<D["entities"]>, D["rooms"]>;
13
+ export declare function domain<E extends EntitiesDef, L extends LinksDef<any>, R extends RoomsDef>(def: DomainDefinition<E, L, R>): DomainInstance<E, L, R>;
14
14
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,34 +1,34 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.domain = domain;
4
- const core_1 = require("@instantdb/core");
5
- function domain(def) {
6
- function schema() {
7
- return core_1.i.schema({
8
- entities: def.entities,
9
- links: def.links,
10
- rooms: def.rooms,
11
- });
12
- }
13
- function compose(other) {
14
- const otherDef = ("schema" in other)
15
- ? { entities: other.entities, links: other.links, rooms: other.rooms }
16
- : other;
17
- const mergedEntities = { ...def.entities, ...otherDef.entities };
18
- const mergedLinks = { ...def.links, ...otherDef.links };
19
- const mergedRooms = { ...def.rooms, ...otherDef.rooms };
20
- return domain({
21
- entities: mergedEntities,
22
- links: mergedLinks,
23
- rooms: mergedRooms,
24
- });
25
- }
26
- return {
27
- entities: def.entities,
28
- links: def.links,
29
- rooms: def.rooms,
30
- schema,
31
- compose,
32
- };
33
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.domain = domain;
4
+ const core_1 = require("@instantdb/core");
5
+ function domain(def) {
6
+ function schema() {
7
+ return core_1.i.schema({
8
+ entities: def.entities,
9
+ links: def.links,
10
+ rooms: def.rooms,
11
+ });
12
+ }
13
+ function compose(other) {
14
+ const otherDef = ("schema" in other)
15
+ ? { entities: other.entities, links: other.links, rooms: other.rooms }
16
+ : other;
17
+ const mergedEntities = { ...def.entities, ...otherDef.entities };
18
+ const mergedLinks = { ...def.links, ...otherDef.links };
19
+ const mergedRooms = { ...def.rooms, ...otherDef.rooms };
20
+ return domain({
21
+ entities: mergedEntities,
22
+ links: mergedLinks,
23
+ rooms: mergedRooms,
24
+ });
25
+ }
26
+ return {
27
+ entities: def.entities,
28
+ links: def.links,
29
+ rooms: def.rooms,
30
+ schema,
31
+ compose,
32
+ };
33
+ }
34
34
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekairos/domain",
3
- "version": "1.6.1",
3
+ "version": "1.8.3",
4
4
  "description": "Pulzar Domain Utilities",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",