proto.io 0.0.188 → 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/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/client.js +1 -1
- package/dist/client.mjs +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -6
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{index-C3PZ692k.mjs → index-BAbXyJEC.mjs} +226 -226
- package/dist/internals/{index-C3PZ692k.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-BvaBC85z.js → index-M-VqTiz9.js} +226 -226
- package/dist/internals/{index-BvaBC85z.js.map → index-M-VqTiz9.js.map} +1 -1
- package/dist/internals/{index-DSxxREND.d.ts → index-z8mWupzT.d.ts} +2 -2
- package/dist/internals/index-z8mWupzT.d.ts.map +1 -0
- package/package.json +1 -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
|
@@ -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-BDHXW8gd.js';
|
|
2
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-BfsVioOA.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-BDHXW8gd.js';
|
|
2
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-BfsVioOA.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-BDHXW8gd.js';
|
|
4
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-BfsVioOA.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-
|
|
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';
|
|
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, f as isJob, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-
|
|
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';
|
|
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-BDHXW8gd.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-
|
|
5
|
+
var index = require('./internals/index-M-VqTiz9.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-
|
|
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-
|
|
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';
|
|
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-
|
|
5
|
-
export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-
|
|
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';
|
|
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-
|
|
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';
|
|
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-
|
|
10
|
+
var index = require('./internals/index-M-VqTiz9.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');
|
|
@@ -15,10 +15,10 @@ var node_stream = require('node:stream');
|
|
|
15
15
|
var node_crypto = require('node:crypto');
|
|
16
16
|
var util = require('util');
|
|
17
17
|
var cryptoJs = require('@o2ter/crypto-js');
|
|
18
|
+
var Decimal = require('decimal.js');
|
|
18
19
|
var index$2 = require('./internals/index-COOeeeBE.js');
|
|
19
20
|
var queryType = require('query-types');
|
|
20
21
|
var busboy = require('busboy');
|
|
21
|
-
var Decimal = require('decimal.js');
|
|
22
22
|
require('axios');
|
|
23
23
|
require('@o2ter/server-js/dist/const');
|
|
24
24
|
require('socket.io-client');
|
|
@@ -493,7 +493,7 @@ const defaultSchema = {
|
|
|
493
493
|
type: { update: [] },
|
|
494
494
|
token: { update: [] },
|
|
495
495
|
nonce: { update: [] },
|
|
496
|
-
_expired_at: {
|
|
496
|
+
_expired_at: { update: [] },
|
|
497
497
|
},
|
|
498
498
|
indexes: [
|
|
499
499
|
{
|
|
@@ -903,11 +903,12 @@ class ProtoInternal {
|
|
|
903
903
|
return object;
|
|
904
904
|
}
|
|
905
905
|
varifyUploadToken(proto, token, isMaster) {
|
|
906
|
-
const { nonce, maxUploadSize } = (_.isString(token) ? this.jwtVarify(token, 'upload') ?? {} : {});
|
|
906
|
+
const { nonce, attributes, maxUploadSize, } = (_.isString(token) ? this.jwtVarify(token, 'upload') ?? {} : {});
|
|
907
907
|
if (!isMaster && !nonce)
|
|
908
908
|
throw Error('Upload token is required');
|
|
909
909
|
return {
|
|
910
910
|
nonce,
|
|
911
|
+
attributes: _.isObject(attributes) ? index.deserialize(JSON.stringify(attributes)) : {},
|
|
911
912
|
maxUploadSize: maxUploadSize ?? this.options.maxUploadSize,
|
|
912
913
|
};
|
|
913
914
|
}
|
|
@@ -915,7 +916,7 @@ class ProtoInternal {
|
|
|
915
916
|
const data = object[_private.PVK].extra.data;
|
|
916
917
|
if (_.isNil(data))
|
|
917
918
|
throw Error('Invalid file object');
|
|
918
|
-
const { nonce, maxUploadSize } = this.varifyUploadToken(proto, options?.uploadToken, options?.master);
|
|
919
|
+
const { nonce, maxUploadSize, attributes } = this.varifyUploadToken(proto, options?.uploadToken, options?.master);
|
|
919
920
|
if (nonce) {
|
|
920
921
|
const found = await proto.Query('File').equalTo('nonce', nonce).first({ master: true });
|
|
921
922
|
if (found)
|
|
@@ -949,6 +950,9 @@ class ProtoInternal {
|
|
|
949
950
|
throw Error('Invalid file object');
|
|
950
951
|
}
|
|
951
952
|
try {
|
|
953
|
+
for (const [key, value] of _.entries(attributes)) {
|
|
954
|
+
object.set(key, value);
|
|
955
|
+
}
|
|
952
956
|
object.set('token', file._id);
|
|
953
957
|
object.set('size', file.size);
|
|
954
958
|
if (nonce)
|
|
@@ -1625,6 +1629,7 @@ class ProtoService extends index.ProtoType {
|
|
|
1625
1629
|
return this[_private.PVK].jwtSign({
|
|
1626
1630
|
nonce: cryptoJs.randomUUID(),
|
|
1627
1631
|
maxUploadSize: options.maxUploadSize,
|
|
1632
|
+
attributes: JSON.parse(index.serialize(options.attributes ?? {})),
|
|
1628
1633
|
}, options?.jwtSignOptions ?? 'upload');
|
|
1629
1634
|
}
|
|
1630
1635
|
jwtSign(payload, options) {
|