@hf-chimera/store 0.0.7 → 0.0.9

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 (44) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/adapters/react.cjs +121 -0
  3. package/dist/adapters/react.d.cts +39 -0
  4. package/dist/adapters/react.d.cts.map +1 -0
  5. package/dist/adapters/react.d.ts +39 -0
  6. package/dist/adapters/react.d.ts.map +1 -0
  7. package/dist/adapters/react.js +92 -0
  8. package/dist/adapters/react.js.map +1 -0
  9. package/dist/defaults-Bg1kIemd.cjs +371 -0
  10. package/dist/defaults-CLUQg2zK.js +210 -0
  11. package/dist/defaults-CLUQg2zK.js.map +1 -0
  12. package/dist/defaults.cjs +21 -0
  13. package/dist/defaults.d.cts +59 -0
  14. package/dist/defaults.d.cts.map +1 -0
  15. package/dist/defaults.d.ts +59 -0
  16. package/dist/defaults.d.ts.map +1 -0
  17. package/dist/defaults.js +13 -0
  18. package/dist/defaults.js.map +1 -0
  19. package/dist/{index-kFATKhTP.d.ts → index-BXn5xYo5.d.ts} +21 -2
  20. package/dist/index-BXn5xYo5.d.ts.map +1 -0
  21. package/dist/{index-DgwhyIVQ.d.cts → index-Bl61_G1s.d.cts} +21 -2
  22. package/dist/index-Bl61_G1s.d.cts.map +1 -0
  23. package/dist/{index-Mu4KG7Z7.d.cts → index-DJ2lT0xs.d.cts} +2 -2
  24. package/dist/{index-Mu4KG7Z7.d.cts.map → index-DJ2lT0xs.d.cts.map} +1 -1
  25. package/dist/{index-CqYNg3Vx.d.ts → index-DNJ6xgnR.d.ts} +2 -2
  26. package/dist/{index-CqYNg3Vx.d.ts.map → index-DNJ6xgnR.d.ts.map} +1 -1
  27. package/dist/index.cjs +13 -12
  28. package/dist/index.d.cts +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +2 -1
  31. package/dist/{qb-DHuihkTp.js → qb-DNcihcMP.js} +2 -2
  32. package/dist/{qb-DHuihkTp.js.map → qb-DNcihcMP.js.map} +1 -1
  33. package/dist/{qb-Cg4Q_DkJ.cjs → qb-pl8eUjYV.cjs} +1 -1
  34. package/dist/qb.cjs +3 -2
  35. package/dist/qb.d.cts +2 -2
  36. package/dist/qb.d.ts +2 -2
  37. package/dist/qb.js +3 -2
  38. package/dist/{src-Bx-gbHfm.js → src-BTo-wGWx.js} +3 -209
  39. package/dist/src-BTo-wGWx.js.map +1 -0
  40. package/dist/{src-u2_wgi_K.cjs → src-FCZZKq4W.cjs} +47 -320
  41. package/package.json +6 -1
  42. package/dist/index-DgwhyIVQ.d.cts.map +0 -1
  43. package/dist/index-kFATKhTP.d.ts.map +0 -1
  44. package/dist/src-Bx-gbHfm.js.map +0 -1
@@ -1,4 +1,4 @@
1
- const require_src = require('./src-u2_wgi_K.cjs');
1
+ const require_src = require('./src-FCZZKq4W.cjs');
2
2
 
3
3
  //#region packages/qb/index.ts
4
4
  var ChimeraQueryBuilder = class ChimeraQueryBuilder {
package/dist/qb.cjs CHANGED
@@ -1,4 +1,5 @@
1
- require('./src-u2_wgi_K.cjs');
2
- const require_qb = require('./qb-Cg4Q_DkJ.cjs');
1
+ require('./defaults-Bg1kIemd.cjs');
2
+ require('./src-FCZZKq4W.cjs');
3
+ const require_qb = require('./qb-pl8eUjYV.cjs');
3
4
 
4
5
  exports.ChimeraQueryBuilder = require_qb.ChimeraQueryBuilder;
package/dist/qb.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- import "./index-DgwhyIVQ.cjs";
2
- import { n as QueryBuilderCreator, t as ChimeraQueryBuilder } from "./index-Mu4KG7Z7.cjs";
1
+ import "./index-Bl61_G1s.cjs";
2
+ import { n as QueryBuilderCreator, t as ChimeraQueryBuilder } from "./index-DJ2lT0xs.cjs";
3
3
  export { ChimeraQueryBuilder, QueryBuilderCreator };
package/dist/qb.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import "./index-kFATKhTP.js";
2
- import { n as QueryBuilderCreator, t as ChimeraQueryBuilder } from "./index-CqYNg3Vx.js";
1
+ import "./index-BXn5xYo5.js";
2
+ import { n as QueryBuilderCreator, t as ChimeraQueryBuilder } from "./index-DNJ6xgnR.js";
3
3
  export { ChimeraQueryBuilder, QueryBuilderCreator };
package/dist/qb.js CHANGED
@@ -1,4 +1,5 @@
1
- import "./src-Bx-gbHfm.js";
2
- import { t as ChimeraQueryBuilder } from "./qb-DHuihkTp.js";
1
+ import "./defaults-CLUQg2zK.js";
2
+ import "./src-BTo-wGWx.js";
3
+ import { t as ChimeraQueryBuilder } from "./qb-DNcihcMP.js";
3
4
 
4
5
  export { ChimeraQueryBuilder };
@@ -1,12 +1,5 @@
1
- //#region src/shared/errors.ts
2
- var ChimeraError = class extends Error {};
3
- var ChimeraInternalError = class extends ChimeraError {
4
- constructor(message, options) {
5
- super(`${message}\nIf you have this bug, feel free to create an issue in https://github.com/hf-chimera/store/issues`, options);
6
- }
7
- };
1
+ import { D as ChimeraInternalError, E as ChimeraError, S as ChimeraQueryUnsuccessfulDeletionError, _ as ChimeraQueryNotReadyError, a as chimeraDefaultFilterConfig, b as ChimeraQueryTrustFetchedCollectionError, d as ChimeraQueryDeletedItemError, f as ChimeraQueryDeletingError, g as ChimeraQueryNotCreatedError, h as ChimeraQueryIdMismatchError, i as chimeraDefaultOrderConfig, l as chimeraDefaultDebugConfig, m as ChimeraQueryFetchingError, t as chimeraDefaultQueryConfig, u as ChimeraQueryAlreadyRunningError, x as ChimeraQueryTrustIdMismatchError } from "./defaults-CLUQg2zK.js";
8
2
 
9
- //#endregion
10
3
  //#region src/filter/errors.ts
11
4
  var ChimeraFilterError = class extends ChimeraError {};
12
5
  var ChimeraFilterOperatorError = class extends ChimeraFilterError {
@@ -238,16 +231,6 @@ const isFilterSubset = (candidate, target, getOperatorKey) => {
238
231
  return isConjunctionSubset(candidate, target, getOperatorKey);
239
232
  };
240
233
 
241
- //#endregion
242
- //#region src/order/errors.ts
243
- var ChimeraOrderError = class extends ChimeraError {};
244
- var ChimeraOrderTypeError = class extends ChimeraOrderError {};
245
- var ChimeraOrderTypeComparisonError = class extends ChimeraOrderTypeError {
246
- constructor(a, b) {
247
- super(`Unsupported comparison "${a}"(${typeof a}[${a != null ? a.constructor.name : a}]) with "${b}"(${typeof b}[${b != null ? b.constructor.name : b}])`);
248
- }
249
- };
250
-
251
234
  //#endregion
252
235
  //#region src/order/types.ts
253
236
  let ChimeraOrderNulls = /* @__PURE__ */ function(ChimeraOrderNulls$1) {
@@ -442,106 +425,6 @@ const IN_PROGRESS_STATES = [
442
425
  ChimeraQueryFetchingState.Deleting
443
426
  ];
444
427
 
445
- //#endregion
446
- //#region src/query/errors.ts
447
- const formatDeepErrorMessage = (message, cause) => `${message}: ${cause instanceof Error ? `\n ${cause.stack}` : cause}`;
448
- var ChimeraQueryError = class extends ChimeraError {
449
- entityName;
450
- constructor(entityName, message, options) {
451
- super(message, options);
452
- this.entityName = entityName;
453
- }
454
- };
455
- var ChimeraQueryIdMismatchError = class extends ChimeraQueryError {
456
- old;
457
- new;
458
- constructor(entityName, oldId, newId) {
459
- super(entityName, `
460
- Can't update "${entityName}" item if the change updates it's [id] (changed from "${oldId}" to "${newId}").
461
- If such an update should not be an error, update <idGetter> field in "${entityName}" entity config to make Chimera get the [id] value properly.
462
- `.trim());
463
- this.old = oldId;
464
- this.new = newId;
465
- }
466
- };
467
- var ChimeraQueryNotSpecifiedError = class extends ChimeraQueryError {
468
- methodName;
469
- constructor(entityName, methodName) {
470
- super(entityName, `<${methodName}> for entity "${entityName}" was not specified`);
471
- this.methodName = methodName;
472
- }
473
- };
474
- var ChimeraQueryTrustError = class extends ChimeraQueryError {
475
- constructor(entityName, description) {
476
- super(entityName, `
477
- DO NOT IGNORE THIS ERROR OR YOUR PROD MAY BREAK!
478
-
479
- Looks like your "${entityName}" query provider ${description}
480
-
481
- By default Chimera tend to trust external query provider to avoid extra data processing.
482
- If it is not your case, set field "trustQuery" to "false" in config defaults or for specific entity.
483
- This error visible only if "devMode" is "true".
484
- If you'll ignore it, your production may fail, because Chimera won't check the data correctness.
485
- `.trim());
486
- }
487
- };
488
- var ChimeraQueryTrustIdMismatchError = class extends ChimeraQueryTrustError {
489
- old;
490
- new;
491
- constructor(entityName, oldId, newId) {
492
- super(entityName, `
493
- returned an item with [id] that not matches with the [id] of item that was updated (changed from "${oldId}" to "${newId}").
494
- If it is not an error, update <idGetter> field in "${entityName}" entity config to make Chimera get the [id] value properly.
495
- `.trim());
496
- this.old = oldId;
497
- this.new = newId;
498
- }
499
- };
500
- var ChimeraQueryTrustFetchedCollectionError = class extends ChimeraQueryTrustError {
501
- old;
502
- new;
503
- constructor(entityName, input, output) {
504
- super(entityName, "returned not properly sorted or ordered collection.");
505
- this.old = input;
506
- this.new = output;
507
- }
508
- };
509
- var ChimeraQueryFetchingError = class extends ChimeraQueryError {
510
- constructor(entityName, cause) {
511
- super(entityName, formatDeepErrorMessage("Something went wrong", cause), { cause });
512
- }
513
- };
514
- var ChimeraQueryDeletingError = class extends ChimeraQueryError {
515
- constructor(entityName, cause) {
516
- super(entityName, formatDeepErrorMessage("Something went wrong", cause), { cause });
517
- }
518
- };
519
- var ChimeraQueryNotReadyError = class extends ChimeraQueryError {
520
- constructor(entityName) {
521
- super(entityName, "Unable to get unready value.");
522
- }
523
- };
524
- var ChimeraQueryDeletedItemError = class extends ChimeraQueryError {
525
- constructor(entityName, id) {
526
- super(entityName, `Unable to updated deleted item with [id] "${id}."`);
527
- }
528
- };
529
- var ChimeraQueryUnsuccessfulDeletionError = class extends ChimeraQueryError {
530
- constructor(entityName, id) {
531
- super(entityName, `Item with [id] "${id}" was not deleted.`);
532
- }
533
- };
534
- var ChimeraQueryAlreadyRunningError = class extends ChimeraQueryError {
535
- constructor(entityName, status) {
536
- super(entityName, `Unable to operate query. Other process already running ${status}.`);
537
- }
538
- };
539
- var ChimeraQueryNotCreatedError = class extends ChimeraQueryError {
540
- constructor(entityName) {
541
- super(entityName, "Unable to operate not created item.");
542
- }
543
- };
544
-
545
428
  //#endregion
546
429
  //#region src/query/ChimeraCollectionQuery.ts
547
430
  var ChimeraCollectionQuery = class extends ChimeraEventEmitter {
@@ -1495,95 +1378,6 @@ var ChimeraWeakValueMap = class extends ChimeraEventEmitter {
1495
1378
  }
1496
1379
  };
1497
1380
 
1498
- //#endregion
1499
- //#region src/debug/defaults.ts
1500
- const chimeraDefaultDebugConfig = {
1501
- devMode: false,
1502
- logs: "info",
1503
- name: "chimera"
1504
- };
1505
-
1506
- //#endregion
1507
- //#region src/filter/defaults.ts
1508
- const getKeyFromOperation = (operator) => JSON.stringify(operator);
1509
- const chimeraDefaultGetKeyFromFilter = (filter) => JSON.stringify(filter);
1510
- const chimeraDefaultFilterOperators = {
1511
- contains: (a, b) => {
1512
- if (typeof a === "string") return a.includes(b);
1513
- if (Array.isArray(a)) return Array.isArray(b) ? b.every((v) => a.includes(v)) : a.includes(b);
1514
- return false;
1515
- },
1516
- endsWith: (a, b) => a.endsWith(b),
1517
- startsWith: (a, b) => a.startsWith(b),
1518
- eq: (a, b) => a === b,
1519
- gt: (a, b) => a > b,
1520
- gte: (a, b) => a >= b,
1521
- in: (a, b) => (Array.isArray(a) ? a : [a]).some((v) => b.includes(v)),
1522
- lt: (a, b) => a < b,
1523
- lte: (a, b) => a <= b,
1524
- neq: (a, b) => a !== b,
1525
- notIn: (a, b) => (Array.isArray(a) ? a : [a]).every((v) => !b.includes(v))
1526
- };
1527
- const chimeraDefaultFilterConfig = {
1528
- getFilterKey: chimeraDefaultGetKeyFromFilter,
1529
- getOperatorKey: getKeyFromOperation,
1530
- operators: chimeraDefaultFilterOperators
1531
- };
1532
-
1533
- //#endregion
1534
- //#region src/order/defaults.ts
1535
- const chimeraDefaultComparator = (a, b) => {
1536
- let result = 0;
1537
- if (typeof a === "string" && typeof b === "string") result = a.localeCompare(b);
1538
- else if (typeof a === "number" && typeof b === "number" || typeof a === "boolean" && typeof b === "boolean") result = a - b;
1539
- else if (a instanceof Date && b instanceof Date) result = a.getTime() - b.getTime();
1540
- else if (a == null || b == null) result = a == b ? 0 : a == null ? -1 : 1;
1541
- else throw new ChimeraOrderTypeComparisonError(a, b);
1542
- return result;
1543
- };
1544
- const chimeraDefaultKeyFromOrder = (order) => JSON.stringify(order);
1545
- const chimeraDefaultOrderConfig = {
1546
- getKey: chimeraDefaultKeyFromOrder,
1547
- primitiveComparator: chimeraDefaultComparator
1548
- };
1549
-
1550
- //#endregion
1551
- //#region src/query/defaults.ts
1552
- const chimeraDefaultQueryConfig = {
1553
- defaults: {
1554
- batchedCreator: (entity) => {
1555
- throw new ChimeraQueryNotSpecifiedError(entity, "batchedCreator");
1556
- },
1557
- batchedDeleter: (entity) => {
1558
- throw new ChimeraQueryNotSpecifiedError(entity, "batchedDeleter");
1559
- },
1560
- batchedUpdater: (entity) => {
1561
- throw new ChimeraQueryNotSpecifiedError(entity, "batchedUpdater");
1562
- },
1563
- collectionFetcher: (entity) => {
1564
- throw new ChimeraQueryNotSpecifiedError(entity, "collectionFetcher");
1565
- },
1566
- idGetter: (entity) => {
1567
- throw new ChimeraQueryNotSpecifiedError(entity, "idGetter");
1568
- },
1569
- itemCreator: (entity) => {
1570
- throw new ChimeraQueryNotSpecifiedError(entity, "itemCreator");
1571
- },
1572
- itemDeleter: (entity) => {
1573
- throw new ChimeraQueryNotSpecifiedError(entity, "itemDeleter");
1574
- },
1575
- itemFetcher: (entity) => {
1576
- throw new ChimeraQueryNotSpecifiedError(entity, "itemFetcher");
1577
- },
1578
- itemUpdater: (entity) => {
1579
- throw new ChimeraQueryNotSpecifiedError(entity, "itemUpdater");
1580
- },
1581
- trustQuery: true,
1582
- updateDebounceTimeout: 0
1583
- },
1584
- entities: {}
1585
- };
1586
-
1587
1381
  //#endregion
1588
1382
  //#region src/store/ChimeraEntityRepository.ts
1589
1383
  var ChimeraEntityRepository = class extends ChimeraEventEmitter {
@@ -1878,5 +1672,5 @@ var ChimeraStore = class extends ChimeraEventEmitter {
1878
1672
  };
1879
1673
 
1880
1674
  //#endregion
1881
- export { ChimeraFilterOperatorNotFoundError as C, ChimeraFilterOperatorError as S, ChimeraInternalError as T, chimeraCreateConjunction as _, ChimeraQueryError as a, isFilterSubset as b, ChimeraQueryTrustError as c, ChimeraQueryFetchingState as d, chimeraCreateOrderBy as f, ChimeraOrderTypeError as g, ChimeraOrderTypeComparisonError as h, ChimeraCollectionQuery as i, ChimeraQueryTrustFetchedCollectionError as l, ChimeraOrderError as m, ChimeraWeakValueMap as n, ChimeraQueryIdMismatchError as o, ChimeraOrderNulls as p, ChimeraItemQuery as r, ChimeraQueryNotSpecifiedError as s, ChimeraStore as t, ChimeraQueryTrustIdMismatchError as u, chimeraCreateNot as v, ChimeraError as w, ChimeraFilterError as x, chimeraCreateOperator as y };
1882
- //# sourceMappingURL=src-Bx-gbHfm.js.map
1675
+ export { ChimeraQueryFetchingState as a, chimeraCreateConjunction as c, isFilterSubset as d, ChimeraFilterError as f, ChimeraCollectionQuery as i, chimeraCreateNot as l, ChimeraFilterOperatorNotFoundError as m, ChimeraWeakValueMap as n, chimeraCreateOrderBy as o, ChimeraFilterOperatorError as p, ChimeraItemQuery as r, ChimeraOrderNulls as s, ChimeraStore as t, chimeraCreateOperator as u };
1676
+ //# sourceMappingURL=src-BTo-wGWx.js.map