over-zero 0.0.0 → 0.0.2

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 (204) hide show
  1. package/dist/cjs/createPermissions.cjs +43 -57
  2. package/dist/cjs/createPermissions.js +46 -48
  3. package/dist/cjs/createPermissions.js.map +2 -2
  4. package/dist/cjs/createPermissions.native.js +46 -53
  5. package/dist/cjs/createPermissions.native.js.map +2 -2
  6. package/dist/cjs/createZero.cjs +128 -0
  7. package/dist/cjs/createZero.js +107 -0
  8. package/dist/cjs/createZero.js.map +6 -0
  9. package/dist/cjs/createZero.native.js +115 -0
  10. package/dist/cjs/createZero.native.js.map +6 -0
  11. package/dist/cjs/createZeroClient.cjs +128 -0
  12. package/dist/cjs/createZeroClient.js +103 -0
  13. package/dist/cjs/createZeroClient.js.map +6 -0
  14. package/dist/cjs/createZeroClient.native.js +115 -0
  15. package/dist/cjs/createZeroClient.native.js.map +6 -0
  16. package/dist/cjs/createZeroServer.cjs +131 -0
  17. package/dist/cjs/createZeroServer.js +108 -0
  18. package/dist/cjs/createZeroServer.js.map +6 -0
  19. package/dist/cjs/createZeroServer.native.js +107 -0
  20. package/dist/cjs/createZeroServer.native.js.map +6 -0
  21. package/dist/cjs/helpers/context.js.map +1 -1
  22. package/dist/cjs/helpers/context.native.js.map +1 -1
  23. package/dist/cjs/helpers/createMutators.cjs +11 -11
  24. package/dist/cjs/helpers/createMutators.js +9 -7
  25. package/dist/cjs/helpers/createMutators.js.map +1 -1
  26. package/dist/cjs/helpers/createMutators.native.js +8 -6
  27. package/dist/cjs/helpers/createMutators.native.js.map +1 -1
  28. package/dist/cjs/helpers/ensureLoggedIn.cjs +1 -1
  29. package/dist/cjs/helpers/ensureLoggedIn.js +1 -1
  30. package/dist/cjs/helpers/ensureLoggedIn.js.map +1 -1
  31. package/dist/cjs/helpers/ensureLoggedIn.native.js +1 -1
  32. package/dist/cjs/helpers/ensureLoggedIn.native.js.map +1 -1
  33. package/dist/cjs/helpers/getAuthData.cjs +0 -36
  34. package/dist/cjs/helpers/getAuthData.js +0 -28
  35. package/dist/cjs/helpers/getAuthData.js.map +2 -2
  36. package/dist/cjs/helpers/getAuthData.native.js +0 -31
  37. package/dist/cjs/helpers/getAuthData.native.js.map +2 -2
  38. package/dist/cjs/helpers/useAuthData.cjs +0 -32
  39. package/dist/cjs/helpers/useAuthData.js +0 -24
  40. package/dist/cjs/helpers/useAuthData.js.map +2 -2
  41. package/dist/cjs/helpers/useAuthData.native.js +0 -31
  42. package/dist/cjs/helpers/useAuthData.native.js.map +2 -2
  43. package/dist/cjs/helpers/useZeroDebug.cjs +68 -0
  44. package/dist/cjs/helpers/useZeroDebug.js +49 -0
  45. package/dist/cjs/helpers/useZeroDebug.js.map +6 -0
  46. package/dist/cjs/helpers/useZeroDebug.native.js +66 -0
  47. package/dist/cjs/helpers/useZeroDebug.native.js.map +6 -0
  48. package/dist/cjs/helpers/zeroEmitter.cjs +2 -2
  49. package/dist/cjs/helpers/zeroEmitter.js +2 -2
  50. package/dist/cjs/helpers/zeroEmitter.native.js +1 -1
  51. package/dist/cjs/helpers/zeroEmitter.native.js.map +1 -1
  52. package/dist/cjs/index.cjs +3 -1
  53. package/dist/cjs/index.js +3 -1
  54. package/dist/cjs/index.js.map +1 -1
  55. package/dist/cjs/index.native.js +6 -2
  56. package/dist/cjs/index.native.js.map +1 -1
  57. package/dist/cjs/mutations.cjs +50 -0
  58. package/dist/cjs/mutations.js +43 -0
  59. package/dist/cjs/mutations.js.map +6 -0
  60. package/dist/cjs/mutations.native.js +50 -0
  61. package/dist/cjs/mutations.native.js.map +6 -0
  62. package/dist/cjs/server.cjs +18 -0
  63. package/dist/cjs/server.js +15 -0
  64. package/dist/cjs/server.js.map +6 -0
  65. package/dist/cjs/server.native.js +20 -0
  66. package/dist/cjs/server.native.js.map +6 -0
  67. package/dist/cjs/where.cjs +33 -0
  68. package/dist/cjs/where.js +28 -0
  69. package/dist/cjs/where.js.map +6 -0
  70. package/dist/cjs/where.native.js +34 -0
  71. package/dist/cjs/where.native.js.map +6 -0
  72. package/dist/esm/createPermissions.js +48 -47
  73. package/dist/esm/createPermissions.js.map +2 -2
  74. package/dist/esm/createPermissions.mjs +41 -55
  75. package/dist/esm/createPermissions.mjs.map +1 -1
  76. package/dist/esm/createPermissions.native.js +55 -69
  77. package/dist/esm/createPermissions.native.js.map +1 -1
  78. package/dist/esm/createZero.js +99 -0
  79. package/dist/esm/createZero.js.map +6 -0
  80. package/dist/esm/createZero.mjs +105 -0
  81. package/dist/esm/createZero.mjs.map +1 -0
  82. package/dist/esm/createZero.native.js +119 -0
  83. package/dist/esm/createZero.native.js.map +1 -0
  84. package/dist/esm/createZeroClient.js +95 -0
  85. package/dist/esm/createZeroClient.js.map +6 -0
  86. package/dist/esm/createZeroClient.mjs +105 -0
  87. package/dist/esm/createZeroClient.mjs.map +1 -0
  88. package/dist/esm/createZeroClient.native.js +119 -0
  89. package/dist/esm/createZeroClient.native.js.map +1 -0
  90. package/dist/esm/createZeroServer.js +90 -0
  91. package/dist/esm/createZeroServer.js.map +6 -0
  92. package/dist/esm/createZeroServer.mjs +97 -0
  93. package/dist/esm/createZeroServer.mjs.map +1 -0
  94. package/dist/esm/createZeroServer.native.js +104 -0
  95. package/dist/esm/createZeroServer.native.js.map +1 -0
  96. package/dist/esm/helpers/context.js.map +1 -1
  97. package/dist/esm/helpers/context.mjs.map +1 -1
  98. package/dist/esm/helpers/context.native.js.map +1 -1
  99. package/dist/esm/helpers/createMutators.js +6 -7
  100. package/dist/esm/helpers/createMutators.js.map +1 -1
  101. package/dist/esm/helpers/createMutators.mjs +7 -7
  102. package/dist/esm/helpers/createMutators.mjs.map +1 -1
  103. package/dist/esm/helpers/createMutators.native.js +9 -7
  104. package/dist/esm/helpers/createMutators.native.js.map +1 -1
  105. package/dist/esm/helpers/ensureLoggedIn.js +1 -1
  106. package/dist/esm/helpers/ensureLoggedIn.js.map +1 -1
  107. package/dist/esm/helpers/ensureLoggedIn.mjs +1 -1
  108. package/dist/esm/helpers/ensureLoggedIn.mjs.map +1 -1
  109. package/dist/esm/helpers/ensureLoggedIn.native.js +1 -1
  110. package/dist/esm/helpers/ensureLoggedIn.native.js.map +1 -1
  111. package/dist/esm/helpers/getAuthData.js +0 -12
  112. package/dist/esm/helpers/getAuthData.js.map +2 -2
  113. package/dist/esm/helpers/getAuthData.mjs +1 -12
  114. package/dist/esm/helpers/getAuthData.mjs.map +1 -1
  115. package/dist/esm/helpers/getAuthData.native.js +1 -12
  116. package/dist/esm/helpers/getAuthData.native.js.map +1 -1
  117. package/dist/esm/helpers/useAuthData.js +0 -10
  118. package/dist/esm/helpers/useAuthData.js.map +2 -2
  119. package/dist/esm/helpers/useAuthData.mjs +1 -8
  120. package/dist/esm/helpers/useAuthData.mjs.map +1 -1
  121. package/dist/esm/helpers/useAuthData.native.js +1 -12
  122. package/dist/esm/helpers/useAuthData.native.js.map +1 -1
  123. package/dist/esm/helpers/useZeroDebug.js +35 -0
  124. package/dist/esm/helpers/useZeroDebug.js.map +6 -0
  125. package/dist/esm/helpers/useZeroDebug.mjs +45 -0
  126. package/dist/esm/helpers/useZeroDebug.mjs.map +1 -0
  127. package/dist/esm/helpers/useZeroDebug.native.js +53 -0
  128. package/dist/esm/helpers/useZeroDebug.native.js.map +1 -0
  129. package/dist/esm/helpers/zeroEmitter.js +1 -1
  130. package/dist/esm/helpers/zeroEmitter.mjs +1 -1
  131. package/dist/esm/helpers/zeroEmitter.native.js +1 -1
  132. package/dist/esm/index.js +3 -1
  133. package/dist/esm/index.js.map +1 -1
  134. package/dist/esm/index.mjs +3 -1
  135. package/dist/esm/index.mjs.map +1 -1
  136. package/dist/esm/index.native.js +3 -1
  137. package/dist/esm/index.native.js.map +1 -1
  138. package/dist/esm/mutations.js +27 -0
  139. package/dist/esm/mutations.js.map +6 -0
  140. package/dist/esm/mutations.mjs +27 -0
  141. package/dist/esm/mutations.mjs.map +1 -0
  142. package/dist/esm/mutations.native.js +29 -0
  143. package/dist/esm/mutations.native.js.map +1 -0
  144. package/dist/esm/server.js +2 -0
  145. package/dist/esm/server.js.map +6 -0
  146. package/dist/esm/server.mjs +2 -0
  147. package/dist/esm/server.mjs.map +1 -0
  148. package/dist/esm/server.native.js +2 -0
  149. package/dist/esm/server.native.js.map +1 -0
  150. package/dist/esm/where.js +12 -0
  151. package/dist/esm/where.js.map +6 -0
  152. package/dist/esm/where.mjs +9 -0
  153. package/dist/esm/where.mjs.map +1 -0
  154. package/dist/esm/where.native.js +9 -0
  155. package/dist/esm/where.native.js.map +1 -0
  156. package/package.json +12 -6
  157. package/src/createPermissions.ts +17 -77
  158. package/src/createZeroClient.tsx +29 -26
  159. package/src/createZeroServer.ts +43 -43
  160. package/src/helpers/createMutators.ts +19 -29
  161. package/src/helpers/ensureLoggedIn.ts +2 -1
  162. package/src/helpers/prettyFormatZeroQuery.ts +1 -1
  163. package/src/helpers/useZeroDebug.ts +1 -0
  164. package/src/index.ts +1 -5
  165. package/src/mutations.ts +20 -7
  166. package/src/server.ts +1 -0
  167. package/src/types.ts +74 -7
  168. package/src/where.ts +28 -0
  169. package/src/helpers/clearZeroDatabase.ts +0 -68
  170. package/src/helpers/getAuthData.tsx +0 -12
  171. package/src/helpers/useAuthData.ts +0 -13
  172. package/src/helpers/zeroEmitter.ts +0 -5
  173. package/types/createMutations.d.ts +0 -20
  174. package/types/createMutations.d.ts.map +0 -1
  175. package/types/createPermissions.d.ts +0 -37
  176. package/types/createPermissions.d.ts.map +0 -1
  177. package/types/createZeroClient.d.ts +0 -45
  178. package/types/createZeroClient.d.ts.map +0 -1
  179. package/types/createZeroServer.d.ts +0 -61
  180. package/types/createZeroServer.d.ts.map +0 -1
  181. package/types/helpers/batchQuery.d.ts +0 -7
  182. package/types/helpers/batchQuery.d.ts.map +0 -1
  183. package/types/helpers/clearZeroDatabase.d.ts +0 -2
  184. package/types/helpers/clearZeroDatabase.d.ts.map +0 -1
  185. package/types/helpers/context.d.ts +0 -5
  186. package/types/helpers/context.d.ts.map +0 -1
  187. package/types/helpers/createMutators.d.ts +0 -16
  188. package/types/helpers/createMutators.d.ts.map +0 -1
  189. package/types/helpers/ensureLoggedIn.d.ts +0 -2
  190. package/types/helpers/ensureLoggedIn.d.ts.map +0 -1
  191. package/types/helpers/getAuthData.d.ts +0 -1
  192. package/types/helpers/getAuthData.d.ts.map +0 -1
  193. package/types/helpers/prettyFormatZeroQuery.d.ts +0 -3
  194. package/types/helpers/prettyFormatZeroQuery.d.ts.map +0 -1
  195. package/types/helpers/useAuthData.d.ts +0 -1
  196. package/types/helpers/useAuthData.d.ts.map +0 -1
  197. package/types/helpers/useZeroDebug.d.ts +0 -3
  198. package/types/helpers/useZeroDebug.d.ts.map +0 -1
  199. package/types/helpers/zeroEmitter.d.ts +0 -2
  200. package/types/helpers/zeroEmitter.d.ts.map +0 -1
  201. package/types/index.d.ts +0 -9
  202. package/types/index.d.ts.map +0 -1
  203. package/types/types.d.ts +0 -21
  204. package/types/types.d.ts.map +0 -1
@@ -1,36 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
- get: () => from[key],
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
- });
16
- return to;
17
- };
18
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
20
- }), mod);
21
- var getAuthData_exports = {};
22
- __export(getAuthData_exports, {
23
- getAuthData: () => getAuthData
24
- });
25
- module.exports = __toCommonJS(getAuthData_exports);
26
- var import_authClient = require("~/auth/client/authClient");
27
- const getAuthData = () => {
28
- const {
29
- user
30
- } = (0, import_authClient.getAuth)();
31
- return user ? {
32
- id: user.id || "anon",
33
- email: user.email,
34
- role: void 0
35
- } : null;
36
- };
@@ -1,29 +1 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: !0 });
8
- }, __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from == "object" || typeof from == "function")
10
- for (let key of __getOwnPropNames(from))
11
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
- var getAuthData_exports = {};
16
- __export(getAuthData_exports, {
17
- getAuthData: () => getAuthData
18
- });
19
- module.exports = __toCommonJS(getAuthData_exports);
20
- var import_authClient = require("~/auth/client/authClient");
21
- const getAuthData = () => {
22
- const { user } = (0, import_authClient.getAuth)();
23
- return user ? {
24
- id: user.id || "anon",
25
- email: user.email,
26
- role: void 0
27
- } : null;
28
- };
29
1
  //# sourceMappingURL=getAuthData.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/helpers/getAuthData.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAwB;AAEjB,MAAM,cAAc,MAAM;AAC/B,QAAM,EAAE,KAAK,QAAI,2BAAQ;AACzB,SAAO,OACH;AAAA,IACE,IAAI,KAAK,MAAM;AAAA,IACf,OAAO,KAAK;AAAA,IACZ,MAAM;AAAA,EACR,IACA;AACN;",
3
+ "sources": [],
4
+ "mappings": "",
5
5
  "names": []
6
6
  }
@@ -1,33 +1,2 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
- var getAuthData_exports = {};
17
- __export(getAuthData_exports, {
18
- getAuthData: () => getAuthData
19
- });
20
- module.exports = __toCommonJS(getAuthData_exports);
21
- var import_authClient = require("~/auth/client/authClient"), getAuthData = function() {
22
- var { user } = (0, import_authClient.getAuth)();
23
- return user ? {
24
- id: user.id || "anon",
25
- email: user.email,
26
- role: void 0
27
- } : null;
28
- };
29
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- getAuthData
32
- });
33
2
  //# sourceMappingURL=getAuthData.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/helpers/getAuthData.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAwB,qCACb,cAAc,WAAW;AAChC,MAAI,EAAE,KAAK,QAAI,2BAAQ;AACvB,SAAO,OAAO;AAAA,IACV,IAAI,KAAK,MAAM;AAAA,IACf,OAAO,KAAK;AAAA,IACZ,MAAM;AAAA,EACV,IAAI;AACR;",
3
+ "sources": [],
4
+ "mappings": "",
5
5
  "names": []
6
6
  }
@@ -1,32 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
- get: () => from[key],
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
- });
16
- return to;
17
- };
18
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
20
- }), mod);
21
- var useAuthData_exports = {};
22
- __export(useAuthData_exports, {
23
- useAuthData: () => useAuthData
24
- });
25
- module.exports = __toCommonJS(useAuthData_exports);
26
- var import_react = require("react"),
27
- import_authClient = require("~/auth/client/authClient"),
28
- import_getAuthData = require("./getAuthData.cjs");
29
- const useAuthData = () => {
30
- const userId = (0, import_authClient.useAuth)()?.user?.id || "anon";
31
- return (0, import_react.useMemo)(() => (0, import_getAuthData.getAuthData)(), [userId]);
32
- };
@@ -1,25 +1 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: !0 });
8
- }, __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from == "object" || typeof from == "function")
10
- for (let key of __getOwnPropNames(from))
11
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
- var useAuthData_exports = {};
16
- __export(useAuthData_exports, {
17
- useAuthData: () => useAuthData
18
- });
19
- module.exports = __toCommonJS(useAuthData_exports);
20
- var import_react = require("react"), import_authClient = require("~/auth/client/authClient"), import_getAuthData = require("./getAuthData");
21
- const useAuthData = () => {
22
- const userId = (0, import_authClient.useAuth)()?.user?.id || "anon";
23
- return (0, import_react.useMemo)(() => (0, import_getAuthData.getAuthData)(), [userId]);
24
- };
25
1
  //# sourceMappingURL=useAuthData.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/helpers/useAuthData.ts"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwB,kBACxB,oBAAwB,qCACxB,qBAA4B;AAErB,MAAM,cAAc,MAAM;AAE/B,QAAM,aADO,2BAAQ,GACA,MAAM,MAAM;AAGjC,aAAO,sBAAQ,UACN,gCAAY,GAClB,CAAC,MAAM,CAAC;AACb;",
3
+ "sources": [],
4
+ "mappings": "",
5
5
  "names": []
6
6
  }
@@ -1,33 +1,2 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
- var useAuthData_exports = {};
17
- __export(useAuthData_exports, {
18
- useAuthData: () => useAuthData
19
- });
20
- module.exports = __toCommonJS(useAuthData_exports);
21
- var import_react = require("react"), import_authClient = require("~/auth/client/authClient"), import_getAuthData = require("./getAuthData"), useAuthData = function() {
22
- var _auth_user, auth = (0, import_authClient.useAuth)(), userId = (auth == null || (_auth_user = auth.user) === null || _auth_user === void 0 ? void 0 : _auth_user.id) || "anon";
23
- return (0, import_react.useMemo)(function() {
24
- return (0, import_getAuthData.getAuthData)();
25
- }, [
26
- userId
27
- ]);
28
- };
29
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- useAuthData
32
- });
33
2
  //# sourceMappingURL=useAuthData.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/helpers/useAuthData.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwB,kBACxB,oBAAwB,qCACxB,qBAA4B,0BACjB,cAAc,WAAW;AAChC,MAAI,YACA,WAAO,2BAAQ,GACf,UAAU,QAAS,SAAoC,aAAa,KAAK,UAAU,QAAQ,eAAe,SAA7D,SAA+E,WAAW,OAAO;AAElJ,aAAO,sBAAQ,WAAW;AACtB,eAAO,gCAAY;AAAA,EACvB,GAAG;AAAA,IACC;AAAA,EACJ,CAAC;AACL;",
3
+ "sources": [],
4
+ "mappings": "",
5
5
  "names": []
6
6
  }
@@ -0,0 +1,68 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var useZeroDebug_exports = {};
22
+ __export(useZeroDebug_exports, {
23
+ useZeroDebug: () => useZeroDebug
24
+ });
25
+ module.exports = __toCommonJS(useZeroDebug_exports);
26
+ var import_helpers = require("@vxrn/helpers"),
27
+ import_react = require("react"),
28
+ import_prettyFormatZeroQuery = require("./prettyFormatZeroQuery.cjs");
29
+ const activeQueries = /* @__PURE__ */new Map(),
30
+ astHistoryByComponent = /* @__PURE__ */new Map(),
31
+ filterLogs = table => !1,
32
+ COLLAPSED = !0,
33
+ AST_CHANGE_THRESHOLD = 4,
34
+ MAX_AST_HISTORY = 10,
35
+ useZeroDebug = (query, options, results) => {
36
+ const astObject = query._completeAst?.(),
37
+ table = astObject.table,
38
+ ast = JSON.stringify(astObject, null, 2),
39
+ enabled = !(!options || options?.enabled === !1) && filterLogs(table),
40
+ isPermissionQuery = new Error().stack?.includes("usePermission.ts"),
41
+ id = (0, import_react.useId)(),
42
+ num = activeQueries.get(ast) || 0,
43
+ shouldLog = enabled && num === 0;
44
+ enabled && (activeQueries.set(ast, num + 1), shouldLog && (COLLAPSED ? (console.groupCollapsed(`${isPermissionQuery ? "\u{1F46E}\u200D\u2642\uFE0F" : "\u2728"}${(0, import_prettyFormatZeroQuery.prettyFormatZeroQuery)(query, "minimal")}`), console.info(id, (0, import_prettyFormatZeroQuery.prettyFormatZeroQuery)(query, "full")), console.info("cached result", results), console.trace(), console.groupEnd()) : console.info("\u2728", (0, import_prettyFormatZeroQuery.prettyFormatZeroQuery)(query, "full")))), (0, import_react.useEffect)(() => {
45
+ if (!enabled) return;
46
+ const history = astHistoryByComponent.get(id) || {
47
+ asts: [],
48
+ changeCount: 0
49
+ },
50
+ currentAst = ast,
51
+ lastAst = history.asts[history.asts.length - 1];
52
+ currentAst !== lastAst && (history.asts.push(currentAst), history.asts.length > MAX_AST_HISTORY && history.asts.shift(), history.changeCount++, astHistoryByComponent.set(id, history), history.changeCount > AST_CHANGE_THRESHOLD && console.warn(`\u26A0\uFE0F AST changed ${history.changeCount} times for component.
53
+ - id: ${id}
54
+ - stack: ${(0, import_helpers.getCurrentComponentStack)("short")}
55
+ - table: ${table}`, {
56
+ componentId: id,
57
+ table,
58
+ changeCount: history.changeCount,
59
+ recentAsts: history.asts
60
+ }));
61
+ }, [id, ast, table, enabled]), (0, import_react.useEffect)(() => {
62
+ if (enabled) return () => {
63
+ activeQueries.set(ast, activeQueries.get(ast) - 1);
64
+ };
65
+ }, [ast, enabled]), (0, import_react.useEffect)(() => () => {
66
+ astHistoryByComponent.delete(id);
67
+ }, [id]);
68
+ };
@@ -0,0 +1,49 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var useZeroDebug_exports = {};
16
+ __export(useZeroDebug_exports, {
17
+ useZeroDebug: () => useZeroDebug
18
+ });
19
+ module.exports = __toCommonJS(useZeroDebug_exports);
20
+ var import_helpers = require("@vxrn/helpers"), import_react = require("react"), import_prettyFormatZeroQuery = require("./prettyFormatZeroQuery");
21
+ const activeQueries = /* @__PURE__ */ new Map(), astHistoryByComponent = /* @__PURE__ */ new Map(), filterLogs = (table) => !1, COLLAPSED = !0, AST_CHANGE_THRESHOLD = 4, MAX_AST_HISTORY = 10, useZeroDebug = (query, options, results) => {
22
+ const astObject = query._completeAst?.(), table = astObject.table, ast = JSON.stringify(astObject, null, 2), enabled = !(!options || options?.enabled === !1) && filterLogs(table), isPermissionQuery = new Error().stack?.includes("usePermission.ts"), id = (0, import_react.useId)(), num = activeQueries.get(ast) || 0, shouldLog = enabled && num === 0;
23
+ enabled && (activeQueries.set(ast, num + 1), shouldLog && (COLLAPSED ? (console.groupCollapsed(
24
+ `${isPermissionQuery ? "\u{1F46E}\u200D\u2642\uFE0F" : "\u2728"}${(0, import_prettyFormatZeroQuery.prettyFormatZeroQuery)(query, "minimal")}`
25
+ ), console.info(id, (0, import_prettyFormatZeroQuery.prettyFormatZeroQuery)(query, "full")), console.info("cached result", results), console.trace(), console.groupEnd()) : console.info("\u2728", (0, import_prettyFormatZeroQuery.prettyFormatZeroQuery)(query, "full")))), (0, import_react.useEffect)(() => {
26
+ if (!enabled) return;
27
+ const history = astHistoryByComponent.get(id) || { asts: [], changeCount: 0 }, currentAst = ast, lastAst = history.asts[history.asts.length - 1];
28
+ currentAst !== lastAst && (history.asts.push(currentAst), history.asts.length > MAX_AST_HISTORY && history.asts.shift(), history.changeCount++, astHistoryByComponent.set(id, history), history.changeCount > AST_CHANGE_THRESHOLD && console.warn(
29
+ `\u26A0\uFE0F AST changed ${history.changeCount} times for component.
30
+ - id: ${id}
31
+ - stack: ${(0, import_helpers.getCurrentComponentStack)("short")}
32
+ - table: ${table}`,
33
+ {
34
+ componentId: id,
35
+ table,
36
+ changeCount: history.changeCount,
37
+ recentAsts: history.asts
38
+ }
39
+ ));
40
+ }, [id, ast, table, enabled]), (0, import_react.useEffect)(() => {
41
+ if (enabled)
42
+ return () => {
43
+ activeQueries.set(ast, activeQueries.get(ast) - 1);
44
+ };
45
+ }, [ast, enabled]), (0, import_react.useEffect)(() => () => {
46
+ astHistoryByComponent.delete(id);
47
+ }, [id]);
48
+ };
49
+ //# sourceMappingURL=useZeroDebug.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/helpers/useZeroDebug.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,qBAAyC,0BACzC,eAAiC,kBACjC,+BAAsC;AAEtC,MAAM,gBAAgB,oBAAI,IAAoB,GAQxC,wBAAwB,oBAAI,IAAwB,GAGpD,aAAa,CAAC,UAA2B,IAEzC,YAAY,IACZ,uBAAuB,GACvB,kBAAkB,IAIX,eAAe,CAAC,OAA6B,SAAc,YAAiB;AAMvF,QAAM,YAAY,MAAM,eAAkB,GACpC,QAAQ,UAAU,OAClB,MAAM,KAAK,UAAU,WAAW,MAAM,CAAC,GAEvC,UAAU,EADM,CAAC,WAAW,SAAS,YAAY,OACrB,WAAW,KAAK,GAE5C,oBADQ,IAAI,MAAM,EAAE,OACO,SAAS,kBAAkB,GACtD,SAAK,oBAAM,GAGX,MAAM,cAAc,IAAI,GAAG,KAAK,GAChC,YAAY,WAAW,QAAQ;AACrC,EAAI,YACF,cAAc,IAAI,KAAK,MAAM,CAAC,GAC1B,cACE,aACF,QAAQ;AAAA,IACN,GAAG,oBAAoB,gCAAU,QAAG,OAAG,oDAAsB,OAAO,SAAS,CAAC;AAAA,EAChF,GACA,QAAQ,KAAK,QAAI,oDAAsB,OAAO,MAAM,CAAC,GACrD,QAAQ,KAAK,iBAAiB,OAAO,GACrC,QAAQ,MAAM,GACd,QAAQ,SAAS,KAEjB,QAAQ,KAAK,cAAK,oDAAsB,OAAO,MAAM,CAAC,SAM5D,wBAAU,MAAM;AACd,QAAI,CAAC,QAAS;AACd,UAAM,UAAU,sBAAsB,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,aAAa,EAAE,GACtE,aAAa,KACb,UAAU,QAAQ,KAAK,QAAQ,KAAK,SAAS,CAAC;AAEpD,IAAI,eAAe,YACjB,QAAQ,KAAK,KAAK,UAAU,GACxB,QAAQ,KAAK,SAAS,mBACxB,QAAQ,KAAK,MAAM,GAErB,QAAQ,eACR,sBAAsB,IAAI,IAAI,OAAO,GAEjC,QAAQ,cAAc,wBACxB,QAAQ;AAAA,MACN,4BAAkB,QAAQ,WAAW;AAAA,gBAC/B,EAAE;AAAA,uBACC,yCAAyB,OAAO,CAAC;AAAA,mBACjC,KAAK;AAAA,MACd;AAAA,QACE,aAAa;AAAA,QACb;AAAA,QACA,aAAa,QAAQ;AAAA,QACrB,YAAY,QAAQ;AAAA,MACtB;AAAA,IACF;AAAA,EAGN,GAAG,CAAC,IAAI,KAAK,OAAO,OAAO,CAAC,OAE5B,wBAAU,MAAM;AACd,QAAK;AACL,aAAO,MAAM;AACX,sBAAc,IAAI,KAAK,cAAc,IAAI,GAAG,IAAK,CAAC;AAAA,MACpD;AAAA,EACF,GAAG,CAAC,KAAK,OAAO,CAAC,OAGjB,wBAAU,MACD,MAAM;AACX,0BAAsB,OAAO,EAAE;AAAA,EACjC,GACC,CAAC,EAAE,CAAC;AACT;",
5
+ "names": []
6
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+ var useZeroDebug_exports = {};
17
+ __export(useZeroDebug_exports, {
18
+ useZeroDebug: () => useZeroDebug
19
+ });
20
+ module.exports = __toCommonJS(useZeroDebug_exports);
21
+ var import_helpers = require("@vxrn/helpers"), import_react = require("react"), import_prettyFormatZeroQuery = require("./prettyFormatZeroQuery"), activeQueries = /* @__PURE__ */ new Map(), astHistoryByComponent = /* @__PURE__ */ new Map(), filterLogs = function(table) {
22
+ return !1;
23
+ }, COLLAPSED = !0, AST_CHANGE_THRESHOLD = 4, MAX_AST_HISTORY = 10, useZeroDebug = function(query, options, results) {
24
+ var _query__completeAst, astObject = (_query__completeAst = query._completeAst) === null || _query__completeAst === void 0 ? void 0 : _query__completeAst.call(query), table = astObject.table, ast = JSON.stringify(astObject, null, 2), queryDisabled = !options || (options == null ? void 0 : options.enabled) === !1, enabled = !queryDisabled && filterLogs(table), stack = new Error().stack, isPermissionQuery = stack == null ? void 0 : stack.includes("usePermission.ts"), id = (0, import_react.useId)(), num = activeQueries.get(ast) || 0, shouldLog = enabled && num === 0;
25
+ enabled && (activeQueries.set(ast, num + 1), shouldLog && (COLLAPSED ? (console.groupCollapsed(`${isPermissionQuery ? "\u{1F46E}\u200D\u2642\uFE0F" : "\u2728"}${(0, import_prettyFormatZeroQuery.prettyFormatZeroQuery)(query, "minimal")}`), console.info(id, (0, import_prettyFormatZeroQuery.prettyFormatZeroQuery)(query, "full")), console.info("cached result", results), console.trace(), console.groupEnd()) : console.info("\u2728", (0, import_prettyFormatZeroQuery.prettyFormatZeroQuery)(query, "full")))), (0, import_react.useEffect)(function() {
26
+ if (enabled) {
27
+ var history = astHistoryByComponent.get(id) || {
28
+ asts: [],
29
+ changeCount: 0
30
+ }, currentAst = ast, lastAst = history.asts[history.asts.length - 1];
31
+ currentAst !== lastAst && (history.asts.push(currentAst), history.asts.length > MAX_AST_HISTORY && history.asts.shift(), history.changeCount++, astHistoryByComponent.set(id, history), history.changeCount > AST_CHANGE_THRESHOLD && console.warn(`\u26A0\uFE0F AST changed ${history.changeCount} times for component.
32
+ - id: ${id}
33
+ - stack: ${(0, import_helpers.getCurrentComponentStack)("short")}
34
+ - table: ${table}`, {
35
+ componentId: id,
36
+ table,
37
+ changeCount: history.changeCount,
38
+ recentAsts: history.asts
39
+ }));
40
+ }
41
+ }, [
42
+ id,
43
+ ast,
44
+ table,
45
+ enabled
46
+ ]), (0, import_react.useEffect)(function() {
47
+ if (enabled)
48
+ return function() {
49
+ activeQueries.set(ast, activeQueries.get(ast) - 1);
50
+ };
51
+ }, [
52
+ ast,
53
+ enabled
54
+ ]), (0, import_react.useEffect)(function() {
55
+ return function() {
56
+ astHistoryByComponent.delete(id);
57
+ };
58
+ }, [
59
+ id
60
+ ]);
61
+ };
62
+ // Annotate the CommonJS export names for ESM import in node:
63
+ 0 && (module.exports = {
64
+ useZeroDebug
65
+ });
66
+ //# sourceMappingURL=useZeroDebug.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/helpers/useZeroDebug.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAyC,0BACzC,eAAiC,kBACjC,+BAAsC,oCAClC,gBAAgB,oBAAI,IAAI,GAExB,wBAAwB,oBAAI,IAAI,GAEhC,aAAa,SAAS,OAAO;AAC7B,SAAO;AACX,GACI,YAAY,IACZ,uBAAuB,GACvB,kBAAkB,IAGX,eAAe,SAAS,OAAO,SAAS,SAAS;AACxD,MAAI,qBAKA,aAAa,sBAAsB,MAAM,kBAAqB,QAAQ,wBAAwB,SAAS,SAAS,oBAAoB,KAAK,KAAK,GAC9I,QAAQ,UAAU,OAClB,MAAM,KAAK,UAAU,WAAW,MAAM,CAAC,GACvC,gBAAgB,CAAC,YAAY,WAAY,OAA6B,SAAS,QAAQ,aAAa,IACpG,UAAU,CAAC,iBAAiB,WAAW,KAAK,GAC5C,QAAQ,IAAI,MAAM,EAAE,OACpB,oBAAoB,SAAU,OAA2B,SAAS,MAAM,SAAS,kBAAkB,GACnG,SAAK,oBAAM,GAEX,MAAM,cAAc,IAAI,GAAG,KAAK,GAChC,YAAY,WAAW,QAAQ;AACnC,EAAI,YACA,cAAc,IAAI,KAAK,MAAM,CAAC,GAC1B,cACI,aACA,QAAQ,eAAe,GAAG,oBAAoB,gCAAU,QAAG,OAAG,oDAAsB,OAAO,SAAS,CAAC,EAAE,GACvG,QAAQ,KAAK,QAAI,oDAAsB,OAAO,MAAM,CAAC,GACrD,QAAQ,KAAK,iBAAiB,OAAO,GACrC,QAAQ,MAAM,GACd,QAAQ,SAAS,KAEjB,QAAQ,KAAK,cAAK,oDAAsB,OAAO,MAAM,CAAC,SAKlE,wBAAU,WAAW;AACjB,QAAK,SACL;AAAA,UAAI,UAAU,sBAAsB,IAAI,EAAE,KAAK;AAAA,QAC3C,MAAM,CAAC;AAAA,QACP,aAAa;AAAA,MACjB,GACI,aAAa,KACb,UAAU,QAAQ,KAAK,QAAQ,KAAK,SAAS,CAAC;AAClD,MAAI,eAAe,YACf,QAAQ,KAAK,KAAK,UAAU,GACxB,QAAQ,KAAK,SAAS,mBACtB,QAAQ,KAAK,MAAM,GAEvB,QAAQ,eACR,sBAAsB,IAAI,IAAI,OAAO,GACjC,QAAQ,cAAc,wBACtB,QAAQ,KAAK,4BAAkB,QAAQ,WAAW;AAAA,gBAClD,EAAE;AAAA,uBACC,yCAAyB,OAAO,CAAC;AAAA,mBACjC,KAAK,IAAI;AAAA,QACR,aAAa;AAAA,QACb;AAAA,QACA,aAAa,QAAQ;AAAA,QACrB,YAAY,QAAQ;AAAA,MACxB,CAAC;AAAA;AAAA,EAGb,GAAG;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAC,OACD,wBAAU,WAAW;AACjB,QAAK;AACL,aAAO,WAAW;AACd,sBAAc,IAAI,KAAK,cAAc,IAAI,GAAG,IAAI,CAAC;AAAA,MACrD;AAAA,EACJ,GAAG;AAAA,IACC;AAAA,IACA;AAAA,EACJ,CAAC,OAED,wBAAU,WAAW;AACjB,WAAO,WAAW;AACd,4BAAsB,OAAO,EAAE;AAAA,IACnC;AAAA,EACJ,GAAG;AAAA,IACC;AAAA,EACJ,CAAC;AACL;",
5
+ "names": []
6
+ }
@@ -23,5 +23,5 @@ __export(zeroEmitter_exports, {
23
23
  zeroEmitter: () => zeroEmitter
24
24
  });
25
25
  module.exports = __toCommonJS(zeroEmitter_exports);
26
- var import_emitter = require("~/helpers/emitter");
27
- const zeroEmitter = (0, import_emitter.createEmitter)("zero", void 0);
26
+ var import_helpers = require("@vxrn/helpers");
27
+ const zeroEmitter = (0, import_helpers.createEmitter)("zero", void 0);
@@ -17,6 +17,6 @@ __export(zeroEmitter_exports, {
17
17
  zeroEmitter: () => zeroEmitter
18
18
  });
19
19
  module.exports = __toCommonJS(zeroEmitter_exports);
20
- var import_emitter = require("~/helpers/emitter");
21
- const zeroEmitter = (0, import_emitter.createEmitter)("zero", void 0);
20
+ var import_helpers = require("@vxrn/helpers");
21
+ const zeroEmitter = (0, import_helpers.createEmitter)("zero", void 0);
22
22
  //# sourceMappingURL=zeroEmitter.js.map
@@ -18,7 +18,7 @@ __export(zeroEmitter_exports, {
18
18
  zeroEmitter: () => zeroEmitter
19
19
  });
20
20
  module.exports = __toCommonJS(zeroEmitter_exports);
21
- var import_emitter = require("~/helpers/emitter"), zeroEmitter = (0, import_emitter.createEmitter)("zero", void 0);
21
+ var import_helpers = require("@vxrn/helpers"), zeroEmitter = (0, import_helpers.createEmitter)("zero", void 0);
22
22
  // Annotate the CommonJS export names for ESM import in node:
23
23
  0 && (module.exports = {
24
24
  zeroEmitter
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/zeroEmitter.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA8B,8BACnB,kBAAc,8BAAc,QAAQ,MAAS;",
4
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA8B,0BACnB,kBAAc,8BAAc,QAAQ,MAAS;",
5
5
  "names": []
6
6
  }
@@ -20,4 +20,6 @@ __reExport(index_exports, require("./helpers/batchQuery.cjs"), module.exports);
20
20
  __reExport(index_exports, require("./helpers/context.cjs"), module.exports);
21
21
  __reExport(index_exports, require("./helpers/createMutators.cjs"), module.exports);
22
22
  __reExport(index_exports, require("./helpers/ensureLoggedIn.cjs"), module.exports);
23
- __reExport(index_exports, require("./createZero"), module.exports);
23
+ __reExport(index_exports, require("./mutations.cjs"), module.exports);
24
+ __reExport(index_exports, require("./where.cjs"), module.exports);
25
+ __reExport(index_exports, require("./createZeroClient.cjs"), module.exports);
package/dist/cjs/index.js CHANGED
@@ -16,5 +16,7 @@ __reExport(index_exports, require("./helpers/batchQuery"), module.exports);
16
16
  __reExport(index_exports, require("./helpers/context"), module.exports);
17
17
  __reExport(index_exports, require("./helpers/createMutators"), module.exports);
18
18
  __reExport(index_exports, require("./helpers/ensureLoggedIn"), module.exports);
19
- __reExport(index_exports, require("./createZero"), module.exports);
19
+ __reExport(index_exports, require("./mutations"), module.exports);
20
+ __reExport(index_exports, require("./where"), module.exports);
21
+ __reExport(index_exports, require("./createZeroClient"), module.exports);
20
22
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,gCAAd;AACA,0BAAc,iCADd;AAEA,0BAAc,8BAFd;AAGA,0BAAc,qCAHd;AAIA,0BAAc,qCAJd;AAMA,0BAAc,yBANd;",
4
+ "mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,gCAAd;AACA,0BAAc,iCADd;AAEA,0BAAc,8BAFd;AAGA,0BAAc,qCAHd;AAIA,0BAAc,qCAJd;AAMA,0BAAc,wBANd;AAOA,0BAAc,oBAPd;AAQA,0BAAc,+BARd;",
5
5
  "names": []
6
6
  }
@@ -17,7 +17,9 @@ __reExport(index_exports, require("./helpers/batchQuery"), module.exports);
17
17
  __reExport(index_exports, require("./helpers/context"), module.exports);
18
18
  __reExport(index_exports, require("./helpers/createMutators"), module.exports);
19
19
  __reExport(index_exports, require("./helpers/ensureLoggedIn"), module.exports);
20
- __reExport(index_exports, require("./createZero"), module.exports);
20
+ __reExport(index_exports, require("./mutations"), module.exports);
21
+ __reExport(index_exports, require("./where"), module.exports);
22
+ __reExport(index_exports, require("./createZeroClient"), module.exports);
21
23
  // Annotate the CommonJS export names for ESM import in node:
22
24
  0 && (module.exports = {
23
25
  ...require("./createPermissions"),
@@ -25,6 +27,8 @@ __reExport(index_exports, require("./createZero"), module.exports);
25
27
  ...require("./helpers/context"),
26
28
  ...require("./helpers/createMutators"),
27
29
  ...require("./helpers/ensureLoggedIn"),
28
- ...require("./createZero")
30
+ ...require("./mutations"),
31
+ ...require("./where"),
32
+ ...require("./createZeroClient")
29
33
  });
30
34
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,gCAAd;AACA,0BAAc,iCADd;AAEA,0BAAc,8BAFd;AAGA,0BAAc,qCAHd;AAIA,0BAAc,qCAJd;AAKA,0BAAc,yBALd;",
4
+ "mappings": ";;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,gCAAd;AACA,0BAAc,iCADd;AAEA,0BAAc,8BAFd;AAGA,0BAAc,qCAHd;AAIA,0BAAc,qCAJd;AAKA,0BAAc,wBALd;AAMA,0BAAc,oBANd;AAOA,0BAAc,+BAPd;",
5
5
  "names": []
6
6
  }
@@ -0,0 +1,50 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var mutations_exports = {};
22
+ __export(mutations_exports, {
23
+ mutations: () => mutations
24
+ });
25
+ module.exports = __toCommonJS(mutations_exports);
26
+ function mutations(table, permissions, mutations2) {
27
+ if (permissions) {
28
+ const tableName = table.schema.name,
29
+ createCRUDMutation = action => async (ctx, obj) => {
30
+ const runServerPermissionCheck = async () => {
31
+ ctx.didCanPermissionsRun || process.env.VITE_ENVIRONMENT === "ssr" && (await ctx.can(permissions, action, obj));
32
+ };
33
+ action !== "insert" && (await runServerPermissionCheck());
34
+ const existing = mutations2?.[action];
35
+ existing ? await existing(ctx, obj) : await ctx.tx.mutate[tableName][action](obj), action === "insert" && (await runServerPermissionCheck());
36
+ },
37
+ crudMutations = {
38
+ insert: createCRUDMutation("insert"),
39
+ update: createCRUDMutation("update"),
40
+ delete: createCRUDMutation("delete"),
41
+ upsert: createCRUDMutation("upsert")
42
+ };
43
+ return {
44
+ ...mutations2,
45
+ // overwrite regular mutations but call them if they are defined by user
46
+ ...crudMutations
47
+ };
48
+ }
49
+ return table;
50
+ }
@@ -0,0 +1,43 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var mutations_exports = {};
16
+ __export(mutations_exports, {
17
+ mutations: () => mutations
18
+ });
19
+ module.exports = __toCommonJS(mutations_exports);
20
+ function mutations(table, permissions, mutations2) {
21
+ if (permissions) {
22
+ const tableName = table.schema.name, createCRUDMutation = (action) => async (ctx, obj) => {
23
+ const runServerPermissionCheck = async () => {
24
+ ctx.didCanPermissionsRun || process.env.VITE_ENVIRONMENT === "ssr" && await ctx.can(permissions, action, obj);
25
+ };
26
+ action !== "insert" && await runServerPermissionCheck();
27
+ const existing = mutations2?.[action];
28
+ existing ? await existing(ctx, obj) : await ctx.tx.mutate[tableName][action](obj), action === "insert" && await runServerPermissionCheck();
29
+ }, crudMutations = {
30
+ insert: createCRUDMutation("insert"),
31
+ update: createCRUDMutation("update"),
32
+ delete: createCRUDMutation("delete"),
33
+ upsert: createCRUDMutation("upsert")
34
+ };
35
+ return {
36
+ ...mutations2,
37
+ // overwrite regular mutations but call them if they are defined by user
38
+ ...crudMutations
39
+ };
40
+ }
41
+ return table;
42
+ }
43
+ //# sourceMappingURL=mutations.js.map