proto.io 0.0.160 → 0.0.161
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/adapters/file/database.d.ts +2 -2
- package/dist/adapters/file/filesystem.d.ts +2 -2
- package/dist/adapters/file/google-cloud-storage.d.ts +2 -2
- package/dist/adapters/storage/progres.d.ts +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -5
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{index-BraAbRER.d.ts → index-2EQQyKaU.d.ts} +2 -2
- package/dist/internals/index-2EQQyKaU.d.ts.map +1 -0
- package/dist/internals/{index-sFLwlp-C.d.ts → index-CHKUNXoz.d.ts} +2 -2
- package/dist/internals/index-CHKUNXoz.d.ts.map +1 -0
- package/dist/internals/{index-CXPH5Pup.d.ts → index-CXLttbg-.d.ts} +3 -3
- package/dist/internals/index-CXLttbg-.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/internals/index-BraAbRER.d.ts.map +0 -1
- package/dist/internals/index-CXPH5Pup.d.ts.map +0 -1
- package/dist/internals/index-sFLwlp-C.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TSchema, P as ProtoService } from '../../internals/index-
|
|
2
|
-
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-
|
|
1
|
+
import { T as TSchema, P as ProtoService } from '../../internals/index-CXLttbg-.js';
|
|
2
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-2EQQyKaU.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-
|
|
2
|
-
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-
|
|
1
|
+
import { P as ProtoService } from '../../internals/index-CXLttbg-.js';
|
|
2
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-2EQQyKaU.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-
|
|
4
|
-
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-
|
|
3
|
+
import { P as ProtoService } from '../../internals/index-CXLttbg-.js';
|
|
4
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-2EQQyKaU.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, n as EventData, T as TSchema, o as DecodedQuery, F as FindOptions, R as RelationOptions, Q as QuerySelector, p as DecodedSortOption, I as InsertOptions, q as TValue, r as FindOneOptions, t as TUpdateOp, u as FieldSelectorExpression, v as QueryExpression, w as TStorage, x as TransactionOptions, h as TObject, y as TQueryRandomOptions, z as TPubSub } from '../../internals/index-
|
|
2
|
+
import { _ as _TValue, n as EventData, T as TSchema, o as DecodedQuery, F as FindOptions, R as RelationOptions, Q as QuerySelector, p as DecodedSortOption, I as InsertOptions, q as TValue, r as FindOneOptions, t as TUpdateOp, u as FieldSelectorExpression, v as QueryExpression, w as TStorage, x as TransactionOptions, h as TObject, y as TQueryRandomOptions, z as TPubSub } from '../../internals/index-CXLttbg-.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-
|
|
2
|
-
export { c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-
|
|
1
|
+
import { P as ProtoClient } from './internals/index-CHKUNXoz.js';
|
|
2
|
+
export { c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-CHKUNXoz.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-
|
|
4
|
+
export { D as DeserializeOptions, S as SerializeOptions, d as TSerializable, e as deserialize, s as serialize } from './internals/index-CXLttbg-.js';
|
|
5
5
|
import '@o2ter/utils-js';
|
|
6
6
|
import 'socket.io-client';
|
|
7
7
|
import '@socket.io/component-emitter';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import * as socket_io from 'socket.io';
|
|
|
2
2
|
import * as socket_io_dist_typed_events from 'socket.io/dist/typed-events';
|
|
3
3
|
import * as express_serve_static_core from 'express-serve-static-core';
|
|
4
4
|
import { Server, RequestHandler } from '@o2ter/server-js';
|
|
5
|
-
import { T as TSchema, _ as _TValue, P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions } from './internals/index-
|
|
6
|
-
export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-
|
|
5
|
+
import { T as TSchema, _ as _TValue, P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions } from './internals/index-CXLttbg-.js';
|
|
6
|
+
export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-CXLttbg-.js';
|
|
7
7
|
import Decimal from 'decimal.js';
|
|
8
8
|
export { Decimal } from 'decimal.js';
|
|
9
|
-
export { P as ProtoClient, c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-
|
|
9
|
+
export { P as ProtoClient, c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-CHKUNXoz.js';
|
|
10
10
|
import '@o2ter/utils-js';
|
|
11
11
|
import 'jsonwebtoken';
|
|
12
12
|
import 'lodash';
|
package/dist/index.js
CHANGED
|
@@ -1171,13 +1171,24 @@ const sessionId = (proto, request) => {
|
|
|
1171
1171
|
const session = _session(proto, request);
|
|
1172
1172
|
return sessionMap.get(request)?.sessionId ?? session?.sessionId;
|
|
1173
1173
|
};
|
|
1174
|
-
const
|
|
1174
|
+
const userCacheMap = new WeakMap;
|
|
1175
1175
|
const fetchSessionInfo = async (proto, userId) => {
|
|
1176
|
-
|
|
1177
|
-
|
|
1176
|
+
if (!userId)
|
|
1177
|
+
return {};
|
|
1178
|
+
if (!userCacheMap.has(proto[_private.PVK]))
|
|
1179
|
+
userCacheMap.set(proto[_private.PVK], {});
|
|
1180
|
+
const cache = userCacheMap.get(proto[_private.PVK]);
|
|
1181
|
+
if (_.isNil(cache[userId]))
|
|
1182
|
+
cache[userId] = (async () => {
|
|
1183
|
+
const user = _.isString(userId) ? await proto.Query('User').get(userId, { master: true }) : undefined;
|
|
1184
|
+
const _roles = user instanceof index.TUser ? _.filter(await proto.userRoles(user), x => !_.isEmpty(x.name)) : [];
|
|
1185
|
+
cache[userId] = undefined;
|
|
1186
|
+
return { user, _roles };
|
|
1187
|
+
})();
|
|
1188
|
+
const { user, _roles } = await cache[userId];
|
|
1178
1189
|
return {
|
|
1179
|
-
|
|
1180
|
-
|
|
1190
|
+
user: user?.clone(),
|
|
1191
|
+
_roles: _.map(_roles, x => x.clone()),
|
|
1181
1192
|
};
|
|
1182
1193
|
};
|
|
1183
1194
|
const sessionWithToken = async (proto, token) => {
|
|
@@ -1189,6 +1200,7 @@ const sessionWithToken = async (proto, token) => {
|
|
|
1189
1200
|
loginedAt: info?.user ? session?.loginedAt : undefined,
|
|
1190
1201
|
};
|
|
1191
1202
|
};
|
|
1203
|
+
const sessionInfoMap = new WeakMap();
|
|
1192
1204
|
const session = async (proto, request) => {
|
|
1193
1205
|
const session = _session(proto, request);
|
|
1194
1206
|
const cached = sessionInfoMap.get(request);
|