proto.io 0.0.153 → 0.0.154
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 +25 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -12
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{index-m4WmZoWj.d.ts → index-BeRyWUVp.d.ts} +3 -1
- package/dist/internals/index-BeRyWUVp.d.ts.map +1 -0
- package/dist/internals/{index-DQm5Xz3Q.d.ts → index-DI0coKnM.d.ts} +2 -2
- package/dist/internals/index-DI0coKnM.d.ts.map +1 -0
- package/dist/internals/{index-DeD3CiUK.d.ts → index-rx1BTcvL.d.ts} +2 -2
- package/dist/internals/index-rx1BTcvL.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/internals/index-DQm5Xz3Q.d.ts.map +0 -1
- package/dist/internals/index-DeD3CiUK.d.ts.map +0 -1
- package/dist/internals/index-m4WmZoWj.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-BeRyWUVp.js';
|
|
2
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-rx1BTcvL.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-BeRyWUVp.js';
|
|
2
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-rx1BTcvL.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-BeRyWUVp.js';
|
|
4
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-rx1BTcvL.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, 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, 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-BeRyWUVp.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-DI0coKnM.js';
|
|
2
|
+
export { c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-DI0coKnM.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-BeRyWUVp.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-BeRyWUVp.js';
|
|
6
|
+
export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-BeRyWUVp.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-DI0coKnM.js';
|
|
10
10
|
import '@o2ter/utils-js';
|
|
11
11
|
import 'jsonwebtoken';
|
|
12
12
|
import 'lodash';
|
package/dist/index.js
CHANGED
|
@@ -1109,7 +1109,12 @@ const _sessionWithToken = (proto, token) => {
|
|
|
1109
1109
|
const payload = proto[_private.PVK].jwtVarify(token, 'login');
|
|
1110
1110
|
if (!_.isObject(payload))
|
|
1111
1111
|
return;
|
|
1112
|
-
return
|
|
1112
|
+
return {
|
|
1113
|
+
...payload,
|
|
1114
|
+
sessionId: payload.sessionId ?? cryptoJs.randomUUID(),
|
|
1115
|
+
createdAt: payload.createdAt && _.isSafeInteger(payload.createdAt) ? new Date(payload.createdAt) : new Date,
|
|
1116
|
+
loginedAt: payload.loginedAt && _.isSafeInteger(payload.loginedAt) ? new Date(payload.loginedAt) : new Date,
|
|
1117
|
+
};
|
|
1113
1118
|
};
|
|
1114
1119
|
const _session = (proto, request) => {
|
|
1115
1120
|
const cached = sessionMap.get(request);
|
|
@@ -1118,6 +1123,7 @@ const _session = (proto, request) => {
|
|
|
1118
1123
|
sessionMap.set(request, {
|
|
1119
1124
|
sessionId: cryptoJs.randomUUID(),
|
|
1120
1125
|
createdAt: new Date,
|
|
1126
|
+
loginedAt: new Date,
|
|
1121
1127
|
});
|
|
1122
1128
|
const jwtToken = proto[_private.PVK].options.jwtToken;
|
|
1123
1129
|
if (_.isEmpty(jwtToken))
|
|
@@ -1133,14 +1139,9 @@ const _session = (proto, request) => {
|
|
|
1133
1139
|
}
|
|
1134
1140
|
if (_.isEmpty(authorization))
|
|
1135
1141
|
return;
|
|
1136
|
-
const
|
|
1137
|
-
if (!_.isObject(
|
|
1142
|
+
const session = _sessionWithToken(proto, authorization);
|
|
1143
|
+
if (!_.isObject(session))
|
|
1138
1144
|
return;
|
|
1139
|
-
const session = {
|
|
1140
|
-
...payload,
|
|
1141
|
-
sessionId: payload.sessionId ?? cryptoJs.randomUUID(),
|
|
1142
|
-
createdAt: payload.createdAt && _.isSafeInteger(payload.createdAt) ? new Date(payload.createdAt) : new Date,
|
|
1143
|
-
};
|
|
1144
1145
|
sessionMap.set(request, session);
|
|
1145
1146
|
return session;
|
|
1146
1147
|
};
|
|
@@ -1159,18 +1160,29 @@ const fetchSessionInfo = async (proto, userId) => {
|
|
|
1159
1160
|
};
|
|
1160
1161
|
const sessionWithToken = async (proto, token) => {
|
|
1161
1162
|
const session = _sessionWithToken(proto, token);
|
|
1162
|
-
const sessionId = session?.sessionId;
|
|
1163
1163
|
const info = await fetchSessionInfo(proto, session?.user);
|
|
1164
|
-
return {
|
|
1164
|
+
return {
|
|
1165
|
+
...session ?? {},
|
|
1166
|
+
...info,
|
|
1167
|
+
loginedAt: info?.user ? session?.loginedAt : undefined,
|
|
1168
|
+
};
|
|
1165
1169
|
};
|
|
1166
1170
|
const session = async (proto, request) => {
|
|
1167
1171
|
const session = _session(proto, request);
|
|
1168
1172
|
const cached = sessionInfoMap.get(request);
|
|
1169
1173
|
if (cached)
|
|
1170
|
-
return {
|
|
1174
|
+
return {
|
|
1175
|
+
...session ?? {},
|
|
1176
|
+
...cached,
|
|
1177
|
+
loginedAt: cached?.user ? session?.loginedAt : undefined,
|
|
1178
|
+
};
|
|
1171
1179
|
const info = await fetchSessionInfo(proto, session?.user);
|
|
1172
1180
|
sessionInfoMap.set(request, info);
|
|
1173
|
-
return {
|
|
1181
|
+
return {
|
|
1182
|
+
...session ?? {},
|
|
1183
|
+
...info,
|
|
1184
|
+
loginedAt: info?.user ? session?.loginedAt : undefined,
|
|
1185
|
+
};
|
|
1174
1186
|
};
|
|
1175
1187
|
const sessionIsMaster = (proto, request) => {
|
|
1176
1188
|
const user = request.header(index.MASTER_USER_HEADER_NAME);
|
|
@@ -1187,6 +1199,7 @@ const signUser = async (proto, res, user, options) => {
|
|
|
1187
1199
|
const token = proto[_private.PVK].jwtSign({
|
|
1188
1200
|
sessionId: session?.sessionId ?? cryptoJs.randomUUID(),
|
|
1189
1201
|
createdAt: session?.createdAt?.getTime() ?? Date.now(),
|
|
1202
|
+
loginedAt: user ? session?.loginedAt?.getTime() ?? Date.now() : undefined,
|
|
1190
1203
|
user: user?.objectId,
|
|
1191
1204
|
cookieOptions,
|
|
1192
1205
|
}, options?.jwtSignOptions ?? 'login');
|