shogun-core 3.0.13 → 3.0.14

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/gundb/api.js CHANGED
@@ -266,147 +266,6 @@ export class SimpleGunAPI {
266
266
  indexedObjectToArray(indexedObj) {
267
267
  return this.getArrayFromIndexedObject(indexedObj);
268
268
  }
269
- // Save array as indexed object in user space
270
- async putUserArray(path, arr) {
271
- try {
272
- if (!this.isLoggedIn()) {
273
- console.warn("User not logged in");
274
- return false;
275
- }
276
- const indexedObject = this.getIndexedObjectFromArray(arr);
277
- return await this.putUserData(path, indexedObject);
278
- }
279
- catch (error) {
280
- console.warn(`Failed to put user array to ${path}:`, error);
281
- return false;
282
- }
283
- }
284
- // Get array from indexed object in user space
285
- async getUserArray(path) {
286
- try {
287
- if (!this.isLoggedIn()) {
288
- console.warn("User not logged in");
289
- return [];
290
- }
291
- const indexedObject = await this.getUserData(path);
292
- return this.getArrayFromIndexedObject(indexedObject);
293
- }
294
- catch (error) {
295
- console.warn(`Failed to get user array from ${path}:`, error);
296
- return [];
297
- }
298
- }
299
- // Add item to user array collection
300
- async addToUserArray(path, item) {
301
- try {
302
- if (!this.isLoggedIn()) {
303
- console.warn("User not logged in");
304
- return false;
305
- }
306
- // Validate item before adding
307
- if (!item || typeof item !== "object" || !item.id) {
308
- console.warn("Invalid item: must be an object with an id property");
309
- return false;
310
- }
311
- const currentArray = await this.getUserArray(path);
312
- const newArray = [...currentArray, item];
313
- return await this.putUserArray(path, newArray);
314
- }
315
- catch (error) {
316
- console.warn(`Failed to add item to user array ${path}:`, error);
317
- return false;
318
- }
319
- }
320
- // Remove item from user array collection
321
- async removeFromUserArray(path, itemId) {
322
- try {
323
- if (!this.isLoggedIn()) {
324
- console.warn("User not logged in");
325
- return false;
326
- }
327
- const currentArray = await this.getUserArray(path);
328
- const newArray = currentArray.filter((item) => item.id !== itemId);
329
- return await this.putUserArray(path, newArray);
330
- }
331
- catch (error) {
332
- console.warn(`Failed to remove item from user array ${path}:`, error);
333
- return false;
334
- }
335
- }
336
- // Update item in user array collection
337
- async updateInUserArray(path, itemId, updates) {
338
- try {
339
- if (!this.isLoggedIn()) {
340
- console.warn("User not logged in");
341
- return false;
342
- }
343
- const currentArray = await this.getUserArray(path);
344
- const newArray = currentArray.map((item) => item.id === itemId ? { ...item, ...updates } : item);
345
- return await this.putUserArray(path, newArray);
346
- }
347
- catch (error) {
348
- console.warn(`Failed to update item in user array ${path}:`, error);
349
- return false;
350
- }
351
- }
352
- // Save array as indexed object in global space
353
- async putArray(path, arr) {
354
- try {
355
- const indexedObject = this.getIndexedObjectFromArray(arr);
356
- return await this.put(path, indexedObject);
357
- }
358
- catch (error) {
359
- console.warn(`Failed to put array to ${path}:`, error);
360
- return false;
361
- }
362
- }
363
- // Get array from indexed object in global space
364
- async getArray(path) {
365
- try {
366
- const indexedObject = await this.get(path);
367
- return this.getArrayFromIndexedObject(indexedObject);
368
- }
369
- catch (error) {
370
- console.warn(`Failed to get array from ${path}:`, error);
371
- return [];
372
- }
373
- }
374
- // Add item to global array collection
375
- async addToArray(path, item) {
376
- try {
377
- const currentArray = await this.getArray(path);
378
- const newArray = [...currentArray, item];
379
- return await this.putArray(path, newArray);
380
- }
381
- catch (error) {
382
- console.warn(`Failed to add item to array ${path}:`, error);
383
- return false;
384
- }
385
- }
386
- // Remove item from global array collection
387
- async removeFromArray(path, itemId) {
388
- try {
389
- const currentArray = await this.getArray(path);
390
- const newArray = currentArray.filter((item) => item.id !== itemId);
391
- return await this.putArray(path, newArray);
392
- }
393
- catch (error) {
394
- console.warn(`Failed to remove item from array ${path}:`, error);
395
- return false;
396
- }
397
- }
398
- // Update item in global array collection
399
- async updateInArray(path, itemId, updates) {
400
- try {
401
- const currentArray = await this.getArray(path);
402
- const newArray = currentArray.map((item) => item.id === itemId ? { ...item, ...updates } : item);
403
- return await this.putArray(path, newArray);
404
- }
405
- catch (error) {
406
- console.warn(`Failed to update item in array ${path}:`, error);
407
- return false;
408
- }
409
- }
410
269
  /**
411
270
  * Path utilities
412
271
  */
@@ -56,32 +56,6 @@ export declare class SimpleGunAPI {
56
56
  id: string | number;
57
57
  }>(arr: T[]): Record<string, T>;
58
58
  indexedObjectToArray<T>(indexedObj: Record<string, T> | null): T[];
59
- putUserArray<T extends {
60
- id: string | number;
61
- }>(path: string, arr: T[]): Promise<boolean>;
62
- getUserArray<T>(path: string): Promise<T[]>;
63
- addToUserArray<T extends {
64
- id: string | number;
65
- }>(path: string, item: T): Promise<boolean>;
66
- removeFromUserArray<T extends {
67
- id: string | number;
68
- }>(path: string, itemId: string | number): Promise<boolean>;
69
- updateInUserArray<T extends {
70
- id: string | number;
71
- }>(path: string, itemId: string | number, updates: Partial<T>): Promise<boolean>;
72
- putArray<T extends {
73
- id: string | number;
74
- }>(path: string, arr: T[]): Promise<boolean>;
75
- getArray<T>(path: string): Promise<T[]>;
76
- addToArray<T extends {
77
- id: string | number;
78
- }>(path: string, item: T): Promise<boolean>;
79
- removeFromArray<T extends {
80
- id: string | number;
81
- }>(path: string, itemId: string | number): Promise<boolean>;
82
- updateInArray<T extends {
83
- id: string | number;
84
- }>(path: string, itemId: string | number, updates: Partial<T>): Promise<boolean>;
85
59
  /**
86
60
  * Path utilities
87
61
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shogun-core",
3
- "version": "3.0.13",
3
+ "version": "3.0.14",
4
4
  "description": "SHOGUN CORE - Core library for Shogun Ecosystem",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",