@constructive-io/graphql-server 2.14.7 → 2.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/codegen/orm/client.d.ts +55 -0
- package/codegen/orm/client.js +75 -0
- package/codegen/orm/index.d.ts +632 -0
- package/codegen/orm/index.js +182 -0
- package/codegen/orm/input-types.d.ts +13248 -0
- package/codegen/orm/input-types.js +7 -0
- package/codegen/orm/models/api.d.ts +42 -0
- package/codegen/orm/models/api.js +77 -0
- package/codegen/orm/models/apiExtension.d.ts +42 -0
- package/codegen/orm/models/apiExtension.js +77 -0
- package/codegen/orm/models/apiModule.d.ts +42 -0
- package/codegen/orm/models/apiModule.js +77 -0
- package/codegen/orm/models/apiSchema.d.ts +42 -0
- package/codegen/orm/models/apiSchema.js +77 -0
- package/codegen/orm/models/app.d.ts +42 -0
- package/codegen/orm/models/app.js +77 -0
- package/codegen/orm/models/checkConstraint.d.ts +42 -0
- package/codegen/orm/models/checkConstraint.js +77 -0
- package/codegen/orm/models/connectedAccountsModule.d.ts +42 -0
- package/codegen/orm/models/connectedAccountsModule.js +77 -0
- package/codegen/orm/models/cryptoAddressesModule.d.ts +42 -0
- package/codegen/orm/models/cryptoAddressesModule.js +77 -0
- package/codegen/orm/models/cryptoAuthModule.d.ts +42 -0
- package/codegen/orm/models/cryptoAuthModule.js +77 -0
- package/codegen/orm/models/database.d.ts +42 -0
- package/codegen/orm/models/database.js +77 -0
- package/codegen/orm/models/databaseExtension.d.ts +42 -0
- package/codegen/orm/models/databaseExtension.js +77 -0
- package/codegen/orm/models/databaseProvision.d.ts +42 -0
- package/codegen/orm/models/databaseProvision.js +77 -0
- package/codegen/orm/models/defaultIdsModule.d.ts +42 -0
- package/codegen/orm/models/defaultIdsModule.js +77 -0
- package/codegen/orm/models/denormalizedTableField.d.ts +42 -0
- package/codegen/orm/models/denormalizedTableField.js +77 -0
- package/codegen/orm/models/domain.d.ts +42 -0
- package/codegen/orm/models/domain.js +77 -0
- package/codegen/orm/models/emailsModule.d.ts +42 -0
- package/codegen/orm/models/emailsModule.js +77 -0
- package/codegen/orm/models/encryptedSecretsModule.d.ts +42 -0
- package/codegen/orm/models/encryptedSecretsModule.js +77 -0
- package/codegen/orm/models/extension.d.ts +42 -0
- package/codegen/orm/models/extension.js +77 -0
- package/codegen/orm/models/field.d.ts +42 -0
- package/codegen/orm/models/field.js +77 -0
- package/codegen/orm/models/fieldModule.d.ts +42 -0
- package/codegen/orm/models/fieldModule.js +77 -0
- package/codegen/orm/models/foreignKeyConstraint.d.ts +42 -0
- package/codegen/orm/models/foreignKeyConstraint.js +77 -0
- package/codegen/orm/models/fullTextSearch.d.ts +42 -0
- package/codegen/orm/models/fullTextSearch.js +77 -0
- package/codegen/orm/models/hierarchyModule.d.ts +42 -0
- package/codegen/orm/models/hierarchyModule.js +77 -0
- package/codegen/orm/models/index.d.ts +64 -0
- package/codegen/orm/models/index.js +127 -0
- package/codegen/orm/models/indexModel.d.ts +42 -0
- package/codegen/orm/models/indexModel.js +77 -0
- package/codegen/orm/models/invitesModule.d.ts +42 -0
- package/codegen/orm/models/invitesModule.js +77 -0
- package/codegen/orm/models/levelsModule.d.ts +42 -0
- package/codegen/orm/models/levelsModule.js +77 -0
- package/codegen/orm/models/limitFunction.d.ts +42 -0
- package/codegen/orm/models/limitFunction.js +77 -0
- package/codegen/orm/models/limitsModule.d.ts +42 -0
- package/codegen/orm/models/limitsModule.js +77 -0
- package/codegen/orm/models/membershipTypesModule.d.ts +42 -0
- package/codegen/orm/models/membershipTypesModule.js +77 -0
- package/codegen/orm/models/membershipsModule.d.ts +42 -0
- package/codegen/orm/models/membershipsModule.js +77 -0
- package/codegen/orm/models/module.d.ts +42 -0
- package/codegen/orm/models/module.js +77 -0
- package/codegen/orm/models/moduleDefinition.d.ts +42 -0
- package/codegen/orm/models/moduleDefinition.js +77 -0
- package/codegen/orm/models/moduleField.d.ts +42 -0
- package/codegen/orm/models/moduleField.js +77 -0
- package/codegen/orm/models/moduleInputRecord.d.ts +42 -0
- package/codegen/orm/models/moduleInputRecord.js +77 -0
- package/codegen/orm/models/moduleOutput.d.ts +42 -0
- package/codegen/orm/models/moduleOutput.js +77 -0
- package/codegen/orm/models/permissionsModule.d.ts +42 -0
- package/codegen/orm/models/permissionsModule.js +77 -0
- package/codegen/orm/models/phoneNumbersModule.d.ts +42 -0
- package/codegen/orm/models/phoneNumbersModule.js +77 -0
- package/codegen/orm/models/policy.d.ts +42 -0
- package/codegen/orm/models/policy.js +77 -0
- package/codegen/orm/models/primaryKeyConstraint.d.ts +42 -0
- package/codegen/orm/models/primaryKeyConstraint.js +77 -0
- package/codegen/orm/models/procedure.d.ts +42 -0
- package/codegen/orm/models/procedure.js +77 -0
- package/codegen/orm/models/profilesModule.d.ts +42 -0
- package/codegen/orm/models/profilesModule.js +77 -0
- package/codegen/orm/models/rlsFunction.d.ts +42 -0
- package/codegen/orm/models/rlsFunction.js +77 -0
- package/codegen/orm/models/rlsModule.d.ts +42 -0
- package/codegen/orm/models/rlsModule.js +77 -0
- package/codegen/orm/models/schema.d.ts +42 -0
- package/codegen/orm/models/schema.js +77 -0
- package/codegen/orm/models/schemaGrant.d.ts +42 -0
- package/codegen/orm/models/schemaGrant.js +77 -0
- package/codegen/orm/models/secretsModule.d.ts +42 -0
- package/codegen/orm/models/secretsModule.js +77 -0
- package/codegen/orm/models/site.d.ts +42 -0
- package/codegen/orm/models/site.js +77 -0
- package/codegen/orm/models/siteMetadatum.d.ts +42 -0
- package/codegen/orm/models/siteMetadatum.js +77 -0
- package/codegen/orm/models/siteModule.d.ts +42 -0
- package/codegen/orm/models/siteModule.js +77 -0
- package/codegen/orm/models/siteTheme.d.ts +42 -0
- package/codegen/orm/models/siteTheme.js +77 -0
- package/codegen/orm/models/table.d.ts +42 -0
- package/codegen/orm/models/table.js +77 -0
- package/codegen/orm/models/tableGrant.d.ts +42 -0
- package/codegen/orm/models/tableGrant.js +77 -0
- package/codegen/orm/models/tokensModule.d.ts +42 -0
- package/codegen/orm/models/tokensModule.js +77 -0
- package/codegen/orm/models/trigger.d.ts +42 -0
- package/codegen/orm/models/trigger.js +77 -0
- package/codegen/orm/models/triggerFunction.d.ts +42 -0
- package/codegen/orm/models/triggerFunction.js +77 -0
- package/codegen/orm/models/uniqueConstraint.d.ts +42 -0
- package/codegen/orm/models/uniqueConstraint.js +77 -0
- package/codegen/orm/models/userAuthModule.d.ts +42 -0
- package/codegen/orm/models/userAuthModule.js +77 -0
- package/codegen/orm/models/usersModule.d.ts +42 -0
- package/codegen/orm/models/usersModule.js +77 -0
- package/codegen/orm/models/uuidModule.d.ts +42 -0
- package/codegen/orm/models/uuidModule.js +77 -0
- package/codegen/orm/mutation/index.d.ts +531 -0
- package/codegen/orm/mutation/index.js +596 -0
- package/codegen/orm/query/index.d.ts +274 -0
- package/codegen/orm/query/index.js +290 -0
- package/codegen/orm/query-builder.d.ts +80 -0
- package/codegen/orm/query-builder.js +249 -0
- package/codegen/orm/select-types.d.ts +50 -0
- package/codegen/orm/select-types.js +7 -0
- package/codegen/orm/types.d.ts +6 -0
- package/codegen/orm/types.js +23 -0
- package/esm/codegen/orm/client.js +70 -0
- package/esm/codegen/orm/index.js +162 -0
- package/esm/codegen/orm/input-types.js +6 -0
- package/esm/codegen/orm/models/api.js +73 -0
- package/esm/codegen/orm/models/apiExtension.js +73 -0
- package/esm/codegen/orm/models/apiModule.js +73 -0
- package/esm/codegen/orm/models/apiSchema.js +73 -0
- package/esm/codegen/orm/models/app.js +73 -0
- package/esm/codegen/orm/models/checkConstraint.js +73 -0
- package/esm/codegen/orm/models/connectedAccountsModule.js +73 -0
- package/esm/codegen/orm/models/cryptoAddressesModule.js +73 -0
- package/esm/codegen/orm/models/cryptoAuthModule.js +73 -0
- package/esm/codegen/orm/models/database.js +73 -0
- package/esm/codegen/orm/models/databaseExtension.js +73 -0
- package/esm/codegen/orm/models/databaseProvision.js +73 -0
- package/esm/codegen/orm/models/defaultIdsModule.js +73 -0
- package/esm/codegen/orm/models/denormalizedTableField.js +73 -0
- package/esm/codegen/orm/models/domain.js +73 -0
- package/esm/codegen/orm/models/emailsModule.js +73 -0
- package/esm/codegen/orm/models/encryptedSecretsModule.js +73 -0
- package/esm/codegen/orm/models/extension.js +73 -0
- package/esm/codegen/orm/models/field.js +73 -0
- package/esm/codegen/orm/models/fieldModule.js +73 -0
- package/esm/codegen/orm/models/foreignKeyConstraint.js +73 -0
- package/esm/codegen/orm/models/fullTextSearch.js +73 -0
- package/esm/codegen/orm/models/hierarchyModule.js +73 -0
- package/esm/codegen/orm/models/index.js +64 -0
- package/esm/codegen/orm/models/indexModel.js +73 -0
- package/esm/codegen/orm/models/invitesModule.js +73 -0
- package/esm/codegen/orm/models/levelsModule.js +73 -0
- package/esm/codegen/orm/models/limitFunction.js +73 -0
- package/esm/codegen/orm/models/limitsModule.js +73 -0
- package/esm/codegen/orm/models/membershipTypesModule.js +73 -0
- package/esm/codegen/orm/models/membershipsModule.js +73 -0
- package/esm/codegen/orm/models/module.js +73 -0
- package/esm/codegen/orm/models/moduleDefinition.js +73 -0
- package/esm/codegen/orm/models/moduleField.js +73 -0
- package/esm/codegen/orm/models/moduleInputRecord.js +73 -0
- package/esm/codegen/orm/models/moduleOutput.js +73 -0
- package/esm/codegen/orm/models/permissionsModule.js +73 -0
- package/esm/codegen/orm/models/phoneNumbersModule.js +73 -0
- package/esm/codegen/orm/models/policy.js +73 -0
- package/esm/codegen/orm/models/primaryKeyConstraint.js +73 -0
- package/esm/codegen/orm/models/procedure.js +73 -0
- package/esm/codegen/orm/models/profilesModule.js +73 -0
- package/esm/codegen/orm/models/rlsFunction.js +73 -0
- package/esm/codegen/orm/models/rlsModule.js +73 -0
- package/esm/codegen/orm/models/schema.js +73 -0
- package/esm/codegen/orm/models/schemaGrant.js +73 -0
- package/esm/codegen/orm/models/secretsModule.js +73 -0
- package/esm/codegen/orm/models/site.js +73 -0
- package/esm/codegen/orm/models/siteMetadatum.js +73 -0
- package/esm/codegen/orm/models/siteModule.js +73 -0
- package/esm/codegen/orm/models/siteTheme.js +73 -0
- package/esm/codegen/orm/models/table.js +73 -0
- package/esm/codegen/orm/models/tableGrant.js +73 -0
- package/esm/codegen/orm/models/tokensModule.js +73 -0
- package/esm/codegen/orm/models/trigger.js +73 -0
- package/esm/codegen/orm/models/triggerFunction.js +73 -0
- package/esm/codegen/orm/models/uniqueConstraint.js +73 -0
- package/esm/codegen/orm/models/userAuthModule.js +73 -0
- package/esm/codegen/orm/models/usersModule.js +73 -0
- package/esm/codegen/orm/models/uuidModule.js +73 -0
- package/esm/codegen/orm/mutation/index.js +593 -0
- package/esm/codegen/orm/query/index.js +287 -0
- package/esm/codegen/orm/query-builder.js +238 -0
- package/esm/codegen/orm/select-types.js +6 -0
- package/esm/codegen/orm/types.js +7 -0
- package/esm/middleware/api.js +10 -9
- package/esm/middleware/gql.js +118 -123
- package/esm/middleware/graphile.js +19 -3
- package/esm/scripts/codegen-schema.js +71 -0
- package/esm/server.js +21 -0
- package/middleware/api.js +9 -8
- package/middleware/gql.d.ts +25 -5
- package/middleware/gql.js +122 -127
- package/middleware/graphile.js +19 -3
- package/middleware/types.d.ts +1 -0
- package/package.json +15 -11
- package/scripts/codegen-schema.d.ts +1 -0
- package/scripts/codegen-schema.js +76 -0
- package/server.js +21 -0
- package/types.d.ts +2 -2
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Query Builder - Builds and executes GraphQL operations
|
|
4
|
+
* @generated by @constructive-io/graphql-codegen
|
|
5
|
+
* DO NOT EDIT - changes will be overwritten
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.QueryBuilder = void 0;
|
|
9
|
+
exports.buildSelections = buildSelections;
|
|
10
|
+
exports.buildFindManyDocument = buildFindManyDocument;
|
|
11
|
+
exports.buildFindFirstDocument = buildFindFirstDocument;
|
|
12
|
+
exports.buildCreateDocument = buildCreateDocument;
|
|
13
|
+
exports.buildUpdateDocument = buildUpdateDocument;
|
|
14
|
+
exports.buildDeleteDocument = buildDeleteDocument;
|
|
15
|
+
exports.buildCustomDocument = buildCustomDocument;
|
|
16
|
+
const client_1 = require("./client");
|
|
17
|
+
class QueryBuilder {
|
|
18
|
+
config;
|
|
19
|
+
constructor(config) {
|
|
20
|
+
this.config = config;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Execute the query and return a discriminated union result
|
|
24
|
+
* Use result.ok to check success, or .unwrap() to throw on error
|
|
25
|
+
*/
|
|
26
|
+
async execute() {
|
|
27
|
+
return this.config.client.execute(this.config.document, this.config.variables);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Execute and unwrap the result, throwing GraphQLRequestError on failure
|
|
31
|
+
* @throws {GraphQLRequestError} If the query returns errors
|
|
32
|
+
*/
|
|
33
|
+
async unwrap() {
|
|
34
|
+
const result = await this.execute();
|
|
35
|
+
if (!result.ok) {
|
|
36
|
+
throw new client_1.GraphQLRequestError(result.errors, result.data);
|
|
37
|
+
}
|
|
38
|
+
return result.data;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Execute and unwrap, returning defaultValue on error instead of throwing
|
|
42
|
+
*/
|
|
43
|
+
async unwrapOr(defaultValue) {
|
|
44
|
+
const result = await this.execute();
|
|
45
|
+
if (!result.ok) {
|
|
46
|
+
return defaultValue;
|
|
47
|
+
}
|
|
48
|
+
return result.data;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Execute and unwrap, calling onError callback on failure
|
|
52
|
+
*/
|
|
53
|
+
async unwrapOrElse(onError) {
|
|
54
|
+
const result = await this.execute();
|
|
55
|
+
if (!result.ok) {
|
|
56
|
+
return onError(result.errors);
|
|
57
|
+
}
|
|
58
|
+
return result.data;
|
|
59
|
+
}
|
|
60
|
+
toGraphQL() {
|
|
61
|
+
return this.config.document;
|
|
62
|
+
}
|
|
63
|
+
getVariables() {
|
|
64
|
+
return this.config.variables;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.QueryBuilder = QueryBuilder;
|
|
68
|
+
// ============================================================================
|
|
69
|
+
// Document Builders
|
|
70
|
+
// ============================================================================
|
|
71
|
+
function buildSelections(select) {
|
|
72
|
+
if (!select)
|
|
73
|
+
return '';
|
|
74
|
+
const fields = [];
|
|
75
|
+
for (const [key, value] of Object.entries(select)) {
|
|
76
|
+
if (value === false || value === undefined)
|
|
77
|
+
continue;
|
|
78
|
+
if (value === true) {
|
|
79
|
+
fields.push(key);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (typeof value === 'object' && value !== null) {
|
|
83
|
+
const nested = value;
|
|
84
|
+
if (nested.select) {
|
|
85
|
+
const nestedSelections = buildSelections(nested.select);
|
|
86
|
+
// Check if this is a connection type (has pagination args or explicit connection flag)
|
|
87
|
+
const isConnection = nested.connection === true ||
|
|
88
|
+
nested.first !== undefined ||
|
|
89
|
+
nested.filter !== undefined;
|
|
90
|
+
if (isConnection) {
|
|
91
|
+
// Connection type - wrap in nodes/totalCount/pageInfo
|
|
92
|
+
const args = [];
|
|
93
|
+
if (nested.first !== undefined)
|
|
94
|
+
args.push(`first: ${nested.first}`);
|
|
95
|
+
if (nested.orderBy?.length)
|
|
96
|
+
args.push(`orderBy: [${nested.orderBy.join(', ')}]`);
|
|
97
|
+
const argsStr = args.length > 0 ? `(${args.join(', ')})` : '';
|
|
98
|
+
fields.push(`${key}${argsStr} {
|
|
99
|
+
nodes { ${nestedSelections} }
|
|
100
|
+
totalCount
|
|
101
|
+
pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
|
|
102
|
+
}`);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
// Regular nested object - just wrap in braces
|
|
106
|
+
fields.push(`${key} { ${nestedSelections} }`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return fields.join('\n ');
|
|
112
|
+
}
|
|
113
|
+
function buildFindManyDocument(operationName, queryField, select, args, filterTypeName, orderByTypeName) {
|
|
114
|
+
const selections = select ? buildSelections(select) : 'id';
|
|
115
|
+
const varDefs = [];
|
|
116
|
+
const queryArgs = [];
|
|
117
|
+
const variables = {};
|
|
118
|
+
if (args.where) {
|
|
119
|
+
varDefs.push(`$where: ${filterTypeName}`);
|
|
120
|
+
queryArgs.push('filter: $where');
|
|
121
|
+
variables.where = args.where;
|
|
122
|
+
}
|
|
123
|
+
if (args.orderBy?.length) {
|
|
124
|
+
varDefs.push(`$orderBy: [${orderByTypeName}!]`);
|
|
125
|
+
queryArgs.push('orderBy: $orderBy');
|
|
126
|
+
variables.orderBy = args.orderBy;
|
|
127
|
+
}
|
|
128
|
+
if (args.first !== undefined) {
|
|
129
|
+
varDefs.push('$first: Int');
|
|
130
|
+
queryArgs.push('first: $first');
|
|
131
|
+
variables.first = args.first;
|
|
132
|
+
}
|
|
133
|
+
if (args.last !== undefined) {
|
|
134
|
+
varDefs.push('$last: Int');
|
|
135
|
+
queryArgs.push('last: $last');
|
|
136
|
+
variables.last = args.last;
|
|
137
|
+
}
|
|
138
|
+
if (args.after) {
|
|
139
|
+
varDefs.push('$after: Cursor');
|
|
140
|
+
queryArgs.push('after: $after');
|
|
141
|
+
variables.after = args.after;
|
|
142
|
+
}
|
|
143
|
+
if (args.before) {
|
|
144
|
+
varDefs.push('$before: Cursor');
|
|
145
|
+
queryArgs.push('before: $before');
|
|
146
|
+
variables.before = args.before;
|
|
147
|
+
}
|
|
148
|
+
if (args.offset !== undefined) {
|
|
149
|
+
varDefs.push('$offset: Int');
|
|
150
|
+
queryArgs.push('offset: $offset');
|
|
151
|
+
variables.offset = args.offset;
|
|
152
|
+
}
|
|
153
|
+
const varDefsStr = varDefs.length > 0 ? `(${varDefs.join(', ')})` : '';
|
|
154
|
+
const queryArgsStr = queryArgs.length > 0 ? `(${queryArgs.join(', ')})` : '';
|
|
155
|
+
const document = `query ${operationName}Query${varDefsStr} {
|
|
156
|
+
${queryField}${queryArgsStr} {
|
|
157
|
+
nodes { ${selections} }
|
|
158
|
+
totalCount
|
|
159
|
+
pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
|
|
160
|
+
}
|
|
161
|
+
}`;
|
|
162
|
+
return { document, variables };
|
|
163
|
+
}
|
|
164
|
+
function buildFindFirstDocument(operationName, queryField, select, args, filterTypeName) {
|
|
165
|
+
const selections = select ? buildSelections(select) : 'id';
|
|
166
|
+
const varDefs = ['$first: Int'];
|
|
167
|
+
const queryArgs = ['first: $first'];
|
|
168
|
+
const variables = { first: 1 };
|
|
169
|
+
if (args.where) {
|
|
170
|
+
varDefs.push(`$where: ${filterTypeName}`);
|
|
171
|
+
queryArgs.push('filter: $where');
|
|
172
|
+
variables.where = args.where;
|
|
173
|
+
}
|
|
174
|
+
const document = `query ${operationName}Query(${varDefs.join(', ')}) {
|
|
175
|
+
${queryField}(${queryArgs.join(', ')}) {
|
|
176
|
+
nodes { ${selections} }
|
|
177
|
+
}
|
|
178
|
+
}`;
|
|
179
|
+
return { document, variables };
|
|
180
|
+
}
|
|
181
|
+
function buildCreateDocument(operationName, mutationField, entityField, select, data, inputTypeName) {
|
|
182
|
+
const selections = select ? buildSelections(select) : 'id';
|
|
183
|
+
const document = `mutation ${operationName}Mutation($input: ${inputTypeName}!) {
|
|
184
|
+
${mutationField}(input: $input) {
|
|
185
|
+
${entityField} { ${selections} }
|
|
186
|
+
}
|
|
187
|
+
}`;
|
|
188
|
+
return {
|
|
189
|
+
document,
|
|
190
|
+
variables: { input: { [entityField]: data } },
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function buildUpdateDocument(operationName, mutationField, entityField, select, where, data, inputTypeName) {
|
|
194
|
+
const selections = select ? buildSelections(select) : 'id';
|
|
195
|
+
const document = `mutation ${operationName}Mutation($input: ${inputTypeName}!) {
|
|
196
|
+
${mutationField}(input: $input) {
|
|
197
|
+
${entityField} { ${selections} }
|
|
198
|
+
}
|
|
199
|
+
}`;
|
|
200
|
+
return {
|
|
201
|
+
document,
|
|
202
|
+
variables: { input: { id: where.id, patch: data } },
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function buildDeleteDocument(operationName, mutationField, entityField, where, inputTypeName) {
|
|
206
|
+
const document = `mutation ${operationName}Mutation($input: ${inputTypeName}!) {
|
|
207
|
+
${mutationField}(input: $input) {
|
|
208
|
+
${entityField} { id }
|
|
209
|
+
}
|
|
210
|
+
}`;
|
|
211
|
+
return {
|
|
212
|
+
document,
|
|
213
|
+
variables: { input: { id: where.id } },
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
function buildCustomDocument(operationType, operationName, fieldName, select, args, variableDefinitions) {
|
|
217
|
+
// Check if select is wrapped with connection metadata
|
|
218
|
+
let actualSelect = select;
|
|
219
|
+
let isConnection = false;
|
|
220
|
+
if (select && typeof select === 'object' && 'select' in select) {
|
|
221
|
+
const wrapper = select;
|
|
222
|
+
if (wrapper.select) {
|
|
223
|
+
actualSelect = wrapper.select;
|
|
224
|
+
isConnection = wrapper.connection === true;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
const selections = actualSelect ? buildSelections(actualSelect) : '';
|
|
228
|
+
const varDefs = variableDefinitions.map((v) => `$${v.name}: ${v.type}`);
|
|
229
|
+
const fieldArgs = variableDefinitions.map((v) => `${v.name}: $${v.name}`);
|
|
230
|
+
const varDefsStr = varDefs.length > 0 ? `(${varDefs.join(', ')})` : '';
|
|
231
|
+
const fieldArgsStr = fieldArgs.length > 0 ? `(${fieldArgs.join(', ')})` : '';
|
|
232
|
+
let selectionsBlock;
|
|
233
|
+
if (isConnection) {
|
|
234
|
+
// Wrap in connection structure
|
|
235
|
+
selectionsBlock = ` {
|
|
236
|
+
nodes { ${selections} }
|
|
237
|
+
totalCount
|
|
238
|
+
pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
|
|
239
|
+
}`;
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
selectionsBlock = selections ? ` { ${selections} }` : '';
|
|
243
|
+
}
|
|
244
|
+
const opType = operationType === 'query' ? 'query' : 'mutation';
|
|
245
|
+
const document = `${opType} ${operationName}${varDefsStr} {
|
|
246
|
+
${fieldName}${fieldArgsStr}${selectionsBlock}
|
|
247
|
+
}`;
|
|
248
|
+
return { document, variables: (args ?? {}) };
|
|
249
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type utilities for select inference
|
|
3
|
+
* @generated by @constructive-io/graphql-codegen
|
|
4
|
+
* DO NOT EDIT - changes will be overwritten
|
|
5
|
+
*/
|
|
6
|
+
export interface ConnectionResult<T> {
|
|
7
|
+
nodes: T[];
|
|
8
|
+
totalCount: number;
|
|
9
|
+
pageInfo: PageInfo;
|
|
10
|
+
}
|
|
11
|
+
export interface PageInfo {
|
|
12
|
+
hasNextPage: boolean;
|
|
13
|
+
hasPreviousPage: boolean;
|
|
14
|
+
startCursor?: string | null;
|
|
15
|
+
endCursor?: string | null;
|
|
16
|
+
}
|
|
17
|
+
export interface FindManyArgs<TSelect, TWhere, TOrderBy> {
|
|
18
|
+
select?: TSelect;
|
|
19
|
+
where?: TWhere;
|
|
20
|
+
orderBy?: TOrderBy[];
|
|
21
|
+
first?: number;
|
|
22
|
+
last?: number;
|
|
23
|
+
after?: string;
|
|
24
|
+
before?: string;
|
|
25
|
+
offset?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface FindFirstArgs<TSelect, TWhere> {
|
|
28
|
+
select?: TSelect;
|
|
29
|
+
where?: TWhere;
|
|
30
|
+
}
|
|
31
|
+
export interface CreateArgs<TSelect, TData> {
|
|
32
|
+
data: TData;
|
|
33
|
+
select?: TSelect;
|
|
34
|
+
}
|
|
35
|
+
export interface UpdateArgs<TSelect, TWhere, TData> {
|
|
36
|
+
where: TWhere;
|
|
37
|
+
data: TData;
|
|
38
|
+
select?: TSelect;
|
|
39
|
+
}
|
|
40
|
+
export interface DeleteArgs<TWhere> {
|
|
41
|
+
where: TWhere;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Infer result type from select configuration
|
|
45
|
+
*/
|
|
46
|
+
export type InferSelectResult<TEntity, TSelect> = TSelect extends undefined ? TEntity : {
|
|
47
|
+
[K in keyof TSelect as TSelect[K] extends false | undefined ? never : K]: TSelect[K] extends true ? K extends keyof TEntity ? TEntity[K] : never : TSelect[K] extends {
|
|
48
|
+
select: infer NestedSelect;
|
|
49
|
+
} ? K extends keyof TEntity ? NonNullable<TEntity[K]> extends ConnectionResult<infer NodeType> ? ConnectionResult<InferSelectResult<NodeType, NestedSelect>> : InferSelectResult<NonNullable<TEntity[K]>, NestedSelect> | (null extends TEntity[K] ? null : never) : never : K extends keyof TEntity ? TEntity[K] : never;
|
|
50
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Types re-export
|
|
4
|
+
* @generated by @constructive-io/graphql-codegen
|
|
5
|
+
* DO NOT EDIT - changes will be overwritten
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
// Re-export all types from input-types
|
|
23
|
+
__exportStar(require("./input-types"), exports);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ORM Client - Runtime GraphQL executor
|
|
3
|
+
* @generated by @constructive-io/graphql-codegen
|
|
4
|
+
* DO NOT EDIT - changes will be overwritten
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Error thrown when GraphQL request fails
|
|
8
|
+
*/
|
|
9
|
+
export class GraphQLRequestError extends Error {
|
|
10
|
+
errors;
|
|
11
|
+
data;
|
|
12
|
+
constructor(errors, data = null) {
|
|
13
|
+
const messages = errors.map((e) => e.message).join('; ');
|
|
14
|
+
super(`GraphQL Error: ${messages}`);
|
|
15
|
+
this.errors = errors;
|
|
16
|
+
this.data = data;
|
|
17
|
+
this.name = 'GraphQLRequestError';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export class OrmClient {
|
|
21
|
+
endpoint;
|
|
22
|
+
headers;
|
|
23
|
+
constructor(config) {
|
|
24
|
+
this.endpoint = config.endpoint;
|
|
25
|
+
this.headers = config.headers ?? {};
|
|
26
|
+
}
|
|
27
|
+
async execute(document, variables) {
|
|
28
|
+
const response = await fetch(this.endpoint, {
|
|
29
|
+
method: 'POST',
|
|
30
|
+
headers: {
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
Accept: 'application/json',
|
|
33
|
+
...this.headers,
|
|
34
|
+
},
|
|
35
|
+
body: JSON.stringify({
|
|
36
|
+
query: document,
|
|
37
|
+
variables: variables ?? {},
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
if (!response.ok) {
|
|
41
|
+
return {
|
|
42
|
+
ok: false,
|
|
43
|
+
data: null,
|
|
44
|
+
errors: [
|
|
45
|
+
{ message: `HTTP ${response.status}: ${response.statusText}` },
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const json = (await response.json());
|
|
50
|
+
// Return discriminated union based on presence of errors
|
|
51
|
+
if (json.errors && json.errors.length > 0) {
|
|
52
|
+
return {
|
|
53
|
+
ok: false,
|
|
54
|
+
data: null,
|
|
55
|
+
errors: json.errors,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
ok: true,
|
|
60
|
+
data: json.data,
|
|
61
|
+
errors: undefined,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
setHeaders(headers) {
|
|
65
|
+
this.headers = { ...this.headers, ...headers };
|
|
66
|
+
}
|
|
67
|
+
getEndpoint() {
|
|
68
|
+
return this.endpoint;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ORM Client - createClient factory
|
|
3
|
+
* @generated by @constructive-io/graphql-codegen
|
|
4
|
+
* DO NOT EDIT - changes will be overwritten
|
|
5
|
+
*/
|
|
6
|
+
import { OrmClient } from './client';
|
|
7
|
+
import { CheckConstraintModel } from './models/checkConstraint';
|
|
8
|
+
import { SchemaModel } from './models/schema';
|
|
9
|
+
import { TableModel } from './models/table';
|
|
10
|
+
import { FieldModel } from './models/field';
|
|
11
|
+
import { DenormalizedTableFieldModel } from './models/denormalizedTableField';
|
|
12
|
+
import { FieldModuleModel } from './models/fieldModule';
|
|
13
|
+
import { MembershipsModuleModel } from './models/membershipsModule';
|
|
14
|
+
import { ForeignKeyConstraintModel } from './models/foreignKeyConstraint';
|
|
15
|
+
import { FullTextSearchModel } from './models/fullTextSearch';
|
|
16
|
+
import { IndexModel } from './models/index';
|
|
17
|
+
import { LimitFunctionModel } from './models/limitFunction';
|
|
18
|
+
import { PolicyModel } from './models/policy';
|
|
19
|
+
import { PrimaryKeyConstraintModel } from './models/primaryKeyConstraint';
|
|
20
|
+
import { RlsFunctionModel } from './models/rlsFunction';
|
|
21
|
+
import { TableGrantModel } from './models/tableGrant';
|
|
22
|
+
import { TriggerModel } from './models/trigger';
|
|
23
|
+
import { UniqueConstraintModel } from './models/uniqueConstraint';
|
|
24
|
+
import { ConnectedAccountsModuleModel } from './models/connectedAccountsModule';
|
|
25
|
+
import { CryptoAddressesModuleModel } from './models/cryptoAddressesModule';
|
|
26
|
+
import { CryptoAuthModuleModel } from './models/cryptoAuthModule';
|
|
27
|
+
import { EmailsModuleModel } from './models/emailsModule';
|
|
28
|
+
import { EncryptedSecretsModuleModel } from './models/encryptedSecretsModule';
|
|
29
|
+
import { InvitesModuleModel } from './models/invitesModule';
|
|
30
|
+
import { LevelsModuleModel } from './models/levelsModule';
|
|
31
|
+
import { LimitsModuleModel } from './models/limitsModule';
|
|
32
|
+
import { MembershipTypesModuleModel } from './models/membershipTypesModule';
|
|
33
|
+
import { PermissionsModuleModel } from './models/permissionsModule';
|
|
34
|
+
import { PhoneNumbersModuleModel } from './models/phoneNumbersModule';
|
|
35
|
+
import { ProfilesModuleModel } from './models/profilesModule';
|
|
36
|
+
import { SecretsModuleModel } from './models/secretsModule';
|
|
37
|
+
import { TokensModuleModel } from './models/tokensModule';
|
|
38
|
+
import { UsersModuleModel } from './models/usersModule';
|
|
39
|
+
import { HierarchyModuleModel } from './models/hierarchyModule';
|
|
40
|
+
import { SchemaGrantModel } from './models/schemaGrant';
|
|
41
|
+
import { ApiSchemaModel } from './models/apiSchema';
|
|
42
|
+
import { ApiExtensionModel } from './models/apiExtension';
|
|
43
|
+
import { ApiModuleModel } from './models/apiModule';
|
|
44
|
+
import { DomainModel } from './models/domain';
|
|
45
|
+
import { SiteMetadatumModel } from './models/siteMetadatum';
|
|
46
|
+
import { SiteModuleModel } from './models/siteModule';
|
|
47
|
+
import { SiteThemeModel } from './models/siteTheme';
|
|
48
|
+
import { RlsModuleModel } from './models/rlsModule';
|
|
49
|
+
import { UserAuthModuleModel } from './models/userAuthModule';
|
|
50
|
+
import { UuidModuleModel } from './models/uuidModule';
|
|
51
|
+
import { DatabaseExtensionModel } from './models/databaseExtension';
|
|
52
|
+
import { ProcedureModel } from './models/procedure';
|
|
53
|
+
import { TriggerFunctionModel } from './models/triggerFunction';
|
|
54
|
+
import { ApiModel } from './models/api';
|
|
55
|
+
import { SiteModel } from './models/site';
|
|
56
|
+
import { AppModel } from './models/app';
|
|
57
|
+
import { DefaultIdsModuleModel } from './models/defaultIdsModule';
|
|
58
|
+
import { DatabaseProvisionModel } from './models/databaseProvision';
|
|
59
|
+
import { ModuleModel } from './models/module';
|
|
60
|
+
import { ModuleFieldModel } from './models/moduleField';
|
|
61
|
+
import { ModuleInputRecordModel } from './models/moduleInputRecord';
|
|
62
|
+
import { ModuleOutputModel } from './models/moduleOutput';
|
|
63
|
+
import { DatabaseModel } from './models/database';
|
|
64
|
+
import { ExtensionModel } from './models/extension';
|
|
65
|
+
import { ModuleDefinitionModel } from './models/moduleDefinition';
|
|
66
|
+
import { createQueryOperations } from './query';
|
|
67
|
+
import { createMutationOperations } from './mutation';
|
|
68
|
+
export { GraphQLRequestError } from './client';
|
|
69
|
+
export { QueryBuilder } from './query-builder';
|
|
70
|
+
export * from './select-types';
|
|
71
|
+
// ============================================================================
|
|
72
|
+
// Client Factory
|
|
73
|
+
// ============================================================================
|
|
74
|
+
/**
|
|
75
|
+
* Create an ORM client instance
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* const db = createClient({
|
|
80
|
+
* endpoint: 'https://api.example.com/graphql',
|
|
81
|
+
* headers: { Authorization: 'Bearer token' },
|
|
82
|
+
* });
|
|
83
|
+
*
|
|
84
|
+
* // Query users
|
|
85
|
+
* const users = await db.user.findMany({
|
|
86
|
+
* select: { id: true, name: true },
|
|
87
|
+
* first: 10,
|
|
88
|
+
* }).execute();
|
|
89
|
+
*
|
|
90
|
+
* // Create a user
|
|
91
|
+
* const newUser = await db.user.create({
|
|
92
|
+
* data: { name: 'John', email: 'john@example.com' },
|
|
93
|
+
* select: { id: true },
|
|
94
|
+
* }).execute();
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export function createClient(config) {
|
|
98
|
+
const client = new OrmClient(config);
|
|
99
|
+
return {
|
|
100
|
+
checkConstraint: new CheckConstraintModel(client),
|
|
101
|
+
schema: new SchemaModel(client),
|
|
102
|
+
table: new TableModel(client),
|
|
103
|
+
field: new FieldModel(client),
|
|
104
|
+
denormalizedTableField: new DenormalizedTableFieldModel(client),
|
|
105
|
+
fieldModule: new FieldModuleModel(client),
|
|
106
|
+
membershipsModule: new MembershipsModuleModel(client),
|
|
107
|
+
foreignKeyConstraint: new ForeignKeyConstraintModel(client),
|
|
108
|
+
fullTextSearch: new FullTextSearchModel(client),
|
|
109
|
+
index: new IndexModel(client),
|
|
110
|
+
limitFunction: new LimitFunctionModel(client),
|
|
111
|
+
policy: new PolicyModel(client),
|
|
112
|
+
primaryKeyConstraint: new PrimaryKeyConstraintModel(client),
|
|
113
|
+
rlsFunction: new RlsFunctionModel(client),
|
|
114
|
+
tableGrant: new TableGrantModel(client),
|
|
115
|
+
trigger: new TriggerModel(client),
|
|
116
|
+
uniqueConstraint: new UniqueConstraintModel(client),
|
|
117
|
+
connectedAccountsModule: new ConnectedAccountsModuleModel(client),
|
|
118
|
+
cryptoAddressesModule: new CryptoAddressesModuleModel(client),
|
|
119
|
+
cryptoAuthModule: new CryptoAuthModuleModel(client),
|
|
120
|
+
emailsModule: new EmailsModuleModel(client),
|
|
121
|
+
encryptedSecretsModule: new EncryptedSecretsModuleModel(client),
|
|
122
|
+
invitesModule: new InvitesModuleModel(client),
|
|
123
|
+
levelsModule: new LevelsModuleModel(client),
|
|
124
|
+
limitsModule: new LimitsModuleModel(client),
|
|
125
|
+
membershipTypesModule: new MembershipTypesModuleModel(client),
|
|
126
|
+
permissionsModule: new PermissionsModuleModel(client),
|
|
127
|
+
phoneNumbersModule: new PhoneNumbersModuleModel(client),
|
|
128
|
+
profilesModule: new ProfilesModuleModel(client),
|
|
129
|
+
secretsModule: new SecretsModuleModel(client),
|
|
130
|
+
tokensModule: new TokensModuleModel(client),
|
|
131
|
+
usersModule: new UsersModuleModel(client),
|
|
132
|
+
hierarchyModule: new HierarchyModuleModel(client),
|
|
133
|
+
schemaGrant: new SchemaGrantModel(client),
|
|
134
|
+
apiSchema: new ApiSchemaModel(client),
|
|
135
|
+
apiExtension: new ApiExtensionModel(client),
|
|
136
|
+
apiModule: new ApiModuleModel(client),
|
|
137
|
+
domain: new DomainModel(client),
|
|
138
|
+
siteMetadatum: new SiteMetadatumModel(client),
|
|
139
|
+
siteModule: new SiteModuleModel(client),
|
|
140
|
+
siteTheme: new SiteThemeModel(client),
|
|
141
|
+
rlsModule: new RlsModuleModel(client),
|
|
142
|
+
userAuthModule: new UserAuthModuleModel(client),
|
|
143
|
+
uuidModule: new UuidModuleModel(client),
|
|
144
|
+
databaseExtension: new DatabaseExtensionModel(client),
|
|
145
|
+
procedure: new ProcedureModel(client),
|
|
146
|
+
triggerFunction: new TriggerFunctionModel(client),
|
|
147
|
+
api: new ApiModel(client),
|
|
148
|
+
site: new SiteModel(client),
|
|
149
|
+
app: new AppModel(client),
|
|
150
|
+
defaultIdsModule: new DefaultIdsModuleModel(client),
|
|
151
|
+
databaseProvision: new DatabaseProvisionModel(client),
|
|
152
|
+
module: new ModuleModel(client),
|
|
153
|
+
moduleField: new ModuleFieldModel(client),
|
|
154
|
+
moduleInputRecord: new ModuleInputRecordModel(client),
|
|
155
|
+
moduleOutput: new ModuleOutputModel(client),
|
|
156
|
+
database: new DatabaseModel(client),
|
|
157
|
+
extension: new ExtensionModel(client),
|
|
158
|
+
moduleDefinition: new ModuleDefinitionModel(client),
|
|
159
|
+
query: createQueryOperations(client),
|
|
160
|
+
mutation: createMutationOperations(client),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateDocument, buildDeleteDocument, } from '../query-builder';
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// Model Class
|
|
4
|
+
// ============================================================================
|
|
5
|
+
export class ApiModel {
|
|
6
|
+
client;
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
findMany(args) {
|
|
11
|
+
const { document, variables } = buildFindManyDocument('Api', 'apis', args?.select, {
|
|
12
|
+
where: args?.where,
|
|
13
|
+
orderBy: args?.orderBy,
|
|
14
|
+
first: args?.first,
|
|
15
|
+
last: args?.last,
|
|
16
|
+
after: args?.after,
|
|
17
|
+
before: args?.before,
|
|
18
|
+
offset: args?.offset,
|
|
19
|
+
}, 'ApiFilter', 'ApisOrderBy');
|
|
20
|
+
return new QueryBuilder({
|
|
21
|
+
client: this.client,
|
|
22
|
+
operation: 'query',
|
|
23
|
+
operationName: 'Api',
|
|
24
|
+
fieldName: 'apis',
|
|
25
|
+
document,
|
|
26
|
+
variables,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
findFirst(args) {
|
|
30
|
+
const { document, variables } = buildFindFirstDocument('Api', 'apis', args?.select, { where: args?.where }, 'ApiFilter');
|
|
31
|
+
return new QueryBuilder({
|
|
32
|
+
client: this.client,
|
|
33
|
+
operation: 'query',
|
|
34
|
+
operationName: 'Api',
|
|
35
|
+
fieldName: 'apis',
|
|
36
|
+
document,
|
|
37
|
+
variables,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
create(args) {
|
|
41
|
+
const { document, variables } = buildCreateDocument('Api', 'createApi', 'api', args.select, args.data, 'CreateApiInput');
|
|
42
|
+
return new QueryBuilder({
|
|
43
|
+
client: this.client,
|
|
44
|
+
operation: 'mutation',
|
|
45
|
+
operationName: 'Api',
|
|
46
|
+
fieldName: 'createApi',
|
|
47
|
+
document,
|
|
48
|
+
variables,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
update(args) {
|
|
52
|
+
const { document, variables } = buildUpdateDocument('Api', 'updateApi', 'api', args.select, args.where, args.data, 'UpdateApiInput');
|
|
53
|
+
return new QueryBuilder({
|
|
54
|
+
client: this.client,
|
|
55
|
+
operation: 'mutation',
|
|
56
|
+
operationName: 'Api',
|
|
57
|
+
fieldName: 'updateApi',
|
|
58
|
+
document,
|
|
59
|
+
variables,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
delete(args) {
|
|
63
|
+
const { document, variables } = buildDeleteDocument('Api', 'deleteApi', 'api', args.where, 'DeleteApiInput');
|
|
64
|
+
return new QueryBuilder({
|
|
65
|
+
client: this.client,
|
|
66
|
+
operation: 'mutation',
|
|
67
|
+
operationName: 'Api',
|
|
68
|
+
fieldName: 'deleteApi',
|
|
69
|
+
document,
|
|
70
|
+
variables,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|