@isaijs/core 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/index.js +2 -2
- package/dist/cli/index.js +1 -1
- package/dist/{create-auth-Ci0PaBoX.js → create-auth-9y_43vJf.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/{policies-CKIdBFKt.js → policies-D_G5Rmxv.js} +17 -7
- package/dist/{resource-CsYksjKc.js → resource-CkzoR3Rq.js} +1 -1
- package/package.json +1 -1
package/dist/auth/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as Policy } from "../policies-
|
|
2
|
-
import { a as createAuth, t as Auth } from "../create-auth-
|
|
1
|
+
import { t as Policy } from "../policies-D_G5Rmxv.js";
|
|
2
|
+
import { a as createAuth, t as Auth } from "../create-auth-9y_43vJf.js";
|
|
3
3
|
export { Auth, Policy, createAuth };
|
package/dist/cli/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { V as toKind, z as object } from "../validation-Cppmd0RV.js";
|
|
3
3
|
import { M as dialectFor, m as emptySnapshot, r as sync, t as migrate, y as MigrationError } from "../migrator-BU3_PHk8.js";
|
|
4
|
-
import { a as lookupsOf, i as filterableOf, n as isRequired, t as Resource, u as Route } from "../resource-
|
|
4
|
+
import { a as lookupsOf, i as filterableOf, n as isRequired, t as Resource, u as Route } from "../resource-CkzoR3Rq.js";
|
|
5
5
|
import { F as sensitivity, c as fieldOf, r as Model } from "../base64url-C5GTYIL5.js";
|
|
6
6
|
import { t as kebabCase } from "../case-BnpcvhdW.js";
|
|
7
7
|
import { i as makeMigrations, n as checkSteps, t as checkMigrations } from "../make-DKBn79cH.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as fromBase64url } from "./base64url-C5GTYIL5.js";
|
|
2
2
|
import { n as PROVIDERS } from "./tables-IrLjsomf.js";
|
|
3
|
-
import { a as byRole, c as tenant, i as anyone, l as user, n as PolicyRegistry, o as owner, s as readsTenant } from "./policies-
|
|
3
|
+
import { a as byRole, c as tenant, i as anyone, l as user, n as PolicyRegistry, o as owner, s as readsTenant } from "./policies-D_G5Rmxv.js";
|
|
4
4
|
//#region src/auth/create-auth.ts
|
|
5
5
|
const methods = { oauth: (provider, options) => ({
|
|
6
6
|
kind: "oauth",
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { G as ValidationError, H as validate, V as toKind, h as line, o as fileTypeNames, p as email, z as object } from "./validation-Cppmd0RV.js";
|
|
2
2
|
import { B as NeedsDatabase, C as database, D as planInsert, E as recordAction, F as systemClock, J as UniqueFailed, K as NotFound, L as PLATFORM, O as planUpdate, R as TENANT, S as clockOf, U as modelOfRow, V as evaluate, j as conditionOf, k as keyCondition, r as sync, t as migrate, w as decodeStored, z as checkTenancy } from "./migrator-BU3_PHk8.js";
|
|
3
|
-
import { C as tooLarge, E as fail, S as tenantSuspended, T as Rejected, _ as json, b as routeNotFound, c as fromBody, d as route, f as HttpError, g as fileTypeRefused, h as fileTooLarge, l as readInput, m as errorResponse, o as parseListQuery, p as crossSiteRequest, r as resource, s as BODY_LIMIT, t as Resource, u as Route, v as lengthRequired, w as tooManyRequests, x as signInRequired, y as methodNotAllowed } from "./resource-
|
|
3
|
+
import { C as tooLarge, E as fail, S as tenantSuspended, T as Rejected, _ as json, b as routeNotFound, c as fromBody, d as route, f as HttpError, g as fileTypeRefused, h as fileTooLarge, l as readInput, m as errorResponse, o as parseListQuery, p as crossSiteRequest, r as resource, s as BODY_LIMIT, t as Resource, u as Route, v as lengthRequired, w as tooManyRequests, x as signInRequired, y as methodNotAllowed } from "./resource-CkzoR3Rq.js";
|
|
4
4
|
import { F as sensitivity, G as ulid, K as Scope, V as asActor, a as columnName, b as asCondition$1, c as fieldOf, f as Condition, m as Expr, n as toBase64url, r as Model, t as fromBase64url, u as rowOf } from "./base64url-C5GTYIL5.js";
|
|
5
5
|
import { t as kebabCase } from "./case-BnpcvhdW.js";
|
|
6
6
|
import { t as PLATFORM_PREFIX } from "./tables-IrLjsomf.js";
|
|
7
7
|
import { t as Seed } from "./seed-BObmdKdP.js";
|
|
8
8
|
import { n as notImplemented, t as NotImplementedError } from "./errors-mCNLlXg9.js";
|
|
9
|
-
import { d as afterUpdate, f as bindFor, h as ownerFieldOf, m as isFalse, p as check, u as FALSE } from "./policies-
|
|
10
|
-
import { i as checkRoles, n as authPerms, r as checkAuth } from "./create-auth-
|
|
9
|
+
import { d as afterUpdate, f as bindFor, h as ownerFieldOf, m as isFalse, p as check, u as FALSE } from "./policies-D_G5Rmxv.js";
|
|
10
|
+
import { i as checkRoles, n as authPerms, r as checkAuth } from "./create-auth-9y_43vJf.js";
|
|
11
11
|
import { _ as permissionsOf, a as hashOf, b as syncRoles, c as GoogleError, f as verifyIdToken, g as safeReturn, h as redirect, i as clearedCookie, l as consentUrl, m as cookieOf, n as authModels, o as sessions, p as cookie, t as makers, u as exchangeCode, v as roleKeys, y as seedAs } from "./makers-DeSNM0Nd.js";
|
|
12
12
|
import { t as WrongSize } from "./storage-body-7dWyMszh.js";
|
|
13
13
|
import { RegExpRouter } from "hono/router/reg-exp-router";
|
|
@@ -10,6 +10,11 @@ import { D as nodesOf, U as isRecorded, a as columnName, f as Condition, m as Ex
|
|
|
10
10
|
* user.<field> → the user's value (null when anonymous)
|
|
11
11
|
* tenant.<field> → the tenant's value
|
|
12
12
|
*
|
|
13
|
+
* A comparison with a value that's null now (`row.author.is(user.id)` for an anonymous asker) is
|
|
14
|
+
* false now, as SQL's would be: so a rule that holds for no row is a denial (401 anonymous), not
|
|
15
|
+
* an empty list. Only where the comparison counts as itself: under a `not` (or as a value) SQL's
|
|
16
|
+
* "unknown" isn't false, so it's left to the database.
|
|
17
|
+
*
|
|
13
18
|
* A user's permissions are loaded once per request, on the first `byRole` that needs them.
|
|
14
19
|
*/
|
|
15
20
|
const TRUE = {
|
|
@@ -32,7 +37,7 @@ function bindOperand(node, asker, holds, model) {
|
|
|
32
37
|
};
|
|
33
38
|
case "truth": return {
|
|
34
39
|
t: "truth",
|
|
35
|
-
condition: bindNode(node.condition, asker, holds, model)
|
|
40
|
+
condition: bindNode(node.condition, asker, holds, model, false)
|
|
36
41
|
};
|
|
37
42
|
case "math": return {
|
|
38
43
|
...node,
|
|
@@ -54,9 +59,9 @@ function bindOperand(node, asker, holds, model) {
|
|
|
54
59
|
default: return node;
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
|
-
function bindNode(node, asker, holds, model) {
|
|
62
|
+
function bindNode(node, asker, holds, model, positive = true) {
|
|
58
63
|
const operand = (o) => bindOperand(o, asker, holds, model);
|
|
59
|
-
const condition = (c) => bindNode(c, asker, holds, model);
|
|
64
|
+
const condition = (c) => bindNode(c, asker, holds, model, positive);
|
|
60
65
|
switch (node.t) {
|
|
61
66
|
case "placeholder": {
|
|
62
67
|
if (node.name === "anyone") return TRUE;
|
|
@@ -69,7 +74,7 @@ function bindNode(node, asker, holds, model) {
|
|
|
69
74
|
...node,
|
|
70
75
|
left: operand(node.left),
|
|
71
76
|
right: operand(node.right)
|
|
72
|
-
});
|
|
77
|
+
}, positive);
|
|
73
78
|
case "isNull": return {
|
|
74
79
|
...node,
|
|
75
80
|
operand: operand(node.operand)
|
|
@@ -100,7 +105,7 @@ function bindNode(node, asker, holds, model) {
|
|
|
100
105
|
};
|
|
101
106
|
}
|
|
102
107
|
case "not": {
|
|
103
|
-
const item =
|
|
108
|
+
const item = bindNode(node.item, asker, holds, model, false);
|
|
104
109
|
if (isTrue(item)) return FALSE;
|
|
105
110
|
if (isFalse(item)) return TRUE;
|
|
106
111
|
return {
|
|
@@ -110,8 +115,13 @@ function bindNode(node, asker, holds, model) {
|
|
|
110
115
|
}
|
|
111
116
|
}
|
|
112
117
|
}
|
|
113
|
-
/**
|
|
114
|
-
|
|
118
|
+
/**
|
|
119
|
+
* A comparison of two values known now (`tenant.coupons.is(true)`) is decided now; so is one with a
|
|
120
|
+
* value null now, where it counts as itself (`positive`): SQL's `x = NULL` matches no row.
|
|
121
|
+
*/
|
|
122
|
+
function simplifyCompare(node, positive) {
|
|
123
|
+
const isNullValue = (o) => o.t === "value" && (o.value === null || o.value === void 0);
|
|
124
|
+
if (isNullValue(node.left) || isNullValue(node.right)) return positive ? FALSE : node;
|
|
115
125
|
if (node.left.t !== "value" || node.right.t !== "value") return node;
|
|
116
126
|
const [a, b] = [node.left.value, node.right.value].map((v) => v instanceof Date ? v.getTime() : v);
|
|
117
127
|
if (a === null || b === null || a === void 0 || b === void 0) return FALSE;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { G as ValidationError, H as validate, V as toKind, z as object } from "./validation-Cppmd0RV.js";
|
|
2
2
|
import { J as UniqueFailed, K as NotFound, W as CheckFailed, q as ReferenceFailed } from "./migrator-BU3_PHk8.js";
|
|
3
3
|
import { a as columnName, b as asCondition, j as IMPLICIT_FIELDS, l as computedFieldOf, m as Expr, p as Embed } from "./base64url-C5GTYIL5.js";
|
|
4
|
-
import { r as actionsOf } from "./policies-
|
|
4
|
+
import { r as actionsOf } from "./policies-D_G5Rmxv.js";
|
|
5
5
|
import { n as RESERVED, t as LOOKUPS } from "./syntax-CrUZFrS7.js";
|
|
6
6
|
//#region src/api/fail.ts
|
|
7
7
|
/**
|