proto.io 0.0.194 → 0.0.196

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.
@@ -1,5 +1,5 @@
1
- import { T as TSchema, P as ProtoService } from '../../internals/index-BDHXW8gd.js';
2
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DIRRQ7jd.js';
1
+ import { T as TSchema, P as ProtoService } from '../../internals/index-CqunpmT-.js';
2
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DjHHDI1M.js';
3
3
  import '@o2ter/utils-js';
4
4
  import 'jsonwebtoken';
5
5
  import '@o2ter/server-js';
@@ -1,5 +1,5 @@
1
- import { P as ProtoService } from '../../internals/index-BDHXW8gd.js';
2
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DIRRQ7jd.js';
1
+ import { P as ProtoService } from '../../internals/index-CqunpmT-.js';
2
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DjHHDI1M.js';
3
3
  import '@o2ter/utils-js';
4
4
  import 'jsonwebtoken';
5
5
  import '@o2ter/server-js';
@@ -1,7 +1,7 @@
1
1
  import * as _google_cloud_storage from '@google-cloud/storage';
2
2
  import { Storage } from '@google-cloud/storage';
3
- import { P as ProtoService } from '../../internals/index-BDHXW8gd.js';
4
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DIRRQ7jd.js';
3
+ import { P as ProtoService } from '../../internals/index-CqunpmT-.js';
4
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DjHHDI1M.js';
5
5
  import '@o2ter/utils-js';
6
6
  import 'jsonwebtoken';
7
7
  import '@o2ter/server-js';
@@ -1,5 +1,5 @@
1
1
  import { Pool, PoolClient, PoolConfig } from 'pg';
2
- import { _ as _TValue, T as TSchema, Q as QuerySelector, q as DecodedQuery, F as FindOptions, R as RelationOptions, r as DecodedSortOption, I as InsertOptions, t as TValue, u as FindOneOptions, v as TUpdateOp, w as FieldSelectorExpression, x as QueryExpression, y as TStorage, z as TransactionOptions, h as TObject, A as TQueryRandomOptions, B as TPubSub } from '../../internals/index-BDHXW8gd.js';
2
+ import { _ as _TValue, T as TSchema, Q as QuerySelector, q as DecodedQuery, F as FindOptions, R as RelationOptions, r as DecodedSortOption, I as InsertOptions, t as TValue, u as FindOneOptions, v as TUpdateOp, w as FieldSelectorExpression, x as QueryExpression, y as TStorage, z as TransactionOptions, h as TObject, A as TQueryRandomOptions, B as TPubSub } from '../../internals/index-CqunpmT-.js';
3
3
  import * as _o2ter_utils_js from '@o2ter/utils-js';
4
4
  import { asyncStream } from '@o2ter/utils-js';
5
5
  import 'jsonwebtoken';
package/dist/client.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { P as ProtoClient } from './internals/index-z8mWupzT.js';
2
- export { c as classExtends, e as isFile, f as isJob, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-z8mWupzT.js';
1
+ import { P as ProtoClient } from './internals/index-ClOV7WJp.js';
2
+ export { c as classExtends, e as isFile, f as isJob, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-ClOV7WJp.js';
3
3
  export { Decimal } from 'decimal.js';
4
- export { D as DeserializeOptions, S as SerializeOptions, d as TSerializable, e as deserialize, s as serialize } from './internals/index-BDHXW8gd.js';
4
+ export { D as DeserializeOptions, S as SerializeOptions, d as TSerializable, e as deserialize, s as serialize } from './internals/index-CqunpmT-.js';
5
5
  import '@o2ter/utils-js';
6
6
  import 'socket.io-client';
7
7
  import '@socket.io/component-emitter';
package/dist/client.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./internals/index-M-VqTiz9.js');
5
+ var index = require('./internals/index-DbXVThGW.js');
6
6
  var Decimal = require('decimal.js');
7
7
  require('@o2ter/utils-js');
8
8
  require('./internals/private-Ciddhure.js');
package/dist/client.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { e as ProtoClient } from './internals/index-BAbXyJEC.mjs';
2
- export { f as classExtends, d as deserialize, k as isFile, l as isJob, g as isObject, i as isQuery, j as isRole, h as isUser, s as serialize } from './internals/index-BAbXyJEC.mjs';
1
+ import { e as ProtoClient } from './internals/index-C9eiMOSP.mjs';
2
+ export { f as classExtends, d as deserialize, k as isFile, l as isJob, g as isObject, i as isQuery, j as isRole, h as isUser, s as serialize } from './internals/index-C9eiMOSP.mjs';
3
3
  export { Decimal } from 'decimal.js';
4
4
  import '@o2ter/utils-js';
5
5
  import './internals/private-CNw40LZ7.mjs';
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 { T as TSchema, _ as _TValue, P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions } from './internals/index-BDHXW8gd.js';
5
- export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-BDHXW8gd.js';
4
+ import { T as TSchema, _ as _TValue, P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions } from './internals/index-CqunpmT-.js';
5
+ export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-CqunpmT-.js';
6
6
  import Decimal from 'decimal.js';
7
7
  export { Decimal } from 'decimal.js';
8
- export { P as ProtoClient, c as classExtends, e as isFile, f as isJob, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-z8mWupzT.js';
8
+ export { P as ProtoClient, c as classExtends, e as isFile, f as isJob, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-ClOV7WJp.js';
9
9
  import '@o2ter/utils-js';
10
10
  import 'jsonwebtoken';
11
11
  import 'lodash';
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ var serverJs = require('@o2ter/server-js');
7
7
  var random = require('./internals/random-CObICDCy.js');
8
8
  var _private = require('./internals/private-Ciddhure.js');
9
9
  var utilsJs = require('@o2ter/utils-js');
10
- var index = require('./internals/index-M-VqTiz9.js');
10
+ var index = require('./internals/index-DbXVThGW.js');
11
11
  var index$1 = require('./internals/index-Dej3GgVf.js');
12
12
  var jwt = require('jsonwebtoken');
13
13
  var node_buffer = require('node:buffer');
@@ -669,12 +669,8 @@ const proxy = (x) => {
669
669
  for (const name of _.uniq(_.flatMap(utilsJs.prototypes(proxy), x => Object.getOwnPropertyNames(x)))) {
670
670
  if (name === 'constructor')
671
671
  continue;
672
- if (_.isFunction(self[name])) {
673
- proxy[name] = self[name].bind(self);
674
- }
675
- else {
676
- Object.defineProperty(proxy, name, { get: () => self[name] });
677
- }
672
+ const value = _.isFunction(self[name]) ? self[name].bind(self) : self[name];
673
+ Object.defineProperty(proxy, name, { get: () => value });
678
674
  }
679
675
  return proxy;
680
676
  };
@@ -1145,7 +1141,7 @@ class JobRunner {
1145
1141
  async getNextJob(proto) {
1146
1142
  const availableJobs = await this.getAvailableJobs(proto);
1147
1143
  return await proto.Query('_Job')
1148
- .containsIn('name', availableJobs)
1144
+ .containedIn('name', availableJobs)
1149
1145
  .or(q => q.lessThan('startedAt', new Date(Date.now() - JobRunner.TIMEOUT)), q => q.equalTo('startedAt', null))
1150
1146
  .equalTo('completedAt', null)
1151
1147
  .empty('locks')
@@ -1562,7 +1558,7 @@ class ProtoService extends index.ProtoType {
1562
1558
  while (!_.isEmpty(queue)) {
1563
1559
  queue = await self.Query('Role')
1564
1560
  .or(_.map(_.uniq(['roles', ...roleKeys]), k => q => q.isIntersect(k, queue)))
1565
- .notContainsIn('_id', _.compact(_.map(roles, x => x.objectId)))
1561
+ .notContainedIn('_id', _.compact(_.map(roles, x => x.objectId)))
1566
1562
  .includes('name')
1567
1563
  .find({ master: true });
1568
1564
  roles = _.uniqBy([...roles, ...queue], x => x.objectId);
@@ -2054,18 +2050,6 @@ var classesRoute = (router, proto) => {
2054
2050
  // THE SOFTWARE.
2055
2051
  //
2056
2052
  var functionRoute = (router, proto) => {
2057
- router.get('/functions/:name', async (req, res) => {
2058
- res.setHeader('Cache-Control', ['no-cache', 'no-store']);
2059
- const { name } = req.params;
2060
- if (_.isNil(proto[_private.PVK].functions[name]))
2061
- return void res.sendStatus(404);
2062
- await response(res, () => {
2063
- const payload = proto.connect(req, x => ({
2064
- params: null,
2065
- }));
2066
- return payload[_private.PVK].run(payload, name, payload, { master: payload.isMaster });
2067
- });
2068
- });
2069
2053
  router.post('/functions/:name', serverJs.Server.text({ type: '*/*' }), async (req, res) => {
2070
2054
  res.setHeader('Cache-Control', ['no-cache', 'no-store']);
2071
2055
  const { name } = req.params;
@@ -2106,16 +2090,6 @@ var functionRoute = (router, proto) => {
2106
2090
  // THE SOFTWARE.
2107
2091
  //
2108
2092
  var jobRoute = (router, proto) => {
2109
- router.get('/jobs/:name', async (req, res) => {
2110
- res.setHeader('Cache-Control', ['no-cache', 'no-store']);
2111
- const { name } = req.params;
2112
- if (_.isNil(proto[_private.PVK].jobs[name]))
2113
- return void res.sendStatus(404);
2114
- await response(res, () => {
2115
- const payload = proto.connect(req);
2116
- return payload[_private.PVK].scheduleJob(payload, name, null, { master: payload.isMaster });
2117
- });
2118
- });
2119
2093
  router.post('/jobs/:name', serverJs.Server.text({ type: '*/*' }), async (req, res) => {
2120
2094
  res.setHeader('Cache-Control', ['no-cache', 'no-store']);
2121
2095
  const { name } = req.params;