@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.
@@ -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" | "UPDATE" | "DELETE";
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
- /** A `${jwt.path}` / `${context.path}` placeholder inside a rule string. */
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
- /** `bypass: false`: the schema's bypass does not skip these rules. */
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;
@@ -0,0 +1,3 @@
1
+ import { GraphModel, NodeType } from './types.js';
2
+ /** The `@uniqueTogether` types `statement` may write. */
3
+ export declare function uniqueTogetherTouched(model: GraphModel, statement: string): NodeType[];
@@ -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
@@ -1,5 +1,5 @@
1
1
  import { graphql as g } from "graphql";
2
- import { L as h, l as b } from "./driver-XeJM24iP.js";
2
+ import { a as h, l as b } from "./driver-C5dSoSD8.js";
3
3
  async function T(l) {
4
4
  let u;
5
5
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loradb/lora-graphql",
3
- "version": "0.20.2",
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.20.2",
68
+ "@loradb/lora-node": "^0.22.0",
69
69
  "graphql": "^16.8.0 || ^17.0.0"
70
70
  },
71
71
  "devDependencies": {