proto.io 0.0.226 → 0.0.228

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.
Files changed (30) hide show
  1. package/dist/adapters/file/aliyun-oss.d.ts +3 -3
  2. package/dist/adapters/file/database.d.ts +2 -2
  3. package/dist/adapters/file/filesystem.d.ts +3 -3
  4. package/dist/adapters/file/google-cloud-storage.d.ts +3 -3
  5. package/dist/adapters/storage/{progres.d.ts → postgres.d.ts} +2 -2
  6. package/dist/adapters/storage/postgres.d.ts.map +1 -0
  7. package/dist/adapters/storage/{progres.js → postgres.js} +1 -1
  8. package/dist/adapters/storage/postgres.js.map +1 -0
  9. package/dist/adapters/storage/{progres.mjs → postgres.mjs} +1 -1
  10. package/dist/adapters/storage/postgres.mjs.map +1 -0
  11. package/dist/client.d.ts +3 -3
  12. package/dist/index.d.ts +3 -3
  13. package/dist/index.js +18 -18
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +18 -18
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/internals/{base-DSo02iAX.d.ts → base-CW4QHAo3.d.ts} +2 -2
  18. package/dist/internals/{base-DSo02iAX.d.ts.map → base-CW4QHAo3.d.ts.map} +1 -1
  19. package/dist/internals/{chunk-BhwfdCdq.d.ts → chunk-DPgxK2_o.d.ts} +3 -3
  20. package/dist/internals/{chunk-BhwfdCdq.d.ts.map → chunk-DPgxK2_o.d.ts.map} +1 -1
  21. package/dist/internals/index-BWZIV3_T.mjs.map +1 -1
  22. package/dist/internals/{index-Cj45GkKv.d.ts → index-CywcwPk-.d.ts} +2 -2
  23. package/dist/internals/{index-Cj45GkKv.d.ts.map → index-CywcwPk-.d.ts.map} +1 -1
  24. package/dist/internals/{index-1ZK5N4yb.d.ts → index-h4KGKuhq.d.ts} +5 -5
  25. package/dist/internals/{index-1ZK5N4yb.d.ts.map → index-h4KGKuhq.d.ts.map} +1 -1
  26. package/dist/internals/index-vOFh8pVc.js.map +1 -1
  27. package/package.json +1 -1
  28. package/dist/adapters/storage/progres.d.ts.map +0 -1
  29. package/dist/adapters/storage/progres.js.map +0 -1
  30. package/dist/adapters/storage/progres.mjs.map +0 -1
package/dist/index.mjs CHANGED
@@ -701,7 +701,7 @@ const passwordHash = async (alg, password, options) => {
701
701
  ...options
702
702
  };
703
703
  };
704
- const varifyPassword = async (alg, password, options) => {
704
+ const verifyPassword = async (alg, password, options) => {
705
705
  if (!_.isString(options.salt))
706
706
  return false;
707
707
  if (!_.isString(options.derivedKey))
@@ -898,7 +898,7 @@ class ProtoInternal {
898
898
  }
899
899
  return callback(proxy(payload ?? proto));
900
900
  }
901
- async varifyPassword(proto, user, password, options) {
901
+ async verifyPassword(proto, user, password, options) {
902
902
  if (!user.id)
903
903
  throw Error('Invalid user object');
904
904
  const _user = await proto.InsecureQuery('User')
@@ -906,7 +906,7 @@ class ProtoInternal {
906
906
  .includes('_id', 'password')
907
907
  .first(options);
908
908
  const { alg, ...opts } = _user?.get('password') ?? {};
909
- return varifyPassword(alg, password, opts);
909
+ return verifyPassword(alg, password, opts);
910
910
  }
911
911
  async setPassword(proto, user, password, options) {
912
912
  if (!user.id)
@@ -947,8 +947,8 @@ class ProtoInternal {
947
947
  }
948
948
  return object;
949
949
  }
950
- varifyUploadToken(proto, token, isMaster) {
951
- const { nonce, attributes, maxUploadSize, } = (_.isString(token) ? this.jwtVarify(token, 'upload') ?? {} : {});
950
+ verifyUploadToken(proto, token, isMaster) {
951
+ const { nonce, attributes, maxUploadSize, } = (_.isString(token) ? this.jwtVerify(token, 'upload') ?? {} : {});
952
952
  if (!isMaster && !nonce)
953
953
  throw Error('Upload token is required');
954
954
  return {
@@ -961,7 +961,7 @@ class ProtoInternal {
961
961
  const data = object[PVK].extra.data;
962
962
  if (_.isNil(data))
963
963
  throw Error('Invalid file object');
964
- const { nonce, attributes = {}, maxUploadSize = this.options.maxUploadSize, } = options?.uploadToken ? this.varifyUploadToken(proto, options.uploadToken, options.master) : {};
964
+ const { nonce, attributes = {}, maxUploadSize = this.options.maxUploadSize, } = options?.uploadToken ? this.verifyUploadToken(proto, options.uploadToken, options.master) : {};
965
965
  if (nonce) {
966
966
  const found = await proto.Query('File').equalTo('nonce', nonce).first({ master: true });
967
967
  if (found)
@@ -1068,7 +1068,7 @@ class ProtoInternal {
1068
1068
  })();
1069
1069
  return jwt.sign(payload, this.options.jwtToken, opts);
1070
1070
  }
1071
- jwtVarify(token, options = {}) {
1071
+ jwtVerify(token, options = {}) {
1072
1072
  try {
1073
1073
  const opts = (() => {
1074
1074
  switch (options) {
@@ -1204,7 +1204,7 @@ class ProtoInternal {
1204
1204
  obj.set('data', params);
1205
1205
  obj.set('user', user);
1206
1206
  await obj.save({ master: true });
1207
- this.jobRunner.excuteJob(proto);
1207
+ this.jobRunner.executeJob(proto);
1208
1208
  return obj;
1209
1209
  }
1210
1210
  }
@@ -1266,7 +1266,7 @@ class JobRunner {
1266
1266
  job.set('completedAt', new Date());
1267
1267
  await job.save({ master: true });
1268
1268
  }
1269
- async excuteJob(proto) {
1269
+ async executeJob(proto) {
1270
1270
  if (this._running || this._stopped)
1271
1271
  return;
1272
1272
  this._running = true;
@@ -1296,7 +1296,7 @@ class JobRunner {
1296
1296
  finally {
1297
1297
  clearInterval(timer);
1298
1298
  }
1299
- this.excuteJob(proto);
1299
+ this.executeJob(proto);
1300
1300
  })();
1301
1301
  }
1302
1302
  this._running = false;
@@ -1330,7 +1330,7 @@ class JobRunner {
1330
1330
  const _sessionWithToken = async (proto, token) => {
1331
1331
  if (_.isEmpty(token))
1332
1332
  return;
1333
- const payload = proto[PVK].jwtVarify(token, 'login') ?? {};
1333
+ const payload = proto[PVK].jwtVerify(token, 'login') ?? {};
1334
1334
  if (!_.isString(payload.sessionId) || _.isEmpty(payload.sessionId))
1335
1335
  return;
1336
1336
  const session = await proto.Query('_Session')
@@ -1489,8 +1489,8 @@ const scheduleOp = {
1489
1489
  expireDocument: async (proto) => {
1490
1490
  await proto.gc();
1491
1491
  },
1492
- excuteJob: async (proto) => {
1493
- proto[PVK].jobRunner.excuteJob(proto);
1492
+ executeJob: async (proto) => {
1493
+ proto[PVK].jobRunner.executeJob(proto);
1494
1494
  },
1495
1495
  };
1496
1496
  const schedule = (proto) => {
@@ -1699,8 +1699,8 @@ class ProtoService extends ProtoType {
1699
1699
  if (req.res)
1700
1700
  await signUser(this, req.res, undefined, options);
1701
1701
  }
1702
- varifyPassword(user, password, options) {
1703
- return this[PVK].varifyPassword(this, user, password, options);
1702
+ verifyPassword(user, password, options) {
1703
+ return this[PVK].verifyPassword(this, user, password, options);
1704
1704
  }
1705
1705
  setPassword(user, password, options) {
1706
1706
  return this[PVK].setPassword(this, user, password, options);
@@ -1787,8 +1787,8 @@ class ProtoService extends ProtoType {
1787
1787
  jwtSign(payload, options) {
1788
1788
  return this[PVK].jwtSign(payload, options);
1789
1789
  }
1790
- jwtVarify(token, options = {}) {
1791
- return this[PVK].jwtVarify(token, options);
1790
+ jwtVerify(token, options = {}) {
1791
+ return this[PVK].jwtVerify(token, options);
1792
1792
  }
1793
1793
  notify(data) {
1794
1794
  return this[PVK].notify(this, data);
@@ -2281,7 +2281,7 @@ var filesRoute = (router, proto) => {
2281
2281
  await response(res, async () => {
2282
2282
  const payload = proto.connect(req);
2283
2283
  const uploadToken = req.header(UPLOAD_TOKEN_HEADER_NAME);
2284
- const { maxUploadSize } = payload[PVK].varifyUploadToken(payload, uploadToken, payload.isMaster);
2284
+ const { maxUploadSize } = payload[PVK].verifyUploadToken(payload, uploadToken, payload.isMaster);
2285
2285
  const { attributes, file } = await decodeFormStream(req, (file, info) => proto.fileStorage.create(proto, file, info, maxUploadSize));
2286
2286
  try {
2287
2287
  const obj = payload.Object('File');