proto.io 0.0.197 → 0.0.199

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.
Files changed (50) hide show
  1. package/dist/adapters/file/database.d.ts +2 -2
  2. package/dist/adapters/file/database.js +2 -2
  3. package/dist/adapters/file/database.mjs +2 -2
  4. package/dist/adapters/file/filesystem.d.ts +2 -2
  5. package/dist/adapters/file/google-cloud-storage.d.ts +2 -2
  6. package/dist/adapters/storage/progres.d.ts +96 -70
  7. package/dist/adapters/storage/progres.js +3 -3
  8. package/dist/adapters/storage/progres.js.map +1 -1
  9. package/dist/adapters/storage/progres.mjs +3 -3
  10. package/dist/adapters/storage/progres.mjs.map +1 -1
  11. package/dist/client.d.ts +3 -3
  12. package/dist/client.js +2 -2
  13. package/dist/client.mjs +3 -3
  14. package/dist/index.d.ts +5 -5
  15. package/dist/index.js +10 -10
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.mjs +11 -11
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/internals/{index-ClOV7WJp.d.ts → index-B1Zb_MrO.d.ts} +6 -6
  20. package/dist/internals/index-B1Zb_MrO.d.ts.map +1 -0
  21. package/dist/internals/{index-C9eiMOSP.mjs → index-B5NdBL7S.mjs} +2 -2
  22. package/dist/internals/index-B5NdBL7S.mjs.map +1 -0
  23. package/dist/internals/{index-j8PFq8Ci.mjs → index-BbrIkcQ7.mjs} +3 -1
  24. package/dist/internals/index-BbrIkcQ7.mjs.map +1 -0
  25. package/dist/internals/{index-Dej3GgVf.js → index-BtqngPTb.js} +3 -1
  26. package/dist/internals/index-BtqngPTb.js.map +1 -0
  27. package/dist/internals/{index-CqunpmT-.d.ts → index-C8EuFNYa.d.ts} +41 -40
  28. package/dist/internals/index-C8EuFNYa.d.ts.map +1 -0
  29. package/dist/internals/{index-DbXVThGW.js → index-CGO-xORH.js} +2 -2
  30. package/dist/internals/index-CGO-xORH.js.map +1 -0
  31. package/dist/internals/{index-ikHjpb6F.mjs → index-DAtoqvEN.mjs} +2 -2
  32. package/dist/internals/{index-ikHjpb6F.mjs.map → index-DAtoqvEN.mjs.map} +1 -1
  33. package/dist/internals/{index-COOeeeBE.js → index-DIFr-lHN.js} +2 -2
  34. package/dist/internals/{index-COOeeeBE.js.map → index-DIFr-lHN.js.map} +1 -1
  35. package/dist/internals/{index-DjHHDI1M.d.ts → index-DvpJENaG.d.ts} +2 -2
  36. package/dist/internals/index-DvpJENaG.d.ts.map +1 -0
  37. package/dist/internals/{random-CObICDCy.js → random-CM_i1mxR.js} +5 -4
  38. package/dist/internals/random-CM_i1mxR.js.map +1 -0
  39. package/dist/internals/{random-uHM4KXoV.mjs → random-l5S7hC1z.mjs} +5 -4
  40. package/dist/internals/random-l5S7hC1z.mjs.map +1 -0
  41. package/package.json +1 -1
  42. package/dist/internals/index-C9eiMOSP.mjs.map +0 -1
  43. package/dist/internals/index-ClOV7WJp.d.ts.map +0 -1
  44. package/dist/internals/index-CqunpmT-.d.ts.map +0 -1
  45. package/dist/internals/index-DbXVThGW.js.map +0 -1
  46. package/dist/internals/index-Dej3GgVf.js.map +0 -1
  47. package/dist/internals/index-DjHHDI1M.d.ts.map +0 -1
  48. package/dist/internals/index-j8PFq8Ci.mjs.map +0 -1
  49. package/dist/internals/random-CObICDCy.js.map +0 -1
  50. package/dist/internals/random-uHM4KXoV.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
- import { T as TSchema, P as ProtoService } from '../../internals/index-CqunpmT-.js';
2
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DjHHDI1M.js';
1
+ import { T as TSchema, P as ProtoService } from '../../internals/index-C8EuFNYa.js';
2
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DvpJENaG.js';
3
3
  import '@o2ter/utils-js';
4
4
  import 'jsonwebtoken';
5
5
  import '@o2ter/server-js';
@@ -4,12 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _ = require('lodash');
6
6
  var index = require('../../internals/index-DfPY7Xbb.js');
7
- var index$1 = require('../../internals/index-COOeeeBE.js');
7
+ var index$1 = require('../../internals/index-DIFr-lHN.js');
8
8
  var utilsJs = require('@o2ter/utils-js');
9
9
  require('util');
10
10
  require('zlib');
11
11
  require('../../internals/private-Ciddhure.js');
12
- require('../../internals/index-Dej3GgVf.js');
12
+ require('../../internals/index-BtqngPTb.js');
13
13
  require('decimal.js');
14
14
 
15
15
  //
@@ -1,11 +1,11 @@
1
1
  import _ from 'lodash';
2
2
  import { F as FileStorageBase } from '../../internals/index-BAFVUYCo.mjs';
3
- import { Q as QuerySelector } from '../../internals/index-ikHjpb6F.mjs';
3
+ import { Q as QuerySelector } from '../../internals/index-DAtoqvEN.mjs';
4
4
  import { bufferToBase64, base64ToBuffer } from '@o2ter/utils-js';
5
5
  import 'util';
6
6
  import 'zlib';
7
7
  import '../../internals/private-CNw40LZ7.mjs';
8
- import '../../internals/index-j8PFq8Ci.mjs';
8
+ import '../../internals/index-BbrIkcQ7.mjs';
9
9
  import 'decimal.js';
10
10
 
11
11
  //
@@ -1,5 +1,5 @@
1
- import { P as ProtoService } from '../../internals/index-CqunpmT-.js';
2
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DjHHDI1M.js';
1
+ import { P as ProtoService } from '../../internals/index-C8EuFNYa.js';
2
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DvpJENaG.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-CqunpmT-.js';
4
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DjHHDI1M.js';
3
+ import { P as ProtoService } from '../../internals/index-C8EuFNYa.js';
4
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DvpJENaG.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-CqunpmT-.js';
2
+ import { a as TValueWithoutObject, T as TSchema, r as TValueWithUndefined, t as TValue, u as TUpdateOp, F as FieldSelectorExpression, Q as QueryExpression, R as RelationOptions, v as QuerySelector, w as DecodedSortOption, x as DecodedQuery, y as FindOptions, I as InsertOptions, z as FindOneOptions, A as TStorage, B as TransactionOptions, i as TObject, C as TQueryRandomOptions, G as TPubSub } from '../../internals/index-C8EuFNYa.js';
3
3
  import * as _o2ter_utils_js from '@o2ter/utils-js';
4
4
  import { asyncStream } from '@o2ter/utils-js';
5
5
  import 'jsonwebtoken';
@@ -34,7 +34,7 @@ declare class PostgresClientDriver {
34
34
  };
35
35
  }>;
36
36
  withClient<T>(callback: (client: PostgresClientDriver) => PromiseLike<T>): Promise<T>;
37
- publish(channel: string, payload: _TValue): Promise<void>;
37
+ publish(channel: string, payload: TValueWithoutObject): Promise<void>;
38
38
  }
39
39
  declare class PostgresDriver extends PostgresClientDriver {
40
40
  database: Pool;
@@ -43,7 +43,59 @@ declare class PostgresDriver extends PostgresClientDriver {
43
43
  shutdown(): Promise<void>;
44
44
  private _init_pubsub;
45
45
  private _release_pubsub;
46
- subscribe(channel: string, callback: (payload: _TValue) => void): () => void;
46
+ subscribe(channel: string, callback: (payload: TValueWithoutObject) => void): () => void;
47
+ }
48
+
49
+ interface SqlDialect {
50
+ quote(str: string): string;
51
+ identifier(name: string): string;
52
+ placeholder(idx: number): string;
53
+ boolean(value: boolean): string;
54
+ encodeType(colname: string, type: TSchema.DataType, value: TValueWithUndefined): SQL;
55
+ decodeType(type: TSchema.Primitive | 'vector', value: any): TValue;
56
+ updateOperation(paths: string[], dataType: TSchema.DataType, operation: TUpdateOp): SQL;
57
+ selectPopulate(compiler: QueryCompiler, parent: QueryContext & {
58
+ className: string;
59
+ }, populate: Populate, field: string, countMatches: boolean): {
60
+ columns: SQL[];
61
+ join?: SQL;
62
+ };
63
+ encodeFieldExpression(compiler: QueryCompiler, parent: QueryContext, field: string, expr: FieldSelectorExpression): SQL;
64
+ encodeQueryExpression(compiler: QueryCompiler, parent: QueryContext, expr: QueryExpression): SQL | undefined;
65
+ encodePopulate(compiler: QueryCompiler, parent: Populate, remix?: QueryContext & {
66
+ className: string;
67
+ }): Record<string, SQL>;
68
+ encodeRelation(compiler: QueryCompiler, parent: QueryContext & {
69
+ className: string;
70
+ }, relatedBy: NonNullable<RelationOptions['relatedBy']>): SQL;
71
+ encodeSortKey(compiler: QueryCompiler, parent: QueryContext, key: string): SQL;
72
+ random(opts: {
73
+ weight?: string;
74
+ }): SQL;
75
+ }
76
+
77
+ type SQLLiteral = SQL | SQL[] | {
78
+ literal: string | SQL[];
79
+ separator?: string;
80
+ };
81
+ type SQLIdentifier = {
82
+ identifier: string;
83
+ };
84
+ type SQLEscapeString = {
85
+ quote: string;
86
+ };
87
+ type SQLValue = {
88
+ value: TValueWithUndefined;
89
+ } | SQLIdentifier | SQLLiteral | SQLEscapeString;
90
+ declare class SQL {
91
+ strings: TemplateStringsArray;
92
+ values: SQLValue[];
93
+ constructor(templates: TemplateStringsArray, values: SQLValue[]);
94
+ private _compile;
95
+ compile(dialect: SqlDialect): {
96
+ query: string;
97
+ values: any[];
98
+ };
47
99
  }
48
100
 
49
101
  type QueryContext = {
@@ -97,77 +149,25 @@ declare class QueryCompiler {
97
149
  private _selectIncludes;
98
150
  _encodeSort(sort: Record<string, 1 | -1> | DecodedSortOption[], parent: QueryContext): SQL;
99
151
  private _selectPopulateMap;
100
- insert(options: InsertOptions, attrs: Record<string, TValue>): SQL;
101
- insertMany(options: InsertOptions, values: Record<string, TValue>[]): SQL;
152
+ insert(options: InsertOptions, attrs: Record<string, TValueWithUndefined>): SQL;
153
+ insertMany(options: InsertOptions, values: Record<string, TValueWithUndefined>[]): SQL;
102
154
  updateOne(query: DecodedQuery<FindOneOptions>, update: Record<string, TUpdateOp>): SQL;
103
155
  updateMany(query: DecodedQuery<FindOneOptions>, update: Record<string, TUpdateOp>): SQL;
104
- upsertOne(query: DecodedQuery<FindOneOptions>, update: Record<string, TUpdateOp>, setOnInsert: Record<string, TValue>): SQL;
105
- upsertMany(query: DecodedQuery<FindOneOptions>, update: Record<string, TUpdateOp>, setOnInsert: Record<string, TValue>): SQL;
156
+ upsertOne(query: DecodedQuery<FindOneOptions>, update: Record<string, TUpdateOp>, setOnInsert: Record<string, TValueWithUndefined>): SQL;
157
+ upsertMany(query: DecodedQuery<FindOneOptions>, update: Record<string, TUpdateOp>, setOnInsert: Record<string, TValueWithUndefined>): SQL;
106
158
  deleteOne(query: DecodedQuery<FindOneOptions>): SQL;
107
159
  deleteMany(query: DecodedQuery<FindOptions>): SQL;
108
160
  }
109
161
 
110
- interface SqlDialect {
111
- quote(str: string): string;
112
- identifier(name: string): string;
113
- placeholder(idx: number): string;
114
- boolean(value: boolean): string;
115
- encodeType(colname: string, type: TSchema.DataType, value: TValue): SQL;
116
- decodeType(type: TSchema.Primitive | 'vector', value: any): TValue;
117
- updateOperation(paths: string[], dataType: TSchema.DataType, operation: TUpdateOp): SQL;
118
- selectPopulate(compiler: QueryCompiler, parent: QueryContext & {
119
- className: string;
120
- }, populate: Populate, field: string, countMatches: boolean): {
121
- columns: SQL[];
122
- join?: SQL;
123
- };
124
- encodeFieldExpression(compiler: QueryCompiler, parent: QueryContext, field: string, expr: FieldSelectorExpression): SQL;
125
- encodeQueryExpression(compiler: QueryCompiler, parent: QueryContext, expr: QueryExpression): SQL | undefined;
126
- encodePopulate(compiler: QueryCompiler, parent: Populate, remix?: QueryContext & {
127
- className: string;
128
- }): Record<string, SQL>;
129
- encodeRelation(compiler: QueryCompiler, parent: QueryContext & {
130
- className: string;
131
- }, relatedBy: NonNullable<RelationOptions['relatedBy']>): SQL;
132
- encodeSortKey(compiler: QueryCompiler, parent: QueryContext, key: string): SQL;
133
- random(opts: {
134
- weight?: string;
135
- }): SQL;
136
- }
137
-
138
- type SQLLiteral = SQL | SQL[] | {
139
- literal: string | SQL[];
140
- separator?: string;
141
- };
142
- type SQLIdentifier = {
143
- identifier: string;
144
- };
145
- type SQLEscapeString = {
146
- quote: string;
147
- };
148
- type SQLValue = {
149
- value: TValue;
150
- } | SQLIdentifier | SQLLiteral | SQLEscapeString;
151
- declare class SQL {
152
- strings: TemplateStringsArray;
153
- values: SQLValue[];
154
- constructor(templates: TemplateStringsArray, values: SQLValue[]);
155
- private _compile;
156
- compile(dialect: SqlDialect): {
157
- query: string;
158
- values: any[];
159
- };
160
- }
161
-
162
162
  declare abstract class SqlStorage implements TStorage {
163
163
  schema: Record<string, TSchema>;
164
164
  prepare(schema: Record<string, TSchema>): Promise<void>;
165
165
  shutdown(): Promise<void>;
166
166
  classes(): string[];
167
167
  abstract selectLock(): boolean;
168
- abstract config(acl?: string[]): PromiseLike<Record<string, _TValue>>;
168
+ abstract config(acl?: string[]): PromiseLike<Record<string, TValueWithoutObject>>;
169
169
  abstract configAcl(): PromiseLike<Record<string, string[]>>;
170
- abstract setConfig(values: Record<string, _TValue>, acl?: string[]): PromiseLike<void>;
170
+ abstract setConfig(values: Record<string, TValueWithoutObject>, acl?: string[]): PromiseLike<void>;
171
171
  abstract lockTable(className: string | string[], update: boolean): Promise<void>;
172
172
  abstract withConnection<T>(callback: (connection: TStorage) => PromiseLike<T>): PromiseLike<T>;
173
173
  abstract isDuplicateIdError(error: any): boolean;
@@ -190,12 +190,12 @@ declare abstract class SqlStorage implements TStorage {
190
190
  random(query: DecodedQuery<FindOptions & RelationOptions>, opts?: TQueryRandomOptions): AsyncGenerator<TObject, void, unknown>;
191
191
  refs(object: TObject, classNames: string[], roles?: string[]): AsyncGenerator<TObject, void, unknown>;
192
192
  nonrefs(query: DecodedQuery<FindOptions>): AsyncGenerator<TObject, void, unknown>;
193
- insert(options: InsertOptions, attrs: Record<string, TValue>): Promise<TObject | undefined>;
194
- insertMany(options: InsertOptions, values: Record<string, TValue>[]): Promise<number>;
193
+ insert(options: InsertOptions, attrs: Record<string, TValueWithUndefined>): Promise<TObject | undefined>;
194
+ insertMany(options: InsertOptions, values: Record<string, TValueWithUndefined>[]): Promise<number>;
195
195
  updateOne(query: DecodedQuery<FindOneOptions>, update: Record<string, TUpdateOp>): Promise<TObject | undefined>;
196
196
  updateMany(query: DecodedQuery<FindOptions>, update: Record<string, TUpdateOp>): Promise<number>;
197
- upsertOne(query: DecodedQuery<FindOneOptions>, update: Record<string, TUpdateOp>, setOnInsert: Record<string, TValue>): Promise<TObject | undefined>;
198
- upsertMany(query: DecodedQuery<FindOptions>, update: Record<string, TUpdateOp>, setOnInsert: Record<string, TValue>): Promise<{
197
+ upsertOne(query: DecodedQuery<FindOneOptions>, update: Record<string, TUpdateOp>, setOnInsert: Record<string, TValueWithUndefined>): Promise<TObject | undefined>;
198
+ upsertMany(query: DecodedQuery<FindOptions>, update: Record<string, TUpdateOp>, setOnInsert: Record<string, TValueWithUndefined>): Promise<{
199
199
  updated: number;
200
200
  inserted: number;
201
201
  }>;
@@ -206,11 +206,37 @@ declare abstract class SqlStorage implements TStorage {
206
206
  declare class PostgresStorageClient<Driver extends PostgresClientDriver> extends SqlStorage implements TPubSub {
207
207
  protected _driver: Driver;
208
208
  constructor(driver: Driver);
209
- get dialect(): SqlDialect;
209
+ get dialect(): {
210
+ quote: (str: string) => string;
211
+ identifier: (name: string) => string;
212
+ placeholder: (idx: number) => string;
213
+ boolean: (value: boolean) => "true" | "false";
214
+ encodeType: (colname: string, dataType: TSchema.DataType, value: TValueWithUndefined) => SQL;
215
+ decodeType: (type: TSchema.Primitive | "vector", value: any) => TValue;
216
+ updateOperation: (paths: string[], dataType: TSchema.DataType, operation: TUpdateOp) => SQL;
217
+ selectPopulate: (compiler: QueryCompiler, parent: QueryContext & {
218
+ className: string;
219
+ }, populate: Populate, field: string, countMatches: boolean) => {
220
+ columns: SQL[];
221
+ join?: SQL;
222
+ };
223
+ encodeFieldExpression: (compiler: QueryCompiler, parent: QueryContext, field: string, expr: FieldSelectorExpression) => SQL;
224
+ encodeQueryExpression: (compiler: QueryCompiler, parent: QueryContext, expr: QueryExpression) => SQL | undefined;
225
+ encodePopulate: (compiler: QueryCompiler, parent: Populate, remix?: QueryContext & {
226
+ className: string;
227
+ }) => Record<string, SQL>;
228
+ encodeRelation: (compiler: QueryCompiler, parent: QueryContext & {
229
+ className: string;
230
+ }, relatedBy: NonNullable<RelationOptions["relatedBy"]>) => SQL;
231
+ encodeSortKey: (compiler: QueryCompiler, parent: QueryContext, key: string) => SQL;
232
+ random: (opts: {
233
+ weight?: string;
234
+ }) => SQL;
235
+ };
210
236
  selectLock(): boolean;
211
- config(acl?: string[]): Promise<Record<string, _TValue>>;
237
+ config(acl?: string[]): Promise<Record<string, TValueWithoutObject>>;
212
238
  configAcl(): Promise<Record<string, string[]>>;
213
- setConfig(values: Record<string, _TValue>, acl?: string[]): Promise<void>;
239
+ setConfig(values: Record<string, TValueWithoutObject>, acl?: string[]): Promise<void>;
214
240
  _query(text: string, values?: any[], batchSize?: number): _o2ter_utils_js.AsyncStream<any>;
215
241
  _explain(compiler: QueryCompiler, query: DecodedQuery<FindOptions>): Promise<any>;
216
242
  classes(): string[];
@@ -242,8 +268,8 @@ declare class PostgresStorageClient<Driver extends PostgresClientDriver> extends
242
268
  retry?: boolean;
243
269
  }): PromiseLike<T>;
244
270
  withTransaction<T>(callback: (connection: PostgresStorageTransaction) => PromiseLike<T>, options?: TransactionOptions): Promise<T>;
245
- subscribe(channel: string, callback: (payload: _TValue) => void): () => void;
246
- publish(channel: string, payload: _TValue): Promise<void>;
271
+ subscribe(channel: string, callback: (payload: TValueWithoutObject) => void): () => void;
272
+ publish(channel: string, payload: TValueWithoutObject): Promise<void>;
247
273
  _refs(schema: Record<string, TSchema>, className: string, keys: string[], item: SQL): SQL;
248
274
  }
249
275
  declare class PostgresStorageTransaction extends PostgresStorageClient<PostgresClientDriver> {
@@ -3,15 +3,15 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _ = require('lodash');
6
- var index = require('../../internals/index-Dej3GgVf.js');
6
+ var index = require('../../internals/index-BtqngPTb.js');
7
7
  var pg = require('pg');
8
8
  var QueryStream = require('pg-query-stream');
9
9
  var utilsJs = require('@o2ter/utils-js');
10
10
  var Decimal = require('decimal.js');
11
11
  var utils = require('pg/lib/utils');
12
- var index$1 = require('../../internals/index-COOeeeBE.js');
12
+ var index$1 = require('../../internals/index-DIFr-lHN.js');
13
13
  require('@o2ter/crypto-js');
14
- var random$1 = require('../../internals/random-CObICDCy.js');
14
+ var random$1 = require('../../internals/random-CM_i1mxR.js');
15
15
  var _private = require('../../internals/private-Ciddhure.js');
16
16
 
17
17
  //