proto.io 0.0.187 → 0.0.189
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/database.js +2 -2
- package/dist/adapters/file/database.mjs +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/adapters/storage/progres.js +3 -3
- package/dist/adapters/storage/progres.mjs +3 -3
- package/dist/client.d.ts +3 -3
- package/dist/client.js +2 -2
- package/dist/client.mjs +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +13 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -9
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{index-CEgTPv9-.mjs → index-BAbXyJEC.mjs} +227 -227
- package/dist/internals/{index-CEgTPv9-.mjs.map → index-BAbXyJEC.mjs.map} +1 -1
- package/dist/internals/{index-fdvea17W.d.ts → index-BDHXW8gd.d.ts} +2 -1
- package/dist/internals/index-BDHXW8gd.d.ts.map +1 -0
- package/dist/internals/{index-wofihxjH.d.ts → index-BfsVioOA.d.ts} +2 -2
- package/dist/internals/index-BfsVioOA.d.ts.map +1 -0
- package/dist/internals/{index-DBuC2OsV.js → index-COOeeeBE.js} +2 -2
- package/dist/internals/{index-DBuC2OsV.js.map → index-COOeeeBE.js.map} +1 -1
- package/dist/internals/{index-BszoCthH.js → index-Dej3GgVf.js} +2 -2
- package/dist/internals/index-Dej3GgVf.js.map +1 -0
- package/dist/internals/{index-PN4p9vcR.js → index-M-VqTiz9.js} +227 -227
- package/dist/internals/{index-PN4p9vcR.js.map → index-M-VqTiz9.js.map} +1 -1
- package/dist/internals/{index-MPHIZrIu.mjs → index-ikHjpb6F.mjs} +2 -2
- package/dist/internals/{index-MPHIZrIu.mjs.map → index-ikHjpb6F.mjs.map} +1 -1
- package/dist/internals/{index-B1FyA93S.mjs → index-j8PFq8Ci.mjs} +2 -2
- package/dist/internals/index-j8PFq8Ci.mjs.map +1 -0
- package/dist/internals/{index-DSxxREND.d.ts → index-z8mWupzT.d.ts} +2 -2
- package/dist/internals/index-z8mWupzT.d.ts.map +1 -0
- package/dist/internals/{random-Bfm98f9v.js → random-CObICDCy.js} +3 -3
- package/dist/internals/{random-Bfm98f9v.js.map → random-CObICDCy.js.map} +1 -1
- package/dist/internals/{random-D6jBS4Q9.mjs → random-uHM4KXoV.mjs} +3 -3
- package/dist/internals/{random-D6jBS4Q9.mjs.map → random-uHM4KXoV.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/internals/index-B1FyA93S.mjs.map +0 -1
- package/dist/internals/index-BszoCthH.js.map +0 -1
- package/dist/internals/index-DSxxREND.d.ts.map +0 -1
- package/dist/internals/index-fdvea17W.d.ts.map +0 -1
- package/dist/internals/index-wofihxjH.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { Server } from '@o2ter/server-js';
|
|
3
|
-
import { Q as QueryValidator, r as resolveColumn, a as resolveDataType, g as generateId } from './internals/random-
|
|
3
|
+
import { Q as QueryValidator, r as resolveColumn, a as resolveDataType, g as generateId } from './internals/random-uHM4KXoV.mjs';
|
|
4
4
|
import { P as PVK } from './internals/private-CNw40LZ7.mjs';
|
|
5
5
|
import { asyncStream, prototypes, isBinaryData, base64ToBuffer } from '@o2ter/utils-js';
|
|
6
|
-
import { T as TQuery, P as PROTO_NOTY_MSG, M as MASTER_USER_HEADER_NAME, a as MASTER_PASS_HEADER_NAME, A as AUTH_COOKIE_KEY, b as TUser, c as ProtoType, s as serialize,
|
|
7
|
-
export { e as ProtoClient, f as classExtends, k as isFile, l as isJob, g as isObject, i as isQuery, j as isRole, h as isUser } from './internals/index-
|
|
8
|
-
import { i as isPointer, a as isRelation, T as TObject, b as isShape, d as defaultObjectKeyTypes, c as isPrimitive } from './internals/index-
|
|
6
|
+
import { T as TQuery, d as deserialize, P as PROTO_NOTY_MSG, M as MASTER_USER_HEADER_NAME, a as MASTER_PASS_HEADER_NAME, A as AUTH_COOKIE_KEY, b as TUser, c as ProtoType, s as serialize, U as UPLOAD_TOKEN_HEADER_NAME } from './internals/index-BAbXyJEC.mjs';
|
|
7
|
+
export { e as ProtoClient, f as classExtends, k as isFile, l as isJob, g as isObject, i as isQuery, j as isRole, h as isUser } from './internals/index-BAbXyJEC.mjs';
|
|
8
|
+
import { i as isPointer, a as isRelation, T as TObject, b as isShape, d as defaultObjectKeyTypes, c as isPrimitive } from './internals/index-j8PFq8Ci.mjs';
|
|
9
9
|
import jwt from 'jsonwebtoken';
|
|
10
10
|
import { Blob } from 'node:buffer';
|
|
11
11
|
import { Readable } from 'node:stream';
|
|
12
12
|
import { scrypt } from 'node:crypto';
|
|
13
13
|
import { promisify } from 'util';
|
|
14
14
|
import { randomBytes, randomUUID } from '@o2ter/crypto-js';
|
|
15
|
-
|
|
15
|
+
export { Decimal } from 'decimal.js';
|
|
16
|
+
import { Q as QuerySelector } from './internals/index-ikHjpb6F.mjs';
|
|
16
17
|
import queryType from 'query-types';
|
|
17
18
|
import busboy from 'busboy';
|
|
18
|
-
export { Decimal } from 'decimal.js';
|
|
19
19
|
import 'axios';
|
|
20
20
|
import '@o2ter/server-js/dist/const';
|
|
21
21
|
import 'socket.io-client';
|
|
@@ -490,7 +490,7 @@ const defaultSchema = {
|
|
|
490
490
|
type: { update: [] },
|
|
491
491
|
token: { update: [] },
|
|
492
492
|
nonce: { update: [] },
|
|
493
|
-
_expired_at: {
|
|
493
|
+
_expired_at: { update: [] },
|
|
494
494
|
},
|
|
495
495
|
indexes: [
|
|
496
496
|
{
|
|
@@ -900,11 +900,12 @@ class ProtoInternal {
|
|
|
900
900
|
return object;
|
|
901
901
|
}
|
|
902
902
|
varifyUploadToken(proto, token, isMaster) {
|
|
903
|
-
const { nonce, maxUploadSize } = (_.isString(token) ? this.jwtVarify(token, 'upload') ?? {} : {});
|
|
903
|
+
const { nonce, attributes, maxUploadSize, } = (_.isString(token) ? this.jwtVarify(token, 'upload') ?? {} : {});
|
|
904
904
|
if (!isMaster && !nonce)
|
|
905
905
|
throw Error('Upload token is required');
|
|
906
906
|
return {
|
|
907
907
|
nonce,
|
|
908
|
+
attributes: _.isObject(attributes) ? deserialize(JSON.stringify(attributes)) : {},
|
|
908
909
|
maxUploadSize: maxUploadSize ?? this.options.maxUploadSize,
|
|
909
910
|
};
|
|
910
911
|
}
|
|
@@ -912,7 +913,7 @@ class ProtoInternal {
|
|
|
912
913
|
const data = object[PVK].extra.data;
|
|
913
914
|
if (_.isNil(data))
|
|
914
915
|
throw Error('Invalid file object');
|
|
915
|
-
const { nonce, maxUploadSize } = this.varifyUploadToken(proto, options?.uploadToken, options?.master);
|
|
916
|
+
const { nonce, maxUploadSize, attributes } = this.varifyUploadToken(proto, options?.uploadToken, options?.master);
|
|
916
917
|
if (nonce) {
|
|
917
918
|
const found = await proto.Query('File').equalTo('nonce', nonce).first({ master: true });
|
|
918
919
|
if (found)
|
|
@@ -946,6 +947,9 @@ class ProtoInternal {
|
|
|
946
947
|
throw Error('Invalid file object');
|
|
947
948
|
}
|
|
948
949
|
try {
|
|
950
|
+
for (const [key, value] of _.entries(attributes)) {
|
|
951
|
+
object.set(key, value);
|
|
952
|
+
}
|
|
949
953
|
object.set('token', file._id);
|
|
950
954
|
object.set('size', file.size);
|
|
951
955
|
if (nonce)
|
|
@@ -1622,6 +1626,7 @@ class ProtoService extends ProtoType {
|
|
|
1622
1626
|
return this[PVK].jwtSign({
|
|
1623
1627
|
nonce: randomUUID(),
|
|
1624
1628
|
maxUploadSize: options.maxUploadSize,
|
|
1629
|
+
attributes: JSON.parse(serialize(options.attributes ?? {})),
|
|
1625
1630
|
}, options?.jwtSignOptions ?? 'upload');
|
|
1626
1631
|
}
|
|
1627
1632
|
jwtSign(payload, options) {
|