on-zero 0.2.1 → 0.2.3

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 (42) hide show
  1. package/package.json +2 -2
  2. package/dist/cjs/helpers/getQueryOrMutatorAuthData.cjs +0 -31
  3. package/dist/cjs/helpers/getQueryOrMutatorAuthData.js +0 -24
  4. package/dist/cjs/helpers/getQueryOrMutatorAuthData.js.map +0 -6
  5. package/dist/cjs/helpers/getQueryOrMutatorAuthData.native.js +0 -34
  6. package/dist/cjs/helpers/getQueryOrMutatorAuthData.native.js.map +0 -1
  7. package/dist/cjs/query.cjs +0 -44
  8. package/dist/cjs/query.js +0 -37
  9. package/dist/cjs/query.js.map +0 -6
  10. package/dist/cjs/query.native.js +0 -49
  11. package/dist/cjs/query.native.js.map +0 -1
  12. package/dist/cjs/relationWhere.cjs +0 -29
  13. package/dist/cjs/relationWhere.js +0 -24
  14. package/dist/cjs/relationWhere.js.map +0 -6
  15. package/dist/cjs/relationWhere.native.js +0 -32
  16. package/dist/cjs/relationWhere.native.js.map +0 -1
  17. package/dist/esm/helpers/getQueryOrMutatorAuthData.js +0 -10
  18. package/dist/esm/helpers/getQueryOrMutatorAuthData.js.map +0 -6
  19. package/dist/esm/helpers/getQueryOrMutatorAuthData.mjs +0 -8
  20. package/dist/esm/helpers/getQueryOrMutatorAuthData.mjs.map +0 -1
  21. package/dist/esm/helpers/getQueryOrMutatorAuthData.native.js +0 -8
  22. package/dist/esm/helpers/getQueryOrMutatorAuthData.native.js.map +0 -1
  23. package/dist/esm/query.js +0 -23
  24. package/dist/esm/query.js.map +0 -6
  25. package/dist/esm/query.mjs +0 -18
  26. package/dist/esm/query.mjs.map +0 -1
  27. package/dist/esm/query.native.js +0 -20
  28. package/dist/esm/query.native.js.map +0 -1
  29. package/dist/esm/relationWhere.js +0 -8
  30. package/dist/esm/relationWhere.js.map +0 -6
  31. package/dist/esm/relationWhere.mjs +0 -6
  32. package/dist/esm/relationWhere.mjs.map +0 -1
  33. package/dist/esm/relationWhere.native.js +0 -6
  34. package/dist/esm/relationWhere.native.js.map +0 -1
  35. package/types/helpers/getQueryOrMutatorAuthData.d.ts +0 -3
  36. package/types/helpers/getQueryOrMutatorAuthData.d.ts.map +0 -1
  37. package/types/helpers/queryContext.test.d.ts +0 -2
  38. package/types/helpers/queryContext.test.d.ts.map +0 -1
  39. package/types/query.d.ts +0 -6
  40. package/types/query.d.ts.map +0 -1
  41. package/types/relationWhere.d.ts +0 -20
  42. package/types/relationWhere.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "on-zero",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "A typed layer over @rocicorp/zero with queries, mutations, and permissions",
5
5
  "sideEffects": false,
6
6
  "source": "src/index.ts",
@@ -71,7 +71,7 @@
71
71
  }
72
72
  },
73
73
  "dependencies": {
74
- "@take-out/helpers": "0.2.1",
74
+ "@take-out/helpers": "0.2.3",
75
75
  "@sinclair/typebox-codegen": "^0.11.1",
76
76
  "chokidar": "^4.0.3",
77
77
  "citty": "^0.1.6",
@@ -1,31 +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 getQueryOrMutatorAuthData_exports = {};
22
- __export(getQueryOrMutatorAuthData_exports, {
23
- getQueryOrMutatorAuthData: () => getQueryOrMutatorAuthData
24
- });
25
- module.exports = __toCommonJS(getQueryOrMutatorAuthData_exports);
26
- var import_state = require("../state.cjs"),
27
- import_mutatorContext = require("./mutatorContext.cjs"),
28
- import_queryContext = require("./queryContext.cjs");
29
- function getQueryOrMutatorAuthData() {
30
- return (0, import_mutatorContext.isInZeroMutation)() ? (0, import_mutatorContext.mutatorContext)().authData : (0, import_queryContext.isInQueryContext)() ? (0, import_queryContext.queryAuthData)() : (0, import_state.getAuthData)();
31
- }
@@ -1,24 +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)
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 getQueryOrMutatorAuthData_exports = {};
16
- __export(getQueryOrMutatorAuthData_exports, {
17
- getQueryOrMutatorAuthData: () => getQueryOrMutatorAuthData
18
- });
19
- module.exports = __toCommonJS(getQueryOrMutatorAuthData_exports);
20
- var import_state = require("../state"), import_mutatorContext = require("./mutatorContext"), import_queryContext = require("./queryContext");
21
- function getQueryOrMutatorAuthData() {
22
- return (0, import_mutatorContext.isInZeroMutation)() ? (0, import_mutatorContext.mutatorContext)().authData : (0, import_queryContext.isInQueryContext)() ? (0, import_queryContext.queryAuthData)() : (0, import_state.getAuthData)();
23
- }
24
- //# sourceMappingURL=getQueryOrMutatorAuthData.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/helpers/getQueryOrMutatorAuthData.ts"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA4B,qBAC5B,wBAAiD,6BACjD,sBAAgD;AAIzC,SAAS,4BAA6C;AAC3D,aAAI,wCAAiB,QACZ,sCAAe,EAAE,eAEtB,sCAAiB,QACZ,mCAAc,QAGhB,0BAAY;AACrB;",
5
- "names": []
6
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
-
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
- get: () => from[key],
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- return to;
19
- };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
22
- }), mod);
23
- var getQueryOrMutatorAuthData_exports = {};
24
- __export(getQueryOrMutatorAuthData_exports, {
25
- getQueryOrMutatorAuthData: () => getQueryOrMutatorAuthData
26
- });
27
- module.exports = __toCommonJS(getQueryOrMutatorAuthData_exports);
28
- var import_state = require("../state.native.js"),
29
- import_mutatorContext = require("./mutatorContext.native.js"),
30
- import_queryContext = require("./queryContext.native.js");
31
- function getQueryOrMutatorAuthData() {
32
- return (0, import_mutatorContext.isInZeroMutation)() ? (0, import_mutatorContext.mutatorContext)().authData : (0, import_queryContext.isInQueryContext)() ? (0, import_queryContext.queryAuthData)() : (0, import_state.getAuthData)();
33
- }
34
- //# sourceMappingURL=getQueryOrMutatorAuthData.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","getQueryOrMutatorAuthData_exports","__export","getQueryOrMutatorAuthData","module","exports","import_state","require","import_mutatorContext","import_queryContext","isInZeroMutation","mutatorContext","authData","isInQueryContext","queryAuthData","getAuthData"],"sources":["../../../src/helpers/getQueryOrMutatorAuthData.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,iCAAA;AAAAC,QAAA,CAAAD,iCAAA;EAAAE,yBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAA4B,CAAAK,iCAC5B,CAAiD;AAK1C,IAAAK,YAAS,GAAAC,OAAA,qBAA6C;EAAAC,qBAAA,GAAAD,OAAA;EAAAE,mBAAA,GAAAF,OAAA;AAC3D,SAAAJ,yBAAIA,CAAA;EAQN,WAAAK,qBAAA,CAAAE,gBAAA,UAAAF,qBAAA,CAAAG,cAAA,IAAAC,QAAA,OAAAH,mBAAA,CAAAI,gBAAA,UAAAJ,mBAAA,CAAAK,aAAA,UAAAR,YAAA,CAAAS,WAAA","ignoreList":[]}
@@ -1,44 +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 query_exports = {};
22
- __export(query_exports, {
23
- ensureAuth: () => ensureAuth,
24
- getAuth: () => getAuth,
25
- query: () => query,
26
- queryContext: () => queryContext
27
- });
28
- module.exports = __toCommonJS(query_exports);
29
- var import_helpers = require("@take-out/helpers"),
30
- import_mutatorContext = require("./helpers/mutatorContext.cjs"),
31
- import_state = require("./state.cjs");
32
- function getAuth() {
33
- return (0, import_mutatorContext.isInZeroMutation)() ? (0, import_mutatorContext.mutatorContext)().auth : (0, import_state.getContext)().auth;
34
- }
35
- function ensureAuth() {
36
- const auth = getAuth();
37
- return (0, import_helpers.ensure)(auth, "authenticated"), auth;
38
- }
39
- function queryContext() {
40
- return (0, import_mutatorContext.isInZeroMutation)() ? (0, import_mutatorContext.mutatorContext)() : (0, import_state.getContext)();
41
- }
42
- function query(fn) {
43
- return props => fn(props, queryContext());
44
- }
package/dist/cjs/query.js DELETED
@@ -1,37 +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)
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 query_exports = {};
16
- __export(query_exports, {
17
- ensureAuth: () => ensureAuth,
18
- getAuth: () => getAuth,
19
- query: () => query,
20
- queryContext: () => queryContext
21
- });
22
- module.exports = __toCommonJS(query_exports);
23
- var import_helpers = require("@take-out/helpers"), import_mutatorContext = require("./helpers/mutatorContext"), import_state = require("./state");
24
- function getAuth() {
25
- return (0, import_mutatorContext.isInZeroMutation)() ? (0, import_mutatorContext.mutatorContext)().auth : (0, import_state.getContext)().auth;
26
- }
27
- function ensureAuth() {
28
- const auth = getAuth();
29
- return (0, import_helpers.ensure)(auth, "authenticated"), auth;
30
- }
31
- function queryContext() {
32
- return (0, import_mutatorContext.isInZeroMutation)() ? (0, import_mutatorContext.mutatorContext)() : (0, import_state.getContext)();
33
- }
34
- function query(fn) {
35
- return (props) => fn(props, queryContext());
36
- }
37
- //# sourceMappingURL=query.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/query.ts"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAuB,8BAEvB,wBAAiD,qCACjD,eAA2B;AAKpB,SAAS,UAA2B;AACzC,aAAI,wCAAiB,QACZ,sCAAe,EAAE,WAEnB,yBAAW,EAAE;AACtB;AAGO,SAAS,aAAuB;AACrC,QAAM,OAAO,QAAQ;AACrB,oCAAO,MAAM,eAAe,GACrB;AACT;AAEO,SAAS,eAAwB;AACtC,aAAI,wCAAiB,QACZ,sCAAe,QAEjB,yBAAW;AACpB;AAEO,SAAS,MACd,IAC0B;AAC1B,SAAO,CAAC,UAAiB,GAAG,OAAO,aAAa,CAAC;AACnD;",
5
- "names": []
6
- }
@@ -1,49 +0,0 @@
1
- "use strict";
2
-
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
- get: () => from[key],
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- return to;
19
- };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
22
- }), mod);
23
- var query_exports = {};
24
- __export(query_exports, {
25
- ensureAuth: () => ensureAuth,
26
- getAuth: () => getAuth,
27
- query: () => query,
28
- queryContext: () => queryContext
29
- });
30
- module.exports = __toCommonJS(query_exports);
31
- var import_helpers = require("@take-out/helpers"),
32
- import_mutatorContext = require("./helpers/mutatorContext.native.js"),
33
- import_state = require("./state.native.js");
34
- function getAuth() {
35
- return (0, import_mutatorContext.isInZeroMutation)() ? (0, import_mutatorContext.mutatorContext)().auth : (0, import_state.getContext)().auth;
36
- }
37
- function ensureAuth() {
38
- var auth = getAuth();
39
- return (0, import_helpers.ensure)(auth, "authenticated"), auth;
40
- }
41
- function queryContext() {
42
- return (0, import_mutatorContext.isInZeroMutation)() ? (0, import_mutatorContext.mutatorContext)() : (0, import_state.getContext)();
43
- }
44
- function query(fn) {
45
- return function (props) {
46
- return fn(props, queryContext());
47
- };
48
- }
49
- //# sourceMappingURL=query.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","query_exports","__export","ensureAuth","getAuth","query","queryContext","module","exports","import_helpers","require","import_mutatorContext","import_state","isInZeroMutation","mutatorContext","auth","getContext","ensure","fn","props"],"sources":["../../src/query.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,UAAA,EAAAA,CAAA,KAAAA,UAAA;EAAAC,OAAA,EAAAA,CAAA,KAAAA,OAAA;EAAAC,KAAA,EAAAA,CAAA,KAAAA,KAAA;EAAAC,YAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAZ,YAAuB,CAAAK,aAAA;AAQhB,IAAAQ,cAAS,GAA2BC,OAAA;EAAAC,qBAAA,GAAAD,OAAA;EAAAE,YAAA,GAAAF,OAAA;AACzC,SAAAN,OAAIA,CAAA;EAIN,WAAAO,qBAAA,CAAAE,gBAAA,UAAAF,qBAAA,CAAAG,cAAA,IAAAC,IAAA,OAAAH,YAAA,CAAAI,UAAA,IAAAD,IAAA;AAGO;AACL,SAAMZ,UAAOA,CAAA;EACb,IAAAY,IAAA,GAAAX,OAAA;EAEF,WAAAK,cAAA,CAAAQ,MAAA,EAAAF,IAAA,oBAAAA,IAAA;AAEO;AACL,SAAAT,YAAIA,CAAA;EAIN,WAAAK,qBAAA,CAAAE,gBAAA,UAAAF,qBAAA,CAAAG,cAAA,UAAAF,YAAA,CAAAI,UAAA;AAEO;AAGL,SAAOX,KAACA,CAAAa,EAAA;EACV,iBAAAC,KAAA","ignoreList":[]}
@@ -1,29 +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 relationWhere_exports = {};
22
- __export(relationWhere_exports, {
23
- relationWhere: () => relationWhere
24
- });
25
- module.exports = __toCommonJS(relationWhere_exports);
26
- var import_where = require("./where.cjs");
27
- function relationWhere(_relationName, builder) {
28
- return (0, import_where.where)(builder);
29
- }
@@ -1,24 +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)
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 relationWhere_exports = {};
16
- __export(relationWhere_exports, {
17
- relationWhere: () => relationWhere
18
- });
19
- module.exports = __toCommonJS(relationWhere_exports);
20
- var import_where = require("./where");
21
- function relationWhere(_relationName, builder) {
22
- return (0, import_where.where)(builder);
23
- }
24
- //# sourceMappingURL=relationWhere.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/relationWhere.ts"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAsB;AAkBf,SAAS,cACd,eACA,SAI6B;AAG7B,aAAO,oBAAM,OAAc;AAC7B;",
5
- "names": []
6
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
- get: () => from[key],
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- return to;
19
- };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
22
- }), mod);
23
- var relationWhere_exports = {};
24
- __export(relationWhere_exports, {
25
- relationWhere: () => relationWhere
26
- });
27
- module.exports = __toCommonJS(relationWhere_exports);
28
- var import_where = require("./where.native.js");
29
- function relationWhere(_relationName, builder) {
30
- return (0, import_where.where)(builder);
31
- }
32
- //# sourceMappingURL=relationWhere.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","relationWhere_exports","__export","relationWhere","module","exports","import_where","require","_relationName","builder","where"],"sources":["../../src/relationWhere.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,qBAAA;AAAAC,QAAA,CAAAD,qBAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA;AAAA;AAEAC,MAAA,CAAAC,OAAA,GAAAT,YAAsB,CAAAK,qBAAA;AAkBf,IAAAK,YAAS,GAAAC,OACd;AAQA,SAAAJ,aAAOA,CAAAK,aAAM,EAAAC,OAAc;EAC7B,WAAAH,YAAA,CAAAI,KAAA,EAAAD,OAAA","ignoreList":[]}
@@ -1,10 +0,0 @@
1
- import { getAuthData } from "../state";
2
- import { isInZeroMutation, mutatorContext } from "./mutatorContext";
3
- import { isInQueryContext, queryAuthData } from "./queryContext";
4
- function getQueryOrMutatorAuthData() {
5
- return isInZeroMutation() ? mutatorContext().authData : isInQueryContext() ? queryAuthData() : getAuthData();
6
- }
7
- export {
8
- getQueryOrMutatorAuthData
9
- };
10
- //# sourceMappingURL=getQueryOrMutatorAuthData.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/helpers/getQueryOrMutatorAuthData.ts"],
4
- "mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB,sBAAsB;AACjD,SAAS,kBAAkB,qBAAqB;AAIzC,SAAS,4BAA6C;AAC3D,SAAI,iBAAiB,IACZ,eAAe,EAAE,WAEtB,iBAAiB,IACZ,cAAc,IAGhB,YAAY;AACrB;",
5
- "names": []
6
- }
@@ -1,8 +0,0 @@
1
- import { getAuthData } from "../state.mjs";
2
- import { isInZeroMutation, mutatorContext } from "./mutatorContext.mjs";
3
- import { isInQueryContext, queryAuthData } from "./queryContext.mjs";
4
- function getQueryOrMutatorAuthData() {
5
- return isInZeroMutation() ? mutatorContext().authData : isInQueryContext() ? queryAuthData() : getAuthData();
6
- }
7
- export { getQueryOrMutatorAuthData };
8
- //# sourceMappingURL=getQueryOrMutatorAuthData.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getAuthData","isInZeroMutation","mutatorContext","isInQueryContext","queryAuthData","getQueryOrMutatorAuthData","authData"],"sources":["../../../src/helpers/getQueryOrMutatorAuthData.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,WAAA,QAAmB;AAC5B,SAASC,gBAAA,EAAkBC,cAAA,QAAsB;AACjD,SAASC,gBAAA,EAAkBC,aAAA,QAAqB;AAIzC,SAASC,0BAAA,EAA6C;EAC3D,OAAIJ,gBAAA,CAAiB,IACZC,cAAA,CAAe,EAAEI,QAAA,GAEtBH,gBAAA,CAAiB,IACZC,aAAA,CAAc,IAGhBJ,WAAA,CAAY;AACrB","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import { getAuthData } from "../state.native.js";
2
- import { isInZeroMutation, mutatorContext } from "./mutatorContext.native.js";
3
- import { isInQueryContext, queryAuthData } from "./queryContext.native.js";
4
- function getQueryOrMutatorAuthData() {
5
- return isInZeroMutation() ? mutatorContext().authData : isInQueryContext() ? queryAuthData() : getAuthData();
6
- }
7
- export { getQueryOrMutatorAuthData };
8
- //# sourceMappingURL=getQueryOrMutatorAuthData.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getAuthData","isInZeroMutation","mutatorContext","isInQueryContext","queryAuthData","getQueryOrMutatorAuthData","authData"],"sources":["../../../src/helpers/getQueryOrMutatorAuthData.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,WAAA,QAAmB;AAC5B,SAASC,gBAAA,EAAkBC,cAAA,QAAsB;AACjD,SAASC,gBAAA,EAAkBC,aAAA,QAAqB;AAIzC,SAASC,0BAAA,EAA6C;EAC3D,OAAIJ,gBAAA,CAAiB,IACZC,cAAA,CAAe,EAAEI,QAAA,GAEtBH,gBAAA,CAAiB,IACZC,aAAA,CAAc,IAGhBJ,WAAA,CAAY;AACrB","ignoreList":[]}
package/dist/esm/query.js DELETED
@@ -1,23 +0,0 @@
1
- import { ensure } from "@take-out/helpers";
2
- import { isInZeroMutation, mutatorContext } from "./helpers/mutatorContext";
3
- import { getContext } from "./state";
4
- function getAuth() {
5
- return isInZeroMutation() ? mutatorContext().auth : getContext().auth;
6
- }
7
- function ensureAuth() {
8
- const auth = getAuth();
9
- return ensure(auth, "authenticated"), auth;
10
- }
11
- function queryContext() {
12
- return isInZeroMutation() ? mutatorContext() : getContext();
13
- }
14
- function query(fn) {
15
- return (props) => fn(props, queryContext());
16
- }
17
- export {
18
- ensureAuth,
19
- getAuth,
20
- query,
21
- queryContext
22
- };
23
- //# sourceMappingURL=query.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/query.ts"],
4
- "mappings": "AAAA,SAAS,cAAc;AAEvB,SAAS,kBAAkB,sBAAsB;AACjD,SAAS,kBAAkB;AAKpB,SAAS,UAA2B;AACzC,SAAI,iBAAiB,IACZ,eAAe,EAAE,OAEnB,WAAW,EAAE;AACtB;AAGO,SAAS,aAAuB;AACrC,QAAM,OAAO,QAAQ;AACrB,gBAAO,MAAM,eAAe,GACrB;AACT;AAEO,SAAS,eAAwB;AACtC,SAAI,iBAAiB,IACZ,eAAe,IAEjB,WAAW;AACpB;AAEO,SAAS,MACd,IAC0B;AAC1B,SAAO,CAAC,UAAiB,GAAG,OAAO,aAAa,CAAC;AACnD;",
5
- "names": []
6
- }
@@ -1,18 +0,0 @@
1
- import { ensure } from "@take-out/helpers";
2
- import { isInZeroMutation, mutatorContext } from "./helpers/mutatorContext.mjs";
3
- import { getContext } from "./state.mjs";
4
- function getAuth() {
5
- return isInZeroMutation() ? mutatorContext().auth : getContext().auth;
6
- }
7
- function ensureAuth() {
8
- const auth = getAuth();
9
- return ensure(auth, "authenticated"), auth;
10
- }
11
- function queryContext() {
12
- return isInZeroMutation() ? mutatorContext() : getContext();
13
- }
14
- function query(fn) {
15
- return props => fn(props, queryContext());
16
- }
17
- export { ensureAuth, getAuth, query, queryContext };
18
- //# sourceMappingURL=query.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["ensure","isInZeroMutation","mutatorContext","getContext","getAuth","auth","ensureAuth","queryContext","query","fn","props"],"sources":["../../src/query.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,MAAA,QAAc;AAEvB,SAASC,gBAAA,EAAkBC,cAAA,QAAsB;AACjD,SAASC,UAAA,QAAkB;AAKpB,SAASC,QAAA,EAA2B;EACzC,OAAIH,gBAAA,CAAiB,IACZC,cAAA,CAAe,EAAEG,IAAA,GAEnBF,UAAA,CAAW,EAAEE,IAAA;AACtB;AAGO,SAASC,WAAA,EAAuB;EACrC,MAAMD,IAAA,GAAOD,OAAA,CAAQ;EACrB,OAAAJ,MAAA,CAAOK,IAAA,EAAM,eAAe,GACrBA,IAAA;AACT;AAEO,SAASE,aAAA,EAAwB;EACtC,OAAIN,gBAAA,CAAiB,IACZC,cAAA,CAAe,IAEjBC,UAAA,CAAW;AACpB;AAEO,SAASK,MACdC,EAAA,EAC0B;EAC1B,OAAQC,KAAA,IAAiBD,EAAA,CAAGC,KAAA,EAAOH,YAAA,CAAa,CAAC;AACnD","ignoreList":[]}
@@ -1,20 +0,0 @@
1
- import { ensure } from "@take-out/helpers";
2
- import { isInZeroMutation, mutatorContext } from "./helpers/mutatorContext.native.js";
3
- import { getContext } from "./state.native.js";
4
- function getAuth() {
5
- return isInZeroMutation() ? mutatorContext().auth : getContext().auth;
6
- }
7
- function ensureAuth() {
8
- var auth = getAuth();
9
- return ensure(auth, "authenticated"), auth;
10
- }
11
- function queryContext() {
12
- return isInZeroMutation() ? mutatorContext() : getContext();
13
- }
14
- function query(fn) {
15
- return function (props) {
16
- return fn(props, queryContext());
17
- };
18
- }
19
- export { ensureAuth, getAuth, query, queryContext };
20
- //# sourceMappingURL=query.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["ensure","isInZeroMutation","mutatorContext","getContext","getAuth","auth","ensureAuth","queryContext","query","fn","props"],"sources":["../../src/query.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,MAAA,QAAc;AAEvB,SAASC,gBAAA,EAAkBC,cAAA,QAAsB;AACjD,SAASC,UAAA,QAAkB;AAKpB,SAASC,QAAA,EAA2B;EACzC,OAAIH,gBAAA,CAAiB,IACZC,cAAA,CAAe,EAAEG,IAAA,GAEnBF,UAAA,CAAW,EAAEE,IAAA;AACtB;AAGO,SAASC,WAAA,EAAuB;EACrC,IAAAD,IAAM,GAAAD,OAAO;EACb,OAAAJ,MAAA,CAAOK,IAAA,EAAM,eAAe,GACrBA,IAAA;AACT;AAEO,SAASE,aAAA,EAAwB;EACtC,OAAIN,gBAAA,CAAiB,IACZC,cAAA,CAAe,IAEjBC,UAAA,CAAW;AACpB;AAEO,SAASK,MACdC,EAAA,EAC0B;EAC1B,OAAO,UAACC,KAAoB;IAC9B,OAAAD,EAAA,CAAAC,KAAA,EAAAH,YAAA","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import { where } from "./where";
2
- function relationWhere(_relationName, builder) {
3
- return where(builder);
4
- }
5
- export {
6
- relationWhere
7
- };
8
- //# sourceMappingURL=relationWhere.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/relationWhere.ts"],
4
- "mappings": "AAEA,SAAS,aAAa;AAkBf,SAAS,cACd,eACA,SAI6B;AAG7B,SAAO,MAAM,OAAc;AAC7B;",
5
- "names": []
6
- }
@@ -1,6 +0,0 @@
1
- import { where } from "./where.mjs";
2
- function relationWhere(_relationName, builder) {
3
- return where(builder);
4
- }
5
- export { relationWhere };
6
- //# sourceMappingURL=relationWhere.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["where","relationWhere","_relationName","builder"],"sources":["../../src/relationWhere.ts"],"sourcesContent":[null],"mappings":"AAEA,SAASA,KAAA,QAAa;AAkBf,SAASC,cACdC,aAAA,EACAC,OAAA,EAI6B;EAG7B,OAAOH,KAAA,CAAMG,OAAc;AAC7B","ignoreList":[]}
@@ -1,6 +0,0 @@
1
- import { where } from "./where.native.js";
2
- function relationWhere(_relationName, builder) {
3
- return where(builder);
4
- }
5
- export { relationWhere };
6
- //# sourceMappingURL=relationWhere.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["where","relationWhere","_relationName","builder"],"sources":["../../src/relationWhere.ts"],"sourcesContent":[null],"mappings":"AAEA,SAASA,KAAA,QAAa;AAkBf,SAASC,cACdC,aAAA,EACAC,OAAA,EAI6B;EAG7B,OAAOH,KAAA,CAAMG,OAAc;AAC7B","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import type { AuthData } from '../types';
2
- export declare function getQueryOrMutatorAuthData(): AuthData | null;
3
- //# sourceMappingURL=getQueryOrMutatorAuthData.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getQueryOrMutatorAuthData.d.ts","sourceRoot":"","sources":["../../src/helpers/getQueryOrMutatorAuthData.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,wBAAgB,yBAAyB,IAAI,QAAQ,GAAG,IAAI,CAS3D"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=queryContext.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queryContext.test.d.ts","sourceRoot":"","sources":["../../src/helpers/queryContext.test.ts"],"names":[],"mappings":""}
package/types/query.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import type { AuthData, Context } from './types';
2
- export declare function getAuth(): AuthData | null;
3
- export declare function ensureAuth(): AuthData;
4
- export declare function queryContext(): Context;
5
- export declare function query<Props, Return>(fn: (props: Props, ctx: Context) => Return): (props: Props) => Return;
6
- //# sourceMappingURL=query.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAGhD,wBAAgB,OAAO,IAAI,QAAQ,GAAG,IAAI,CAKzC;AAGD,wBAAgB,UAAU,IAAI,QAAQ,CAIrC;AAED,wBAAgB,YAAY,IAAI,OAAO,CAKtC;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EACjC,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,KAAK,MAAM,GACzC,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAE1B"}
@@ -1,20 +0,0 @@
1
- import type { Condition, ExpressionBuilder } from '@rocicorp/zero';
2
- import type { AuthData, Schema, TableName, Where } from './types';
3
- /**
4
- * A permission builder that works for any table with a given relationship.
5
- * Uses weaker typing than serverWhere to avoid expensive union distribution.
6
- *
7
- * Use this when the permission logic only traverses relationships,
8
- * not table-specific fields.
9
- *
10
- * @example
11
- * // Instead of:
12
- * const perm = serverWhere<RelatedToServer>((_, auth) =>
13
- * _.exists('server', q => q.whereExists('role', ...)))
14
- *
15
- * // Use:
16
- * const perm = relationWhere('server', (_, auth) =>
17
- * _.exists('server', q => q.whereExists('role', ...)))
18
- */
19
- export declare function relationWhere<RelName extends string>(_relationName: RelName, builder: (eb: ExpressionBuilder<any, Schema>, auth?: AuthData | null) => Condition): Where<TableName, Condition>;
20
- //# sourceMappingURL=relationWhere.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"relationWhere.d.ts","sourceRoot":"","sources":["../src/relationWhere.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAGjE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,OAAO,SAAS,MAAM,EAClD,aAAa,EAAE,OAAO,EACtB,OAAO,EAAE,CACP,EAAE,EAAE,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,EAClC,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,KACnB,SAAS,GACb,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAI7B"}