@simtlix/simfinity-descriptor 3.15.0 → 3.17.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 +8 -0
- package/package.json +2 -2
- package/src/client-descriptor.js +7 -4
- package/src/package-info.js +1 -1
- package/types/index.d.ts +2 -1
package/README.md
CHANGED
|
@@ -28,3 +28,11 @@ types. Directly importing `@simtlix/simfinity-core/introspection` requires core
|
|
|
28
28
|
a direct dependency pinned to the facade's version. The 3.x introspection default
|
|
29
29
|
remains enabled, and clients selecting `__Field.extensions` must migrate before
|
|
30
30
|
using the early opt-out.
|
|
31
|
+
|
|
32
|
+
Since 3.16.0, a generated transaction field is described with
|
|
33
|
+
`operation: 'transaction'` and `type: null`, with its actual arguments, result
|
|
34
|
+
type and reachable `@oneOf` input. Format version 1 is unchanged; clients that
|
|
35
|
+
handle operation kinds exhaustively must accept `transaction`. User-registered
|
|
36
|
+
mutations retain `customMutation`.
|
|
37
|
+
|
|
38
|
+
The descriptor also traverses the generated nullable `valuePath: String` field on `QLFilter`, `QLTypeFilter` and `QLFilterCondition` with format version 1 unchanged. This describes input shape, not adapter capabilities; `value`/`valuePath` mutual exclusion and `queryFeatures.valuePath` support are runtime validation rules.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simtlix/simfinity-descriptor",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.17.0",
|
|
4
4
|
"description": "Schema-owned client metadata and an explicitly authorized HTTP endpoint for Simfinity",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"directory": "packages/descriptor"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@simtlix/simfinity-core": "3.
|
|
30
|
+
"@simtlix/simfinity-core": "3.17.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"graphql": "^16.11.0"
|
package/src/client-descriptor.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
isObjectType, isScalarType, isUnionType, print,
|
|
4
4
|
} from 'graphql';
|
|
5
5
|
import SimfinityError from '@simtlix/simfinity-core/internal/errors';
|
|
6
|
-
import { schemaRegistrations } from '@simtlix/simfinity-core/internal/schema-registrations';
|
|
6
|
+
import { schemaRegistrations, schemaTransaction } from '@simtlix/simfinity-core/internal/schema-registrations';
|
|
7
7
|
import { getFieldStorageName, getListShape, isVirtualField, normalizeConnectionField, virtualFieldOptions } from '@simtlix/simfinity-core/internal/relation-storage';
|
|
8
8
|
import { packageInfo } from './package-info.js';
|
|
9
9
|
|
|
@@ -118,9 +118,10 @@ const createDescriptor = (schema, registrations) => {
|
|
|
118
118
|
...(marker?.view ? { view: marker.view.name } : {}) }];
|
|
119
119
|
});
|
|
120
120
|
const mutationKinds = { save: 'add', update: 'update', delete: 'delete', state_changed: 'transition', custom_mutation: 'customMutation' };
|
|
121
|
+
const transaction = schemaTransaction(schema);
|
|
121
122
|
const mutationEntries = Object.entries(schema.getMutationType()?.getFields() || {}).map(([name, field]) => {
|
|
122
123
|
const marker = field.extensions?.simfinityMutation;
|
|
123
|
-
const kind = mutationKinds[marker?.operation] || 'customMutation';
|
|
124
|
+
const kind = field === transaction ? 'transaction' : mutationKinds[marker?.operation] || 'customMutation';
|
|
124
125
|
const result = { ...operation(field), type: marker?.typeName || null, operation: kind };
|
|
125
126
|
if (['add', 'update', 'delete'].includes(kind) && result.description === kind) result.description = null;
|
|
126
127
|
if (kind === 'transition') Object.assign(result, { action: marker.action, from: textOrNull(marker.from), to: textOrNull(marker.to) });
|
|
@@ -161,8 +162,10 @@ const createDescriptor = (schema, registrations) => {
|
|
|
161
162
|
} : null;
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
|
-
if (isInputObjectType(type))
|
|
165
|
-
|
|
165
|
+
if (isInputObjectType(type)) {
|
|
166
|
+
result.fields = Object.values(type.getFields()).map(input);
|
|
167
|
+
if (type.isOneOf === true) result.isOneOf = true;
|
|
168
|
+
} else if (isObjectType(type) || isInterfaceType(type)) {
|
|
166
169
|
result.interfaces = type.getInterfaces().map((item) => item.name);
|
|
167
170
|
result.fields = Object.values(type.getFields()).map((field) => {
|
|
168
171
|
const relation = relationOf(type, field);
|
package/src/package-info.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by scripts/release-packages.js; keeps the descriptor builder free of Node/JSON loader dependencies.
|
|
2
|
-
export const packageInfo = Object.freeze({ name: '@simtlix/simfinity-descriptor', version: '3.
|
|
2
|
+
export const packageInfo = Object.freeze({ name: '@simtlix/simfinity-descriptor', version: '3.17.0' });
|
package/types/index.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export interface ClientDescriptorField {
|
|
|
34
34
|
}
|
|
35
35
|
export interface ClientDescriptorOperation {
|
|
36
36
|
readonly type: string | null;
|
|
37
|
-
readonly operation: 'get' | 'list' | 'aggregate' | 'add' | 'update' | 'delete' | 'transition' | 'customQuery' | 'customMutation';
|
|
37
|
+
readonly operation: 'get' | 'list' | 'aggregate' | 'add' | 'update' | 'delete' | 'transition' | 'transaction' | 'customQuery' | 'customMutation';
|
|
38
38
|
readonly args: readonly ClientDescriptorInputValue[];
|
|
39
39
|
readonly returns: string;
|
|
40
40
|
readonly description: string | null;
|
|
@@ -58,6 +58,7 @@ export interface ClientDescriptorType {
|
|
|
58
58
|
readonly inputs?: Readonly<{ add?: string; update?: string }>;
|
|
59
59
|
readonly stateMachine?: ClientDescriptorStateMachine | null;
|
|
60
60
|
readonly fields?: readonly (ClientDescriptorField | ClientDescriptorInputValue)[];
|
|
61
|
+
readonly isOneOf?: boolean;
|
|
61
62
|
readonly interfaces?: readonly string[];
|
|
62
63
|
readonly possibleTypes?: readonly string[];
|
|
63
64
|
readonly values?: readonly Readonly<{ name: string; description: string | null; deprecationReason: string | null }>[];
|