proto.io 0.0.193 → 0.0.194
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.js +28 -7
- package/dist/adapters/storage/progres.js.map +1 -1
- package/dist/adapters/storage/progres.mjs +30 -9
- package/dist/adapters/storage/progres.mjs.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{index-BfsVioOA.d.ts → index-DIRRQ7jd.d.ts} +2 -2
- package/dist/internals/index-DIRRQ7jd.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/internals/index-BfsVioOA.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { T as TSchema, P as ProtoService } from '../../internals/index-BDHXW8gd.js';
|
|
2
|
-
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-
|
|
2
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DIRRQ7jd.js';
|
|
3
3
|
import '@o2ter/utils-js';
|
|
4
4
|
import 'jsonwebtoken';
|
|
5
5
|
import '@o2ter/server-js';
|
|
@@ -14,7 +14,7 @@ declare class DatabaseFileStorage extends FileStorageBase {
|
|
|
14
14
|
createChunk<E>(proto: ProtoService<E>, token: string, start: number, end: number, compressed: Buffer): Promise<void>;
|
|
15
15
|
readChunks<E>(proto: ProtoService<E>, token: string, start?: number | undefined, end?: number | undefined): AsyncGenerator<{
|
|
16
16
|
start: number;
|
|
17
|
-
data: Buffer | Uint8Array
|
|
17
|
+
data: Buffer<ArrayBufferLike> | Uint8Array<ArrayBuffer>;
|
|
18
18
|
}, void, unknown>;
|
|
19
19
|
destroy<E>(proto: ProtoService<E>, token: string): Promise<void>;
|
|
20
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as ProtoService } from '../../internals/index-BDHXW8gd.js';
|
|
2
|
-
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-
|
|
2
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DIRRQ7jd.js';
|
|
3
3
|
import '@o2ter/utils-js';
|
|
4
4
|
import 'jsonwebtoken';
|
|
5
5
|
import '@o2ter/server-js';
|
|
@@ -14,7 +14,7 @@ declare class FileSystemStorage extends FileStorageBase {
|
|
|
14
14
|
createChunk<E>(proto: ProtoService<E>, token: string, start: number, end: number, compressed: Buffer): Promise<void>;
|
|
15
15
|
readChunks<E>(proto: ProtoService<E>, token: string, start?: number | undefined, end?: number | undefined): AsyncGenerator<{
|
|
16
16
|
start: number;
|
|
17
|
-
data: Promise<Buffer
|
|
17
|
+
data: Promise<Buffer<ArrayBufferLike>>;
|
|
18
18
|
}, void, unknown>;
|
|
19
19
|
destroy<E>(proto: ProtoService<E>, token: string): Promise<void>;
|
|
20
20
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _google_cloud_storage from '@google-cloud/storage';
|
|
2
2
|
import { Storage } from '@google-cloud/storage';
|
|
3
3
|
import { P as ProtoService } from '../../internals/index-BDHXW8gd.js';
|
|
4
|
-
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-
|
|
4
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DIRRQ7jd.js';
|
|
5
5
|
import '@o2ter/utils-js';
|
|
6
6
|
import 'jsonwebtoken';
|
|
7
7
|
import '@o2ter/server-js';
|
|
@@ -18,7 +18,7 @@ declare class GoogleCloudStorage extends FileStorageBase {
|
|
|
18
18
|
createChunk<E>(proto: ProtoService<E>, token: string, start: number, end: number, compressed: Buffer): Promise<void>;
|
|
19
19
|
readChunks<E>(proto: ProtoService<E>, token: string, start?: number | undefined, end?: number | undefined): AsyncGenerator<{
|
|
20
20
|
start: number;
|
|
21
|
-
data: Promise<Buffer
|
|
21
|
+
data: Promise<Buffer<ArrayBufferLike>>;
|
|
22
22
|
}, void, unknown>;
|
|
23
23
|
destroy<E>(proto: ProtoService<E>, token: string): Promise<void>;
|
|
24
24
|
}
|
|
@@ -2905,6 +2905,21 @@ class PostgresStorageTransaction extends PostgresStorageClient {
|
|
|
2905
2905
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
2906
2906
|
// THE SOFTWARE.
|
|
2907
2907
|
//
|
|
2908
|
+
const resolveDataType = (schema, path) => {
|
|
2909
|
+
let fields = schema.fields;
|
|
2910
|
+
let last;
|
|
2911
|
+
for (const key of _.toPath(path)) {
|
|
2912
|
+
const dataType = fields[key];
|
|
2913
|
+
if (_.isNil(dataType))
|
|
2914
|
+
throw Error(`Invalid path: ${path}`);
|
|
2915
|
+
if (index.isPrimitive(dataType) || index.isVector(dataType))
|
|
2916
|
+
return dataType;
|
|
2917
|
+
if (!index.isShape(dataType))
|
|
2918
|
+
return dataType;
|
|
2919
|
+
fields = dataType.shape;
|
|
2920
|
+
}
|
|
2921
|
+
return last;
|
|
2922
|
+
};
|
|
2908
2923
|
class PostgresStorage extends PostgresStorageClient {
|
|
2909
2924
|
constructor(config) {
|
|
2910
2925
|
super(new PostgresDriver(config));
|
|
@@ -3010,7 +3025,9 @@ class PostgresStorage extends PostgresStorageClient {
|
|
|
3010
3025
|
],
|
|
3011
3026
|
};
|
|
3012
3027
|
}
|
|
3013
|
-
_indexBasicName(className, keys) {
|
|
3028
|
+
_indexBasicName(className, keys, unique) {
|
|
3029
|
+
if (unique)
|
|
3030
|
+
return `${className}$u$${_.map(keys, (v, k) => `${k}:${v}`).join('$')}`;
|
|
3014
3031
|
return `${className}$b$${_.map(keys, (v, k) => `${k}:${v}`).join('$')}`;
|
|
3015
3032
|
}
|
|
3016
3033
|
_indexVectorName(className, keys) {
|
|
@@ -3032,7 +3049,7 @@ class PostgresStorage extends PostgresStorageClient {
|
|
|
3032
3049
|
names.push(..._.values(this._indexVectorName(className, _.castArray(index.keys))));
|
|
3033
3050
|
break;
|
|
3034
3051
|
default:
|
|
3035
|
-
names.push(this._indexBasicName(className, index.keys));
|
|
3052
|
+
names.push(this._indexBasicName(className, index.keys, !!index.unique));
|
|
3036
3053
|
break;
|
|
3037
3054
|
}
|
|
3038
3055
|
}
|
|
@@ -3128,16 +3145,20 @@ class PostgresStorage extends PostgresStorageClient {
|
|
|
3128
3145
|
break;
|
|
3129
3146
|
default:
|
|
3130
3147
|
{
|
|
3131
|
-
const name = this._indexBasicName(className, index$1.keys);
|
|
3132
|
-
const
|
|
3133
|
-
|
|
3148
|
+
const name = this._indexBasicName(className, index$1.keys, !!index$1.unique);
|
|
3149
|
+
const useGin = _.some(_.keys(index$1.keys), column => {
|
|
3150
|
+
const dataType = resolveDataType(schema, column);
|
|
3151
|
+
if (!dataType || index.isShape(dataType))
|
|
3152
|
+
throw Error('Invalid index type');
|
|
3153
|
+
return index._isTypeof(dataType, 'string[]') || _.has(relations, column);
|
|
3154
|
+
});
|
|
3134
3155
|
await this.query(sql `
|
|
3135
3156
|
CREATE ${{ literal: index$1.unique ? 'UNIQUE' : '' }} INDEX CONCURRENTLY
|
|
3136
3157
|
IF NOT EXISTS ${{ identifier: name }}
|
|
3137
3158
|
ON ${{ identifier: className }}
|
|
3138
|
-
${{ literal:
|
|
3159
|
+
${{ literal: useGin ? 'USING GIN' : '' }}
|
|
3139
3160
|
(${_.map(index$1.keys, (v, k) => sql `
|
|
3140
|
-
${{ identifier: k }} ${{ literal:
|
|
3161
|
+
${{ identifier: k }} ${{ literal: useGin ? '' : v === 1 ? 'ASC' : 'DESC' }}
|
|
3141
3162
|
`)})
|
|
3142
3163
|
`);
|
|
3143
3164
|
}
|