proto.io 0.0.190 → 0.0.191

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/dist/index.js CHANGED
@@ -161,6 +161,8 @@ const dispatcher = (proto, options) => {
161
161
  }
162
162
  },
163
163
  async insertMany(options, values) {
164
+ if (options.className === 'File')
165
+ throw Error('File is not support insertMany');
164
166
  random.QueryValidator.recursiveCheck(values);
165
167
  const _validator = await validator();
166
168
  _validator.validateCountMatches(options.className, options.countMatches ?? []);
@@ -201,6 +203,8 @@ const dispatcher = (proto, options) => {
201
203
  return proto.storage.atomic((storage) => storage.updateMany(_validator.decodeQuery(normalize(query), 'update'), normalize(_validator.validateFields(query.className, update, 'update', random.QueryValidator.patterns.path))));
202
204
  },
203
205
  async upsertOne(query, update, setOnInsert) {
206
+ if (query.className === 'File')
207
+ throw Error('File is not support upsertOne');
204
208
  random.QueryValidator.recursiveCheck(query, update, setOnInsert);
205
209
  const _validator = await validator();
206
210
  if (!_validator.validateCLPs(query.className, 'create', 'update'))
@@ -220,6 +224,8 @@ const dispatcher = (proto, options) => {
220
224
  }
221
225
  },
222
226
  async upsertMany(query, update, setOnInsert) {
227
+ if (query.className === 'File')
228
+ throw Error('File is not support upsertOne');
223
229
  random.QueryValidator.recursiveCheck(query, update, setOnInsert);
224
230
  const _validator = await validator();
225
231
  if (!_validator.validateCLPs(query.className, 'create', 'update'))
@@ -916,7 +922,7 @@ class ProtoInternal {
916
922
  const data = object[_private.PVK].extra.data;
917
923
  if (_.isNil(data))
918
924
  throw Error('Invalid file object');
919
- const { nonce, maxUploadSize, attributes } = this.varifyUploadToken(proto, options?.uploadToken, options?.master);
925
+ const { nonce, attributes = {}, maxUploadSize = this.options.maxUploadSize, } = options?.uploadToken ? this.varifyUploadToken(proto, options.uploadToken, options.master) : {};
920
926
  if (nonce) {
921
927
  const found = await proto.Query('File').equalTo('nonce', nonce).first({ master: true });
922
928
  if (found)
@@ -1825,6 +1831,9 @@ var classesRoute = (router, proto) => {
1825
1831
  const query = relatedBy ? payload.Relation(payload.Object(relatedBy.className, relatedBy.objectId), relatedBy.key) : payload.Query(name);
1826
1832
  query[_private.PVK].options = options;
1827
1833
  const opts = { master: payload.isMaster };
1834
+ if (_.includes(['File', '_Job', '_JobScope'], name) &&
1835
+ _.includes(['insert', 'insertMany', 'upsertOne', 'upsertMany'], operation))
1836
+ throw Error('Invaild operation');
1828
1837
  switch (operation) {
1829
1838
  case 'explain':
1830
1839
  if (!payload.isMaster)