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/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { P as ProtoClient } from './internals/index-Cj45GkKv.js';
2
- export { c as classExtends } from './internals/index-Cj45GkKv.js';
3
- export { D as DeserializeOptions, S as SerializeOptions, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-1ZK5N4yb.js';
1
+ import { P as ProtoClient } from './internals/index-CywcwPk-.js';
2
+ export { c as classExtends } from './internals/index-CywcwPk-.js';
3
+ export { D as DeserializeOptions, S as SerializeOptions, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-h4KGKuhq.js';
4
4
  export { Decimal } from 'decimal.js';
5
5
  import '@o2ter/utils-js';
6
6
  import 'socket.io-client';
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as socket_io from 'socket.io';
2
2
  import { Router } from 'express';
3
3
  import { Server } from '@o2ter/server-js';
4
- import { P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions, T as TSchema, c as TValueWithoutObject } from './internals/index-1ZK5N4yb.js';
5
- export { D as DeserializeOptions, S as SerializeOptions, d as TFileStorage, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-1ZK5N4yb.js';
4
+ import { P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions, T as TSchema, c as TValueWithoutObject } from './internals/index-h4KGKuhq.js';
5
+ export { D as DeserializeOptions, S as SerializeOptions, d as TFileStorage, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-h4KGKuhq.js';
6
6
  import Decimal from 'decimal.js';
7
7
  export { Decimal } from 'decimal.js';
8
- export { P as ProtoClient, c as classExtends } from './internals/index-Cj45GkKv.js';
8
+ export { P as ProtoClient, c as classExtends } from './internals/index-CywcwPk-.js';
9
9
  import '@o2ter/utils-js';
10
10
  import 'jsonwebtoken';
11
11
  import 'lodash';
package/dist/index.js CHANGED
@@ -704,7 +704,7 @@ const passwordHash = async (alg, password, options) => {
704
704
  ...options
705
705
  };
706
706
  };
707
- const varifyPassword = async (alg, password, options) => {
707
+ const verifyPassword = async (alg, password, options) => {
708
708
  if (!_.isString(options.salt))
709
709
  return false;
710
710
  if (!_.isString(options.derivedKey))
@@ -901,7 +901,7 @@ class ProtoInternal {
901
901
  }
902
902
  return callback(proxy(payload ?? proto));
903
903
  }
904
- async varifyPassword(proto, user, password, options) {
904
+ async verifyPassword(proto, user, password, options) {
905
905
  if (!user.id)
906
906
  throw Error('Invalid user object');
907
907
  const _user = await proto.InsecureQuery('User')
@@ -909,7 +909,7 @@ class ProtoInternal {
909
909
  .includes('_id', 'password')
910
910
  .first(options);
911
911
  const { alg, ...opts } = _user?.get('password') ?? {};
912
- return varifyPassword(alg, password, opts);
912
+ return verifyPassword(alg, password, opts);
913
913
  }
914
914
  async setPassword(proto, user, password, options) {
915
915
  if (!user.id)
@@ -950,8 +950,8 @@ class ProtoInternal {
950
950
  }
951
951
  return object;
952
952
  }
953
- varifyUploadToken(proto, token, isMaster) {
954
- const { nonce, attributes, maxUploadSize, } = (_.isString(token) ? this.jwtVarify(token, 'upload') ?? {} : {});
953
+ verifyUploadToken(proto, token, isMaster) {
954
+ const { nonce, attributes, maxUploadSize, } = (_.isString(token) ? this.jwtVerify(token, 'upload') ?? {} : {});
955
955
  if (!isMaster && !nonce)
956
956
  throw Error('Upload token is required');
957
957
  return {
@@ -964,7 +964,7 @@ class ProtoInternal {
964
964
  const data = object[_private.PVK].extra.data;
965
965
  if (_.isNil(data))
966
966
  throw Error('Invalid file object');
967
- const { nonce, attributes = {}, maxUploadSize = this.options.maxUploadSize, } = options?.uploadToken ? this.varifyUploadToken(proto, options.uploadToken, options.master) : {};
967
+ const { nonce, attributes = {}, maxUploadSize = this.options.maxUploadSize, } = options?.uploadToken ? this.verifyUploadToken(proto, options.uploadToken, options.master) : {};
968
968
  if (nonce) {
969
969
  const found = await proto.Query('File').equalTo('nonce', nonce).first({ master: true });
970
970
  if (found)
@@ -1071,7 +1071,7 @@ class ProtoInternal {
1071
1071
  })();
1072
1072
  return jwt.sign(payload, this.options.jwtToken, opts);
1073
1073
  }
1074
- jwtVarify(token, options = {}) {
1074
+ jwtVerify(token, options = {}) {
1075
1075
  try {
1076
1076
  const opts = (() => {
1077
1077
  switch (options) {
@@ -1207,7 +1207,7 @@ class ProtoInternal {
1207
1207
  obj.set('data', params);
1208
1208
  obj.set('user', user);
1209
1209
  await obj.save({ master: true });
1210
- this.jobRunner.excuteJob(proto);
1210
+ this.jobRunner.executeJob(proto);
1211
1211
  return obj;
1212
1212
  }
1213
1213
  }
@@ -1269,7 +1269,7 @@ class JobRunner {
1269
1269
  job.set('completedAt', new Date());
1270
1270
  await job.save({ master: true });
1271
1271
  }
1272
- async excuteJob(proto) {
1272
+ async executeJob(proto) {
1273
1273
  if (this._running || this._stopped)
1274
1274
  return;
1275
1275
  this._running = true;
@@ -1299,7 +1299,7 @@ class JobRunner {
1299
1299
  finally {
1300
1300
  clearInterval(timer);
1301
1301
  }
1302
- this.excuteJob(proto);
1302
+ this.executeJob(proto);
1303
1303
  })();
1304
1304
  }
1305
1305
  this._running = false;
@@ -1333,7 +1333,7 @@ class JobRunner {
1333
1333
  const _sessionWithToken = async (proto, token) => {
1334
1334
  if (_.isEmpty(token))
1335
1335
  return;
1336
- const payload = proto[_private.PVK].jwtVarify(token, 'login') ?? {};
1336
+ const payload = proto[_private.PVK].jwtVerify(token, 'login') ?? {};
1337
1337
  if (!_.isString(payload.sessionId) || _.isEmpty(payload.sessionId))
1338
1338
  return;
1339
1339
  const session = await proto.Query('_Session')
@@ -1492,8 +1492,8 @@ const scheduleOp = {
1492
1492
  expireDocument: async (proto) => {
1493
1493
  await proto.gc();
1494
1494
  },
1495
- excuteJob: async (proto) => {
1496
- proto[_private.PVK].jobRunner.excuteJob(proto);
1495
+ executeJob: async (proto) => {
1496
+ proto[_private.PVK].jobRunner.executeJob(proto);
1497
1497
  },
1498
1498
  };
1499
1499
  const schedule = (proto) => {
@@ -1702,8 +1702,8 @@ class ProtoService extends index.ProtoType {
1702
1702
  if (req.res)
1703
1703
  await signUser(this, req.res, undefined, options);
1704
1704
  }
1705
- varifyPassword(user, password, options) {
1706
- return this[_private.PVK].varifyPassword(this, user, password, options);
1705
+ verifyPassword(user, password, options) {
1706
+ return this[_private.PVK].verifyPassword(this, user, password, options);
1707
1707
  }
1708
1708
  setPassword(user, password, options) {
1709
1709
  return this[_private.PVK].setPassword(this, user, password, options);
@@ -1790,8 +1790,8 @@ class ProtoService extends index.ProtoType {
1790
1790
  jwtSign(payload, options) {
1791
1791
  return this[_private.PVK].jwtSign(payload, options);
1792
1792
  }
1793
- jwtVarify(token, options = {}) {
1794
- return this[_private.PVK].jwtVarify(token, options);
1793
+ jwtVerify(token, options = {}) {
1794
+ return this[_private.PVK].jwtVerify(token, options);
1795
1795
  }
1796
1796
  notify(data) {
1797
1797
  return this[_private.PVK].notify(this, data);
@@ -2284,7 +2284,7 @@ var filesRoute = (router, proto) => {
2284
2284
  await response(res, async () => {
2285
2285
  const payload = proto.connect(req);
2286
2286
  const uploadToken = req.header(_const.UPLOAD_TOKEN_HEADER_NAME);
2287
- const { maxUploadSize } = payload[_private.PVK].varifyUploadToken(payload, uploadToken, payload.isMaster);
2287
+ const { maxUploadSize } = payload[_private.PVK].verifyUploadToken(payload, uploadToken, payload.isMaster);
2288
2288
  const { attributes, file } = await decodeFormStream(req, (file, info) => proto.fileStorage.create(proto, file, info, maxUploadSize));
2289
2289
  try {
2290
2290
  const obj = payload.Object('File');