graphile-build-pg 4.13.0 → 4.14.1
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 +4 -13
- package/node8plus/GraphQLJSON.js +0 -11
- package/node8plus/GraphQLJSON.js.map +1 -1
- package/node8plus/PgLiveProvider.js +4 -11
- package/node8plus/PgLiveProvider.js.map +1 -1
- package/node8plus/QueryBuilder.js +42 -176
- package/node8plus/QueryBuilder.js.map +1 -1
- package/node8plus/index.js +8 -47
- package/node8plus/index.js.map +1 -1
- package/node8plus/inflections.js +9 -61
- package/node8plus/inflections.js.map +1 -1
- package/node8plus/omit.js +7 -22
- package/node8plus/omit.js.map +1 -1
- package/node8plus/parseIdentifier.js +0 -1
- package/node8plus/parseIdentifier.js.map +1 -1
- package/node8plus/pgPrepareAndRun.js +2 -14
- package/node8plus/pgPrepareAndRun.js.map +1 -1
- package/node8plus/plugins/PageInfoStartEndCursor.js +0 -4
- package/node8plus/plugins/PageInfoStartEndCursor.js.map +1 -1
- package/node8plus/plugins/PgAllRows.js +0 -29
- package/node8plus/plugins/PgAllRows.js.map +1 -1
- package/node8plus/plugins/PgBackwardRelationPlugin.js +2 -41
- package/node8plus/plugins/PgBackwardRelationPlugin.js.map +1 -1
- package/node8plus/plugins/PgBasicsPlugin.js +20 -147
- package/node8plus/plugins/PgBasicsPlugin.js.map +1 -1
- package/node8plus/plugins/PgColumnDeprecationPlugin.js +2 -5
- package/node8plus/plugins/PgColumnDeprecationPlugin.js.map +1 -1
- package/node8plus/plugins/PgColumnsPlugin.js +4 -17
- package/node8plus/plugins/PgColumnsPlugin.js.map +1 -1
- package/node8plus/plugins/PgComputedColumnsPlugin.js +4 -19
- package/node8plus/plugins/PgComputedColumnsPlugin.js.map +1 -1
- package/node8plus/plugins/PgConditionComputedColumnPlugin.js +12 -23
- package/node8plus/plugins/PgConditionComputedColumnPlugin.js.map +1 -1
- package/node8plus/plugins/PgConnectionArgCondition.js +1 -9
- package/node8plus/plugins/PgConnectionArgCondition.js.map +1 -1
- package/node8plus/plugins/PgConnectionArgFirstLastBeforeAfter.js +0 -12
- package/node8plus/plugins/PgConnectionArgFirstLastBeforeAfter.js.map +1 -1
- package/node8plus/plugins/PgConnectionArgOrderBy.js +2 -19
- package/node8plus/plugins/PgConnectionArgOrderBy.js.map +1 -1
- package/node8plus/plugins/PgConnectionArgOrderByDefaultValue.js +0 -6
- package/node8plus/plugins/PgConnectionArgOrderByDefaultValue.js.map +1 -1
- package/node8plus/plugins/PgConnectionTotalCount.js +0 -8
- package/node8plus/plugins/PgConnectionTotalCount.js.map +1 -1
- package/node8plus/plugins/PgForwardRelationPlugin.js +2 -25
- package/node8plus/plugins/PgForwardRelationPlugin.js.map +1 -1
- package/node8plus/plugins/PgIntrospectionPlugin.js +91 -180
- package/node8plus/plugins/PgIntrospectionPlugin.js.flow +30 -2
- package/node8plus/plugins/PgIntrospectionPlugin.js.map +1 -1
- package/node8plus/plugins/PgJWTPlugin.js +2 -18
- package/node8plus/plugins/PgJWTPlugin.js.map +1 -1
- package/node8plus/plugins/PgMutationCreatePlugin.js +0 -18
- package/node8plus/plugins/PgMutationCreatePlugin.js.map +1 -1
- package/node8plus/plugins/PgMutationPayloadEdgePlugin.js +4 -25
- package/node8plus/plugins/PgMutationPayloadEdgePlugin.js.map +1 -1
- package/node8plus/plugins/PgMutationProceduresPlugin.js +0 -6
- package/node8plus/plugins/PgMutationProceduresPlugin.js.map +1 -1
- package/node8plus/plugins/PgMutationUpdateDeletePlugin.js +14 -49
- package/node8plus/plugins/PgMutationUpdateDeletePlugin.js.flow +5 -2
- package/node8plus/plugins/PgMutationUpdateDeletePlugin.js.map +1 -1
- package/node8plus/plugins/PgNodeAliasPostGraphile.js +0 -6
- package/node8plus/plugins/PgNodeAliasPostGraphile.js.map +1 -1
- package/node8plus/plugins/PgOrderAllColumnsPlugin.js +0 -4
- package/node8plus/plugins/PgOrderAllColumnsPlugin.js.map +1 -1
- package/node8plus/plugins/PgOrderByPrimaryKeyPlugin.js +0 -6
- package/node8plus/plugins/PgOrderByPrimaryKeyPlugin.js.map +1 -1
- package/node8plus/plugins/PgOrderComputedColumnsPlugin.js +10 -14
- package/node8plus/plugins/PgOrderComputedColumnsPlugin.js.map +1 -1
- package/node8plus/plugins/PgQueryProceduresPlugin.js +4 -16
- package/node8plus/plugins/PgQueryProceduresPlugin.js.map +1 -1
- package/node8plus/plugins/PgRecordFunctionConnectionPlugin.js +3 -20
- package/node8plus/plugins/PgRecordFunctionConnectionPlugin.js.map +1 -1
- package/node8plus/plugins/PgRecordReturnTypesPlugin.js +11 -16
- package/node8plus/plugins/PgRecordReturnTypesPlugin.js.map +1 -1
- package/node8plus/plugins/PgRowByUniqueConstraint.js +4 -25
- package/node8plus/plugins/PgRowByUniqueConstraint.js.map +1 -1
- package/node8plus/plugins/PgRowNode.js +0 -32
- package/node8plus/plugins/PgRowNode.js.map +1 -1
- package/node8plus/plugins/PgScalarFunctionConnectionPlugin.js +3 -17
- package/node8plus/plugins/PgScalarFunctionConnectionPlugin.js.map +1 -1
- package/node8plus/plugins/PgTablesPlugin.js +7 -59
- package/node8plus/plugins/PgTablesPlugin.js.map +1 -1
- package/node8plus/plugins/PgTypesPlugin.js +140 -240
- package/node8plus/plugins/PgTypesPlugin.js.flow +76 -23
- package/node8plus/plugins/PgTypesPlugin.js.map +1 -1
- package/node8plus/plugins/addStartEndCursor.js +2 -5
- package/node8plus/plugins/addStartEndCursor.js.map +1 -1
- package/node8plus/plugins/debugSql.js +1 -16
- package/node8plus/plugins/debugSql.js.map +1 -1
- package/node8plus/plugins/introspectionQuery.js +3 -4
- package/node8plus/plugins/introspectionQuery.js.flow +11 -3
- package/node8plus/plugins/introspectionQuery.js.map +1 -1
- package/node8plus/plugins/makeProcField.js +40 -90
- package/node8plus/plugins/makeProcField.js.map +1 -1
- package/node8plus/plugins/pgField.js +2 -7
- package/node8plus/plugins/pgField.js.map +1 -1
- package/node8plus/plugins/viaTemporaryTable.js +6 -12
- package/node8plus/plugins/viaTemporaryTable.js.map +1 -1
- package/node8plus/postgresInterval.js +4 -4
- package/node8plus/postgresInterval.js.map +1 -1
- package/node8plus/queryFromResolveDataFactory.js +33 -77
- package/node8plus/queryFromResolveDataFactory.js.map +1 -1
- package/node8plus/utils.js +8 -9
- package/node8plus/utils.js.map +1 -1
- package/node8plus/withPgClient.js +4 -26
- package/node8plus/withPgClient.js.map +1 -1
- package/package.json +4 -4
|
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
const base64 = str => Buffer.from(String(str)).toString("base64");
|
|
9
|
-
|
|
10
8
|
const hasNonNullKey = row => {
|
|
11
9
|
if (Array.isArray(row.__identifiers) && row.__identifiers.every(i => i != null)) {
|
|
12
10
|
return true;
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
for (const k in row) {
|
|
16
13
|
if (Object.prototype.hasOwnProperty.call(row, k)) {
|
|
17
14
|
if ((k[0] !== "_" || k[1] !== "_") && row[k] !== null) {
|
|
@@ -19,10 +16,8 @@ const hasNonNullKey = row => {
|
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
return false;
|
|
24
20
|
};
|
|
25
|
-
|
|
26
21
|
var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
27
22
|
pgForbidSetofFunctionsToReturnNull = false,
|
|
28
23
|
subscriptions = false
|
|
@@ -61,21 +56,16 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
61
56
|
sqlCommentByAddingTags,
|
|
62
57
|
pgField
|
|
63
58
|
} = build;
|
|
64
|
-
|
|
65
59
|
const nullableIf = (condition, Type) => condition ? Type : new GraphQLNonNull(Type);
|
|
66
|
-
|
|
67
60
|
const Cursor = getTypeByName("Cursor");
|
|
68
61
|
introspectionResultsByKind.class.forEach(table => {
|
|
69
62
|
if (table.tags.enum) {
|
|
70
63
|
return;
|
|
71
64
|
}
|
|
72
|
-
|
|
73
65
|
const tablePgType = table.type;
|
|
74
|
-
|
|
75
66
|
if (!tablePgType) {
|
|
76
67
|
throw new Error("Could not determine the type for this table");
|
|
77
68
|
}
|
|
78
|
-
|
|
79
69
|
const arrayTablePgType = tablePgType.arrayType;
|
|
80
70
|
const primaryKeyConstraint = table.primaryKeyConstraint;
|
|
81
71
|
const primaryKeys = primaryKeyConstraint && primaryKeyConstraint.keyAttributes;
|
|
@@ -89,12 +79,10 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
89
79
|
if (TableType) {
|
|
90
80
|
return TableType;
|
|
91
81
|
}
|
|
92
|
-
|
|
93
82
|
if (pg2GqlMapper[tablePgType.id]) {
|
|
94
83
|
// Already handled
|
|
95
84
|
throw new Error(`Register was called but there's already a mapper in place for '${tablePgType.id}'!`);
|
|
96
85
|
}
|
|
97
|
-
|
|
98
86
|
TableType = newWithHooks(GraphQLObjectType, {
|
|
99
87
|
description: table.description || tablePgType.description,
|
|
100
88
|
name: tableTypeName,
|
|
@@ -110,7 +98,6 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
110
98
|
Self
|
|
111
99
|
}) => {
|
|
112
100
|
const fields = {};
|
|
113
|
-
|
|
114
101
|
if (shouldHaveNodeId) {
|
|
115
102
|
// Enable nodeId interface
|
|
116
103
|
addDataGeneratorForField(nodeIdFieldName, () => {
|
|
@@ -123,10 +110,8 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
123
110
|
fields[nodeIdFieldName] = {
|
|
124
111
|
description: build.wrapDescription("A globally unique identifier. Can be used in various places throughout the system to identify this single value.", "field"),
|
|
125
112
|
type: new GraphQLNonNull(GraphQLID),
|
|
126
|
-
|
|
127
113
|
resolve(data) {
|
|
128
114
|
const identifiers = data.__identifiers;
|
|
129
|
-
|
|
130
115
|
if (!identifiers) {
|
|
131
116
|
return null;
|
|
132
117
|
}
|
|
@@ -135,15 +120,10 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
135
120
|
* to the limits of int, and only to be strings after
|
|
136
121
|
* that point.
|
|
137
122
|
*/
|
|
138
|
-
|
|
139
|
-
|
|
140
123
|
const finalIdentifiers = identifiers.map((identifier, idx) => {
|
|
141
124
|
const key = primaryKeys[idx];
|
|
142
125
|
const type = key.type.domainBaseType || key.type;
|
|
143
|
-
|
|
144
|
-
if (type.id === "20"
|
|
145
|
-
/* bigint */
|
|
146
|
-
) {
|
|
126
|
+
if (type.id === "20" /* bigint */) {
|
|
147
127
|
/*
|
|
148
128
|
* When migrating from 'int' to 'bigint' we want
|
|
149
129
|
* to maintain nodeIDs in the safe range before
|
|
@@ -153,20 +133,16 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
153
133
|
* boundary.
|
|
154
134
|
*/
|
|
155
135
|
const int = parseInt(identifier, 10);
|
|
156
|
-
|
|
157
136
|
if (int >= -Number.MAX_SAFE_INTEGER && int <= Number.MAX_SAFE_INTEGER) {
|
|
158
137
|
return int;
|
|
159
138
|
}
|
|
160
139
|
}
|
|
161
|
-
|
|
162
140
|
return identifier;
|
|
163
141
|
});
|
|
164
142
|
return getNodeIdForTypeAndIdentifiers(Self, ...finalIdentifiers);
|
|
165
143
|
}
|
|
166
|
-
|
|
167
144
|
};
|
|
168
145
|
}
|
|
169
|
-
|
|
170
146
|
return fields;
|
|
171
147
|
}
|
|
172
148
|
}, {
|
|
@@ -194,7 +170,6 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
194
170
|
isInputType: true,
|
|
195
171
|
isPgRowType: table.isSelectable,
|
|
196
172
|
isPgCompoundType: !table.isSelectable,
|
|
197
|
-
|
|
198
173
|
pgAddSubfield(fieldName, attrName, pgType, spec, typeModifier) {
|
|
199
174
|
pgCreateInputFields[fieldName] = {
|
|
200
175
|
name: attrName,
|
|
@@ -203,7 +178,6 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
203
178
|
};
|
|
204
179
|
return spec;
|
|
205
180
|
}
|
|
206
|
-
|
|
207
181
|
}, true // If no fields, skip type automatically
|
|
208
182
|
);
|
|
209
183
|
|
|
@@ -224,7 +198,6 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
224
198
|
isPgRowType: table.isSelectable,
|
|
225
199
|
isPgCompoundType: !table.isSelectable,
|
|
226
200
|
isPgPatch: true,
|
|
227
|
-
|
|
228
201
|
pgAddSubfield(fieldName, attrName, pgType, spec, typeModifier) {
|
|
229
202
|
pgPatchInputFields[fieldName] = {
|
|
230
203
|
name: attrName,
|
|
@@ -233,9 +206,9 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
233
206
|
};
|
|
234
207
|
return spec;
|
|
235
208
|
}
|
|
236
|
-
|
|
237
209
|
}, true // Safe to skip this if no fields support updating
|
|
238
210
|
);
|
|
211
|
+
|
|
239
212
|
TableBaseInputType = newWithHooks(GraphQLInputObjectType, {
|
|
240
213
|
description: build.wrapDescription(`An input representation of \`${tableTypeName}\` with nullable fields.`, "type"),
|
|
241
214
|
name: inflection.baseInputType(TableType)
|
|
@@ -247,7 +220,6 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
247
220
|
isPgRowType: table.isSelectable,
|
|
248
221
|
isPgCompoundType: !table.isSelectable,
|
|
249
222
|
isPgBaseInput: true,
|
|
250
|
-
|
|
251
223
|
pgAddSubfield(fieldName, attrName, pgType, spec, typeModifier) {
|
|
252
224
|
pgBaseInputFields[fieldName] = {
|
|
253
225
|
name: attrName,
|
|
@@ -256,15 +228,12 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
256
228
|
};
|
|
257
229
|
return spec;
|
|
258
230
|
}
|
|
259
|
-
|
|
260
231
|
});
|
|
261
232
|
}
|
|
262
|
-
|
|
263
233
|
pg2GqlMapper[tablePgType.id] = {
|
|
264
234
|
map: _ => _,
|
|
265
235
|
unmap: (obj, modifier) => {
|
|
266
236
|
let fieldLookup;
|
|
267
|
-
|
|
268
237
|
if (modifier === "patch") {
|
|
269
238
|
fieldLookup = pgPatchInputFields;
|
|
270
239
|
} else if (modifier === "base") {
|
|
@@ -272,13 +241,11 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
272
241
|
} else {
|
|
273
242
|
fieldLookup = pgCreateInputFields;
|
|
274
243
|
}
|
|
275
|
-
|
|
276
244
|
const attr2sql = attr => {
|
|
277
245
|
// TODO: this should use `fieldInput[*].name` to find the attribute
|
|
278
246
|
const fieldName = inflection.column(attr);
|
|
279
247
|
const inputField = fieldLookup[fieldName];
|
|
280
248
|
const v = obj[fieldName];
|
|
281
|
-
|
|
282
249
|
if (inputField && v != null) {
|
|
283
250
|
const {
|
|
284
251
|
type,
|
|
@@ -314,11 +281,9 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
314
281
|
return {
|
|
315
282
|
description: build.wrapDescription("A cursor for use in pagination.", "field"),
|
|
316
283
|
type: Cursor,
|
|
317
|
-
|
|
318
284
|
resolve(data) {
|
|
319
285
|
return data.__cursor && base64(JSON.stringify(data.__cursor));
|
|
320
286
|
}
|
|
321
|
-
|
|
322
287
|
};
|
|
323
288
|
}, {
|
|
324
289
|
isCursorField: true
|
|
@@ -326,19 +291,15 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
326
291
|
node: pgField(build, fieldWithHooks, "node", {
|
|
327
292
|
description: build.wrapDescription(`The \`${tableTypeName}\` at the end of the edge.`, "field"),
|
|
328
293
|
type: nullableIf(!pgForbidSetofFunctionsToReturnNull, TableType),
|
|
329
|
-
|
|
330
294
|
resolve(data, _args, resolveContext, resolveInfo) {
|
|
331
295
|
const safeAlias = getSafeAliasFromResolveInfo(resolveInfo);
|
|
332
296
|
const record = handleNullRow(data[safeAlias], data.__identifiers);
|
|
333
297
|
const liveRecord = resolveInfo.rootValue && resolveInfo.rootValue.liveRecord;
|
|
334
|
-
|
|
335
298
|
if (record && primaryKeys && liveRecord && data.__identifiers) {
|
|
336
299
|
liveRecord("pg", table, data.__identifiers);
|
|
337
300
|
}
|
|
338
|
-
|
|
339
301
|
return record;
|
|
340
302
|
}
|
|
341
|
-
|
|
342
303
|
}, {}, false, {
|
|
343
304
|
withQueryBuilder: queryBuilder => {
|
|
344
305
|
if (subscriptions) {
|
|
@@ -358,8 +319,8 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
358
319
|
pgIntrospection: table
|
|
359
320
|
});
|
|
360
321
|
const PageInfo = getTypeByName(inflection.builtin("PageInfo"));
|
|
361
|
-
/*const ConnectionType = */
|
|
362
322
|
|
|
323
|
+
/*const ConnectionType = */
|
|
363
324
|
newWithHooks(GraphQLObjectType, {
|
|
364
325
|
description: build.wrapDescription(`A connection to a list of \`${tableTypeName}\` values.`, "type"),
|
|
365
326
|
name: inflection.connection(TableType.name),
|
|
@@ -372,21 +333,17 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
372
333
|
nodes: pgField(build, fieldWithHooks, "nodes", {
|
|
373
334
|
description: build.wrapDescription(`A list of \`${tableTypeName}\` objects.`, "field"),
|
|
374
335
|
type: new GraphQLNonNull(new GraphQLList(nullableIf(!pgForbidSetofFunctionsToReturnNull, TableType))),
|
|
375
|
-
|
|
376
336
|
resolve(data, _args, resolveContext, resolveInfo) {
|
|
377
337
|
const safeAlias = getSafeAliasFromResolveInfo(resolveInfo);
|
|
378
338
|
const liveRecord = resolveInfo.rootValue && resolveInfo.rootValue.liveRecord;
|
|
379
339
|
return data.data.map(entry => {
|
|
380
340
|
const record = handleNullRow(entry[safeAlias], entry[safeAlias].__identifiers);
|
|
381
|
-
|
|
382
341
|
if (record && liveRecord && primaryKeys && entry[safeAlias].__identifiers) {
|
|
383
342
|
liveRecord("pg", table, entry[safeAlias].__identifiers);
|
|
384
343
|
}
|
|
385
|
-
|
|
386
344
|
return record;
|
|
387
345
|
});
|
|
388
346
|
}
|
|
389
|
-
|
|
390
347
|
}, {}, false, {
|
|
391
348
|
withQueryBuilder: queryBuilder => {
|
|
392
349
|
if (subscriptions) {
|
|
@@ -397,25 +354,22 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
397
354
|
edges: pgField(build, fieldWithHooks, "edges", {
|
|
398
355
|
description: build.wrapDescription(`A list of edges which contains the \`${tableTypeName}\` and cursor to aid in pagination.`, "field"),
|
|
399
356
|
type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(EdgeType))),
|
|
400
|
-
|
|
401
357
|
resolve(data, _args, _context, resolveInfo) {
|
|
402
358
|
const safeAlias = getSafeAliasFromResolveInfo(resolveInfo);
|
|
403
|
-
return data.data.map(entry => ({
|
|
359
|
+
return data.data.map(entry => ({
|
|
360
|
+
...entry,
|
|
404
361
|
...entry[safeAlias]
|
|
405
362
|
}));
|
|
406
363
|
}
|
|
407
|
-
|
|
408
364
|
}, {}, false, {
|
|
409
365
|
hoistCursor: true
|
|
410
366
|
}),
|
|
411
367
|
pageInfo: PageInfo && {
|
|
412
368
|
description: build.wrapDescription("Information to aid in pagination.", "field"),
|
|
413
369
|
type: new GraphQLNonNull(PageInfo),
|
|
414
|
-
|
|
415
370
|
resolve(data) {
|
|
416
371
|
return data;
|
|
417
372
|
}
|
|
418
|
-
|
|
419
373
|
}
|
|
420
374
|
};
|
|
421
375
|
}
|
|
@@ -432,25 +386,21 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
432
386
|
}, true);
|
|
433
387
|
pgRegisterGqlInputTypeByTypeId(tablePgType.id, (_set, modifier) => {
|
|
434
388
|
// This must come first, it triggers creation of all the types
|
|
435
|
-
const TableType = pgGetGqlTypeByTypeIdAndModifier(tablePgType.id, null);
|
|
436
|
-
|
|
389
|
+
const TableType = pgGetGqlTypeByTypeIdAndModifier(tablePgType.id, null);
|
|
390
|
+
// This must come after the pgGetGqlTypeByTypeIdAndModifier call
|
|
437
391
|
if (modifier === "patch") {
|
|
438
392
|
// TODO: v5: move the definition from above down here
|
|
439
393
|
return TablePatchType;
|
|
440
394
|
}
|
|
441
|
-
|
|
442
395
|
if (modifier === "base") {
|
|
443
396
|
// TODO: v5: move the definition from above down here
|
|
444
397
|
return TableBaseInputType;
|
|
445
398
|
}
|
|
446
|
-
|
|
447
399
|
if (TableType) {
|
|
448
400
|
return getTypeByName(inflection.inputType(TableType));
|
|
449
401
|
}
|
|
450
|
-
|
|
451
402
|
return null;
|
|
452
403
|
}, true);
|
|
453
|
-
|
|
454
404
|
if (arrayTablePgType) {
|
|
455
405
|
// Note: these do not return
|
|
456
406
|
//
|
|
@@ -465,7 +415,6 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
465
415
|
}, true);
|
|
466
416
|
pgRegisterGqlInputTypeByTypeId(arrayTablePgType.id, (_set, modifier) => {
|
|
467
417
|
const RelevantTableInputType = pgGetGqlInputTypeByTypeIdAndModifier(tablePgType.id, modifier);
|
|
468
|
-
|
|
469
418
|
if (RelevantTableInputType) {
|
|
470
419
|
return new GraphQLList(RelevantTableInputType);
|
|
471
420
|
}
|
|
@@ -475,6 +424,5 @@ var PgTablesPlugin = function PgTablesPlugin(builder, {
|
|
|
475
424
|
return _;
|
|
476
425
|
}, ["PgTables"], [], ["PgTypes"]);
|
|
477
426
|
};
|
|
478
|
-
|
|
479
427
|
exports.default = PgTablesPlugin;
|
|
480
428
|
//# sourceMappingURL=PgTablesPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/plugins/PgTablesPlugin.js"],"names":["base64","str","Buffer","from","String","toString","hasNonNullKey","row","Array","isArray","__identifiers","every","i","k","Object","prototype","hasOwnProperty","call","PgTablesPlugin","builder","pgForbidSetofFunctionsToReturnNull","subscriptions","handleNullRow","_identifiers","identifiers","hook","_","build","getNodeIdForTypeAndIdentifiers","nodeIdFieldName","newWithHooks","getSafeAliasFromResolveInfo","pgSql","sql","pgIntrospectionResultsByKind","introspectionResultsByKind","getTypeByName","pgGetGqlTypeByTypeIdAndModifier","pgGetGqlInputTypeByTypeIdAndModifier","pgRegisterGqlTypeByTypeId","pgRegisterGqlInputTypeByTypeId","pg2GqlMapper","gql2pg","graphql","GraphQLObjectType","GraphQLNonNull","GraphQLID","GraphQLList","GraphQLInputObjectType","inflection","describePgEntity","sqlCommentByAddingTags","pgField","nullableIf","condition","Type","Cursor","class","forEach","table","tags","enum","tablePgType","type","Error","arrayTablePgType","arrayType","primaryKeyConstraint","primaryKeys","keyAttributes","attributes","tableTypeName","tableType","shouldHaveNodeId","isSelectable","namespace","length","TableType","TablePatchType","TableBaseInputType","id","cb","description","name","interfaces","builtin","fields","addDataGeneratorForField","Self","pgQuery","queryBuilder","selectIdentifiers","wrapDescription","resolve","data","finalIdentifiers","map","identifier","idx","key","domainBaseType","int","parseInt","Number","MAX_SAFE_INTEGER","__origin","pgIntrospection","isPgRowType","isPgCompoundType","isPgCompositeType","pgCreateInputFields","pgPatchInputFields","pgBaseInputFields","inputType","isInputType","pgAddSubfield","fieldName","attrName","pgType","spec","typeModifier","patchType","isPgPatch","baseInputType","isPgBaseInput","unmap","obj","modifier","fieldLookup","attr2sql","attr","column","inputField","v","fragment","isFake","namespaceName","null","join","EdgeType","edge","fieldWithHooks","cursor","addDataGenerator","usesCursor","__cursor","JSON","stringify","isCursorField","node","_args","resolveContext","resolveInfo","safeAlias","record","liveRecord","rootValue","withQueryBuilder","isEdgeType","isPgRowEdgeType","nodeType","PageInfo","connection","recurseDataGeneratorsForField","nodes","entry","edges","_context","hoistCursor","pageInfo","isConnectionType","isPgRowConnectionType","edgeType","_set","RelevantTableInputType"],"mappings":";;;;;;;AAEA,MAAMA,MAAM,GAAGC,GAAG,IAAIC,MAAM,CAACC,IAAP,CAAYC,MAAM,CAACH,GAAD,CAAlB,EAAyBI,QAAzB,CAAkC,QAAlC,CAAtB;;AAEA,MAAMC,aAAa,GAAGC,GAAG,IAAI;AAC3B,MACEC,KAAK,CAACC,OAAN,CAAcF,GAAG,CAACG,aAA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AA+B,CAC/CyB,WAAW,CAACkB,EADmC,EAE/C,IAF+C,CAAjD,CAFkB,CAMlB;;AACA,YAAI+C,QAAQ,KAAK,OAAjB,EAA0B;AACxB;AACA,iBAAOjD,cAAP;AACD;;AACD,YAAIiD,QAAQ,KAAK,MAAjB,EAAyB;AACvB;AACA,iBAAOhD,kBAAP;AACD;;AACD,YAAIF,SAAJ,EAAe;AACb,iBAAOzC,aAAa,CAACa,UAAU,CAACgE,SAAX,CAAqBpC,SAArB,CAAD,CAApB;AACD;;AACD,eAAO,IAAP;AACD,OArB2B,EAsB5B,IAtB4B,CAA9B;;AAyBA,UAAIZ,gBAAJ,EAAsB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA1B,QAAAA,yBAAyB,CACvB0B,gBAAgB,CAACe,EADM,EAEvB,MAAM;AACJ,gBAAMH,SAAS,GAAGxC,+BAA+B,CAC/CyB,WAAW,CAACkB,EADmC,EAE/C,IAF+C,CAAjD;AAIA,iBAAO,IAAIjC,WAAJ,CAAgB8B,SAAhB,CAAP;AACD,SARsB,EASvB,IATuB,CAAzB;AAWArC,QAAAA,8BAA8B,CAC5ByB,gBAAgB,CAACe,EADW,EAE5B,CAAC6F,IAAD,EAAO9C,QAAP,KAAoB;AAClB,gBAAM+C,sBAAsB,GAC1BxI,oCAAoC,CAACwB,WAAW,CAACkB,EAAb,EAAiB+C,QAAjB,CADtC;;AAEA,cAAI+C,sBAAJ,EAA4B;AAC1B,mBAAO,IAAI/H,WAAJ,CAAgB+H,sBAAhB,CAAP;AACD;AACF,SAR2B,EAS5B,IAT4B,CAA9B;AAWD;AACF,KAhkBD;AAikBA,WAAOpJ,CAAP;AACD,GApmBH,EAqmBE,CAAC,UAAD,CArmBF,EAsmBE,EAtmBF,EAumBE,CAAC,SAAD,CAvmBF;AAymBD,C","sourcesContent":["// @flow\nimport type { Plugin } from \"graphile-build\";\nconst base64 = str => Buffer.from(String(str)).toString(\"base64\");\n\nconst hasNonNullKey = row => {\n if (\n Array.isArray(row.__identifiers) &&\n row.__identifiers.every(i => i != null)\n ) {\n return true;\n }\n for (const k in row) {\n if (Object.prototype.hasOwnProperty.call(row, k)) {\n if ((k[0] !== \"_\" || k[1] !== \"_\") && row[k] !== null) {\n return true;\n }\n }\n }\n return false;\n};\n\nexport default (function PgTablesPlugin(\n builder,\n { pgForbidSetofFunctionsToReturnNull = false, subscriptions = false }\n) {\n const handleNullRow = pgForbidSetofFunctionsToReturnNull\n ? (row, _identifiers) => row\n : (row, identifiers) => {\n if ((identifiers && hasNonNullKey(identifiers)) || hasNonNullKey(row)) {\n return row;\n } else {\n return null;\n }\n };\n\n builder.hook(\n \"init\",\n (_, build) => {\n const {\n getNodeIdForTypeAndIdentifiers,\n nodeIdFieldName,\n newWithHooks,\n getSafeAliasFromResolveInfo,\n pgSql: sql,\n pgIntrospectionResultsByKind: introspectionResultsByKind,\n getTypeByName,\n pgGetGqlTypeByTypeIdAndModifier,\n pgGetGqlInputTypeByTypeIdAndModifier,\n pgRegisterGqlTypeByTypeId,\n pgRegisterGqlInputTypeByTypeId,\n pg2GqlMapper,\n gql2pg,\n graphql: {\n GraphQLObjectType,\n GraphQLNonNull,\n GraphQLID,\n GraphQLList,\n GraphQLInputObjectType,\n },\n inflection,\n describePgEntity,\n sqlCommentByAddingTags,\n pgField,\n } = build;\n\n const nullableIf = (condition, Type) =>\n condition ? Type : new GraphQLNonNull(Type);\n const Cursor = getTypeByName(\"Cursor\");\n\n introspectionResultsByKind.class.forEach(table => {\n if (table.tags.enum) {\n return;\n }\n const tablePgType = table.type;\n if (!tablePgType) {\n throw new Error(\"Could not determine the type for this table\");\n }\n const arrayTablePgType = tablePgType.arrayType;\n const primaryKeyConstraint = table.primaryKeyConstraint;\n const primaryKeys =\n primaryKeyConstraint && primaryKeyConstraint.keyAttributes;\n const attributes = table.attributes;\n const tableTypeName = inflection.tableType(table);\n const shouldHaveNodeId: boolean =\n nodeIdFieldName &&\n table.isSelectable &&\n table.namespace &&\n primaryKeys &&\n primaryKeys.length\n ? true\n : false;\n let TableType;\n let TablePatchType;\n let TableBaseInputType;\n pgRegisterGqlTypeByTypeId(\n tablePgType.id,\n cb => {\n if (TableType) {\n return TableType;\n }\n if (pg2GqlMapper[tablePgType.id]) {\n // Already handled\n throw new Error(\n `Register was called but there's already a mapper in place for '${tablePgType.id}'!`\n );\n }\n TableType = newWithHooks(\n GraphQLObjectType,\n {\n description: table.description || tablePgType.description,\n name: tableTypeName,\n interfaces: () => {\n if (shouldHaveNodeId) {\n return [getTypeByName(inflection.builtin(\"Node\"))];\n } else {\n return [];\n }\n },\n fields: ({ addDataGeneratorForField, Self }) => {\n const fields = {};\n if (shouldHaveNodeId) {\n // Enable nodeId interface\n addDataGeneratorForField(nodeIdFieldName, () => {\n return {\n pgQuery: queryBuilder => {\n queryBuilder.selectIdentifiers(table);\n },\n };\n });\n fields[nodeIdFieldName] = {\n description: build.wrapDescription(\n \"A globally unique identifier. Can be used in various places throughout the system to identify this single value.\",\n \"field\"\n ),\n type: new GraphQLNonNull(GraphQLID),\n resolve(data) {\n const identifiers = data.__identifiers;\n if (!identifiers) {\n return null;\n }\n /*\n * For bigint we want NodeIDs to be the same as int up\n * to the limits of int, and only to be strings after\n * that point.\n */\n const finalIdentifiers = identifiers.map(\n (identifier, idx) => {\n const key = primaryKeys[idx];\n const type = key.type.domainBaseType || key.type;\n if (type.id === \"20\" /* bigint */) {\n /*\n * When migrating from 'int' to 'bigint' we want\n * to maintain nodeIDs in the safe range before\n * moving to strings for larger numbers. Since we\n * can represent ints up to MAX_SAFE_INTEGER\n * (2^53 - 1) fine, we're using that as the\n * boundary.\n */\n const int = parseInt(identifier, 10);\n if (\n int >= -Number.MAX_SAFE_INTEGER &&\n int <= Number.MAX_SAFE_INTEGER\n ) {\n return int;\n }\n }\n return identifier;\n }\n );\n return getNodeIdForTypeAndIdentifiers(\n Self,\n ...finalIdentifiers\n );\n },\n };\n }\n return fields;\n },\n },\n {\n __origin: `Adding table type for ${describePgEntity(\n table\n )}. You can rename the table's GraphQL type via a 'Smart Comment':\\n\\n ${sqlCommentByAddingTags(\n table,\n {\n name: \"newNameHere\",\n }\n )}`,\n pgIntrospection: table,\n isPgRowType: table.isSelectable,\n isPgCompoundType: !table.isSelectable, // TODO:v5: remove - typo\n isPgCompositeType: !table.isSelectable,\n }\n );\n cb(TableType);\n const pgCreateInputFields = {};\n const pgPatchInputFields = {};\n const pgBaseInputFields = {};\n newWithHooks(\n GraphQLInputObjectType,\n {\n description: build.wrapDescription(\n `An input for mutations affecting \\`${tableTypeName}\\``,\n \"type\"\n ),\n name: inflection.inputType(TableType),\n },\n {\n __origin: `Adding table input type for ${describePgEntity(\n table\n )}. You can rename the table's GraphQL type via a 'Smart Comment':\\n\\n ${sqlCommentByAddingTags(\n table,\n {\n name: \"newNameHere\",\n }\n )}`,\n pgIntrospection: table,\n isInputType: true,\n isPgRowType: table.isSelectable,\n isPgCompoundType: !table.isSelectable,\n pgAddSubfield(fieldName, attrName, pgType, spec, typeModifier) {\n pgCreateInputFields[fieldName] = {\n name: attrName,\n type: pgType,\n typeModifier,\n };\n return spec;\n },\n },\n true // If no fields, skip type automatically\n );\n\n if (table.isSelectable) {\n // XXX: these don't belong here; but we have to keep them here\n // because third-party code depends on `getTypeByName` to find\n // them; so we have to register them ahead of time. A better\n // approach is to use the modifier to specify the type you need,\n // 'patch' or 'base', so they can be registered just in time.\n TablePatchType = newWithHooks(\n GraphQLInputObjectType,\n {\n description: build.wrapDescription(\n `Represents an update to a \\`${tableTypeName}\\`. Fields that are set will be updated.`,\n \"type\"\n ),\n name: inflection.patchType(TableType),\n },\n {\n __origin: `Adding table patch type for ${describePgEntity(\n table\n )}. You can rename the table's GraphQL type via a 'Smart Comment':\\n\\n ${sqlCommentByAddingTags(\n table,\n {\n name: \"newNameHere\",\n }\n )}`,\n pgIntrospection: table,\n isPgRowType: table.isSelectable,\n isPgCompoundType: !table.isSelectable,\n isPgPatch: true,\n pgAddSubfield(\n fieldName,\n attrName,\n pgType,\n spec,\n typeModifier\n ) {\n pgPatchInputFields[fieldName] = {\n name: attrName,\n type: pgType,\n typeModifier,\n };\n return spec;\n },\n },\n true // Safe to skip this if no fields support updating\n );\n TableBaseInputType = newWithHooks(\n GraphQLInputObjectType,\n {\n description: build.wrapDescription(\n `An input representation of \\`${tableTypeName}\\` with nullable fields.`,\n \"type\"\n ),\n name: inflection.baseInputType(TableType),\n },\n {\n __origin: `Adding table base input type for ${describePgEntity(\n table\n )}. You can rename the table's GraphQL type via a 'Smart Comment':\\n\\n ${sqlCommentByAddingTags(\n table,\n {\n name: \"newNameHere\",\n }\n )}`,\n pgIntrospection: table,\n isPgRowType: table.isSelectable,\n isPgCompoundType: !table.isSelectable,\n isPgBaseInput: true,\n pgAddSubfield(\n fieldName,\n attrName,\n pgType,\n spec,\n typeModifier\n ) {\n pgBaseInputFields[fieldName] = {\n name: attrName,\n type: pgType,\n typeModifier,\n };\n return spec;\n },\n }\n );\n }\n\n pg2GqlMapper[tablePgType.id] = {\n map: _ => _,\n unmap: (obj, modifier) => {\n let fieldLookup;\n if (modifier === \"patch\") {\n fieldLookup = pgPatchInputFields;\n } else if (modifier === \"base\") {\n fieldLookup = pgBaseInputFields;\n } else {\n fieldLookup = pgCreateInputFields;\n }\n\n const attr2sql = attr => {\n // TODO: this should use `fieldInput[*].name` to find the attribute\n const fieldName = inflection.column(attr);\n const inputField = fieldLookup[fieldName];\n const v = obj[fieldName];\n if (inputField && v != null) {\n const { type, typeModifier } = inputField;\n return sql.fragment`${gql2pg(v, type, typeModifier)}::${\n type.isFake\n ? sql.identifier(\"unknown\")\n : sql.identifier(type.namespaceName, type.name)\n }`;\n } else {\n return sql.null; // TODO: return default instead.\n }\n };\n\n return sql.fragment`row(${sql.join(\n attributes.map(attr2sql),\n \",\"\n )})::${\n tablePgType.isFake\n ? sql.identifier(\"unknown\")\n : sql.identifier(\n tablePgType.namespaceName,\n tablePgType.name\n )\n }`;\n },\n };\n\n const EdgeType = newWithHooks(\n GraphQLObjectType,\n {\n description: build.wrapDescription(\n `A \\`${tableTypeName}\\` edge in the connection.`,\n \"type\"\n ),\n name: inflection.edge(TableType.name),\n fields: ({ fieldWithHooks }) => {\n return {\n cursor: fieldWithHooks(\n \"cursor\",\n ({ addDataGenerator }) => {\n addDataGenerator(() => ({\n usesCursor: [true],\n pgQuery: queryBuilder => {\n if (primaryKeys) {\n queryBuilder.selectIdentifiers(table);\n }\n },\n }));\n return {\n description: build.wrapDescription(\n \"A cursor for use in pagination.\",\n \"field\"\n ),\n type: Cursor,\n resolve(data) {\n return (\n data.__cursor &&\n base64(JSON.stringify(data.__cursor))\n );\n },\n };\n },\n {\n isCursorField: true,\n }\n ),\n node: pgField(\n build,\n fieldWithHooks,\n \"node\",\n {\n description: build.wrapDescription(\n `The \\`${tableTypeName}\\` at the end of the edge.`,\n \"field\"\n ),\n type: nullableIf(\n !pgForbidSetofFunctionsToReturnNull,\n TableType\n ),\n resolve(data, _args, resolveContext, resolveInfo) {\n const safeAlias =\n getSafeAliasFromResolveInfo(resolveInfo);\n const record = handleNullRow(\n data[safeAlias],\n data.__identifiers\n );\n const liveRecord =\n resolveInfo.rootValue &&\n resolveInfo.rootValue.liveRecord;\n if (\n record &&\n primaryKeys &&\n liveRecord &&\n data.__identifiers\n ) {\n liveRecord(\"pg\", table, data.__identifiers);\n }\n return record;\n },\n },\n {},\n false,\n {\n withQueryBuilder: queryBuilder => {\n if (subscriptions) {\n queryBuilder.selectIdentifiers(table);\n }\n },\n }\n ),\n };\n },\n },\n {\n __origin: `Adding table edge type for ${describePgEntity(\n table\n )}. You can rename the table's GraphQL type via a 'Smart Comment':\\n\\n ${sqlCommentByAddingTags(\n table,\n {\n name: \"newNameHere\",\n }\n )}`,\n isEdgeType: true,\n isPgRowEdgeType: true,\n nodeType: TableType,\n pgIntrospection: table,\n }\n );\n const PageInfo = getTypeByName(inflection.builtin(\"PageInfo\"));\n\n /*const ConnectionType = */\n newWithHooks(\n GraphQLObjectType,\n {\n description: build.wrapDescription(\n `A connection to a list of \\`${tableTypeName}\\` values.`,\n \"type\"\n ),\n name: inflection.connection(TableType.name),\n fields: ({ recurseDataGeneratorsForField, fieldWithHooks }) => {\n recurseDataGeneratorsForField(\"pageInfo\", true);\n return {\n nodes: pgField(\n build,\n fieldWithHooks,\n \"nodes\",\n {\n description: build.wrapDescription(\n `A list of \\`${tableTypeName}\\` objects.`,\n \"field\"\n ),\n type: new GraphQLNonNull(\n new GraphQLList(\n nullableIf(\n !pgForbidSetofFunctionsToReturnNull,\n TableType\n )\n )\n ),\n resolve(data, _args, resolveContext, resolveInfo) {\n const safeAlias =\n getSafeAliasFromResolveInfo(resolveInfo);\n const liveRecord =\n resolveInfo.rootValue &&\n resolveInfo.rootValue.liveRecord;\n return data.data.map(entry => {\n const record = handleNullRow(\n entry[safeAlias],\n entry[safeAlias].__identifiers\n );\n if (\n record &&\n liveRecord &&\n primaryKeys &&\n entry[safeAlias].__identifiers\n ) {\n liveRecord(\n \"pg\",\n table,\n entry[safeAlias].__identifiers\n );\n }\n\n return record;\n });\n },\n },\n {},\n false,\n {\n withQueryBuilder: queryBuilder => {\n if (subscriptions) {\n queryBuilder.selectIdentifiers(table);\n }\n },\n }\n ),\n edges: pgField(\n build,\n fieldWithHooks,\n \"edges\",\n {\n description: build.wrapDescription(\n `A list of edges which contains the \\`${tableTypeName}\\` and cursor to aid in pagination.`,\n \"field\"\n ),\n type: new GraphQLNonNull(\n new GraphQLList(new GraphQLNonNull(EdgeType))\n ),\n resolve(data, _args, _context, resolveInfo) {\n const safeAlias =\n getSafeAliasFromResolveInfo(resolveInfo);\n return data.data.map(entry => ({\n ...entry,\n ...entry[safeAlias],\n }));\n },\n },\n {},\n false,\n {\n hoistCursor: true,\n }\n ),\n pageInfo: PageInfo && {\n description: build.wrapDescription(\n \"Information to aid in pagination.\",\n \"field\"\n ),\n type: new GraphQLNonNull(PageInfo),\n resolve(data) {\n return data;\n },\n },\n };\n },\n },\n {\n __origin: `Adding table connection type for ${describePgEntity(\n table\n )}. You can rename the table's GraphQL type via a 'Smart Comment':\\n\\n ${sqlCommentByAddingTags(\n table,\n {\n name: \"newNameHere\",\n }\n )}`,\n isConnectionType: true,\n isPgRowConnectionType: true,\n edgeType: EdgeType,\n nodeType: TableType,\n pgIntrospection: table,\n }\n );\n },\n true\n );\n pgRegisterGqlInputTypeByTypeId(\n tablePgType.id,\n (_set, modifier) => {\n // This must come first, it triggers creation of all the types\n const TableType = pgGetGqlTypeByTypeIdAndModifier(\n tablePgType.id,\n null\n );\n // This must come after the pgGetGqlTypeByTypeIdAndModifier call\n if (modifier === \"patch\") {\n // TODO: v5: move the definition from above down here\n return TablePatchType;\n }\n if (modifier === \"base\") {\n // TODO: v5: move the definition from above down here\n return TableBaseInputType;\n }\n if (TableType) {\n return getTypeByName(inflection.inputType(TableType));\n }\n return null;\n },\n true\n );\n\n if (arrayTablePgType) {\n // Note: these do not return\n //\n // `new GraphQLList(new GraphQLNonNull(...))`\n //\n // because it's possible to return null entries from postgresql\n // functions. We should probably add a flag to instead export\n // the non-null version as that's more typical.\n pgRegisterGqlTypeByTypeId(\n arrayTablePgType.id,\n () => {\n const TableType = pgGetGqlTypeByTypeIdAndModifier(\n tablePgType.id,\n null\n );\n return new GraphQLList(TableType);\n },\n true\n );\n pgRegisterGqlInputTypeByTypeId(\n arrayTablePgType.id,\n (_set, modifier) => {\n const RelevantTableInputType =\n pgGetGqlInputTypeByTypeIdAndModifier(tablePgType.id, modifier);\n if (RelevantTableInputType) {\n return new GraphQLList(RelevantTableInputType);\n }\n },\n true\n );\n }\n });\n return _;\n },\n [\"PgTables\"],\n [],\n [\"PgTypes\"]\n );\n}: Plugin);\n"],"file":"PgTablesPlugin.js"}
|
|
1
|
+
{"version":3,"file":"PgTablesPlugin.js","names":["base64","str","Buffer","from","String","toString","hasNonNullKey","row","Array","isArray","__identifiers","every","i","k","Object","prototype","hasOwnProperty","call","PgTablesPlugin","builder","pgForbidSetofFunctionsToReturnNull","subscriptions","handleNullRow","_identifiers","identifiers","hook","_","build","getNodeIdForTypeAndIdentifiers","nodeIdFieldName","newWithHooks","getSafeAliasFromResolveInfo","pgSql","sql","pgIntrospectionResultsByKind","introspectionResultsByKind","getTypeByName","pgGetGqlTypeByTypeIdAndModifier","pgGetGqlInputTypeByTypeIdAndModifier","pgRegisterGqlTypeByTypeId","pgRegisterGqlInputTypeByTypeId","pg2GqlMapper","gql2pg","graphql","GraphQLObjectType","GraphQLNonNull","GraphQLID","GraphQLList","GraphQLInputObjectType","inflection","describePgEntity","sqlCommentByAddingTags","pgField","nullableIf","condition","Type","Cursor","class","forEach","table","tags","enum","tablePgType","type","Error","arrayTablePgType","arrayType","primaryKeyConstraint","primaryKeys","keyAttributes","attributes","tableTypeName","tableType","shouldHaveNodeId","isSelectable","namespace","length","TableType","TablePatchType","TableBaseInputType","id","cb","description","name","interfaces","builtin","fields","addDataGeneratorForField","Self","pgQuery","queryBuilder","selectIdentifiers","wrapDescription","resolve","data","finalIdentifiers","map","identifier","idx","key","domainBaseType","int","parseInt","Number","MAX_SAFE_INTEGER","__origin","pgIntrospection","isPgRowType","isPgCompoundType","isPgCompositeType","pgCreateInputFields","pgPatchInputFields","pgBaseInputFields","inputType","isInputType","pgAddSubfield","fieldName","attrName","pgType","spec","typeModifier","patchType","isPgPatch","baseInputType","isPgBaseInput","unmap","obj","modifier","fieldLookup","attr2sql","attr","column","inputField","v","fragment","isFake","namespaceName","null","join","EdgeType","edge","fieldWithHooks","cursor","addDataGenerator","usesCursor","__cursor","JSON","stringify","isCursorField","node","_args","resolveContext","resolveInfo","safeAlias","record","liveRecord","rootValue","withQueryBuilder","isEdgeType","isPgRowEdgeType","nodeType","PageInfo","connection","recurseDataGeneratorsForField","nodes","entry","edges","_context","hoistCursor","pageInfo","isConnectionType","isPgRowConnectionType","edgeType","_set","RelevantTableInputType","exports","default"],"sources":["../../src/plugins/PgTablesPlugin.js"],"sourcesContent":["// @flow\nimport type { Plugin } from \"graphile-build\";\nconst base64 = str => Buffer.from(String(str)).toString(\"base64\");\n\nconst hasNonNullKey = row => {\n if (\n Array.isArray(row.__identifiers) &&\n row.__identifiers.every(i => i != null)\n ) {\n return true;\n }\n for (const k in row) {\n if (Object.prototype.hasOwnProperty.call(row, k)) {\n if ((k[0] !== \"_\" || k[1] !== \"_\") && row[k] !== null) {\n return true;\n }\n }\n }\n return false;\n};\n\nexport default (function PgTablesPlugin(\n builder,\n { pgForbidSetofFunctionsToReturnNull = false, subscriptions = false }\n) {\n const handleNullRow = pgForbidSetofFunctionsToReturnNull\n ? (row, _identifiers) => row\n : (row, identifiers) => {\n if ((identifiers && hasNonNullKey(identifiers)) || hasNonNullKey(row)) {\n return row;\n } else {\n return null;\n }\n };\n\n builder.hook(\n \"init\",\n (_, build) => {\n const {\n getNodeIdForTypeAndIdentifiers,\n nodeIdFieldName,\n newWithHooks,\n getSafeAliasFromResolveInfo,\n pgSql: sql,\n pgIntrospectionResultsByKind: introspectionResultsByKind,\n getTypeByName,\n pgGetGqlTypeByTypeIdAndModifier,\n pgGetGqlInputTypeByTypeIdAndModifier,\n pgRegisterGqlTypeByTypeId,\n pgRegisterGqlInputTypeByTypeId,\n pg2GqlMapper,\n gql2pg,\n graphql: {\n GraphQLObjectType,\n GraphQLNonNull,\n GraphQLID,\n GraphQLList,\n GraphQLInputObjectType,\n },\n inflection,\n describePgEntity,\n sqlCommentByAddingTags,\n pgField,\n } = build;\n\n const nullableIf = (condition, Type) =>\n condition ? Type : new GraphQLNonNull(Type);\n const Cursor = getTypeByName(\"Cursor\");\n\n introspectionResultsByKind.class.forEach(table => {\n if (table.tags.enum) {\n return;\n }\n const tablePgType = table.type;\n if (!tablePgType) {\n throw new Error(\"Could not determine the type for this table\");\n }\n const arrayTablePgType = tablePgType.arrayType;\n const primaryKeyConstraint = table.primaryKeyConstraint;\n const primaryKeys =\n primaryKeyConstraint && primaryKeyConstraint.keyAttributes;\n const attributes = table.attributes;\n const tableTypeName = inflection.tableType(table);\n const shouldHaveNodeId: boolean =\n nodeIdFieldName &&\n table.isSelectable &&\n table.namespace &&\n primaryKeys &&\n primaryKeys.length\n ? true\n : false;\n let TableType;\n let TablePatchType;\n let TableBaseInputType;\n pgRegisterGqlTypeByTypeId(\n tablePgType.id,\n cb => {\n if (TableType) {\n return TableType;\n }\n if (pg2GqlMapper[tablePgType.id]) {\n // Already handled\n throw new Error(\n `Register was called but there's already a mapper in place for '${tablePgType.id}'!`\n );\n }\n TableType = newWithHooks(\n GraphQLObjectType,\n {\n description: table.description || tablePgType.description,\n name: tableTypeName,\n interfaces: () => {\n if (shouldHaveNodeId) {\n return [getTypeByName(inflection.builtin(\"Node\"))];\n } else {\n return [];\n }\n },\n fields: ({ addDataGeneratorForField, Self }) => {\n const fields = {};\n if (shouldHaveNodeId) {\n // Enable nodeId interface\n addDataGeneratorForField(nodeIdFieldName, () => {\n return {\n pgQuery: queryBuilder => {\n queryBuilder.selectIdentifiers(table);\n },\n };\n });\n fields[nodeIdFieldName] = {\n description: build.wrapDescription(\n \"A globally unique identifier. Can be used in various places throughout the system to identify this single value.\",\n \"field\"\n ),\n type: new GraphQLNonNull(GraphQLID),\n resolve(data) {\n const identifiers = data.__identifiers;\n if (!identifiers) {\n return null;\n }\n /*\n * For bigint we want NodeIDs to be the same as int up\n * to the limits of int, and only to be strings after\n * that point.\n */\n const finalIdentifiers = identifiers.map(\n (identifier, idx) => {\n const key = primaryKeys[idx];\n const type = key.type.domainBaseType || key.type;\n if (type.id === \"20\" /* bigint */) {\n /*\n * When migrating from 'int' to 'bigint' we want\n * to maintain nodeIDs in the safe range before\n * moving to strings for larger numbers. Since we\n * can represent ints up to MAX_SAFE_INTEGER\n * (2^53 - 1) fine, we're using that as the\n * boundary.\n */\n const int = parseInt(identifier, 10);\n if (\n int >= -Number.MAX_SAFE_INTEGER &&\n int <= Number.MAX_SAFE_INTEGER\n ) {\n return int;\n }\n }\n return identifier;\n }\n );\n return getNodeIdForTypeAndIdentifiers(\n Self,\n ...finalIdentifiers\n );\n },\n };\n }\n return fields;\n },\n },\n {\n __origin: `Adding table type for ${describePgEntity(\n table\n )}. You can rename the table's GraphQL type via a 'Smart Comment':\\n\\n ${sqlCommentByAddingTags(\n table,\n {\n name: \"newNameHere\",\n }\n )}`,\n pgIntrospection: table,\n isPgRowType: table.isSelectable,\n isPgCompoundType: !table.isSelectable, // TODO:v5: remove - typo\n isPgCompositeType: !table.isSelectable,\n }\n );\n cb(TableType);\n const pgCreateInputFields = {};\n const pgPatchInputFields = {};\n const pgBaseInputFields = {};\n newWithHooks(\n GraphQLInputObjectType,\n {\n description: build.wrapDescription(\n `An input for mutations affecting \\`${tableTypeName}\\``,\n \"type\"\n ),\n name: inflection.inputType(TableType),\n },\n {\n __origin: `Adding table input type for ${describePgEntity(\n table\n )}. You can rename the table's GraphQL type via a 'Smart Comment':\\n\\n ${sqlCommentByAddingTags(\n table,\n {\n name: \"newNameHere\",\n }\n )}`,\n pgIntrospection: table,\n isInputType: true,\n isPgRowType: table.isSelectable,\n isPgCompoundType: !table.isSelectable,\n pgAddSubfield(fieldName, attrName, pgType, spec, typeModifier) {\n pgCreateInputFields[fieldName] = {\n name: attrName,\n type: pgType,\n typeModifier,\n };\n return spec;\n },\n },\n true // If no fields, skip type automatically\n );\n\n if (table.isSelectable) {\n // XXX: these don't belong here; but we have to keep them here\n // because third-party code depends on `getTypeByName` to find\n // them; so we have to register them ahead of time. A better\n // approach is to use the modifier to specify the type you need,\n // 'patch' or 'base', so they can be registered just in time.\n TablePatchType = newWithHooks(\n GraphQLInputObjectType,\n {\n description: build.wrapDescription(\n `Represents an update to a \\`${tableTypeName}\\`. Fields that are set will be updated.`,\n \"type\"\n ),\n name: inflection.patchType(TableType),\n },\n {\n __origin: `Adding table patch type for ${describePgEntity(\n table\n )}. You can rename the table's GraphQL type via a 'Smart Comment':\\n\\n ${sqlCommentByAddingTags(\n table,\n {\n name: \"newNameHere\",\n }\n )}`,\n pgIntrospection: table,\n isPgRowType: table.isSelectable,\n isPgCompoundType: !table.isSelectable,\n isPgPatch: true,\n pgAddSubfield(\n fieldName,\n attrName,\n pgType,\n spec,\n typeModifier\n ) {\n pgPatchInputFields[fieldName] = {\n name: attrName,\n type: pgType,\n typeModifier,\n };\n return spec;\n },\n },\n true // Safe to skip this if no fields support updating\n );\n TableBaseInputType = newWithHooks(\n GraphQLInputObjectType,\n {\n description: build.wrapDescription(\n `An input representation of \\`${tableTypeName}\\` with nullable fields.`,\n \"type\"\n ),\n name: inflection.baseInputType(TableType),\n },\n {\n __origin: `Adding table base input type for ${describePgEntity(\n table\n )}. You can rename the table's GraphQL type via a 'Smart Comment':\\n\\n ${sqlCommentByAddingTags(\n table,\n {\n name: \"newNameHere\",\n }\n )}`,\n pgIntrospection: table,\n isPgRowType: table.isSelectable,\n isPgCompoundType: !table.isSelectable,\n isPgBaseInput: true,\n pgAddSubfield(\n fieldName,\n attrName,\n pgType,\n spec,\n typeModifier\n ) {\n pgBaseInputFields[fieldName] = {\n name: attrName,\n type: pgType,\n typeModifier,\n };\n return spec;\n },\n }\n );\n }\n\n pg2GqlMapper[tablePgType.id] = {\n map: _ => _,\n unmap: (obj, modifier) => {\n let fieldLookup;\n if (modifier === \"patch\") {\n fieldLookup = pgPatchInputFields;\n } else if (modifier === \"base\") {\n fieldLookup = pgBaseInputFields;\n } else {\n fieldLookup = pgCreateInputFields;\n }\n\n const attr2sql = attr => {\n // TODO: this should use `fieldInput[*].name` to find the attribute\n const fieldName = inflection.column(attr);\n const inputField = fieldLookup[fieldName];\n const v = obj[fieldName];\n if (inputField && v != null) {\n const { type, typeModifier } = inputField;\n return sql.fragment`${gql2pg(v, type, typeModifier)}::${\n type.isFake\n ? sql.identifier(\"unknown\")\n : sql.identifier(type.namespaceName, type.name)\n }`;\n } else {\n return sql.null; // TODO: return default instead.\n }\n };\n\n return sql.fragment`row(${sql.join(\n attributes.map(attr2sql),\n \",\"\n )})::${\n tablePgType.isFake\n ? sql.identifier(\"unknown\")\n : sql.identifier(\n tablePgType.namespaceName,\n tablePgType.name\n )\n }`;\n },\n };\n\n const EdgeType = newWithHooks(\n GraphQLObjectType,\n {\n description: build.wrapDescription(\n `A \\`${tableTypeName}\\` edge in the connection.`,\n \"type\"\n ),\n name: inflection.edge(TableType.name),\n fields: ({ fieldWithHooks }) => {\n return {\n cursor: fieldWithHooks(\n \"cursor\",\n ({ addDataGenerator }) => {\n addDataGenerator(() => ({\n usesCursor: [true],\n pgQuery: queryBuilder => {\n if (primaryKeys) {\n queryBuilder.selectIdentifiers(table);\n }\n },\n }));\n return {\n description: build.wrapDescription(\n \"A cursor for use in pagination.\",\n \"field\"\n ),\n type: Cursor,\n resolve(data) {\n return (\n data.__cursor &&\n base64(JSON.stringify(data.__cursor))\n );\n },\n };\n },\n {\n isCursorField: true,\n }\n ),\n node: pgField(\n build,\n fieldWithHooks,\n \"node\",\n {\n description: build.wrapDescription(\n `The \\`${tableTypeName}\\` at the end of the edge.`,\n \"field\"\n ),\n type: nullableIf(\n !pgForbidSetofFunctionsToReturnNull,\n TableType\n ),\n resolve(data, _args, resolveContext, resolveInfo) {\n const safeAlias =\n getSafeAliasFromResolveInfo(resolveInfo);\n const record = handleNullRow(\n data[safeAlias],\n data.__identifiers\n );\n const liveRecord =\n resolveInfo.rootValue &&\n resolveInfo.rootValue.liveRecord;\n if (\n record &&\n primaryKeys &&\n liveRecord &&\n data.__identifiers\n ) {\n liveRecord(\"pg\", table, data.__identifiers);\n }\n return record;\n },\n },\n {},\n false,\n {\n withQueryBuilder: queryBuilder => {\n if (subscriptions) {\n queryBuilder.selectIdentifiers(table);\n }\n },\n }\n ),\n };\n },\n },\n {\n __origin: `Adding table edge type for ${describePgEntity(\n table\n )}. You can rename the table's GraphQL type via a 'Smart Comment':\\n\\n ${sqlCommentByAddingTags(\n table,\n {\n name: \"newNameHere\",\n }\n )}`,\n isEdgeType: true,\n isPgRowEdgeType: true,\n nodeType: TableType,\n pgIntrospection: table,\n }\n );\n const PageInfo = getTypeByName(inflection.builtin(\"PageInfo\"));\n\n /*const ConnectionType = */\n newWithHooks(\n GraphQLObjectType,\n {\n description: build.wrapDescription(\n `A connection to a list of \\`${tableTypeName}\\` values.`,\n \"type\"\n ),\n name: inflection.connection(TableType.name),\n fields: ({ recurseDataGeneratorsForField, fieldWithHooks }) => {\n recurseDataGeneratorsForField(\"pageInfo\", true);\n return {\n nodes: pgField(\n build,\n fieldWithHooks,\n \"nodes\",\n {\n description: build.wrapDescription(\n `A list of \\`${tableTypeName}\\` objects.`,\n \"field\"\n ),\n type: new GraphQLNonNull(\n new GraphQLList(\n nullableIf(\n !pgForbidSetofFunctionsToReturnNull,\n TableType\n )\n )\n ),\n resolve(data, _args, resolveContext, resolveInfo) {\n const safeAlias =\n getSafeAliasFromResolveInfo(resolveInfo);\n const liveRecord =\n resolveInfo.rootValue &&\n resolveInfo.rootValue.liveRecord;\n return data.data.map(entry => {\n const record = handleNullRow(\n entry[safeAlias],\n entry[safeAlias].__identifiers\n );\n if (\n record &&\n liveRecord &&\n primaryKeys &&\n entry[safeAlias].__identifiers\n ) {\n liveRecord(\n \"pg\",\n table,\n entry[safeAlias].__identifiers\n );\n }\n\n return record;\n });\n },\n },\n {},\n false,\n {\n withQueryBuilder: queryBuilder => {\n if (subscriptions) {\n queryBuilder.selectIdentifiers(table);\n }\n },\n }\n ),\n edges: pgField(\n build,\n fieldWithHooks,\n \"edges\",\n {\n description: build.wrapDescription(\n `A list of edges which contains the \\`${tableTypeName}\\` and cursor to aid in pagination.`,\n \"field\"\n ),\n type: new GraphQLNonNull(\n new GraphQLList(new GraphQLNonNull(EdgeType))\n ),\n resolve(data, _args, _context, resolveInfo) {\n const safeAlias =\n getSafeAliasFromResolveInfo(resolveInfo);\n return data.data.map(entry => ({\n ...entry,\n ...entry[safeAlias],\n }));\n },\n },\n {},\n false,\n {\n hoistCursor: true,\n }\n ),\n pageInfo: PageInfo && {\n description: build.wrapDescription(\n \"Information to aid in pagination.\",\n \"field\"\n ),\n type: new GraphQLNonNull(PageInfo),\n resolve(data) {\n return data;\n },\n },\n };\n },\n },\n {\n __origin: `Adding table connection type for ${describePgEntity(\n table\n )}. You can rename the table's GraphQL type via a 'Smart Comment':\\n\\n ${sqlCommentByAddingTags(\n table,\n {\n name: \"newNameHere\",\n }\n )}`,\n isConnectionType: true,\n isPgRowConnectionType: true,\n edgeType: EdgeType,\n nodeType: TableType,\n pgIntrospection: table,\n }\n );\n },\n true\n );\n pgRegisterGqlInputTypeByTypeId(\n tablePgType.id,\n (_set, modifier) => {\n // This must come first, it triggers creation of all the types\n const TableType = pgGetGqlTypeByTypeIdAndModifier(\n tablePgType.id,\n null\n );\n // This must come after the pgGetGqlTypeByTypeIdAndModifier call\n if (modifier === \"patch\") {\n // TODO: v5: move the definition from above down here\n return TablePatchType;\n }\n if (modifier === \"base\") {\n // TODO: v5: move the definition from above down here\n return TableBaseInputType;\n }\n if (TableType) {\n return getTypeByName(inflection.inputType(TableType));\n }\n return null;\n },\n true\n );\n\n if (arrayTablePgType) {\n // Note: these do not return\n //\n // `new GraphQLList(new GraphQLNonNull(...))`\n //\n // because it's possible to return null entries from postgresql\n // functions. We should probably add a flag to instead export\n // the non-null version as that's more typical.\n pgRegisterGqlTypeByTypeId(\n arrayTablePgType.id,\n () => {\n const TableType = pgGetGqlTypeByTypeIdAndModifier(\n tablePgType.id,\n null\n );\n return new GraphQLList(TableType);\n },\n true\n );\n pgRegisterGqlInputTypeByTypeId(\n arrayTablePgType.id,\n (_set, modifier) => {\n const RelevantTableInputType =\n pgGetGqlInputTypeByTypeIdAndModifier(tablePgType.id, modifier);\n if (RelevantTableInputType) {\n return new GraphQLList(RelevantTableInputType);\n }\n },\n true\n );\n }\n });\n return _;\n },\n [\"PgTables\"],\n [],\n [\"PgTypes\"]\n );\n}: Plugin);\n"],"mappings":";;;;;;AAEA,MAAMA,MAAM,GAAGC,GAAG,IAAIC,MAAM,CAACC,IAAI,CAACC,MAAM,CAACH,GAAG,CAAC,CAAC,CAACI,QAAQ,CAAC,QAAQ,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