@simtlix/simfinity-js 3.5.2 → 3.5.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simtlix/simfinity-js",
3
- "version": "3.5.2",
3
+ "version": "3.5.3",
4
4
  "description": "MongoDB/Mongoose adapter and compatibility facade for Simfinity GraphQL APIs",
5
5
  "main": "src/index.js",
6
6
  "types": "./types/index.d.ts",
@@ -29,8 +29,8 @@
29
29
  "owner": "simtlix"
30
30
  },
31
31
  "dependencies": {
32
- "@simtlix/simfinity-core": "3.5.2",
33
- "@simtlix/simfinity-mcp": "3.5.2"
32
+ "@simtlix/simfinity-core": "3.5.3",
33
+ "@simtlix/simfinity-mcp": "3.5.3"
34
34
  },
35
35
  "files": [
36
36
  "src",
package/src/index.js CHANGED
@@ -12,6 +12,7 @@ const mongoAdapter = createMongoAdapter();
12
12
  const runtime = createRuntime(mongoAdapter);
13
13
 
14
14
  export const configureQueryLimits = runtime.configureQueryLimits;
15
+ export const configureMutationLimits = runtime.configureMutationLimits;
15
16
  export const connect = runtime.connect;
16
17
  export const addNoEndpointType = runtime.addNoEndpointType;
17
18
  export const createSchema = runtime.createSchema;
package/types/index.d.ts CHANGED
@@ -14,6 +14,7 @@ import type {
14
14
  } from 'graphql';
15
15
  import type {
16
16
  DatabaseAdapter,
17
+ MutationLimitsOptions,
17
18
  RuntimeRegistration,
18
19
  SimfinityError,
19
20
  } from '@simtlix/simfinity-core';
@@ -35,9 +36,14 @@ export type {
35
36
  EnvelopSchemaPlugin,
36
37
  FieldValidations,
37
38
  FieldValidator,
39
+ MutationLimitsOptions,
38
40
  PermissionSchema,
39
41
  PolicyExpression,
42
+ ScopeFunction,
43
+ ScopeOperation,
44
+ ScopeParams,
40
45
  TypePermissions,
46
+ TypeScopes,
41
47
  } from '@simtlix/simfinity-core';
42
48
  export * from '@simtlix/simfinity-mcp';
43
49
  export { default as mcp } from '@simtlix/simfinity-mcp';
@@ -74,7 +80,12 @@ export interface StateMachine {
74
80
  [key: string]: any;
75
81
  }
76
82
 
77
- /** Register a Mongoose model + GraphQL type pair, exposing single and list endpoints. */
83
+ /**
84
+ * Register a Mongoose model + GraphQL type pair, exposing single and list endpoints.
85
+ * Throws INVALID_SCOPE (500) for an invalid `extensions.scope`, and TYPE_BOUND_TO_OTHER_RUNTIME
86
+ * (409) when another runtime bound the type by generating its relation resolvers, or reserved it
87
+ * because its schema reached the type with an unresolved relation field.
88
+ */
78
89
  export function connect(
79
90
  model: any,
80
91
  gqltype: GraphQLObjectType,
@@ -85,13 +96,18 @@ export function connect(
85
96
  stateMachine?: StateMachine | null,
86
97
  ): void;
87
98
 
88
- /** Register a GraphQL type without exposing root endpoints (e.g. embedded/related types). */
99
+ /** Register a GraphQL type without exposing root endpoints (e.g. embedded/related types). Throws like connect(). */
89
100
  export function addNoEndpointType(gqltype: GraphQLObjectType): void;
90
101
 
91
102
  /**
92
103
  * Build the executable GraphQLSchema from every connected type. The first two
93
104
  * allowlists are matched against the GraphQLObjectType INSTANCES passed to
94
- * connect(); only custom mutations are matched by name.
105
+ * connect(); only custom mutations are matched by name. Scopes are validated
106
+ * (INVALID_SCOPE), and reachable types bound or reserved by another runtime, or
107
+ * holding a field copied with toConfig() after another runtime generated its
108
+ * relation resolver, keeping the generated resolver or its extensions, are rejected (TYPE_BOUND_TO_OTHER_RUNTIME), before models
109
+ * are created; a list or embedded relation to an unregistered type throws
110
+ * UNREGISTERED_RELATION_TARGET.
95
111
  */
96
112
  export function createSchema(
97
113
  includedQueryTypes?: GraphQLObjectType[] | null,
@@ -122,6 +138,10 @@ export interface SimfinityMiddlewareContext {
122
138
  * Register middleware before generated operations, including related-type reads and nested child writes.
123
139
  * Nested operations keep root argument shapes and the GraphQL request context.
124
140
  * Await next() to advance the middleware chain; throw to reject before the operation executes.
141
+ * A non-function throws INVALID_MIDDLEWARE (500). The rest of the chain runs at most once and is
142
+ * awaited even when next() is not; its errors cancel the operation, even if a middleware catches them.
143
+ * Call next() before the middleware returns or its promise settles: a later call, such as
144
+ * setTimeout(next), does nothing, so the remaining middleware is skipped.
125
145
  */
126
146
  export function use(
127
147
  middleware: (
@@ -142,6 +162,15 @@ export interface QueryLimitsOptions {
142
162
  /** Configure at startup. Invalid configuration throws INVALID_QUERY_LIMITS (400). */
143
163
  export function configureQueryLimits(options?: QueryLimitsOptions): void;
144
164
 
165
+ /**
166
+ * Process-wide limit on nested added/updated/deleted entries per generated add, update or
167
+ * state-action mutation; unlimited by default, restored by calling it without options.
168
+ * Invalid configuration, including an unknown or misspelled option key, throws
169
+ * INVALID_MUTATION_LIMITS (400) and keeps the current limit; a mutation over the limit
170
+ * fails with NESTED_OPERATIONS_EXCEEDED (400) before its transaction starts.
171
+ */
172
+ export function configureMutationLimits(options?: MutationLimitsOptions): void;
173
+
145
174
  /**
146
175
  * Get the generated create input type, preserving field and list-item non-null
147
176
  * wrappers. Update inputs remove only the outer wrapper (except entity id).