@loradb/lora-graphql 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +500 -77
- package/dist/analyze/access.d.ts +45 -2
- package/dist/analyze/statistics.d.ts +1 -0
- package/dist/cli.js +386 -323
- package/dist/cli.js.map +1 -1
- package/dist/compile/auth.d.ts +49 -0
- package/dist/compile/cache.d.ts +11 -1
- package/dist/compile/context.d.ts +20 -0
- package/dist/compile/cost.d.ts +36 -0
- package/dist/compile/read.d.ts +7 -0
- package/dist/{diff-CcRU-3_p.js → diff-B9iDdELF.js} +13 -12
- package/dist/{diff-CcRU-3_p.js.map → diff-B9iDdELF.js.map} +1 -1
- package/dist/driver-C5dSoSD8.js +13905 -0
- package/dist/driver-C5dSoSD8.js.map +1 -0
- package/dist/driver.d.ts +2 -0
- package/dist/errors.d.ts +29 -1
- package/dist/execute/budget.d.ts +22 -0
- package/dist/execute/changes.d.ts +2 -0
- package/dist/execute/cypher-mutation.d.ts +4 -1
- package/dist/execute/mutate.d.ts +29 -1
- package/dist/guards.d.ts +19 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +19 -17
- package/dist/lora-graphql.d.ts +120 -13
- package/dist/model/desugar.d.ts +10 -0
- package/dist/model/directives.d.ts +1 -1
- package/dist/model/inputs.d.ts +9 -0
- package/dist/model/types.d.ts +46 -3
- package/dist/model/unique-together.d.ts +3 -0
- package/dist/schema/build.d.ts +6 -1
- package/dist/testing.js +1 -1
- package/package.json +2 -2
- package/dist/driver-DAtBEMWj.js +0 -11845
- package/dist/driver-DAtBEMWj.js.map +0 -1
package/dist/analyze/access.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GraphQLSchema } from 'graphql';
|
|
1
|
+
import { FragmentDefinitionNode, GraphQLSchema, OperationDefinitionNode } from 'graphql';
|
|
2
2
|
import { AuthOperation, GraphModel, ModelWarning } from '../model/types.js';
|
|
3
3
|
export type AccessVerdict =
|
|
4
4
|
/** Every row, for this caller. */
|
|
@@ -17,12 +17,55 @@ export interface AccessEntry {
|
|
|
17
17
|
type: string;
|
|
18
18
|
/** The field, for field-level and relationship rules. */
|
|
19
19
|
field?: string;
|
|
20
|
-
|
|
20
|
+
/** `EXECUTE`: running a Mutation @cypher field. */
|
|
21
|
+
operation: AuthOperation | "EXECUTE";
|
|
21
22
|
principal: string;
|
|
22
23
|
verdict: AccessVerdict;
|
|
23
24
|
/** What decides it: `filter[0]`, `validate[1]`, `@authentication`, `bypass`, … */
|
|
24
25
|
by: string[];
|
|
25
26
|
}
|
|
27
|
+
/** One root field of an operation, as each kind of caller. */
|
|
28
|
+
export interface RootFieldAccess {
|
|
29
|
+
/** The root field. */
|
|
30
|
+
field: string;
|
|
31
|
+
/** Its response key, when aliased. */
|
|
32
|
+
alias?: string;
|
|
33
|
+
/**
|
|
34
|
+
* What the field acts on: a node type, an interface or union, `Node`
|
|
35
|
+
* (for `node` / `nodes`), or `Query` / `Mutation` for a `@cypher` field.
|
|
36
|
+
*/
|
|
37
|
+
type: string;
|
|
38
|
+
/** The operations it needs: `READ`, `CREATE`, `UPDATE` …, `EXECUTE`. */
|
|
39
|
+
operations: Array<AuthOperation | "EXECUTE">;
|
|
40
|
+
/**
|
|
41
|
+
* Per principal (`anonymous`, `authenticated`, `roles:admin` …). A
|
|
42
|
+
* field over several operations or types (an upsert, `node`, a union)
|
|
43
|
+
* reports the most restrictive of them, `by` naming each part.
|
|
44
|
+
*/
|
|
45
|
+
access: Record<string, {
|
|
46
|
+
verdict: AccessVerdict;
|
|
47
|
+
by: string[];
|
|
48
|
+
}>;
|
|
49
|
+
}
|
|
50
|
+
export interface OperationAccess {
|
|
51
|
+
operation: "query" | "mutation" | "subscription";
|
|
52
|
+
name: string | undefined;
|
|
53
|
+
/** The principals, in the order the matrix lists them. */
|
|
54
|
+
principals: string[];
|
|
55
|
+
/** Root fields in document order (fragments followed); `__typename` left out. */
|
|
56
|
+
fields: RootFieldAccess[];
|
|
57
|
+
/**
|
|
58
|
+
* Per principal, the most restrictive verdict over the root fields:
|
|
59
|
+
* `denied` or `unauthenticated` means the operation cannot succeed.
|
|
60
|
+
*/
|
|
61
|
+
verdicts: Record<string, AccessVerdict>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Who may run `operation`: each root field's verdict per principal, read
|
|
65
|
+
* off the same rules as `accessMatrix`. Root fields only: nested
|
|
66
|
+
* selections answer to their own types' READ rules (see the matrix).
|
|
67
|
+
*/
|
|
68
|
+
export declare function operationAccess(model: GraphModel, schema: GraphQLSchema, operation: OperationDefinitionNode, fragments: ReadonlyMap<string, FragmentDefinitionNode>): OperationAccess;
|
|
26
69
|
/** The access matrix of `model`, in a stable order. */
|
|
27
70
|
export declare function accessMatrix(model: GraphModel, schema: GraphQLSchema): AccessEntry[];
|
|
28
71
|
/**
|