@coderich/autograph 0.9.7 → 0.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/graphql/ast/Field.js
CHANGED
|
@@ -175,4 +175,9 @@ module.exports = class Field extends Node {
|
|
|
175
175
|
type = this.isArray() ? `[${type}${this.isArrayElementRequired() ? '!' : ''}]` : type;
|
|
176
176
|
return `${type}${req}`;
|
|
177
177
|
}
|
|
178
|
+
|
|
179
|
+
getSubscriptionType() {
|
|
180
|
+
if (this.isFKReference()) return this.isArray() ? '[ID]' : 'ID';
|
|
181
|
+
return this.getGQLType();
|
|
182
|
+
}
|
|
178
183
|
};
|
|
@@ -90,7 +90,7 @@ module.exports = (schema) => {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
type ${model.getName()}SubscriptionPayloadEventData {
|
|
93
|
-
${getGQLWhereFields(model).map(field => `${field.getName()}: ${field.
|
|
93
|
+
${getGQLWhereFields(model).map(field => `${field.getName()}: ${field.getSubscriptionType()}`)}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
interface ${model.getName()}SubscriptionQuery {
|
|
@@ -154,7 +154,7 @@ module.exports = class QueryResolver {
|
|
|
154
154
|
return this.resolver.match(model).match(match).flags(flags).one({ required: true }).then(async (doc) => {
|
|
155
155
|
await DataService.spliceEmbeddedArray(query, doc, key, from, to);
|
|
156
156
|
|
|
157
|
-
return createSystemEvent('Mutation', { method: '
|
|
157
|
+
return createSystemEvent('Mutation', { method: 'update', query: query.doc(doc).merged(doc) }, async () => {
|
|
158
158
|
await model.validate(query, doc);
|
|
159
159
|
const $doc = model.serialize(query, doc, true);
|
|
160
160
|
return this.resolver.resolve(query.method('updateOne').doc(doc).$doc($doc));
|
|
@@ -41,7 +41,7 @@ exports.mergeDeep = (...args) => DeepMerge.all(args, { isMergeableObject: obj =>
|
|
|
41
41
|
exports.uniq = arr => [...new Set(arr.map(a => `${a}`))];
|
|
42
42
|
exports.timeout = ms => new Promise(res => setTimeout(res, ms));
|
|
43
43
|
exports.hashObject = obj => ObjectHash(obj, { respectType: false, respectFunctionNames: false, respectFunctionProperties: false, unorderedArrays: true, ignoreUnknown: true, replacer: r => (r instanceof ObjectID ? `${r}` : r) });
|
|
44
|
-
exports.globToRegex = (glob, options = {}) => PicoMatch.makeRe(glob, {
|
|
44
|
+
exports.globToRegex = (glob, options = {}) => PicoMatch.makeRe(glob, { ...options, expandRange: (a, b) => `(${FillRange(a, b, { toRegex: true })})` });
|
|
45
45
|
exports.globToRegexp = (glob, options = {}) => PicoMatch.toRegex(exports.globToRegex(glob, options));
|
|
46
46
|
exports.toGUID = (model, id) => Buffer.from(`${model},${`${id}`}`).toString('base64');
|
|
47
47
|
exports.fromGUID = guid => Buffer.from(`${guid}`, 'base64').toString('ascii').split(',');
|