@loradb/lora-graphql 0.20.2 → 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 +523 -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-BO2igqdY.js → diff-B9iDdELF.js} +13 -12
- package/dist/{diff-BO2igqdY.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 +141 -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-XeJM24iP.js +0 -11778
- package/dist/driver-XeJM24iP.js.map +0 -1
package/dist/model/types.d.ts
CHANGED
|
@@ -84,7 +84,11 @@ export interface ScalarField extends FieldBase {
|
|
|
84
84
|
} | undefined;
|
|
85
85
|
description: string | undefined;
|
|
86
86
|
}
|
|
87
|
-
export type NestedOperation = "CREATE" | "CONNECT" | "DISCONNECT"
|
|
87
|
+
export type NestedOperation = "CREATE" | "CONNECT" | "DISCONNECT"
|
|
88
|
+
/** `update: [{ key, edge, node }]`: the connected node and the properties. */
|
|
89
|
+
| "UPDATE"
|
|
90
|
+
/** `update: [{ key, edge }]`: the relationship's properties only. */
|
|
91
|
+
| "UPDATE_EDGE" | "DELETE";
|
|
88
92
|
export interface RelationshipField extends FieldBase {
|
|
89
93
|
kind: "relationship";
|
|
90
94
|
name: string;
|
|
@@ -140,6 +144,13 @@ export interface CypherArgument {
|
|
|
140
144
|
type: TypeShape;
|
|
141
145
|
defaultValue: unknown;
|
|
142
146
|
description: string | undefined;
|
|
147
|
+
/** `@size(max:)`: the most items a list argument takes. */
|
|
148
|
+
maxItems?: number | undefined;
|
|
149
|
+
/** `@range(min:, max:)`: bounds of an Int or Float argument. */
|
|
150
|
+
range?: {
|
|
151
|
+
min?: number | undefined;
|
|
152
|
+
max?: number | undefined;
|
|
153
|
+
} | undefined;
|
|
143
154
|
}
|
|
144
155
|
export interface CypherField extends FieldBase {
|
|
145
156
|
kind: "cypher";
|
|
@@ -180,8 +191,15 @@ export interface CustomField extends FieldBase {
|
|
|
180
191
|
description: string | undefined;
|
|
181
192
|
}
|
|
182
193
|
export type Field = ScalarField | RelationshipField | CypherField | CustomField;
|
|
183
|
-
/**
|
|
194
|
+
/**
|
|
195
|
+
* A placeholder inside a rule string: `${jwt.path}`, `${context.path}`,
|
|
196
|
+
* `${viewer.field}`, or a value of the node the rule is about:
|
|
197
|
+
* `${node.path}` in a type's rules, `${source.path}` / `${target.path}` /
|
|
198
|
+
* `${edge.property}` in a relationship field's rules.
|
|
199
|
+
*/
|
|
184
200
|
export declare const PLACEHOLDER: RegExp;
|
|
201
|
+
/** The placeholder sources that name a node (or edge) of the rule itself. */
|
|
202
|
+
export declare const RULE_REFERENCES: Set<string>;
|
|
185
203
|
/** `{ node, jwt, AND, OR, NOT }`, as written in `@authorization`. */
|
|
186
204
|
export type AuthorizationWhere = Record<string, unknown>;
|
|
187
205
|
export interface AuthorizationFilterRule {
|
|
@@ -202,7 +220,10 @@ export interface AuthorizationValidateRule {
|
|
|
202
220
|
export interface Authorization {
|
|
203
221
|
filter: readonly AuthorizationFilterRule[];
|
|
204
222
|
validate: readonly AuthorizationValidateRule[];
|
|
205
|
-
/**
|
|
223
|
+
/**
|
|
224
|
+
* `bypass: false`: the schema's bypass does not skip these rules.
|
|
225
|
+
* `true`: it does, as when left out, and `check()` does not note it.
|
|
226
|
+
*/
|
|
206
227
|
bypass?: boolean;
|
|
207
228
|
/** `public:` operations deliberately open to every caller. */
|
|
208
229
|
public?: ReadonlySet<AuthOperation>;
|
|
@@ -248,8 +269,28 @@ export interface NodeType {
|
|
|
248
269
|
search: readonly SearchIndex[];
|
|
249
270
|
/** Interfaces the type implements. */
|
|
250
271
|
interfaces: readonly string[];
|
|
272
|
+
/** `@uniqueTogether`: combinations no two nodes of the type may share. */
|
|
273
|
+
uniqueTogether: readonly UniqueTogether[];
|
|
251
274
|
description: string | undefined;
|
|
252
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* `@uniqueTogether(fields:, where:)`: no two nodes of the type (among those
|
|
278
|
+
* matching `where`) hold the same value of every field. A combination
|
|
279
|
+
* with a null scalar, a missing single relationship or an empty set is
|
|
280
|
+
* exempt, as a null is in a unique index.
|
|
281
|
+
*/
|
|
282
|
+
export interface UniqueTogether {
|
|
283
|
+
/** The fields as declared, for messages. */
|
|
284
|
+
fields: readonly string[];
|
|
285
|
+
/** Scalar fields, compared by stored value. */
|
|
286
|
+
scalars: readonly ScalarField[];
|
|
287
|
+
/** Single relationships, compared by the target's @key. */
|
|
288
|
+
singles: readonly RelationshipField[];
|
|
289
|
+
/** At most one list relationship, compared as the set of target keys. */
|
|
290
|
+
set: RelationshipField | undefined;
|
|
291
|
+
/** A `<Type>Where`-shaped filter: only nodes matching it are compared. */
|
|
292
|
+
where: Record<string, unknown> | undefined;
|
|
293
|
+
}
|
|
253
294
|
export type SearchIndex = {
|
|
254
295
|
kind: "fulltext";
|
|
255
296
|
name: string;
|
|
@@ -346,6 +387,8 @@ export interface GraphModel {
|
|
|
346
387
|
} | undefined;
|
|
347
388
|
/** Secret cursors are signed with, when configured. */
|
|
348
389
|
cursorSecret: string | undefined;
|
|
390
|
+
/** The global page-size cap (`maxLimit`); also caps `nodes(ids:)`. */
|
|
391
|
+
maxLimit?: number | undefined;
|
|
349
392
|
}
|
|
350
393
|
export interface ModelWarning {
|
|
351
394
|
type: string;
|
package/dist/schema/build.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GraphQLSchema, GraphQLFieldResolver, GraphQLResolveInfo, GraphQLScalarType } from 'graphql';
|
|
2
2
|
import { RootKind } from '../compile/read.js';
|
|
3
|
-
import { AbstractType, CustomField, CypherField, GraphModel, NodeType, SearchIndex } from '../model/types.js';
|
|
3
|
+
import { AbstractType, CustomField, CypherField, GraphModel, NodeType, ScalarField, SearchIndex } from '../model/types.js';
|
|
4
4
|
import { MutationResolver } from './mutations.js';
|
|
5
5
|
/** One event of a generated subscription. */
|
|
6
6
|
export interface ChangeEvent {
|
|
@@ -22,6 +22,11 @@ export interface SchemaHooks {
|
|
|
22
22
|
resolveAbstract: (abstract: AbstractType, info: GraphQLResolveInfo, context: unknown) => Promise<unknown>;
|
|
23
23
|
subscribe: (node: NodeType, args: Record<string, unknown>, context: unknown) => AsyncIterable<ChangeEvent>;
|
|
24
24
|
resolveChangedNode: (node: NodeType, event: ChangeEvent, info: GraphQLResolveInfo, context: unknown) => Promise<unknown>;
|
|
25
|
+
/**
|
|
26
|
+
* A `previousState` value as the subscriber may see it: throws when
|
|
27
|
+
* field-level @authentication refuses it, applies masks by the claims.
|
|
28
|
+
*/
|
|
29
|
+
previousValue: (node: NodeType, field: ScalarField, value: unknown, context: unknown) => unknown;
|
|
25
30
|
/** Implementations of custom scalars, by name (the scalars option). */
|
|
26
31
|
scalars?: Readonly<Record<string, GraphQLScalarType>> | undefined;
|
|
27
32
|
/** The resolver of a `@customResolver` field (from the resolvers option). */
|
package/dist/testing.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loradb/lora-graphql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Schema-first GraphQL for LoraDB: one annotated SDL becomes an executable, index-aware GraphQL API that compiles every operation to a single Cypher statement.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"packageManager": "yarn@4.5.1",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"bench:load": "node bench/load/main.mjs"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@loradb/lora-node": "^0.
|
|
68
|
+
"@loradb/lora-node": "^0.22.0",
|
|
69
69
|
"graphql": "^16.8.0 || ^17.0.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|