@cerbos/orm-prisma 1.0.0-alpha.0 → 1.1.0-alpha.1
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/README.md +1 -1
- package/lib/cjs/index.d.ts +1 -1
- package/lib/cjs/index.js +135 -110
- package/lib/index.d.ts +1 -1
- package/lib/index.js +136 -111
- package/package.json +2 -2
package/README.md
CHANGED
package/lib/cjs/index.d.ts
CHANGED
|
@@ -20,5 +20,5 @@ interface QueryPlanToPrismaResult {
|
|
|
20
20
|
kind: PlanKind;
|
|
21
21
|
filters?: any;
|
|
22
22
|
}
|
|
23
|
-
export declare function queryPlanToPrisma({ queryPlan, fieldNameMapper, relationMapper }: QueryPlanToPrismaArgs): QueryPlanToPrismaResult;
|
|
23
|
+
export declare function queryPlanToPrisma({ queryPlan, fieldNameMapper, relationMapper, }: QueryPlanToPrismaArgs): QueryPlanToPrismaResult;
|
|
24
24
|
export {};
|
package/lib/cjs/index.js
CHANGED
|
@@ -3,35 +3,45 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.queryPlanToPrisma = exports.PlanKind = void 0;
|
|
4
4
|
const core_1 = require("@cerbos/core");
|
|
5
5
|
exports.PlanKind = core_1.PlanKind;
|
|
6
|
-
function queryPlanToPrisma({ queryPlan, fieldNameMapper, relationMapper = {} }) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (typeof relationMapper === "function") {
|
|
27
|
-
return relationMapper(key);
|
|
28
|
-
}
|
|
29
|
-
else if (relationMapper[key]) {
|
|
30
|
-
return relationMapper[key];
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
33
|
-
}, {})
|
|
6
|
+
function queryPlanToPrisma({ queryPlan, fieldNameMapper, relationMapper = {}, }) {
|
|
7
|
+
const toFieldName = (key) => {
|
|
8
|
+
if (typeof fieldNameMapper === "function") {
|
|
9
|
+
return fieldNameMapper(key);
|
|
10
|
+
}
|
|
11
|
+
else if (fieldNameMapper[key]) {
|
|
12
|
+
return fieldNameMapper[key];
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return key;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const toRelationName = (key) => {
|
|
19
|
+
if (typeof relationMapper === "function") {
|
|
20
|
+
return relationMapper(key);
|
|
21
|
+
}
|
|
22
|
+
else if (relationMapper[key]) {
|
|
23
|
+
return relationMapper[key];
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
34
26
|
};
|
|
27
|
+
switch (queryPlan.kind) {
|
|
28
|
+
case exports.PlanKind.ALWAYS_ALLOWED:
|
|
29
|
+
return {
|
|
30
|
+
kind: exports.PlanKind.ALWAYS_ALLOWED,
|
|
31
|
+
filters: {},
|
|
32
|
+
};
|
|
33
|
+
case exports.PlanKind.ALWAYS_DENIED:
|
|
34
|
+
return {
|
|
35
|
+
kind: exports.PlanKind.ALWAYS_DENIED,
|
|
36
|
+
};
|
|
37
|
+
case exports.PlanKind.CONDITIONAL:
|
|
38
|
+
return {
|
|
39
|
+
kind: exports.PlanKind.CONDITIONAL,
|
|
40
|
+
filters: mapOperand(queryPlan.condition, toFieldName, toRelationName),
|
|
41
|
+
};
|
|
42
|
+
default:
|
|
43
|
+
throw Error(`Invalid query plan.`);
|
|
44
|
+
}
|
|
35
45
|
}
|
|
36
46
|
exports.queryPlanToPrisma = queryPlanToPrisma;
|
|
37
47
|
function isExpression(e) {
|
|
@@ -43,102 +53,117 @@ function isValue(e) {
|
|
|
43
53
|
function isVariable(e) {
|
|
44
54
|
return e.variable !== undefined;
|
|
45
55
|
}
|
|
46
|
-
function
|
|
47
|
-
const op = operands.find(o => o.hasOwnProperty("name"));
|
|
56
|
+
function getOperandVariable(operands) {
|
|
57
|
+
const op = operands.find((o) => o.hasOwnProperty("name"));
|
|
48
58
|
if (!op)
|
|
49
59
|
return;
|
|
50
60
|
return op.name;
|
|
51
61
|
}
|
|
52
62
|
function getOperandValue(operands) {
|
|
53
|
-
const op = operands.find(o => o
|
|
63
|
+
const op = operands.find((o) => isValue(o));
|
|
54
64
|
if (!op)
|
|
55
65
|
return;
|
|
56
66
|
return op.value;
|
|
57
67
|
}
|
|
68
|
+
const OPERATORS = {
|
|
69
|
+
eq: {
|
|
70
|
+
relationalCondition: "is",
|
|
71
|
+
fieldCondition: "equals",
|
|
72
|
+
},
|
|
73
|
+
ne: {
|
|
74
|
+
relationalCondition: "isNot",
|
|
75
|
+
fieldCondition: "not",
|
|
76
|
+
},
|
|
77
|
+
in: {
|
|
78
|
+
relationalCondition: "some",
|
|
79
|
+
fieldCondition: "in",
|
|
80
|
+
},
|
|
81
|
+
lt: {
|
|
82
|
+
fieldCondition: "lt",
|
|
83
|
+
},
|
|
84
|
+
gt: {
|
|
85
|
+
fieldCondition: "gt",
|
|
86
|
+
},
|
|
87
|
+
le: {
|
|
88
|
+
fieldCondition: "lte",
|
|
89
|
+
},
|
|
90
|
+
ge: {
|
|
91
|
+
fieldCondition: "gte",
|
|
92
|
+
},
|
|
93
|
+
};
|
|
58
94
|
function mapOperand(operand, getFieldName, getRelationName, output = {}) {
|
|
59
|
-
if (isExpression(operand))
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (operator == "lt" && fieldName) {
|
|
109
|
-
output[fieldName] = {
|
|
110
|
-
lt: opValue,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
if (operator == "gt" && fieldName) {
|
|
114
|
-
output[fieldName] = {
|
|
115
|
-
gt: opValue,
|
|
116
|
-
};
|
|
95
|
+
if (!isExpression(operand))
|
|
96
|
+
throw Error(`Query plan did not contain an expression for operand ${operand}`);
|
|
97
|
+
const { operator, operands } = operand;
|
|
98
|
+
// HANDLE NESTING OPERATIONS: AND/OR/NOT
|
|
99
|
+
if (operator == "and") {
|
|
100
|
+
if (operands.length < 2)
|
|
101
|
+
throw Error("Expected atleast 2 operands");
|
|
102
|
+
output.AND = operands.map((o) => mapOperand(o, getFieldName, getRelationName, {}));
|
|
103
|
+
return output;
|
|
104
|
+
}
|
|
105
|
+
if (operator == "or") {
|
|
106
|
+
if (operands.length < 2)
|
|
107
|
+
throw Error("Expected atleast 2 operands");
|
|
108
|
+
output.OR = operands.map((o) => mapOperand(o, getFieldName, getRelationName, {}));
|
|
109
|
+
return output;
|
|
110
|
+
}
|
|
111
|
+
if (operator == "not") {
|
|
112
|
+
if (operands.length > 1)
|
|
113
|
+
throw Error("Expected only one operand");
|
|
114
|
+
output.NOT = operands.map((o) => mapOperand(o, getFieldName, getRelationName, {}))[0];
|
|
115
|
+
return output;
|
|
116
|
+
}
|
|
117
|
+
// get the operation parameters
|
|
118
|
+
const operation = OPERATORS[operator];
|
|
119
|
+
if (!operation)
|
|
120
|
+
throw Error(`Unsupported operator ${operator}`);
|
|
121
|
+
const opVariable = getOperandVariable(operands);
|
|
122
|
+
if (!opVariable)
|
|
123
|
+
throw Error(`Unexpected variable ${operands}`);
|
|
124
|
+
const opValue = getOperandValue(operands);
|
|
125
|
+
const relation = getRelationName(opVariable);
|
|
126
|
+
const fieldName = getFieldName(opVariable);
|
|
127
|
+
// There is a relational mapper for this variable
|
|
128
|
+
if (relation && operation.relationalCondition) {
|
|
129
|
+
output[relation.relation] = {
|
|
130
|
+
[operation.relationalCondition]: {
|
|
131
|
+
[relation.field]: opValue,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
return output;
|
|
135
|
+
}
|
|
136
|
+
else if (fieldName && operation.fieldCondition) {
|
|
137
|
+
// There is a field mapper for this variable
|
|
138
|
+
const fieldPath = fieldName.split(".");
|
|
139
|
+
if (fieldPath.length > 1) {
|
|
140
|
+
output[fieldPath[0]] = convertPathToJSON(fieldPath.splice(1), {
|
|
141
|
+
[operation.fieldCondition]: opValue,
|
|
142
|
+
});
|
|
117
143
|
}
|
|
118
|
-
|
|
119
|
-
output[
|
|
120
|
-
|
|
144
|
+
else {
|
|
145
|
+
output[fieldPath[0]] = {
|
|
146
|
+
[operation.fieldCondition]: opValue,
|
|
121
147
|
};
|
|
122
148
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
149
|
+
return output;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
throw Error("Failed to map");
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function convertPathToJSON(segments, value) {
|
|
156
|
+
const result = {};
|
|
157
|
+
let current = result;
|
|
158
|
+
for (let i = 0; i < segments.length; i++) {
|
|
159
|
+
const segment = segments[i];
|
|
160
|
+
if (i === segments.length - 1) {
|
|
161
|
+
current[segment] = value;
|
|
127
162
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
some: {
|
|
132
|
-
[relation.field]: opValue
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
else if (fieldName) {
|
|
137
|
-
output[fieldName] = {
|
|
138
|
-
in: opValue,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
163
|
+
else {
|
|
164
|
+
current[segment] = {};
|
|
165
|
+
current = current[segment];
|
|
141
166
|
}
|
|
142
167
|
}
|
|
143
|
-
return
|
|
168
|
+
return result;
|
|
144
169
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -20,5 +20,5 @@ interface QueryPlanToPrismaResult {
|
|
|
20
20
|
kind: PlanKind;
|
|
21
21
|
filters?: any;
|
|
22
22
|
}
|
|
23
|
-
export declare function queryPlanToPrisma({ queryPlan, fieldNameMapper, relationMapper }: QueryPlanToPrismaArgs): QueryPlanToPrismaResult;
|
|
23
|
+
export declare function queryPlanToPrisma({ queryPlan, fieldNameMapper, relationMapper, }: QueryPlanToPrismaArgs): QueryPlanToPrismaResult;
|
|
24
24
|
export {};
|
package/lib/index.js
CHANGED
|
@@ -1,34 +1,44 @@
|
|
|
1
|
-
import { PlanKind as PK } from "@cerbos/core";
|
|
1
|
+
import { PlanKind as PK, } from "@cerbos/core";
|
|
2
2
|
export const PlanKind = PK;
|
|
3
|
-
export function queryPlanToPrisma({ queryPlan, fieldNameMapper, relationMapper = {} }) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (typeof relationMapper === "function") {
|
|
24
|
-
return relationMapper(key);
|
|
25
|
-
}
|
|
26
|
-
else if (relationMapper[key]) {
|
|
27
|
-
return relationMapper[key];
|
|
28
|
-
}
|
|
29
|
-
return null;
|
|
30
|
-
}, {})
|
|
3
|
+
export function queryPlanToPrisma({ queryPlan, fieldNameMapper, relationMapper = {}, }) {
|
|
4
|
+
const toFieldName = (key) => {
|
|
5
|
+
if (typeof fieldNameMapper === "function") {
|
|
6
|
+
return fieldNameMapper(key);
|
|
7
|
+
}
|
|
8
|
+
else if (fieldNameMapper[key]) {
|
|
9
|
+
return fieldNameMapper[key];
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return key;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const toRelationName = (key) => {
|
|
16
|
+
if (typeof relationMapper === "function") {
|
|
17
|
+
return relationMapper(key);
|
|
18
|
+
}
|
|
19
|
+
else if (relationMapper[key]) {
|
|
20
|
+
return relationMapper[key];
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
31
23
|
};
|
|
24
|
+
switch (queryPlan.kind) {
|
|
25
|
+
case PlanKind.ALWAYS_ALLOWED:
|
|
26
|
+
return {
|
|
27
|
+
kind: PlanKind.ALWAYS_ALLOWED,
|
|
28
|
+
filters: {},
|
|
29
|
+
};
|
|
30
|
+
case PlanKind.ALWAYS_DENIED:
|
|
31
|
+
return {
|
|
32
|
+
kind: PlanKind.ALWAYS_DENIED,
|
|
33
|
+
};
|
|
34
|
+
case PlanKind.CONDITIONAL:
|
|
35
|
+
return {
|
|
36
|
+
kind: PlanKind.CONDITIONAL,
|
|
37
|
+
filters: mapOperand(queryPlan.condition, toFieldName, toRelationName),
|
|
38
|
+
};
|
|
39
|
+
default:
|
|
40
|
+
throw Error(`Invalid query plan.`);
|
|
41
|
+
}
|
|
32
42
|
}
|
|
33
43
|
function isExpression(e) {
|
|
34
44
|
return e.operator !== undefined;
|
|
@@ -39,102 +49,117 @@ function isValue(e) {
|
|
|
39
49
|
function isVariable(e) {
|
|
40
50
|
return e.variable !== undefined;
|
|
41
51
|
}
|
|
42
|
-
function
|
|
43
|
-
const op = operands.find(o => o.hasOwnProperty("name"));
|
|
52
|
+
function getOperandVariable(operands) {
|
|
53
|
+
const op = operands.find((o) => o.hasOwnProperty("name"));
|
|
44
54
|
if (!op)
|
|
45
55
|
return;
|
|
46
56
|
return op.name;
|
|
47
57
|
}
|
|
48
58
|
function getOperandValue(operands) {
|
|
49
|
-
const op = operands.find(o => o
|
|
59
|
+
const op = operands.find((o) => isValue(o));
|
|
50
60
|
if (!op)
|
|
51
61
|
return;
|
|
52
62
|
return op.value;
|
|
53
63
|
}
|
|
64
|
+
const OPERATORS = {
|
|
65
|
+
eq: {
|
|
66
|
+
relationalCondition: "is",
|
|
67
|
+
fieldCondition: "equals",
|
|
68
|
+
},
|
|
69
|
+
ne: {
|
|
70
|
+
relationalCondition: "isNot",
|
|
71
|
+
fieldCondition: "not",
|
|
72
|
+
},
|
|
73
|
+
in: {
|
|
74
|
+
relationalCondition: "some",
|
|
75
|
+
fieldCondition: "in",
|
|
76
|
+
},
|
|
77
|
+
lt: {
|
|
78
|
+
fieldCondition: "lt",
|
|
79
|
+
},
|
|
80
|
+
gt: {
|
|
81
|
+
fieldCondition: "gt",
|
|
82
|
+
},
|
|
83
|
+
le: {
|
|
84
|
+
fieldCondition: "lte",
|
|
85
|
+
},
|
|
86
|
+
ge: {
|
|
87
|
+
fieldCondition: "gte",
|
|
88
|
+
},
|
|
89
|
+
};
|
|
54
90
|
function mapOperand(operand, getFieldName, getRelationName, output = {}) {
|
|
55
|
-
if (isExpression(operand))
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
if (operator == "lt" && fieldName) {
|
|
105
|
-
output[fieldName] = {
|
|
106
|
-
lt: opValue,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
if (operator == "gt" && fieldName) {
|
|
110
|
-
output[fieldName] = {
|
|
111
|
-
gt: opValue,
|
|
112
|
-
};
|
|
91
|
+
if (!isExpression(operand))
|
|
92
|
+
throw Error(`Query plan did not contain an expression for operand ${operand}`);
|
|
93
|
+
const { operator, operands } = operand;
|
|
94
|
+
// HANDLE NESTING OPERATIONS: AND/OR/NOT
|
|
95
|
+
if (operator == "and") {
|
|
96
|
+
if (operands.length < 2)
|
|
97
|
+
throw Error("Expected atleast 2 operands");
|
|
98
|
+
output.AND = operands.map((o) => mapOperand(o, getFieldName, getRelationName, {}));
|
|
99
|
+
return output;
|
|
100
|
+
}
|
|
101
|
+
if (operator == "or") {
|
|
102
|
+
if (operands.length < 2)
|
|
103
|
+
throw Error("Expected atleast 2 operands");
|
|
104
|
+
output.OR = operands.map((o) => mapOperand(o, getFieldName, getRelationName, {}));
|
|
105
|
+
return output;
|
|
106
|
+
}
|
|
107
|
+
if (operator == "not") {
|
|
108
|
+
if (operands.length > 1)
|
|
109
|
+
throw Error("Expected only one operand");
|
|
110
|
+
output.NOT = operands.map((o) => mapOperand(o, getFieldName, getRelationName, {}))[0];
|
|
111
|
+
return output;
|
|
112
|
+
}
|
|
113
|
+
// get the operation parameters
|
|
114
|
+
const operation = OPERATORS[operator];
|
|
115
|
+
if (!operation)
|
|
116
|
+
throw Error(`Unsupported operator ${operator}`);
|
|
117
|
+
const opVariable = getOperandVariable(operands);
|
|
118
|
+
if (!opVariable)
|
|
119
|
+
throw Error(`Unexpected variable ${operands}`);
|
|
120
|
+
const opValue = getOperandValue(operands);
|
|
121
|
+
const relation = getRelationName(opVariable);
|
|
122
|
+
const fieldName = getFieldName(opVariable);
|
|
123
|
+
// There is a relational mapper for this variable
|
|
124
|
+
if (relation && operation.relationalCondition) {
|
|
125
|
+
output[relation.relation] = {
|
|
126
|
+
[operation.relationalCondition]: {
|
|
127
|
+
[relation.field]: opValue,
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
return output;
|
|
131
|
+
}
|
|
132
|
+
else if (fieldName && operation.fieldCondition) {
|
|
133
|
+
// There is a field mapper for this variable
|
|
134
|
+
const fieldPath = fieldName.split(".");
|
|
135
|
+
if (fieldPath.length > 1) {
|
|
136
|
+
output[fieldPath[0]] = convertPathToJSON(fieldPath.splice(1), {
|
|
137
|
+
[operation.fieldCondition]: opValue,
|
|
138
|
+
});
|
|
113
139
|
}
|
|
114
|
-
|
|
115
|
-
output[
|
|
116
|
-
|
|
140
|
+
else {
|
|
141
|
+
output[fieldPath[0]] = {
|
|
142
|
+
[operation.fieldCondition]: opValue,
|
|
117
143
|
};
|
|
118
144
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
145
|
+
return output;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
throw Error("Failed to map");
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function convertPathToJSON(segments, value) {
|
|
152
|
+
const result = {};
|
|
153
|
+
let current = result;
|
|
154
|
+
for (let i = 0; i < segments.length; i++) {
|
|
155
|
+
const segment = segments[i];
|
|
156
|
+
if (i === segments.length - 1) {
|
|
157
|
+
current[segment] = value;
|
|
123
158
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
some: {
|
|
128
|
-
[relation.field]: opValue
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
else if (fieldName) {
|
|
133
|
-
output[fieldName] = {
|
|
134
|
-
in: opValue,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
159
|
+
else {
|
|
160
|
+
current[segment] = {};
|
|
161
|
+
current = current[segment];
|
|
137
162
|
}
|
|
138
163
|
}
|
|
139
|
-
return
|
|
164
|
+
return result;
|
|
140
165
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerbos/orm-prisma",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0-alpha.1",
|
|
4
4
|
"homepage": "https://cerbos.dev",
|
|
5
5
|
"description": "",
|
|
6
6
|
"private": false,
|
|
@@ -33,4 +33,4 @@
|
|
|
33
33
|
"@cerbos/core": "^0.5.1",
|
|
34
34
|
"@cerbos/grpc": "^0.8.0"
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
}
|