@loradb/lora-graphql 0.18.0 → 0.19.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 +15 -9
- package/dist/cli.js +2 -2
- package/dist/compile/read.d.ts +6 -0
- package/dist/{diff-fpWH5KUa.js → diff-BH4Na9pC.js} +2 -2
- package/dist/{diff-fpWH5KUa.js.map → diff-BH4Na9pC.js.map} +1 -1
- package/dist/{driver-CQj9gkvl.js → driver-CuXOoYWT.js} +1720 -1595
- package/dist/driver-CuXOoYWT.js.map +1 -0
- package/dist/driver.d.ts +17 -8
- package/dist/errors.d.ts +1 -1
- package/dist/execute/feed.d.ts +1 -1
- package/dist/guards.d.ts +13 -1
- package/dist/index.js +2 -2
- package/dist/lora-graphql.d.ts +13 -5
- package/dist/testing.js +1 -1
- package/package.json +4 -3
- package/dist/driver-CQj9gkvl.js.map +0 -1
package/dist/driver.d.ts
CHANGED
|
@@ -27,10 +27,15 @@ export interface RunOptions {
|
|
|
27
27
|
signal?: AbortSignal | undefined;
|
|
28
28
|
/**
|
|
29
29
|
* A read the library vouches for: generated, or a @cypher statement
|
|
30
|
-
* checked read-only at startup. The driver may
|
|
30
|
+
* checked read-only at startup. The driver may run it outside a
|
|
31
31
|
* read-only transaction.
|
|
32
32
|
*/
|
|
33
33
|
verified?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* A verified read of at most one row, by an exact @key seek, projecting
|
|
36
|
+
* only stored properties. Cheap enough to run synchronously.
|
|
37
|
+
*/
|
|
38
|
+
bounded?: boolean;
|
|
34
39
|
}
|
|
35
40
|
/** An open interactive transaction: statements see earlier writes. */
|
|
36
41
|
export interface DriverTransaction {
|
|
@@ -82,20 +87,24 @@ export interface LoraDatabaseLike {
|
|
|
82
87
|
timeoutMs?: number;
|
|
83
88
|
signal?: AbortSignal;
|
|
84
89
|
}): Promise<QueryResult[]>;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
fromLsn?: number;
|
|
90
|
+
execute?(query: string, params?: never, options?: {
|
|
91
|
+
timeoutMs?: number;
|
|
88
92
|
signal?: AbortSignal;
|
|
89
|
-
}):
|
|
90
|
-
ready: Promise<void>;
|
|
91
|
-
};
|
|
93
|
+
}): Promise<QueryResult>;
|
|
92
94
|
stream?(query: string, params?: never, options?: {
|
|
93
95
|
timeoutMs?: number;
|
|
94
96
|
signal?: AbortSignal;
|
|
95
97
|
}): {
|
|
96
|
-
columns(): string[]
|
|
98
|
+
columns(): string[] | Promise<string[]>;
|
|
97
99
|
toArray(): Promise<Array<Record<string, unknown>>>;
|
|
98
100
|
};
|
|
101
|
+
explain?(query: string, params?: never): Promise<QueryPlan>;
|
|
102
|
+
changes?(options?: {
|
|
103
|
+
fromLsn?: number;
|
|
104
|
+
signal?: AbortSignal;
|
|
105
|
+
}): AsyncIterable<DriverChangeBatch> & {
|
|
106
|
+
ready: Promise<void>;
|
|
107
|
+
};
|
|
99
108
|
begin?(mode?: "read_write" | "read_only"): Promise<{
|
|
100
109
|
execute(query: string, params?: never, options?: {
|
|
101
110
|
timeoutMs?: number;
|
package/dist/errors.d.ts
CHANGED
|
@@ -15,6 +15,6 @@ export declare class ModelError extends Error {
|
|
|
15
15
|
constructor(problems: ModelProblem[]);
|
|
16
16
|
}
|
|
17
17
|
export declare function formatProblem(p: ModelProblem): string;
|
|
18
|
-
export type LoraGraphQLErrorCode = "BAD_USER_INPUT" | "INVALID_CURSOR" | "LIMIT_EXCEEDED" | "COST_EXCEEDED" | "UNAUTHENTICATED" | "FORBIDDEN" | "NOT_FOUND" | "CONSTRAINT_VIOLATION" | "DATABASE_ERROR" | "PERSISTED_QUERY_ONLY";
|
|
18
|
+
export type LoraGraphQLErrorCode = "BAD_USER_INPUT" | "INVALID_CURSOR" | "LIMIT_EXCEEDED" | "COST_EXCEEDED" | "UNAUTHENTICATED" | "FORBIDDEN" | "NOT_FOUND" | "CONSTRAINT_VIOLATION" | "DATABASE_ERROR" | "PERSISTED_QUERY_ONLY" | "WRONG_OPERATION_TYPE";
|
|
19
19
|
/** A request-time error with a stable `extensions.code`. */
|
|
20
20
|
export declare function requestError(code: LoraGraphQLErrorCode, message: string, cause?: unknown, extensions?: Record<string, unknown>): GraphQLError;
|
package/dist/execute/feed.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { GraphModel } from '../model/types.js';
|
|
|
3
3
|
import { WriteChange } from './changes.js';
|
|
4
4
|
export declare class EngineFeed {
|
|
5
5
|
#private;
|
|
6
|
-
constructor(driver: LoraDriver, model: GraphModel, emit: (change: WriteChange) => void);
|
|
6
|
+
constructor(driver: LoraDriver, model: GraphModel, emit: (change: WriteChange) => void, onError?: (err: unknown) => void);
|
|
7
7
|
/** Subscribe; resolves once every later commit will be delivered. */
|
|
8
8
|
start(): Promise<void>;
|
|
9
9
|
stop(): void;
|
package/dist/guards.d.ts
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { ParseOptions, ValidationRule } from 'graphql';
|
|
2
2
|
export interface DocumentGuards {
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Deepest field nesting, fragments followed. Default 12. An
|
|
5
|
+
* introspection field (`__schema`, `__type`) counts as one level here:
|
|
6
|
+
* its subtree follows the type-reference chain, not the graph, and is
|
|
7
|
+
* bounded by `maxIntrospectionDepth`.
|
|
8
|
+
*/
|
|
4
9
|
maxDepth?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Deepest nesting under `__schema` or `__type`, the field included.
|
|
12
|
+
* Default 20: the standard introspection query (every option on) needs
|
|
13
|
+
* 15, and a runaway `ofType { ofType … }` chain is still refused.
|
|
14
|
+
*/
|
|
15
|
+
maxIntrospectionDepth?: number;
|
|
5
16
|
/** Aliased fields in one document. Default 30. */
|
|
6
17
|
maxAliases?: number;
|
|
7
18
|
/** Root fields in one operation. Default 20. */
|
|
@@ -16,6 +27,7 @@ export interface DocumentGuards {
|
|
|
16
27
|
}
|
|
17
28
|
export declare const DEFAULT_GUARDS: {
|
|
18
29
|
readonly maxDepth: 12;
|
|
30
|
+
readonly maxIntrospectionDepth: 20;
|
|
19
31
|
readonly maxAliases: 30;
|
|
20
32
|
readonly maxRootFields: 20;
|
|
21
33
|
readonly maxTokens: 5000;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as e, L as r, a as o, M as l, b as i, c as d, d as n, e as t, f, g as m, i as p, l as c, p as h, r as D, s as b, h as u, t as v, v as L } from "./driver-
|
|
2
|
-
import { d as x } from "./diff-
|
|
1
|
+
import { D as e, L as r, a as o, M as l, b as i, c as d, d as n, e as t, f, g as m, i as p, l as c, p as h, r as D, s as b, h as u, t as v, v as L } from "./driver-CuXOoYWT.js";
|
|
2
|
+
import { d as x } from "./diff-BH4Na9pC.js";
|
|
3
3
|
export {
|
|
4
4
|
e as DEFAULT_GUARDS,
|
|
5
5
|
r as LoraGraphQL,
|
package/dist/lora-graphql.d.ts
CHANGED
|
@@ -106,7 +106,10 @@ export interface CostEvent {
|
|
|
106
106
|
export interface DatabaseErrorEvent {
|
|
107
107
|
/** Correlation id, also in the client error's `extensions.id`. */
|
|
108
108
|
id: string;
|
|
109
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* The root field that failed, or `changeFeed` for a failure of the
|
|
111
|
+
* change feed (it reopens from where it stopped after a backoff).
|
|
112
|
+
*/
|
|
110
113
|
field: string;
|
|
111
114
|
/** The engine's message, which may name labels, properties and Cypher. */
|
|
112
115
|
message: string;
|
|
@@ -273,7 +276,8 @@ export declare class LoraGraphQL {
|
|
|
273
276
|
/**
|
|
274
277
|
* Execute a query or mutation against the schema. Parsed and validated
|
|
275
278
|
* documents are cached by source text; persisted ones by id. A
|
|
276
|
-
* subscription runs with {@link LoraGraphQL.subscribe}
|
|
279
|
+
* subscription runs with {@link LoraGraphQL.subscribe}; given one, this
|
|
280
|
+
* returns a `WRONG_OPERATION_TYPE` error.
|
|
277
281
|
*/
|
|
278
282
|
execute(args: ExecuteArgs): Promise<ExecutionResult>;
|
|
279
283
|
/**
|
|
@@ -281,15 +285,19 @@ export declare class LoraGraphQL {
|
|
|
281
285
|
* single result with the errors when it cannot start (an unknown id, a
|
|
282
286
|
* validation error, a denied subscribe). Takes the same arguments as
|
|
283
287
|
* {@link LoraGraphQL.execute}, a persisted id included, with the same
|
|
284
|
-
* document cache and guards
|
|
285
|
-
* with
|
|
288
|
+
* document cache and guards; a query or mutation gets a
|
|
289
|
+
* `WRONG_OPERATION_TYPE` error. End it with `return()` on the iterator
|
|
290
|
+
* or with an `AbortSignal` passed as `context.signal`: either ends it at
|
|
291
|
+
* once, without waiting for another event, and drops its listener. The
|
|
292
|
+
* cost limit applies to each event on its own.
|
|
286
293
|
*/
|
|
287
294
|
subscribe(args: ExecuteArgs): Promise<AsyncIterableIterator<ExecutionResult> | ExecutionResult>;
|
|
288
295
|
/** Called after every committed mutation with its exact write-set. */
|
|
289
296
|
onWrite(listener: (change: WriteChange) => void): () => void;
|
|
290
297
|
/**
|
|
291
298
|
* Committed writes as an async iterator, e.g. for a subscription
|
|
292
|
-
* resolver. Only writes made through this instance are seen.
|
|
299
|
+
* resolver. Only writes made through this instance are seen. `return()`
|
|
300
|
+
* or aborting `signal` (already aborted included) ends it at once.
|
|
293
301
|
*/
|
|
294
302
|
changes(options?: {
|
|
295
303
|
signal?: AbortSignal;
|
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.19.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",
|
|
@@ -61,10 +61,11 @@
|
|
|
61
61
|
"lint:fix": "eslint src test bench --fix",
|
|
62
62
|
"format": "prettier --write src test",
|
|
63
63
|
"format:check": "prettier --check src test",
|
|
64
|
-
"bench": "vitest bench --run"
|
|
64
|
+
"bench": "vitest bench --run",
|
|
65
|
+
"bench:load": "node bench/load/main.mjs"
|
|
65
66
|
},
|
|
66
67
|
"peerDependencies": {
|
|
67
|
-
"@loradb/lora-node": "^0.
|
|
68
|
+
"@loradb/lora-node": "^0.19.0",
|
|
68
69
|
"graphql": "^16.8.0 || ^17.0.0"
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|