json-fs-query 3.1.3 → 3.2.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.
Files changed (109) hide show
  1. package/browser/jsonFsQuery.js +2172 -5301
  2. package/browser/jsonFsQuery.min.js +1 -1
  3. package/dist/data/introspect/create.js +7 -22
  4. package/dist/data/introspect/create.min.js +1 -1
  5. package/dist/data/introspect/drop.js +5 -15
  6. package/dist/data/introspect/drop.min.js +1 -1
  7. package/dist/data/introspect/policies/foreignKeyExists.d.ts +2 -0
  8. package/dist/data/introspect/policies/foreignKeyExists.js +9 -3
  9. package/dist/data/introspect/policies/foreignKeyExists.min.js +1 -1
  10. package/dist/data/introspect/policies/hasDependents.d.ts +3 -3
  11. package/dist/data/introspect/policies/hasDependents.js +11 -3
  12. package/dist/data/introspect/policies/hasDependents.min.js +1 -1
  13. package/dist/data/introspect/policies/keyUnique.d.ts +3 -0
  14. package/dist/data/introspect/policies/keyUnique.js +10 -0
  15. package/dist/data/introspect/policies/keyUnique.min.js +1 -1
  16. package/dist/data/queries/deleteEntity.js +29 -18
  17. package/dist/data/queries/deleteEntity.min.js +1 -1
  18. package/dist/data/queries/insertEntity.js +6 -8
  19. package/dist/data/queries/insertEntity.min.js +1 -1
  20. package/dist/data/queries/joinEntity.d.ts +15 -0
  21. package/dist/data/queries/joinEntity.js +91 -15
  22. package/dist/data/queries/joinEntity.min.js +1 -1
  23. package/dist/data/queries/updateEntity.js +15 -10
  24. package/dist/data/queries/updateEntity.min.js +1 -1
  25. package/dist/data/storage/fileExists.d.ts +6 -0
  26. package/dist/data/storage/fileExists.js +18 -0
  27. package/dist/data/storage/fileExists.min.js +1 -0
  28. package/dist/data/storage/index.d.ts +16 -0
  29. package/dist/data/storage/index.js +61 -0
  30. package/dist/data/storage/index.min.js +1 -0
  31. package/dist/data/storage/makeDirectory.d.ts +6 -0
  32. package/dist/data/storage/makeDirectory.js +18 -0
  33. package/dist/data/storage/makeDirectory.min.js +1 -0
  34. package/dist/data/storage/nodeFiles.d.ts +6 -0
  35. package/dist/data/storage/nodeFiles.js +12 -0
  36. package/dist/data/storage/nodeFiles.min.js +1 -0
  37. package/dist/data/storage/readCache.d.ts +37 -0
  38. package/dist/data/storage/readCache.js +117 -0
  39. package/dist/data/storage/readCache.min.js +1 -0
  40. package/dist/data/storage/readJson.d.ts +8 -0
  41. package/dist/data/storage/readJson.js +25 -0
  42. package/dist/data/storage/readJson.min.js +1 -0
  43. package/dist/data/storage/removeDirectory.d.ts +6 -0
  44. package/dist/data/storage/removeDirectory.js +24 -0
  45. package/dist/data/storage/removeDirectory.min.js +1 -0
  46. package/dist/data/storage/removeFile.d.ts +7 -0
  47. package/dist/data/storage/removeFile.js +22 -0
  48. package/dist/data/storage/removeFile.min.js +1 -0
  49. package/dist/data/storage/storagePath.d.ts +11 -0
  50. package/dist/data/storage/storagePath.js +25 -0
  51. package/dist/data/storage/storagePath.min.js +1 -0
  52. package/dist/data/storage/writeJson.d.ts +8 -0
  53. package/dist/data/storage/writeJson.js +23 -0
  54. package/dist/data/storage/writeJson.min.js +1 -0
  55. package/dist/data/utilities/compareAs.d.ts +1 -0
  56. package/dist/data/utilities/compareAs.js +2 -2
  57. package/dist/data/utilities/compareAs.min.js +1 -1
  58. package/dist/data/utilities/databaseLock.d.ts +2 -0
  59. package/dist/data/utilities/databaseLock.js +5 -2
  60. package/dist/data/utilities/databaseLock.min.js +1 -1
  61. package/dist/data/utilities/deregisterRecord.js +4 -10
  62. package/dist/data/utilities/deregisterRecord.min.js +1 -1
  63. package/dist/data/utilities/indexHas.d.ts +13 -0
  64. package/dist/data/utilities/indexHas.js +48 -0
  65. package/dist/data/utilities/indexHas.min.js +1 -0
  66. package/dist/data/utilities/joinBases.d.ts +29 -0
  67. package/dist/data/utilities/joinBases.js +136 -0
  68. package/dist/data/utilities/joinBases.min.js +1 -0
  69. package/dist/data/utilities/joinKey.d.ts +17 -0
  70. package/dist/data/utilities/joinKey.js +31 -0
  71. package/dist/data/utilities/joinKey.min.js +1 -0
  72. package/dist/data/utilities/keyIndexFiles.d.ts +16 -0
  73. package/dist/data/utilities/keyIndexFiles.js +60 -0
  74. package/dist/data/utilities/keyIndexFiles.min.js +1 -0
  75. package/dist/data/utilities/recordExists.js +2 -7
  76. package/dist/data/utilities/recordExists.min.js +1 -1
  77. package/dist/data/utilities/registerRecord.js +4 -10
  78. package/dist/data/utilities/registerRecord.min.js +1 -1
  79. package/dist/data/utilities/removeFromIndex.js +4 -10
  80. package/dist/data/utilities/removeFromIndex.min.js +1 -1
  81. package/dist/data/utilities/retrieveFile.d.ts +5 -0
  82. package/dist/data/utilities/retrieveFile.js +7 -16
  83. package/dist/data/utilities/retrieveFile.min.js +1 -1
  84. package/dist/data/utilities/rowLookup.d.ts +38 -0
  85. package/dist/data/utilities/rowLookup.js +99 -0
  86. package/dist/data/utilities/rowLookup.min.js +1 -0
  87. package/dist/data/utilities/runQuery.js +1 -2
  88. package/dist/data/utilities/runQuery.min.js +1 -1
  89. package/dist/data/utilities/semiJoin.d.ts +27 -0
  90. package/dist/data/utilities/semiJoin.js +97 -0
  91. package/dist/data/utilities/semiJoin.min.js +1 -0
  92. package/dist/data/utilities/updateIndex.js +5 -14
  93. package/dist/data/utilities/updateIndex.min.js +1 -1
  94. package/package.json +4 -2
  95. package/dist/data/utilities/getJoinIndexedList.d.ts +0 -3
  96. package/dist/data/utilities/getJoinIndexedList.js +0 -76
  97. package/dist/data/utilities/getJoinIndexedList.min.js +0 -1
  98. package/dist/data/utilities/getMatchingIndexes.d.ts +0 -2
  99. package/dist/data/utilities/getMatchingIndexes.js +0 -28
  100. package/dist/data/utilities/getMatchingIndexes.min.js +0 -1
  101. package/dist/data/utilities/matchIndexedJoins.d.ts +0 -2
  102. package/dist/data/utilities/matchIndexedJoins.js +0 -63
  103. package/dist/data/utilities/matchIndexedJoins.min.js +0 -1
  104. package/dist/data/utilities/restrictIndexedList.d.ts +0 -2
  105. package/dist/data/utilities/restrictIndexedList.js +0 -45
  106. package/dist/data/utilities/restrictIndexedList.min.js +0 -1
  107. package/dist/data/utilities/useJoinClause.d.ts +0 -6
  108. package/dist/data/utilities/useJoinClause.js +0 -57
  109. package/dist/data/utilities/useJoinClause.min.js +0 -1
@@ -1,2 +0,0 @@
1
- export declare const restrictIndexedList: (joinClause: any, filterJoins: any, indexedClone: any) => any;
2
- //# sourceMappingURL=restrictIndexedList.d.ts.map
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.restrictIndexedList = void 0;
7
- var _splitEntityProperty = require("./parsers/splitEntityProperty");
8
- const restrictIndexedList = (joinClause, filterJoins, indexedClone) => {
9
- const {
10
- entity: entityA,
11
- property: propertyA
12
- } = (0, _splitEntityProperty.splitEntityProperty)(joinClause.propertyA);
13
- const {
14
- entity: entityB,
15
- property: propertyB
16
- } = (0, _splitEntityProperty.splitEntityProperty)(joinClause.propertyB);
17
- if (Object.prototype.hasOwnProperty.call(filterJoins, entityA)) {
18
- const existingEntities = filterJoins[entityA];
19
- if (!Object.prototype.hasOwnProperty.call(indexedClone, entityA)) {
20
- indexedClone[entityA] = {};
21
- }
22
- if (!Object.prototype.hasOwnProperty.call(indexedClone[entityA], propertyA)) {
23
- indexedClone[entityA][propertyA] = {};
24
- }
25
- indexedClone[entityA][propertyA] = [{
26
- value: existingEntities[0][propertyA],
27
- record: existingEntities
28
- }];
29
- }
30
- if (Object.prototype.hasOwnProperty.call(filterJoins, entityB)) {
31
- const existingEntities = filterJoins[entityB];
32
- if (!Object.prototype.hasOwnProperty.call(indexedClone, entityB)) {
33
- indexedClone[entityB] = {};
34
- }
35
- if (!Object.prototype.hasOwnProperty.call(indexedClone[entityB], propertyB)) {
36
- indexedClone[entityB][propertyB] = {};
37
- }
38
- indexedClone[entityB][propertyB] = [{
39
- value: existingEntities[0][propertyB],
40
- record: existingEntities
41
- }];
42
- }
43
- return indexedClone;
44
- };
45
- exports.restrictIndexedList = restrictIndexedList;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.restrictIndexedList=void 0;var _splitEntityProperty=require("./parsers/splitEntityProperty");const restrictIndexedList=(t,r,e)=>{const{entity:p,property:o}=(0,_splitEntityProperty.splitEntityProperty)(t.propertyA),{entity:s,property:y}=(0,_splitEntityProperty.splitEntityProperty)(t.propertyB);if(Object.prototype.hasOwnProperty.call(r,p)){const t=r[p];Object.prototype.hasOwnProperty.call(e,p)||(e[p]={}),Object.prototype.hasOwnProperty.call(e[p],o)||(e[p][o]={}),e[p][o]=[{value:t[0][o],record:t}]}if(Object.prototype.hasOwnProperty.call(r,s)){const t=r[s];Object.prototype.hasOwnProperty.call(e,s)||(e[s]={}),Object.prototype.hasOwnProperty.call(e[s],y)||(e[s][y]={}),e[s][y]=[{value:t[0][y],record:t}]}return e};exports.restrictIndexedList=restrictIndexedList;
@@ -1,6 +0,0 @@
1
- export declare const useJoinClause: ({ propertyA, comparator, propertyB }?: {
2
- propertyA?: any;
3
- comparator?: string;
4
- propertyB?: any;
5
- }, dataSets?: {}, filterJoins?: {}) => Promise<{}>;
6
- //# sourceMappingURL=useJoinClause.d.ts.map
@@ -1,57 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useJoinClause = void 0;
7
- require("core-js/modules/esnext.iterator.constructor.js");
8
- require("core-js/modules/esnext.iterator.reduce.js");
9
- var _readEntity = require("../queries/readEntity");
10
- var _where = require("../queries/where");
11
- var _splitEntityProperty = require("./parsers/splitEntityProperty");
12
- var _siFunciona = _interopRequireDefault(require("si-funciona"));
13
- var _retrieveRecord = require("./retrieveRecord");
14
- var _fieldType = require("./fieldType");
15
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
- const useJoinClause = async ({
17
- propertyA = null,
18
- comparator = '=',
19
- propertyB = null
20
- } = {}, dataSets = {}, filterJoins = {}) => {
21
- const {
22
- entity: entityA,
23
- property: propA
24
- } = (0, _splitEntityProperty.splitEntityProperty)(propertyA);
25
- const {
26
- entity: entityB,
27
- property: propB
28
- } = (0, _splitEntityProperty.splitEntityProperty)(propertyB);
29
- if (!Object.prototype.hasOwnProperty.call(dataSets, entityA)) {
30
- dataSets = await (0, _readEntity.readEntity)(entityA, dataSets);
31
- }
32
- if (!Object.prototype.hasOwnProperty.call(dataSets, entityB)) {
33
- dataSets = await (0, _readEntity.readEntity)(entityB, dataSets);
34
- }
35
- if (!Object.prototype.hasOwnProperty.call(filterJoins, entityA)) {
36
- filterJoins[entityA] = _siFunciona.default.cloneObject(dataSets[entityA]);
37
- }
38
- if (!Object.prototype.hasOwnProperty.call(filterJoins, entityB)) {
39
- filterJoins[entityB] = _siFunciona.default.cloneObject(dataSets[entityB]);
40
- }
41
- const typeA = (0, _fieldType.fieldType)(await (0, _retrieveRecord.retrieveRecord)(entityA), propA);
42
- const typeB = (0, _fieldType.fieldType)(await (0, _retrieveRecord.retrieveRecord)(entityB), propB);
43
- filterJoins[entityA] = filterJoins[entityB].reduce((dataA, dataB) => _siFunciona.default.mergeArrays(dataA, (0, _where.where)(filterJoins[entityA], {
44
- property: propA,
45
- comparator,
46
- value: dataB[propB],
47
- type: typeA
48
- })), []);
49
- filterJoins[entityB] = filterJoins[entityA].reduce((dataB, dataA) => _siFunciona.default.mergeArrays(dataB, (0, _where.where)(filterJoins[entityB], {
50
- property: propB,
51
- comparator,
52
- value: dataA[propA],
53
- type: typeB
54
- })), []);
55
- return filterJoins;
56
- };
57
- exports.useJoinClause = useJoinClause;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useJoinClause=void 0,require("core-js/modules/esnext.iterator.constructor.js"),require("core-js/modules/esnext.iterator.reduce.js");var _readEntity=require("../queries/readEntity"),_where=require("../queries/where"),_splitEntityProperty=require("./parsers/splitEntityProperty"),_siFunciona=_interopRequireDefault(require("si-funciona")),_retrieveRecord=require("./retrieveRecord"),_fieldType=require("./fieldType");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const useJoinClause=async({propertyA:e=null,comparator:r="=",propertyB:t=null}={},i={},o={})=>{const{entity:a,property:p}=(0,_splitEntityProperty.splitEntityProperty)(e),{entity:n,property:s}=(0,_splitEntityProperty.splitEntityProperty)(t);Object.prototype.hasOwnProperty.call(i,a)||(i=await(0,_readEntity.readEntity)(a,i)),Object.prototype.hasOwnProperty.call(i,n)||(i=await(0,_readEntity.readEntity)(n,i)),Object.prototype.hasOwnProperty.call(o,a)||(o[a]=_siFunciona.default.cloneObject(i[a])),Object.prototype.hasOwnProperty.call(o,n)||(o[n]=_siFunciona.default.cloneObject(i[n]));const u=(0,_fieldType.fieldType)(await(0,_retrieveRecord.retrieveRecord)(a),p),y=(0,_fieldType.fieldType)(await(0,_retrieveRecord.retrieveRecord)(n),s);return o[a]=o[n].reduce(((e,t)=>_siFunciona.default.mergeArrays(e,(0,_where.where)(o[a],{property:p,comparator:r,value:t[s],type:u}))),[]),o[n]=o[a].reduce(((e,t)=>_siFunciona.default.mergeArrays(e,(0,_where.where)(o[n],{property:s,comparator:r,value:t[p],type:y}))),[]),o};exports.useJoinClause=useJoinClause;