@pc-nexus/storage 0.5.0-next.20 → 0.5.0-next.22
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/lib/ces/condition-builder/condition.builder.d.ts +9 -8
- package/lib/ces/condition-builder/condition.builder.d.ts.map +1 -1
- package/lib/ces/condition-builder/condition.builder.js +5 -3
- package/lib/ces/condition-builder/inner-condition.builder.d.ts +4 -9
- package/lib/ces/condition-builder/inner-condition.builder.d.ts.map +1 -1
- package/lib/ces/condition-builder/inner-condition.builder.js +14 -119
- package/lib/ces/entity-storage.d.ts +5 -5
- package/lib/ces/entity-storage.d.ts.map +1 -1
- package/lib/ces/entity-storage.js +5 -5
- package/lib/kvs/kvs.d.ts +3 -3
- package/lib/kvs/kvs.d.ts.map +1 -1
- package/lib/kvs/type.d.ts +2 -2
- package/lib/kvs/type.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { CurrentLevelType, EqOptions,
|
|
1
|
+
import type { CurrentLevelType, EqOptions, KeyChains, LogicalLevelType, Condition, ConditionBuilderOptions, QueryOperatorCondition$contains, RangeOptions, RootLevelType, TypeAtKeyChain, ValueAlternativeType, QueryOperator, Document } from "@pc-nexus/internal";
|
|
2
|
+
import { InnerConditionBuilder } from "./inner-condition.builder.js";
|
|
2
3
|
export interface CommonConditionBuilder<Schema = Document, CurrentLevel extends CurrentLevelType<Schema> = RootLevelType<Schema>> {
|
|
3
4
|
field<TFieldChains extends KeyChains<Schema>>(field: TFieldChains): LimitComparisonConditionBuilder<Schema, TFieldChains, CurrentLevel, TypeAtKeyChain<Schema, TFieldChains>>;
|
|
4
5
|
}
|
|
@@ -8,7 +9,7 @@ export interface LogicalConditionBuilder<Schema = Document, FieldChains extends
|
|
|
8
9
|
and(closure: (andBuilder: LogicalOperatorBuilder<Schema>) => void): LogicalOperatorReturnType<Schema, V, CurrentLevel>;
|
|
9
10
|
or(closure: (orBuilder: LogicalOperatorBuilder<Schema>) => void): LogicalOperatorReturnType<Schema, V, CurrentLevel>;
|
|
10
11
|
}
|
|
11
|
-
type LimitComparisonConditionBuilder<Schema = Document, FieldChains extends KeyChains<Schema> = KeyChains<Schema>, CurrentLevel extends CurrentLevelType<Schema> = RootLevelType<Schema>, V = TypeAtKeyChain<Schema, FieldChains>, FieldType = TypeAtKeyChain<Schema, FieldChains>> = FieldType extends number ? ComparisonConditionBuilder<Schema, FieldChains, CurrentLevel, V> : FieldType extends string ? Pick<ComparisonConditionBuilder<Schema, FieldChains, CurrentLevel, V>, "eq" | "ne" | "exists" | "
|
|
12
|
+
type LimitComparisonConditionBuilder<Schema = Document, FieldChains extends KeyChains<Schema> = KeyChains<Schema>, CurrentLevel extends CurrentLevelType<Schema> = RootLevelType<Schema>, V = TypeAtKeyChain<Schema, FieldChains>, FieldType = TypeAtKeyChain<Schema, FieldChains>> = FieldType extends number ? Pick<ComparisonConditionBuilder<Schema, FieldChains, CurrentLevel, V>, "eq" | "ne" | "exists" | "gt" | "gte" | "lt" | "lte"> : FieldType extends string ? Pick<ComparisonConditionBuilder<Schema, FieldChains, CurrentLevel, V>, "eq" | "ne" | "exists" | "contains" | "notContains"> : FieldType extends boolean ? Pick<ComparisonConditionBuilder<Schema, FieldChains, CurrentLevel, V>, "eq" | "ne" | "exists"> : FieldType extends any[] ? Pick<ComparisonConditionBuilder<Schema, FieldChains, CurrentLevel, V>, "contains" | "notContains" | "eq" | "ne" | "exists"> : FieldType extends Document ? Pick<ComparisonConditionBuilder<Schema, FieldChains, CurrentLevel, V>, "eq" | "ne" | "exists"> : never;
|
|
12
13
|
export type ComparisonConditionBuilderReturnType<Schema = Document, FieldChains extends KeyChains<Schema> = KeyChains<Schema>, CurrentLevel extends CurrentLevelType<Schema> = RootLevelType<Schema>, V = TypeAtKeyChain<Schema, FieldChains>> = LogicalConditionBuilder<Schema, never, CurrentLevel, V> & LimitComparisonConditionBuilder<Schema, FieldChains, CurrentLevel, V>;
|
|
13
14
|
export interface ComparisonConditionBuilder<Schema = Document, FieldChains extends KeyChains<Schema> = KeyChains<Schema>, CurrentLevel extends CurrentLevelType<Schema> = RootLevelType<Schema>, V = TypeAtKeyChain<Schema, FieldChains>> {
|
|
14
15
|
eq(value: ValueAlternativeType<V>, options?: EqOptions<QueryOperator.eq>): ComparisonConditionBuilderReturnType<Schema, FieldChains, CurrentLevel, V>;
|
|
@@ -17,20 +18,20 @@ export interface ComparisonConditionBuilder<Schema = Document, FieldChains exten
|
|
|
17
18
|
gte(value: ValueAlternativeType<V>, options?: RangeOptions): ComparisonConditionBuilderReturnType<Schema, FieldChains, CurrentLevel, V>;
|
|
18
19
|
lt(value: ValueAlternativeType<V>, options?: RangeOptions): ComparisonConditionBuilderReturnType<Schema, FieldChains, CurrentLevel, V>;
|
|
19
20
|
lte(value: ValueAlternativeType<V>, options?: RangeOptions): ComparisonConditionBuilderReturnType<Schema, FieldChains, CurrentLevel, V>;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
nin(value: QueryOperatorCondition$in<V>, options?: Omit<InOptions, "queryOperator">): ComparisonConditionBuilderReturnType<Schema, FieldChains, CurrentLevel, V>;
|
|
21
|
+
contains(value: QueryOperatorCondition$contains<V>, options?: ConditionBuilderOptions): ComparisonConditionBuilderReturnType<Schema, FieldChains, CurrentLevel, V>;
|
|
22
|
+
notContains(value: QueryOperatorCondition$contains<V>, options?: ConditionBuilderOptions): ComparisonConditionBuilderReturnType<Schema, FieldChains, CurrentLevel, V>;
|
|
23
23
|
exists(exists?: boolean): ComparisonConditionBuilderReturnType<Schema, FieldChains, CurrentLevel, V>;
|
|
24
24
|
}
|
|
25
25
|
export declare class ConditionBuilder<Schema = Document, FieldChains extends KeyChains<Schema> = KeyChains<Schema>, CurrentLevel extends CurrentLevelType<Schema> = RootLevelType<Schema>, V = TypeAtKeyChain<Schema, FieldChains>> implements LogicalConditionBuilder<Schema, FieldChains, CurrentLevel, V> {
|
|
26
|
-
|
|
27
|
-
private _innerBuilder;
|
|
26
|
+
protected _innerBuilder: InnerConditionBuilder<Schema, FieldChains, CurrentLevel, V>;
|
|
28
27
|
constructor(options?: ConditionBuilderOptions);
|
|
29
28
|
and(closure: (andBuilder: LogicalOperatorBuilder<Schema>) => void): LogicalOperatorReturnType<Schema, never, CurrentLevel>;
|
|
30
29
|
or(closure: (orBuilder: LogicalOperatorBuilder<Schema>) => void): LogicalOperatorReturnType<Schema, never, CurrentLevel>;
|
|
31
30
|
field<TFieldChains extends FieldChains>(field: TFieldChains): LimitComparisonConditionBuilder<Schema, TFieldChains, CurrentLevel, TypeAtKeyChain<Schema, TFieldChains>>;
|
|
31
|
+
}
|
|
32
|
+
export declare class ConditionBuilderHelper<Schema = Document, FieldChains extends KeyChains<Schema> = KeyChains<Schema>, CurrentLevel extends CurrentLevelType<Schema> = RootLevelType<Schema>, V = TypeAtKeyChain<Schema, FieldChains>> extends ConditionBuilder<Schema, FieldChains, CurrentLevel, V> {
|
|
33
|
+
static create<Schema>(options?: ConditionBuilderOptions): ConditionBuilderHelper<Schema>;
|
|
32
34
|
done(reset?: boolean): Condition;
|
|
33
35
|
}
|
|
34
|
-
export type ConditionBuilderApi<Schema> = Omit<ConditionBuilder<Schema>, "done">;
|
|
35
36
|
export {};
|
|
36
37
|
//# sourceMappingURL=condition.builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition.builder.d.ts","sourceRoot":"","sources":["../../../../src/lib/ces/condition-builder/condition.builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"condition.builder.d.ts","sourceRoot":"","sources":["../../../../src/lib/ces/condition-builder/condition.builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,uBAAuB,EACvB,+BAA+B,EAC/B,YAAY,EACZ,aAAa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
export class ConditionBuilder {
|
|
3
|
-
static create(options) {
|
|
4
|
-
return new ConditionBuilder(options);
|
|
5
|
-
}
|
|
6
3
|
_innerBuilder;
|
|
7
4
|
constructor(options) {
|
|
8
5
|
this._innerBuilder = new InnerConditionBuilder(options);
|
|
@@ -19,6 +16,11 @@ export class ConditionBuilder {
|
|
|
19
16
|
this._innerBuilder.field(field);
|
|
20
17
|
return this._innerBuilder;
|
|
21
18
|
}
|
|
19
|
+
}
|
|
20
|
+
export class ConditionBuilderHelper extends ConditionBuilder {
|
|
21
|
+
static create(options) {
|
|
22
|
+
return new ConditionBuilderHelper(options);
|
|
23
|
+
}
|
|
22
24
|
done(reset = true) {
|
|
23
25
|
return this._innerBuilder.done(reset);
|
|
24
26
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CurrentLevelType, EqOptions,
|
|
1
|
+
import type { CurrentLevelType, EqOptions, KeyChains, LogicalLevelType, Query, Condition, ConditionBuilderOptions, QueryOperatorCondition$contains, RangeOptions, RootLevelType, TypeAtKeyChain, ValueAlternativeType } from "@pc-nexus/internal";
|
|
2
2
|
import { QueryOperator } from "@pc-nexus/internal";
|
|
3
3
|
export declare class InnerConditionBuilder<Schema = Record<string, any>, FieldChains extends KeyChains<Schema> = KeyChains<Schema>, CurrentLevel extends CurrentLevelType<Schema> = RootLevelType<Schema>, V = TypeAtKeyChain<Schema, FieldChains>> {
|
|
4
4
|
private _field;
|
|
@@ -26,19 +26,14 @@ export declare class InnerConditionBuilder<Schema = Record<string, any>, FieldCh
|
|
|
26
26
|
private updateQuery;
|
|
27
27
|
field<TFieldChains extends FieldChains>(field: TFieldChains): InnerConditionBuilder<Schema, TFieldChains, CurrentLevel>;
|
|
28
28
|
resetFieldConditions(): this;
|
|
29
|
-
eq<OP extends QueryOperator.eq | QueryOperator.ne | QueryOperator.gt | QueryOperator.gte | QueryOperator.lte | QueryOperator.lt = QueryOperator.eq>(value: ValueAlternativeType<V>, { queryOperator, ...options }?: EqOptions<OP>): this;
|
|
29
|
+
eq<OP extends QueryOperator.eq | QueryOperator.ne | QueryOperator.gt | QueryOperator.gte | QueryOperator.lte | QueryOperator.lt | QueryOperator.contains | QueryOperator.notContains = QueryOperator.eq>(value: ValueAlternativeType<V>, { queryOperator, ...options }?: EqOptions<OP>): this;
|
|
30
30
|
ne(value: ValueAlternativeType<V>, options?: Omit<EqOptions, "queryOperator">): this;
|
|
31
|
-
range(values: Partial<Record<"gte" | "lte" | "gt" | "lt", ValueAlternativeType<V>>>, { ...options }?: RangeOptions): this;
|
|
32
31
|
gte(value: ValueAlternativeType<V>, { ...options }?: RangeOptions): this;
|
|
33
32
|
gt(value: ValueAlternativeType<V>, { ...options }?: RangeOptions): this;
|
|
34
33
|
lte(value: ValueAlternativeType<V>, { ...options }?: RangeOptions): this;
|
|
35
34
|
lt(value: ValueAlternativeType<V>, { ...options }?: RangeOptions): this;
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
contains(value: QueryOperatorCondition$contains<V>, { ...options }?: ConditionBuilderOptions): this;
|
|
36
|
+
notContains(value: QueryOperatorCondition$contains<V>, { ...options }?: ConditionBuilderOptions): this;
|
|
38
37
|
exists(exists?: boolean): this;
|
|
39
|
-
private toAST;
|
|
40
|
-
private mapLogicalKey;
|
|
41
|
-
private convertTopLevelObject;
|
|
42
|
-
private convertFieldEntry;
|
|
43
38
|
}
|
|
44
39
|
//# sourceMappingURL=inner-condition.builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inner-condition.builder.d.ts","sourceRoot":"","sources":["../../../../src/lib/ces/condition-builder/inner-condition.builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,gBAAgB,EAChB,SAAS,EACT,SAAS,
|
|
1
|
+
{"version":3,"file":"inner-condition.builder.d.ts","sourceRoot":"","sources":["../../../../src/lib/ces/condition-builder/inner-condition.builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,gBAAgB,EAChB,SAAS,EACT,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C,SAAS,EAAE,eAAe,CAAM,GAAG,IAAI;IAIxF,GAAG,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,GAAE,YAAiB,GAAG,IAAI;IAK5E,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,GAAE,YAAiB,GAAG,IAAI;IAK3E,GAAG,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,GAAE,YAAiB,GAAG,IAAI;IAK5E,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,GAAE,YAAiB,GAAG,IAAI;IAK3E,QAAQ,CAAC,KAAK,EAAE,+BAA+B,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,GAAE,uBAA4B,GAAG,IAAI;IAKvG,WAAW,CAAC,KAAK,EAAE,+BAA+B,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,GAAE,uBAA4B,GAAG,IAAI;IAK1G,MAAM,CAAC,MAAM,UAAO,GAAG,IAAI;CAKrC"}
|
|
@@ -24,11 +24,18 @@ export class InnerConditionBuilder {
|
|
|
24
24
|
}
|
|
25
25
|
done(reset = true) {
|
|
26
26
|
this.assertAtRootLevel();
|
|
27
|
-
const
|
|
27
|
+
const root = _.cloneDeep(this.root);
|
|
28
|
+
const result = {};
|
|
29
|
+
for (const [key, value] of Object.entries(root)) {
|
|
30
|
+
if (key && !result.and) {
|
|
31
|
+
result.and = [];
|
|
32
|
+
}
|
|
33
|
+
result.and?.push({ [key]: value });
|
|
34
|
+
}
|
|
28
35
|
if (reset) {
|
|
29
36
|
this.reset();
|
|
30
37
|
}
|
|
31
|
-
return
|
|
38
|
+
return result;
|
|
32
39
|
}
|
|
33
40
|
reset() {
|
|
34
41
|
const root = {};
|
|
@@ -190,22 +197,6 @@ export class InnerConditionBuilder {
|
|
|
190
197
|
ne(value, options = {}) {
|
|
191
198
|
return this.eq(value, { ...options, queryOperator: QueryOperator.ne });
|
|
192
199
|
}
|
|
193
|
-
range(values, { ...options } = {}) {
|
|
194
|
-
const condition = {};
|
|
195
|
-
const setCondition = (key, value) => {
|
|
196
|
-
if (value !== undefined && this.shouldReserveValue(value, options)) {
|
|
197
|
-
condition[key] = value;
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
setCondition("gte", values.gte);
|
|
201
|
-
setCondition("gt", values.gt);
|
|
202
|
-
setCondition("lte", values.lte);
|
|
203
|
-
setCondition("lt", values.lt);
|
|
204
|
-
if (!_.isEmpty(condition)) {
|
|
205
|
-
this.updateQuery(this.currentField, condition);
|
|
206
|
-
}
|
|
207
|
-
return this;
|
|
208
|
-
}
|
|
209
200
|
gte(value, { ...options } = {}) {
|
|
210
201
|
this.eq(value, { queryOperator: QueryOperator.gte, ...options });
|
|
211
202
|
return this;
|
|
@@ -222,113 +213,17 @@ export class InnerConditionBuilder {
|
|
|
222
213
|
this.eq(value, { queryOperator: QueryOperator.lt, ...options });
|
|
223
214
|
return this;
|
|
224
215
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if (value === undefined) {
|
|
228
|
-
if (this.shouldReserveValue(value, options)) {
|
|
229
|
-
throw new NexusInnerError(NexusCode.invalidInput, NexusInnerErrorType.storageConditionBuilder, `${queryOperator} needs an array`);
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
return this;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
else if (!_.isArray(value)) {
|
|
236
|
-
throw new NexusInnerError(NexusCode.invalidInput, NexusInnerErrorType.storageConditionBuilder, `${queryOperator} needs an array`);
|
|
237
|
-
}
|
|
238
|
-
if (options.ignoreEmpty && _.isEmpty(value)) {
|
|
239
|
-
return this;
|
|
240
|
-
}
|
|
241
|
-
this.updateQuery(field, {
|
|
242
|
-
[queryOperator]: value.filter((ele) => this.shouldReserveValue(ele, options)),
|
|
243
|
-
});
|
|
216
|
+
contains(value, { ...options } = {}) {
|
|
217
|
+
this.eq(value, { queryOperator: QueryOperator.contains, ...options });
|
|
244
218
|
return this;
|
|
245
219
|
}
|
|
246
|
-
|
|
247
|
-
|
|
220
|
+
notContains(value, { ...options } = {}) {
|
|
221
|
+
this.eq(value, { queryOperator: QueryOperator.notContains, ...options });
|
|
222
|
+
return this;
|
|
248
223
|
}
|
|
249
224
|
exists(exists = true) {
|
|
250
225
|
const field = this.currentField;
|
|
251
226
|
this.updateQuery(field, { [QueryOperator.exists]: !!exists });
|
|
252
227
|
return this;
|
|
253
228
|
}
|
|
254
|
-
toAST(query) {
|
|
255
|
-
const nodes = [];
|
|
256
|
-
const entries = Object.entries(query);
|
|
257
|
-
for (const [key, value] of entries) {
|
|
258
|
-
if (key in LogicalOperator) {
|
|
259
|
-
const group = {
|
|
260
|
-
kind: "group",
|
|
261
|
-
op: this.mapLogicalKey(key),
|
|
262
|
-
nodes: [],
|
|
263
|
-
};
|
|
264
|
-
const arr = value;
|
|
265
|
-
for (const ele of arr) {
|
|
266
|
-
const subNodes = this.convertTopLevelObject(ele);
|
|
267
|
-
group.nodes.push(...subNodes);
|
|
268
|
-
}
|
|
269
|
-
if (group.nodes.length > 0) {
|
|
270
|
-
nodes.push(group);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
else {
|
|
274
|
-
const fieldNodes = this.convertFieldEntry(key, value);
|
|
275
|
-
if (fieldNodes.length > 0)
|
|
276
|
-
nodes.push(...fieldNodes);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
if (nodes.length === 1) {
|
|
280
|
-
return nodes[0];
|
|
281
|
-
}
|
|
282
|
-
return { kind: "group", op: LogicalOperator.and, nodes };
|
|
283
|
-
}
|
|
284
|
-
mapLogicalKey(key) {
|
|
285
|
-
return key;
|
|
286
|
-
}
|
|
287
|
-
convertTopLevelObject(obj) {
|
|
288
|
-
const out = [];
|
|
289
|
-
for (const [k, v] of Object.entries(obj)) {
|
|
290
|
-
if (k in LogicalOperator) {
|
|
291
|
-
const group = {
|
|
292
|
-
kind: "group",
|
|
293
|
-
op: this.mapLogicalKey(k),
|
|
294
|
-
nodes: [],
|
|
295
|
-
};
|
|
296
|
-
for (const ele of v) {
|
|
297
|
-
group.nodes.push(...this.convertTopLevelObject(ele));
|
|
298
|
-
}
|
|
299
|
-
out.push(group);
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
const fieldNodes = this.convertFieldEntry(k, v);
|
|
303
|
-
out.push(...fieldNodes);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
return out;
|
|
307
|
-
}
|
|
308
|
-
convertFieldEntry(field, condition) {
|
|
309
|
-
const out = [];
|
|
310
|
-
if (_.isPlainObject(condition) && !_.isRegExp(condition)) {
|
|
311
|
-
const supported = {
|
|
312
|
-
[QueryOperator.eq]: true,
|
|
313
|
-
[QueryOperator.ne]: true,
|
|
314
|
-
[QueryOperator.gt]: true,
|
|
315
|
-
[QueryOperator.gte]: true,
|
|
316
|
-
[QueryOperator.lt]: true,
|
|
317
|
-
[QueryOperator.lte]: true,
|
|
318
|
-
[QueryOperator.in]: true,
|
|
319
|
-
[QueryOperator.nin]: true,
|
|
320
|
-
[QueryOperator.exists]: true,
|
|
321
|
-
};
|
|
322
|
-
for (const [k, val] of Object.entries(condition)) {
|
|
323
|
-
const op = k;
|
|
324
|
-
if (!supported[op])
|
|
325
|
-
continue;
|
|
326
|
-
out.push({ kind: "field", field, op, value: op === QueryOperator.exists ? !!val : val });
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
else {
|
|
330
|
-
out.push({ kind: "field", field, op: QueryOperator.eq, value: condition });
|
|
331
|
-
}
|
|
332
|
-
return out;
|
|
333
|
-
}
|
|
334
229
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConditionBuilder } from "./condition-builder/index.js";
|
|
2
2
|
import type { DeleteOptions, FindOptions, InsertOptions, UpdateOptions } from "@pc-nexus/internal";
|
|
3
3
|
/**
|
|
4
4
|
* Entity storage API implementation, provides CRUD operations for entities via CES hook
|
|
@@ -24,7 +24,7 @@ export declare class CustomEntityStorage<T> {
|
|
|
24
24
|
* @param options Find options, e.g. projection, hint, includes
|
|
25
25
|
* @returns Matching entities
|
|
26
26
|
*/
|
|
27
|
-
find(condition: (conditionBuilder:
|
|
27
|
+
find(condition: (conditionBuilder: ConditionBuilder<T>) => void, options?: FindOptions<T>): Promise<T[]>;
|
|
28
28
|
/**
|
|
29
29
|
* Update all records matching the condition
|
|
30
30
|
* @param condition Query condition
|
|
@@ -32,19 +32,19 @@ export declare class CustomEntityStorage<T> {
|
|
|
32
32
|
* @param options Update options, e.g. returnValue, upsert, hint
|
|
33
33
|
* @returns void
|
|
34
34
|
*/
|
|
35
|
-
update(condition: (conditionBuilder:
|
|
35
|
+
update(condition: (conditionBuilder: ConditionBuilder<T>) => void, value?: Partial<T>, options?: UpdateOptions): Promise<void>;
|
|
36
36
|
/**
|
|
37
37
|
* Count records matching the condition
|
|
38
38
|
* @param condition Query condition
|
|
39
39
|
* @returns Record count
|
|
40
40
|
*/
|
|
41
|
-
count(condition: (conditionBuilder:
|
|
41
|
+
count(condition: (conditionBuilder: ConditionBuilder<T>) => void): Promise<number>;
|
|
42
42
|
/**
|
|
43
43
|
* Delete records matching the condition (soft delete)
|
|
44
44
|
* @param condition Query condition
|
|
45
45
|
* @param options Delete options, e.g. justOne
|
|
46
46
|
* @returns void
|
|
47
47
|
*/
|
|
48
|
-
delete(condition: (conditionBuilder:
|
|
48
|
+
delete(condition: (conditionBuilder: ConditionBuilder<T>) => void, options?: DeleteOptions): Promise<void>;
|
|
49
49
|
}
|
|
50
50
|
//# sourceMappingURL=entity-storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-storage.d.ts","sourceRoot":"","sources":["../../../src/lib/ces/entity-storage.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"entity-storage.d.ts","sourceRoot":"","sources":["../../../src/lib/ces/entity-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAA0B,MAAM,8BAA8B,CAAC;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnG;;;GAGG;AACH,qBAAa,mBAAmB,CAAC,CAAC;IAIX,OAAO,CAAC,QAAQ,CAAC,UAAU;IAH9C;;OAEG;gBACiC,UAAU,EAAE,MAAM;IAEtD;;;;;OAKG;IACU,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IACzD,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC;IAalE;;;;;OAKG;IACU,IAAI,CAAC,SAAS,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAerH;;;;;;OAMG;IACU,MAAM,CACf,SAAS,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,EAC1D,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAClB,OAAO,CAAC,EAAE,aAAa,GACxB,OAAO,CAAC,IAAI,CAAC;IAehB;;;;OAIG;IACU,KAAK,CAAC,SAAS,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IAc/F;;;;;OAKG;IACU,MAAM,CAAC,SAAS,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAa1H"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { invoke } from "@pc-nexus/internal";
|
|
2
|
-
import {
|
|
2
|
+
import { ConditionBuilderHelper } from "./condition-builder/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Entity storage API implementation, provides CRUD operations for entities via CES hook
|
|
5
5
|
* @template T Entity type extending Entity
|
|
@@ -30,7 +30,7 @@ export class CustomEntityStorage {
|
|
|
30
30
|
* @returns Matching entities
|
|
31
31
|
*/
|
|
32
32
|
async find(condition, options) {
|
|
33
|
-
const conditionBuilder =
|
|
33
|
+
const conditionBuilder = ConditionBuilderHelper.create();
|
|
34
34
|
condition(conditionBuilder);
|
|
35
35
|
const ast = conditionBuilder.done();
|
|
36
36
|
const response = await invoke("storage/ces", "find", {
|
|
@@ -51,7 +51,7 @@ export class CustomEntityStorage {
|
|
|
51
51
|
* @returns void
|
|
52
52
|
*/
|
|
53
53
|
async update(condition, value, options) {
|
|
54
|
-
const conditionBuilder =
|
|
54
|
+
const conditionBuilder = ConditionBuilderHelper.create();
|
|
55
55
|
condition(conditionBuilder);
|
|
56
56
|
const ast = conditionBuilder.done();
|
|
57
57
|
const response = await invoke("storage/ces", "update", {
|
|
@@ -70,7 +70,7 @@ export class CustomEntityStorage {
|
|
|
70
70
|
* @returns Record count
|
|
71
71
|
*/
|
|
72
72
|
async count(condition) {
|
|
73
|
-
const conditionBuilder =
|
|
73
|
+
const conditionBuilder = ConditionBuilderHelper.create();
|
|
74
74
|
condition(conditionBuilder);
|
|
75
75
|
const ast = conditionBuilder.done();
|
|
76
76
|
const response = await invoke("storage/ces", "count", {
|
|
@@ -89,7 +89,7 @@ export class CustomEntityStorage {
|
|
|
89
89
|
* @returns void
|
|
90
90
|
*/
|
|
91
91
|
async delete(condition, options) {
|
|
92
|
-
const conditionBuilder =
|
|
92
|
+
const conditionBuilder = ConditionBuilderHelper.create();
|
|
93
93
|
condition(conditionBuilder);
|
|
94
94
|
const ast = conditionBuilder.done();
|
|
95
95
|
const response = await invoke("storage/ces", "delete", {
|
package/lib/kvs/kvs.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { KvsGetOptions, KvsSetResult, KvsValueType, KvsSetOptions } from "./type.js";
|
|
2
2
|
declare class Kvs {
|
|
3
|
-
set(key: string, value: KvsValueType, options?:
|
|
4
|
-
get(key: string, options?:
|
|
3
|
+
set(key: string, value: KvsValueType, options?: KvsSetOptions): Promise<KvsSetResult>;
|
|
4
|
+
get(key: string, options?: KvsGetOptions): Promise<KvsValueType | undefined>;
|
|
5
5
|
delete(key: string): Promise<void>;
|
|
6
6
|
}
|
|
7
7
|
export declare const kvs: Kvs;
|
package/lib/kvs/kvs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kvs.d.ts","sourceRoot":"","sources":["../../../src/lib/kvs/kvs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"kvs.d.ts","sourceRoot":"","sources":["../../../src/lib/kvs/kvs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAErF,cAAM,GAAG;IACQ,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAUrF,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAS5E,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKlD;AACD,eAAO,MAAM,GAAG,KAAY,CAAC"}
|
package/lib/kvs/type.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type KvsValueType = number | string | boolean | object | unknown[];
|
|
2
|
-
export interface
|
|
2
|
+
export interface KvsSetOptions {
|
|
3
3
|
policy?: "OVERRIDE" | "FAIL_IF_EXISTS";
|
|
4
4
|
secret?: boolean;
|
|
5
5
|
}
|
|
@@ -7,7 +7,7 @@ export interface KvsSetResult {
|
|
|
7
7
|
key: string;
|
|
8
8
|
value: KvsValueType;
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
10
|
+
export interface KvsGetOptions {
|
|
11
11
|
secret?: boolean;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=type.d.ts.map
|
package/lib/kvs/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/lib/kvs/type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,EAAE,CAAC;AAE1E,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/lib/kvs/type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,EAAE,CAAC;AAE1E,MAAM,WAAW,aAAa;IAC1B,MAAM,CAAC,EAAE,UAAU,GAAG,gBAAgB,CAAC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,YAAY,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pc-nexus/storage",
|
|
3
|
-
"version": "0.5.0-next.
|
|
3
|
+
"version": "0.5.0-next.22",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"type": "module",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@pc-nexus/internal": "0.5.0-next.
|
|
33
|
+
"@pc-nexus/internal": "0.5.0-next.22",
|
|
34
34
|
"lodash": "^4.17.21"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {},
|