remult 3.3.0-next.1 → 3.3.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/esm/graphql.js CHANGED
@@ -360,7 +360,7 @@ export function remultGraphql(options) {
360
360
  [toCamelCase(getMetaType(meta))]: y,
361
361
  });
362
362
  },
363
- }, arg1.id, arg1.patch);
363
+ }, { get: () => undefined }, arg1.id, arg1.patch);
364
364
  })(args, req);
365
365
  }
366
366
  // update many
@@ -208,7 +208,7 @@ class KnexEntityDataProvider {
208
208
  wrapIdentifier: r.wrapIdentifier,
209
209
  };
210
210
  }
211
- async update(id, data) {
211
+ async update(id, data, options) {
212
212
  const e = await this.init();
213
213
  let f = new FilterConsumerBridgeToKnexRequest(e, this.rawSqlWrapIdentifier);
214
214
  Filter.fromEntityFilter(this.entity, this.entity.idMetadata.getIdFilter(id)).__applyToConsumer(f);
@@ -228,6 +228,8 @@ class KnexEntityDataProvider {
228
228
  await this.getEntityFrom(e)
229
229
  .update(updateObject)
230
230
  .where((b) => where.forEach((w) => w(b)));
231
+ if (options?.select === 'none')
232
+ return undefined;
231
233
  return getRowAfterUpdate(this.entity, this, data, id, 'update');
232
234
  }
233
235
  async delete(id) {
@@ -239,7 +241,7 @@ class KnexEntityDataProvider {
239
241
  .delete()
240
242
  .where((b) => where.forEach((w) => w(b)));
241
243
  }
242
- async insert(data) {
244
+ async insert(data, options) {
243
245
  const e = await this.init();
244
246
  let insertObject = {};
245
247
  for (const x of this.entity.fields) {
@@ -265,12 +267,16 @@ class KnexEntityDataProvider {
265
267
  let result = await insert.returning(this.entity.idMetadata.field.dbName);
266
268
  newId = result[0][this.entity.idMetadata.field.dbName];
267
269
  }
270
+ if (options?.select === 'none')
271
+ return undefined;
268
272
  return this.find({
269
273
  where: new Filter((x) => x.isEqualTo(this.entity.idMetadata.field, newId)),
270
274
  }).then((y) => y[0]);
271
275
  }
272
276
  else
273
277
  await insert;
278
+ if (options?.select === 'none')
279
+ return undefined;
274
280
  return getRowAfterUpdate(this.entity, this, data, undefined, 'insert');
275
281
  }
276
282
  }
@@ -5,7 +5,7 @@ import { remult as remultContext } from './src/remult-proxy.js';
5
5
  import { getRepository } from './src/remult3/RepositoryImplementation.js';
6
6
  import { getRepositoryInternals } from './src/remult3/repository-internals.js';
7
7
  import { getRowAfterUpdate } from './src/data-providers/sql-database.js';
8
- import { GroupByCountMember, GroupByOperators } from './src/remult3/remult3.js';
8
+ import { GroupByCountMember, GroupByOperators, } from './src/remult3/remult3.js';
9
9
  export class MongoDataProvider {
10
10
  db;
11
11
  client;
@@ -246,7 +246,7 @@ class MongoEntityDataProvider {
246
246
  .map((x) => this.translateFromDb(x, e, options.select))
247
247
  .toArray());
248
248
  }
249
- async update(id, data) {
249
+ async update(id, data, options) {
250
250
  let { collection, e } = await this.collection();
251
251
  let f = new FilterConsumerBridgeToMongo(e);
252
252
  Filter.fromEntityFilter(this.entity, this.entity.idMetadata.getIdFilter(id)).__applyToConsumer(f);
@@ -262,6 +262,8 @@ class MongoEntityDataProvider {
262
262
  let r = await collection.updateOne(await f.resolveWhere(), {
263
263
  $set: newR,
264
264
  }, { session: this.session });
265
+ if (options?.select === 'none')
266
+ return undefined;
265
267
  return getRowAfterUpdate(this.entity, this, data, id, 'update');
266
268
  }
267
269
  async delete(id) {
@@ -272,11 +274,13 @@ class MongoEntityDataProvider {
272
274
  session: this.session,
273
275
  });
274
276
  }
275
- async insert(data) {
277
+ async insert(data, options) {
276
278
  let { collection, e } = await this.collection();
277
279
  let r = await collection.insertOne(await this.translateToDb(data, e), {
278
280
  session: this.session,
279
281
  });
282
+ if (options?.select === 'none')
283
+ return undefined;
280
284
  return await this.translateFromDb(await collection.findOne({ _id: r.insertedId }, { session: this.session }), e);
281
285
  }
282
286
  async collection() {