@stonecrop/graphql-middleware 0.13.14 → 0.15.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 +19 -18
- package/dist/graphql-middleware.d.ts +44 -74
- package/dist/index.js +314 -354
- package/dist/index.js.map +1 -1
- package/dist/src/dispatch/transition.d.ts +20 -8
- package/dist/src/dispatch/transition.d.ts.map +1 -1
- package/dist/src/dispatch/transition.js +33 -9
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -2
- package/dist/src/plugin/postgraphile.d.ts +3 -3
- package/dist/src/plugin/postgraphile.d.ts.map +1 -1
- package/dist/src/plugin/postgraphile.js +48 -23
- package/dist/src/registry/doctypes.d.ts.map +1 -1
- package/dist/src/registry/doctypes.js +17 -5
- package/dist/src/typeDefs.d.ts.map +1 -1
- package/dist/src/typeDefs.js +15 -10
- package/package.json +11 -6
- package/dist/plugin/postgraphile.js +0 -583
- package/dist/preset.js +0 -45
- package/dist/registry/actions.js +0 -163
- package/dist/registry/doctypes.js +0 -161
- package/dist/src/registry/actions.d.ts +0 -36
- package/dist/src/registry/actions.d.ts.map +0 -1
- package/dist/src/registry/actions.js +0 -169
- package/dist/src/types/context.d.ts +0 -20
- package/dist/src/types/context.d.ts.map +0 -1
- package/dist/src/types/index.d.ts +0 -46
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/types/index.js +0 -3
- package/dist/src/types/preset.d.ts +0 -18
- package/dist/src/types/preset.d.ts.map +0 -1
- package/dist/src/types/query.d.ts +0 -132
- package/dist/src/types/query.d.ts.map +0 -1
- package/dist/src/types/query.js +0 -3
- package/dist/typeDefs.js +0 -79
- package/dist/types/context.js +0 -0
- package/dist/types/index.js +0 -3
- package/dist/types/preset.js +0 -0
- package/dist/types/query.js +0 -3
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import type { DoctypeMeta, LinkDeclaration } from '@stonecrop/schema';
|
|
2
|
-
/**
|
|
3
|
-
* Parameters for reverse connection name inflection
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export interface ReverseConnectionParams {
|
|
7
|
-
/** Parent doctype slug */
|
|
8
|
-
doctype: string;
|
|
9
|
-
/** Link key on the parent */
|
|
10
|
-
linkName: string;
|
|
11
|
-
/** Link field on the target that points back to the parent (optional) */
|
|
12
|
-
backlink?: string;
|
|
13
|
-
/** Target doctype slug */
|
|
14
|
-
target: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Options for buildRecordQuery nested selection building
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
export interface BuildRecordQueryOptions {
|
|
21
|
-
/** Include nested/related records */
|
|
22
|
-
includeNested?: boolean | string[];
|
|
23
|
-
/** Maximum nesting depth */
|
|
24
|
-
maxDepth?: number;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Parameters for buildRecordQuery
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
export interface BuildRecordQueryParams {
|
|
31
|
-
/** Doctype metadata */
|
|
32
|
-
meta: DoctypeMeta;
|
|
33
|
-
/** Function to derive the record field name from a table name */
|
|
34
|
-
recordFieldName: (tableName: string) => string;
|
|
35
|
-
/** Function to derive the record argument name from a table name */
|
|
36
|
-
recordArgName: (tableName: string) => string;
|
|
37
|
-
/** Function to derive the record argument type from a table name */
|
|
38
|
-
recordArgType: (tableName: string) => string;
|
|
39
|
-
/** Lookup function to get doctype metadata by slug */
|
|
40
|
-
getMeta: (slug: string) => DoctypeMeta | undefined;
|
|
41
|
-
/** Options for nested query building */
|
|
42
|
-
options?: BuildRecordQueryOptions;
|
|
43
|
-
/** Function to derive reverse connection field names */
|
|
44
|
-
reverseConnectionNameFn?: (params: ReverseConnectionParams) => string;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Parameters for buildNestedSelections
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
50
|
-
export interface BuildNestedSelectionsParams {
|
|
51
|
-
/** Link declarations from the parent doctype */
|
|
52
|
-
links: Record<string, LinkDeclaration>;
|
|
53
|
-
/** Parent doctype metadata */
|
|
54
|
-
meta: DoctypeMeta;
|
|
55
|
-
/** Set of link names to include, or null for all */
|
|
56
|
-
includeSet: Set<string> | null;
|
|
57
|
-
/** Lookup function to get doctype metadata by slug */
|
|
58
|
-
getMeta: (slug: string) => DoctypeMeta | undefined;
|
|
59
|
-
/** Set of already-seen doctype slugs to prevent circular references */
|
|
60
|
-
seen: Set<string>;
|
|
61
|
-
/** Current recursion depth */
|
|
62
|
-
depth: number;
|
|
63
|
-
/** Maximum recursion depth */
|
|
64
|
-
maxDepth?: number;
|
|
65
|
-
/** Function to derive reverse connection field names */
|
|
66
|
-
reverseConnectionNameFn?: (params: ReverseConnectionParams) => string;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Arguments for buildListQuery
|
|
70
|
-
* @public
|
|
71
|
-
*/
|
|
72
|
-
export interface BuildListQueryArgs {
|
|
73
|
-
/** Maximum number of records to return */
|
|
74
|
-
limit?: number;
|
|
75
|
-
/** Number of records to skip */
|
|
76
|
-
offset?: number;
|
|
77
|
-
/** OrderBy specification */
|
|
78
|
-
orderBy?: string;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Parameters for buildListQuery
|
|
82
|
-
* @public
|
|
83
|
-
*/
|
|
84
|
-
export interface BuildListQueryParams {
|
|
85
|
-
/** Doctype metadata */
|
|
86
|
-
meta: DoctypeMeta;
|
|
87
|
-
/** Query arguments */
|
|
88
|
-
args: BuildListQueryArgs;
|
|
89
|
-
/** Function to derive the connection field name from a table name */
|
|
90
|
-
connectionFieldName: (tableName: string) => string;
|
|
91
|
-
/** Function to derive the OrderBy type name from a table name */
|
|
92
|
-
orderByTypeName: (tableName: string) => string;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Parameters for mergeNestedResults
|
|
96
|
-
* @public
|
|
97
|
-
*/
|
|
98
|
-
export interface MergeNestedResultsParams {
|
|
99
|
-
/** The record object with nested connection data */
|
|
100
|
-
record: Record<string, unknown>;
|
|
101
|
-
/** Doctype metadata */
|
|
102
|
-
meta: DoctypeMeta;
|
|
103
|
-
/** Lookup function to get doctype metadata by slug */
|
|
104
|
-
getMeta: (slug: string) => DoctypeMeta | undefined;
|
|
105
|
-
/** Function to derive the reverse connection field name from link params */
|
|
106
|
-
reverseConnectionNameFn?: (params: ReverseConnectionParams) => string;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Parameters for extractSingleResult
|
|
110
|
-
* @public
|
|
111
|
-
*/
|
|
112
|
-
export interface ExtractSingleResultParams {
|
|
113
|
-
/** The raw query result */
|
|
114
|
-
result: unknown;
|
|
115
|
-
/** Doctype metadata */
|
|
116
|
-
meta: DoctypeMeta;
|
|
117
|
-
/** Function to derive the record field name from a table name */
|
|
118
|
-
recordFieldName: (tableName: string) => string;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Parameters for extractListResult
|
|
122
|
-
* @public
|
|
123
|
-
*/
|
|
124
|
-
export interface ExtractListResultParams {
|
|
125
|
-
/** The raw query result */
|
|
126
|
-
result: unknown;
|
|
127
|
-
/** Doctype metadata */
|
|
128
|
-
meta: DoctypeMeta;
|
|
129
|
-
/** Function to derive the connection field name from a table name */
|
|
130
|
-
connectionFieldName: (tableName: string) => string;
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=query.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/types/query.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAErE;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACvC,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,6BAA6B;IAC7B,QAAQ,EAAE,MAAM,CA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2BAA2B;IAC3B,MAAM,EAAE,OAAO,CAAA;IACf,uBAAuB;IACvB,IAAI,EAAE,WAAW,CAAA;IACjB,qEAAqE;IACrE,mBAAmB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAA;CAClD"}
|
package/dist/src/types/query.js
DELETED
package/dist/typeDefs.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { gql } from 'postgraphile/utils';
|
|
2
|
-
/**
|
|
3
|
-
* GraphQL type definitions for Stonecrop's middleware API.
|
|
4
|
-
* Includes stonecropMeta, stonecropRecord, stonecropRecords, stonecropAction, and related types.
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export const typeDefs = gql `
|
|
8
|
-
type StonecropFieldMeta {
|
|
9
|
-
fieldname: String!
|
|
10
|
-
fieldtype: String!
|
|
11
|
-
component: String
|
|
12
|
-
label: String
|
|
13
|
-
width: String
|
|
14
|
-
align: String
|
|
15
|
-
required: Boolean
|
|
16
|
-
readOnly: Boolean
|
|
17
|
-
edit: Boolean
|
|
18
|
-
hidden: Boolean
|
|
19
|
-
default: JSON
|
|
20
|
-
options: JSON
|
|
21
|
-
mask: String
|
|
22
|
-
precision: Int
|
|
23
|
-
scale: Int
|
|
24
|
-
mode: String
|
|
25
|
-
validation: JSON
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
type StonecropWorkflowAction {
|
|
29
|
-
label: String!
|
|
30
|
-
handler: String!
|
|
31
|
-
requiredFields: [String!]
|
|
32
|
-
allowedStates: [String!]
|
|
33
|
-
confirm: Boolean
|
|
34
|
-
args: JSON
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
type StonecropWorkflowMeta {
|
|
38
|
-
states: [String!]
|
|
39
|
-
actions: [StonecropWorkflowAction!]
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
type StonecropDoctypeMeta {
|
|
43
|
-
name: String!
|
|
44
|
-
slug: String
|
|
45
|
-
tableName: String
|
|
46
|
-
fields: [StonecropFieldMeta!]!
|
|
47
|
-
workflow: StonecropWorkflowMeta
|
|
48
|
-
inherits: String
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
type StonecropRecordResult {
|
|
52
|
-
data: JSON
|
|
53
|
-
doctype: String!
|
|
54
|
-
unknownLinks: [String!]
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
type StonecropRecordsResult {
|
|
58
|
-
data: [JSON!]!
|
|
59
|
-
doctype: String!
|
|
60
|
-
count: Int!
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
type StonecropActionResult {
|
|
64
|
-
success: Boolean!
|
|
65
|
-
data: JSON
|
|
66
|
-
error: String
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
extend type Query {
|
|
70
|
-
stonecropMeta(doctype: String!): StonecropDoctypeMeta
|
|
71
|
-
stonecropAllMeta: [StonecropDoctypeMeta!]!
|
|
72
|
-
stonecropRecord(doctype: String!, id: String!, options: JSON): StonecropRecordResult
|
|
73
|
-
stonecropRecords(doctype: String!, filters: JSON, orderBy: String, limit: Int, offset: Int): StonecropRecordsResult
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
extend type Mutation {
|
|
77
|
-
stonecropAction(doctype: String!, action: String!, args: JSON): StonecropActionResult!
|
|
78
|
-
}
|
|
79
|
-
`;
|
package/dist/types/context.js
DELETED
|
File without changes
|
package/dist/types/index.js
DELETED
package/dist/types/preset.js
DELETED
|
File without changes
|
package/dist/types/query.js
DELETED