@wszerad/items 0.0.0 → 0.1.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/README.md CHANGED
@@ -4,7 +4,7 @@ Lightweight, immutable collection manager inspired by NgRx Entity Adapter.
4
4
 
5
5
  ## Features
6
6
 
7
- - ✅ Immutable operations (insert/insertMany, upsert/upsertMany, set/setMany, update, remove, filter, etc.)
7
+ - ✅ Immutable operations (insert/insertMany, upsert/upsertMany, set/setMany, update, remove/removeMany, filter, etc.)
8
8
  - ✅ Single entity and batch operations
9
9
  - ✅ Custom ID selection (`selectId`)
10
10
  - ✅ Optional sorting (`sortComparer`)
@@ -19,7 +19,7 @@ Lightweight, immutable collection manager inspired by NgRx Entity Adapter.
19
19
  ## Installation
20
20
 
21
21
  ```bash
22
- npm install items
22
+ npm install @wszerad/items
23
23
  ```
24
24
 
25
25
  ## Quick Start
@@ -722,40 +722,45 @@ users = users.setMany([
722
722
  ### Checking Entity Existence
723
723
 
724
724
  ```typescript
725
- import { Items } from 'items'
725
+ interface Product {
726
+ sku: string
727
+ name: string
728
+ price: number
729
+ }
726
730
 
727
- const users = new Items<number, User>([
728
- { id: 1, name: 'Alice', age: 25 },
729
- { id: 2, name: 'Bob', age: 30 },
730
- { id: 3, name: 'Charlie', age: 35 }
731
+ const products = new Items<string, Product>([], {
732
+ selectId: (product) => product.sku
733
+ })
734
+
735
+ const updated = products.insert([
736
+ { sku: 'ABC-123', name: 'Widget', price: 19.99 }
731
737
  ])
732
738
 
733
- // Check single entity exists
734
- if (users.has(1)) {
735
- console.log('User 1 exists')
736
- }
739
+ console.log(updated.select('ABC-123'))
740
+ ```
737
741
 
738
- if (!users.has(99)) {
739
- console.log('User 99 does not exist')
740
- }
742
+ ### With Sorting
741
743
 
742
- // Check multiple entities exist (ALL must exist)
743
- if (users.hasMany([1, 2])) {
744
- console.log('Users 1 and 2 both exist')
745
- }
744
+ ```typescript
745
+ const items = new Items<number, User>(
746
+ [
747
+ { id: 3, name: 'Charlie', age: 35 },
748
+ { id: 1, name: 'Alice', age: 25 },
749
+ { id: 2, name: 'Bob', age: 30 }
750
+ ],
751
+ { sortComparer: (a, b) => a.name.localeCompare(b.name) }
752
+ )
746
753
 
747
- if (!users.hasMany([1, 99])) {
748
- console.log('Not all users exist')
749
- }
754
+ console.log(items.getIds()) // [1, 2, 3] - sorted by name
755
+ ```
750
756
 
751
- // Check if any entity matches condition
752
- if (users.hasMany(user => user.age >= 30)) {
753
- console.log('At least one user is 30 or older')
754
- }
757
+ ---
758
+
759
+ ## Development
755
760
 
756
- // Use with conditionals
757
- const userExists = users.has(1)
758
- const allExist = users.hasMany([1, 2, 3])
759
- const hasAdults = users.hasMany(user => user.age >= 18)
761
+ ### Scripts
760
762
 
761
- // Combine with ot
763
+ - `npm test` – runs tests (Vitest)
764
+ - `npm run test:watch` – watch mode
765
+ - `npm run build` – typecheck + bundling (tsc + tsdown)
766
+ - `npm run typecheck` – TypeScript type checking (
@@ -0,0 +1,77 @@
1
+ import { diff } from "ohash/utils";
2
+
3
+ //#region src/selectId.d.ts
4
+ type StrOrNum = string | number;
5
+ type SelectId<E> = (entity: E) => StrOrNum;
6
+ //#endregion
7
+ //#region src/diff.d.ts
8
+ interface ItemDiff<I> {
9
+ id: I;
10
+ changes: ReturnType<typeof diff>;
11
+ }
12
+ interface ItemsDiff<I> {
13
+ added: I[];
14
+ removed: I[];
15
+ updated: ItemDiff<I>[];
16
+ }
17
+ //#endregion
18
+ //#region src/selector.d.ts
19
+ type SelectorFn<E> = (entity: E) => boolean;
20
+ type Selector<E, I> = Iterable<I> | SelectorFn<E>;
21
+ type Operation<E, I> = (entity: E | undefined, id: I) => void;
22
+ //#endregion
23
+ //#region src/updater.d.ts
24
+ type UpdateFn<E> = (entity: E) => E;
25
+ type Updater<E> = UpdateFn<E> | Partial<E>;
26
+ //#endregion
27
+ //#region src/Items.d.ts
28
+ type ItemsOptions<E> = {
29
+ selectId?: SelectId<E>;
30
+ sortComparer?: false | ((a: E, b: E) => number);
31
+ };
32
+ interface ItemsState<E, I> {
33
+ ids: I[];
34
+ entities: Map<I, E>;
35
+ }
36
+ declare class Items<E, I extends StrOrNum = StrOrNum> {
37
+ private options;
38
+ private state;
39
+ constructor(items?: Iterable<E>, options?: ItemsOptions<E>);
40
+ getIds(): I[];
41
+ getEntities(): Map<I, E>;
42
+ get length(): number;
43
+ select(id: I): E | undefined;
44
+ insert(entity: E): Items<E, I>;
45
+ insertMany(entities: Iterable<E>): Items<E, I>;
46
+ upsert(entity: Partial<E>): Items<E, I>;
47
+ upsertMany(entities: Iterable<Partial<E>>): Items<E, I>;
48
+ set(entity: E): Items<E, I>;
49
+ setMany(entities: Iterable<E>): Items<E, I>;
50
+ every(check: SelectorFn<E>): boolean;
51
+ some(check: SelectorFn<E>): boolean;
52
+ has(id: I): boolean;
53
+ hasMany(select: Selector<E, I>): boolean;
54
+ update(id: I, updater: Updater<E>): Items<E, I>;
55
+ updateMany(select: Selector<E, I>, updater: Updater<E>): Items<E, I>;
56
+ remove(id: I): Items<E, I>;
57
+ removeMany(select: Selector<E, I>): Items<E, I>;
58
+ clear(): Items<E, I>;
59
+ filter(select: Selector<E, I>): Items<E, I>;
60
+ page(page: number, pageSize: number): {
61
+ items: NonNullable<E>[];
62
+ page: number;
63
+ pageSize: number;
64
+ hasNext: boolean;
65
+ hasPrevious: boolean;
66
+ total: number;
67
+ totalPages: number;
68
+ };
69
+ diff(base: Items<E, I>): ItemsDiff<I>;
70
+ private sortIds;
71
+ private selectId;
72
+ private get sortComparer();
73
+ [Symbol.iterator](): Iterator<E>;
74
+ }
75
+ //#endregion
76
+ export { type ItemDiff, Items, type ItemsDiff, type ItemsOptions, type ItemsState, type Operation, type SelectId, type Selector, type SelectorFn, type StrOrNum, type UpdateFn, type Updater };
77
+ //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs ADDED
@@ -0,0 +1,194 @@
1
+ import { diff } from "ohash/utils";
2
+
3
+ //#region src/selectId.ts
4
+ function defaultSelectId(entity) {
5
+ return entity.id;
6
+ }
7
+
8
+ //#endregion
9
+ //#region src/selector.ts
10
+ function selector(items, selector$1, operation) {
11
+ if (typeof selector$1 === "function") items.getEntities().forEach((entity, id) => {
12
+ if (selector$1(entity)) operation(entity, id);
13
+ });
14
+ else Array.from(selector$1).forEach((id) => operation(items.select(id), id));
15
+ }
16
+
17
+ //#endregion
18
+ //#region src/diff.ts
19
+ function itemsDiff(fromItems, toItems) {
20
+ const ids = new Set(toItems.getIds());
21
+ const baseIds = new Set(fromItems.getIds());
22
+ const added = [];
23
+ const updated = [];
24
+ ids.forEach((id) => {
25
+ if (!baseIds.has(id)) added.push(id);
26
+ else {
27
+ const changes = diff(fromItems.select(id), toItems.select(id));
28
+ if (changes.length > 0) updated.push({
29
+ id,
30
+ changes
31
+ });
32
+ baseIds.delete(id);
33
+ }
34
+ });
35
+ return {
36
+ added,
37
+ removed: [...baseIds],
38
+ updated
39
+ };
40
+ }
41
+
42
+ //#endregion
43
+ //#region src/updater.ts
44
+ function update(entity, updater) {
45
+ return {
46
+ ...entity,
47
+ ...typeof updater === "function" ? updater(entity) : updater
48
+ };
49
+ }
50
+
51
+ //#endregion
52
+ //#region src/Items.ts
53
+ var Items = class Items {
54
+ state;
55
+ constructor(items = [], options = {}) {
56
+ this.options = options;
57
+ const entities = new Map(Array.from(items).map((item) => {
58
+ return [this.selectId(item), item];
59
+ }));
60
+ this.state = {
61
+ ids: this.sortIds([...entities.keys()], entities),
62
+ entities
63
+ };
64
+ }
65
+ getIds() {
66
+ return [...this.state.ids];
67
+ }
68
+ getEntities() {
69
+ return new Map(this.state.entities);
70
+ }
71
+ get length() {
72
+ return this.state.ids.length;
73
+ }
74
+ select(id) {
75
+ return this.state.entities.get(id);
76
+ }
77
+ insert(entity) {
78
+ return this.insertMany([entity]);
79
+ }
80
+ insertMany(entities) {
81
+ return new Items([...this, ...Array.from(entities).filter((entity) => !this.has(this.selectId(entity)))], this.options);
82
+ }
83
+ upsert(entity) {
84
+ return this.upsertMany([entity]);
85
+ }
86
+ upsertMany(entities) {
87
+ const clone = this.getEntities();
88
+ Array.from(entities).forEach((entity) => {
89
+ const id = this.selectId(entity);
90
+ const existing = clone.get(id);
91
+ if (existing) clone.set(id, {
92
+ ...existing,
93
+ ...entity
94
+ });
95
+ else clone.set(id, entity);
96
+ });
97
+ return new Items(clone.values(), this.options);
98
+ }
99
+ set(entity) {
100
+ return this.setMany([entity]);
101
+ }
102
+ setMany(entities) {
103
+ return new Items([...this, ...entities], this.options);
104
+ }
105
+ every(check) {
106
+ return this.getIds().every((id) => check(this.select(id)));
107
+ }
108
+ some(check) {
109
+ return this.getIds().some((id) => check(this.select(id)));
110
+ }
111
+ has(id) {
112
+ return this.state.ids.includes(id);
113
+ }
114
+ hasMany(select) {
115
+ let failToFind = false;
116
+ let result = false;
117
+ selector(this, select, (entity) => {
118
+ if (entity) result = true;
119
+ else failToFind = true;
120
+ });
121
+ return !failToFind && result;
122
+ }
123
+ update(id, updater) {
124
+ const entity = this.select(id);
125
+ if (!entity) return this;
126
+ const clone = this.getEntities();
127
+ clone.set(id, update(entity, updater));
128
+ return new Items(clone.values(), this.options);
129
+ }
130
+ updateMany(select, updater) {
131
+ const clone = this.getEntities();
132
+ selector(this, select, (entity, id) => {
133
+ if (entity) clone.set(id, update(entity, updater));
134
+ });
135
+ return new Items(clone.values(), this.options);
136
+ }
137
+ remove(id) {
138
+ const clone = this.getEntities();
139
+ clone.delete(id);
140
+ return new Items(clone.values(), this.options);
141
+ }
142
+ removeMany(select) {
143
+ const clone = this.getEntities();
144
+ selector(this, select, (_, id) => {
145
+ clone.delete(id);
146
+ });
147
+ return new Items(clone.values(), this.options);
148
+ }
149
+ clear() {
150
+ return new Items([], this.options);
151
+ }
152
+ filter(select) {
153
+ const clone = /* @__PURE__ */ new Map();
154
+ selector(this, select, (entity, id) => {
155
+ if (entity) clone.set(id, entity);
156
+ });
157
+ return new Items(clone.values(), this.options);
158
+ }
159
+ page(page, pageSize) {
160
+ const totalPages = Math.ceil(this.length / pageSize);
161
+ return {
162
+ items: this.getIds().slice(page * pageSize, (page + 1) * pageSize).map((id) => this.select(id)),
163
+ page,
164
+ pageSize,
165
+ hasNext: page < totalPages - 1,
166
+ hasPrevious: page > 0,
167
+ total: this.length,
168
+ totalPages
169
+ };
170
+ }
171
+ diff(base) {
172
+ return itemsDiff(base, this);
173
+ }
174
+ sortIds(ids, entities) {
175
+ if (this.sortComparer === false) return ids;
176
+ const sorter = this.sortComparer;
177
+ return [...ids].sort((aId, bId) => {
178
+ return sorter(entities.get(aId), entities.get(bId));
179
+ });
180
+ }
181
+ selectId(entity) {
182
+ return this.options?.selectId?.(entity) || defaultSelectId(entity);
183
+ }
184
+ get sortComparer() {
185
+ return this.options.sortComparer || false;
186
+ }
187
+ [Symbol.iterator]() {
188
+ return this.state.entities.values();
189
+ }
190
+ };
191
+
192
+ //#endregion
193
+ export { Items };
194
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["selector","added: I[]","updated: ItemDiff<I>[]","options: ItemsOptions<E>"],"sources":["../src/selectId.ts","../src/selector.ts","../src/diff.ts","../src/updater.ts","../src/Items.ts"],"sourcesContent":["export type StrOrNum = string | number\n\nexport type SelectId<E> = (entity: E) => StrOrNum\n\nexport function defaultSelectId<E extends { id: I }, I = E['id']>(entity: E) {\n return entity.id\n}\n","import { Items } from './Items'\nimport { StrOrNum } from './selectId'\n\nexport type SelectorFn<E> = (entity: E) => boolean\nexport type Selector<E, I> = Iterable<I> | SelectorFn<E>\nexport type Operation<E, I> = (entity: E | undefined, id: I) => void\n\nexport function selector<E, I extends StrOrNum>(items: Items<E, I>, selector: Selector<E, I>, operation: Operation<E, I>) {\n if (typeof selector === 'function') {\n items.getEntities().forEach((entity, id) => {\n if ((selector as SelectorFn<E>)(entity)) {\n operation(entity, id)\n }\n })\n } else {\n Array\n .from(selector as Iterable<I>)\n .forEach(id => operation(items.select(id), id))\n }\n}\n","import { diff } from 'ohash/utils'\nimport { Items } from './Items'\nimport { StrOrNum } from './selectId'\n\nexport interface ItemDiff<I> {\n id: I\n changes: ReturnType<typeof diff>\n}\n\nexport interface ItemsDiff<I> {\n added: I[]\n removed: I[]\n updated: ItemDiff<I>[]\n}\n\nexport function itemsDiff<E, I extends StrOrNum>(fromItems: Items<E, I>, toItems: Items<E, I>): ItemsDiff<I> {\n const ids = new Set(toItems.getIds())\n const baseIds = new Set(fromItems.getIds())\n\n const added: I[] = []\n const updated: ItemDiff<I>[] = []\n\n ids.forEach(id => {\n if (!baseIds.has(id)) {\n added.push(id)\n } else {\n const changes = diff(fromItems.select(id), toItems.select(id))\n\n if (changes.length > 0) {\n updated.push({ id, changes })\n }\n\n baseIds.delete(id)\n }\n })\n\n const removed = [...baseIds]\n\n return {\n added,\n removed,\n updated\n }\n}\n","export type UpdateFn<E> = (entity: E) => E\nexport type Updater<E> = UpdateFn<E> | Partial<E>\n\nexport function update<E>(entity: E, updater: Updater<E>) {\n return { ...entity, ...(typeof updater === 'function' ? updater(entity) : updater) }\n}\n","import { defaultSelectId, SelectId, StrOrNum } from './selectId'\nimport { selector, Selector, SelectorFn } from './selector'\nimport { Updater } from './updater'\nimport { itemsDiff } from './diff'\nimport { update } from './updater'\n\nexport type ItemsOptions<E> = {\n selectId?: SelectId<E>\n sortComparer?: false | ((a: E, b: E) => number)\n}\n\nexport interface ItemsState<E, I> {\n ids: I[]\n entities: Map<I, E>\n}\n\nexport class Items<E, I extends StrOrNum = StrOrNum> {\n private state: ItemsState<E, I>\n\n constructor(\n items: Iterable<E> = [],\n private options: ItemsOptions<E> = {}\n ) {\n const entities = new Map(\n Array\n .from(items)\n .map((item) => {\n const id = this.selectId(item)\n return [id, item]\n })\n )\n\n this.state = {\n ids: this.sortIds([...entities.keys()], entities),\n entities\n }\n }\n\n getIds(): I[] {\n return [...this.state.ids]\n }\n\n getEntities(): Map<I, E> {\n return new Map(this.state.entities)\n }\n\n get length(): number {\n return this.state.ids.length\n }\n\n select(id: I): E | undefined {\n return this.state.entities.get(id)\n }\n\n insert(entity: E) {\n return this.insertMany([entity])\n }\n\n insertMany(entities: Iterable<E>) {\n return new Items<E, I>([\n ...this,\n ...Array.from(entities).filter(entity => !this.has(this.selectId(entity)))\n ], this.options)\n }\n\n upsert(entity: Partial<E>) {\n return this.upsertMany([entity])\n }\n\n upsertMany(entities: Iterable<Partial<E>>) {\n const clone = this.getEntities()\n Array.from(entities).forEach(entity => {\n const id = this.selectId(entity as E)\n const existing = clone.get(id)\n if (existing) {\n clone.set(id, { ...existing, ...entity } as E)\n } else {\n clone.set(id, entity as E)\n }\n })\n return new Items<E, I>(clone.values(), this.options)\n }\n\n set(entity: E) {\n return this.setMany([entity])\n }\n\n setMany(entities: Iterable<E>) {\n return new Items<E, I>([\n ...this,\n ...entities\n ], this.options)\n }\n\n every(check: SelectorFn<E>) {\n return this.getIds().every(id => check(this.select(id)!))\n }\n\n some(check: SelectorFn<E>) {\n return this.getIds().some(id => check(this.select(id)!))\n }\n\n has(id: I) {\n return this.state.ids.includes(id)\n }\n\n hasMany(select: Selector<E, I>) {\n let failToFind = false\n let result = false\n selector(this, select, (entity) => {\n if (entity) {\n result = true\n } else {\n failToFind = true\n }\n })\n return !failToFind && result\n }\n\n update(id: I, updater: Updater<E>) {\n const entity = this.select(id)\n if (!entity) {\n return this\n }\n const clone = this.getEntities()\n clone.set(id, update(entity, updater))\n return new Items<E, I>(clone.values(), this.options)\n }\n\n updateMany(select: Selector<E, I>, updater: Updater<E>) {\n const clone = this.getEntities()\n selector(this, select, (entity, id) => {\n if (entity) {\n clone.set(id, update(entity, updater))\n }\n })\n return new Items<E, I>(clone.values(), this.options)\n }\n\n remove(id: I) {\n const clone = this.getEntities()\n clone.delete(id)\n return new Items<E, I>(clone.values(), this.options)\n }\n\n removeMany(select: Selector<E, I>) {\n const clone = this.getEntities()\n selector(this, select, (_, id) => {\n clone.delete(id)\n })\n return new Items<E, I>(clone.values(), this.options)\n }\n\n clear() {\n return new Items<E, I>([], this.options)\n }\n\n filter(select: Selector<E, I>) {\n const clone = new Map<I, E>()\n\n selector(this, select, (entity, id) => {\n if (entity) {\n clone.set(id, entity)\n }\n })\n\n return new Items<E, I>(clone.values(), this.options)\n }\n\n page(page: number, pageSize: number) {\n const totalPages = Math.ceil(this.length / pageSize)\n return {\n items: this.getIds()\n .slice(page * pageSize, (page + 1) * pageSize)\n .map(id => this.select(id)!),\n page,\n pageSize,\n hasNext: page < totalPages - 1,\n hasPrevious: page > 0,\n total: this.length,\n totalPages\n }\n }\n\n diff(base: Items<E, I>) {\n return itemsDiff(base, this)\n }\n\n private sortIds(\n ids: I[],\n entities: Map<I, E>\n ): Array<I> {\n if (this.sortComparer === false) {\n return ids\n }\n const sorter = this.sortComparer\n return [...ids].sort((aId, bId) => {\n const a = entities.get(aId)!\n const b = entities.get(bId)!\n return sorter(a, b)\n })\n }\n\n private selectId(entity: E): I {\n return this.options?.selectId?.(entity) as undefined || defaultSelectId(entity as E & { id: I })\n }\n\n private get sortComparer() {\n return this.options.sortComparer || false\n }\n\n [Symbol.iterator](): Iterator<E> {\n return this.state.entities.values()\n }\n}\n"],"mappings":";;;AAIA,SAAgB,gBAAkD,QAAW;AAC3E,QAAO,OAAO;;;;;ACEhB,SAAgB,SAAgC,OAAoB,YAA0B,WAA4B;AACxH,KAAI,OAAOA,eAAa,WACtB,OAAM,aAAa,CAAC,SAAS,QAAQ,OAAO;AAC1C,MAAKA,WAA2B,OAAO,CACrC,WAAU,QAAQ,GAAG;GAEvB;KAEF,OACG,KAAKA,WAAwB,CAC7B,SAAQ,OAAM,UAAU,MAAM,OAAO,GAAG,EAAE,GAAG,CAAC;;;;;ACFrD,SAAgB,UAAiC,WAAwB,SAAoC;CAC3G,MAAM,MAAM,IAAI,IAAI,QAAQ,QAAQ,CAAC;CACrC,MAAM,UAAU,IAAI,IAAI,UAAU,QAAQ,CAAC;CAE3C,MAAMC,QAAa,EAAE;CACrB,MA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C,GAAG,IAAI,CAAC,MAAM,KAAK,QAAQ;AAGjC,UAAO,OAFG,SAAS,IAAI,IAAI,EACjB,SAAS,IAAI,IAAI,CACR;IACnB;;CAGJ,AAAQ,SAAS,QAAc;AAC7B,SAAO,KAAK,SAAS,WAAW,OAAO,IAAiB,gBAAgB,OAAwB;;CAGlG,IAAY,eAAe;AACzB,SAAO,KAAK,QAAQ,gBAAgB;;CAGtC,CAAC,OAAO,YAAyB;AAC/B,SAAO,KAAK,MAAM,SAAS,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wszerad/items",
3
- "version": "0.0.0",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -38,12 +38,14 @@
38
38
  },
39
39
  "keywords": [
40
40
  "array",
41
- "diff"
41
+ "diff",
42
+ "ohash",
43
+ "immutable"
42
44
  ],
43
45
  "author": "Wszerad Martynowski",
44
46
  "repository": {
45
- "type": "npm",
46
- "url": "https://www.npmjs.com/package/@wszerad/items"
47
+ "type": "git",
48
+ "url": "git+https://github.com/wszerad/items.git"
47
49
  },
48
50
  "license": "MIT",
49
51
  "module": "./dist/index.js"