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