proto.io 0.0.192 → 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 +39 -16
- package/dist/adapters/storage/progres.js.map +1 -1
- package/dist/adapters/storage/progres.mjs +41 -18
- 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
|
}
|
|
@@ -1027,15 +1027,17 @@ class PostgresClientDriver {
|
|
|
1027
1027
|
return utilsJs.asyncStream(async function* () {
|
|
1028
1028
|
const client = db instanceof pg.Pool ? await db.connect() : db;
|
|
1029
1029
|
const stream = new QueryStream(text, values, { batchSize });
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1030
|
+
yield* utilsJs.IteratorPool(Number.MAX_SAFE_INTEGER, async function* () {
|
|
1031
|
+
client.query(stream);
|
|
1032
|
+
try {
|
|
1033
|
+
yield* stream;
|
|
1034
|
+
}
|
|
1035
|
+
finally {
|
|
1036
|
+
stream.destroy();
|
|
1037
|
+
if (db instanceof pg.Pool)
|
|
1038
|
+
client.release();
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1039
1041
|
});
|
|
1040
1042
|
}
|
|
1041
1043
|
async version() {
|
|
@@ -2903,6 +2905,21 @@ class PostgresStorageTransaction extends PostgresStorageClient {
|
|
|
2903
2905
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
2904
2906
|
// THE SOFTWARE.
|
|
2905
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
|
+
};
|
|
2906
2923
|
class PostgresStorage extends PostgresStorageClient {
|
|
2907
2924
|
constructor(config) {
|
|
2908
2925
|
super(new PostgresDriver(config));
|
|
@@ -3008,7 +3025,9 @@ class PostgresStorage extends PostgresStorageClient {
|
|
|
3008
3025
|
],
|
|
3009
3026
|
};
|
|
3010
3027
|
}
|
|
3011
|
-
_indexBasicName(className, keys) {
|
|
3028
|
+
_indexBasicName(className, keys, unique) {
|
|
3029
|
+
if (unique)
|
|
3030
|
+
return `${className}$u$${_.map(keys, (v, k) => `${k}:${v}`).join('$')}`;
|
|
3012
3031
|
return `${className}$b$${_.map(keys, (v, k) => `${k}:${v}`).join('$')}`;
|
|
3013
3032
|
}
|
|
3014
3033
|
_indexVectorName(className, keys) {
|
|
@@ -3030,7 +3049,7 @@ class PostgresStorage extends PostgresStorageClient {
|
|
|
3030
3049
|
names.push(..._.values(this._indexVectorName(className, _.castArray(index.keys))));
|
|
3031
3050
|
break;
|
|
3032
3051
|
default:
|
|
3033
|
-
names.push(this._indexBasicName(className, index.keys));
|
|
3052
|
+
names.push(this._indexBasicName(className, index.keys, !!index.unique));
|
|
3034
3053
|
break;
|
|
3035
3054
|
}
|
|
3036
3055
|
}
|
|
@@ -3126,16 +3145,20 @@ class PostgresStorage extends PostgresStorageClient {
|
|
|
3126
3145
|
break;
|
|
3127
3146
|
default:
|
|
3128
3147
|
{
|
|
3129
|
-
const name = this._indexBasicName(className, index$1.keys);
|
|
3130
|
-
const
|
|
3131
|
-
|
|
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
|
+
});
|
|
3132
3155
|
await this.query(sql `
|
|
3133
3156
|
CREATE ${{ literal: index$1.unique ? 'UNIQUE' : '' }} INDEX CONCURRENTLY
|
|
3134
3157
|
IF NOT EXISTS ${{ identifier: name }}
|
|
3135
3158
|
ON ${{ identifier: className }}
|
|
3136
|
-
${{ literal:
|
|
3159
|
+
${{ literal: useGin ? 'USING GIN' : '' }}
|
|
3137
3160
|
(${_.map(index$1.keys, (v, k) => sql `
|
|
3138
|
-
${{ identifier: k }} ${{ literal:
|
|
3161
|
+
${{ identifier: k }} ${{ literal: useGin ? '' : v === 1 ? 'ASC' : 'DESC' }}
|
|
3139
3162
|
`)})
|
|
3140
3163
|
`);
|
|
3141
3164
|
}
|