@syntropix/database 0.0.3 → 0.0.4
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/core/dataClient.d.ts +1 -1
- package/dist/core/dataClient.js +2 -1
- package/dist/core/tableClient.d.ts +1 -1
- package/dist/core/tableClient.js +2 -1
- package/dist/types/basemodel.d.ts +1 -1
- package/dist/types/filter.d.ts +8 -0
- package/dist/types/filter.js +24 -0
- package/dist/types/requests.d.ts +2 -41
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { DeleteData, Insert, Query, Update } from '../types/requests';
|
|
|
2
2
|
import { ClientConfig } from './config';
|
|
3
3
|
export declare class DataClient {
|
|
4
4
|
private client;
|
|
5
|
-
constructor(config
|
|
5
|
+
constructor(config?: ClientConfig);
|
|
6
6
|
insertData(data: Insert): Promise<any>;
|
|
7
7
|
insertOne(data: Insert): Promise<any>;
|
|
8
8
|
updateByPrimaryKey(pk: string, data: Update): Promise<any>;
|
package/dist/core/dataClient.js
CHANGED
|
@@ -4,7 +4,7 @@ import { TableAddColumn, TableCreate, TableDrop, TableDropColumn, TableGetSchema
|
|
|
4
4
|
import { ClientConfig } from './config';
|
|
5
5
|
export declare class TableClient {
|
|
6
6
|
private client;
|
|
7
|
-
constructor(config
|
|
7
|
+
constructor(config?: ClientConfig);
|
|
8
8
|
createTable(data: TableCreate): Promise<TableCreateResponse>;
|
|
9
9
|
dropTable(data: TableDrop): Promise<any>;
|
|
10
10
|
renameTable(data: TableRename): Promise<any>;
|
package/dist/core/tableClient.js
CHANGED
|
@@ -51,7 +51,7 @@ export declare class BaseModel {
|
|
|
51
51
|
static get<T extends BaseModel>(this: new (data?: any) => T, filter: Filter, select?: string[], _client?: SyntropixClient | null): Promise<T>;
|
|
52
52
|
static filter<T extends BaseModel>(this: new (data?: any) => T, options: {
|
|
53
53
|
filter: Filter;
|
|
54
|
-
sort?: Sort;
|
|
54
|
+
sort?: Sort[];
|
|
55
55
|
aggregate?: Aggregate[];
|
|
56
56
|
join?: Join;
|
|
57
57
|
limit?: number;
|
package/dist/types/filter.d.ts
CHANGED
|
@@ -16,9 +16,13 @@ export declare enum FilterOperation {
|
|
|
16
16
|
NEQ = "NEQ",
|
|
17
17
|
Between = "Between",
|
|
18
18
|
In = "In",
|
|
19
|
+
Contains = "Contains",
|
|
20
|
+
Overlap = "Overlap",
|
|
19
21
|
NotIn = "NotIn",
|
|
20
22
|
Like = "Like",
|
|
21
23
|
NotLike = "NotLike",
|
|
24
|
+
ILike = "ILike",
|
|
25
|
+
NotILike = "NotILike",
|
|
22
26
|
IsNull = "IsNull",
|
|
23
27
|
IsNotNull = "IsNotNull",
|
|
24
28
|
Similarity = "Similarity",
|
|
@@ -51,6 +55,10 @@ export declare const GTE: (field: string, value: any) => SyntropixDBFilterItem;
|
|
|
51
55
|
export declare const LT: (field: string, value: any) => SyntropixDBFilterItem;
|
|
52
56
|
export declare const LTE: (field: string, value: any) => SyntropixDBFilterItem;
|
|
53
57
|
export declare const IN: (field: string, values: any[]) => SyntropixDBFilterItem;
|
|
58
|
+
export declare const CONTAINS: (field: string, value: any) => SyntropixDBFilterItem;
|
|
59
|
+
export declare const OVERLAP: (field: string, value: any) => SyntropixDBFilterItem;
|
|
60
|
+
export declare const I_LIKE: (field: string, pattern: string) => SyntropixDBFilterItem;
|
|
61
|
+
export declare const NOT_I_LIKE: (field: string, pattern: string) => SyntropixDBFilterItem;
|
|
54
62
|
export declare const NOT_IN: (field: string, values: any[]) => SyntropixDBFilterItem;
|
|
55
63
|
export declare const LIKE: (field: string, pattern: string) => SyntropixDBFilterItem;
|
|
56
64
|
export declare const NOT_LIKE: (field: string, pattern: string) => SyntropixDBFilterItem;
|
package/dist/types/filter.js
CHANGED
|
@@ -14,9 +14,13 @@ export var FilterOperation;
|
|
|
14
14
|
FilterOperation["NEQ"] = "NEQ";
|
|
15
15
|
FilterOperation["Between"] = "Between";
|
|
16
16
|
FilterOperation["In"] = "In";
|
|
17
|
+
FilterOperation["Contains"] = "Contains";
|
|
18
|
+
FilterOperation["Overlap"] = "Overlap";
|
|
17
19
|
FilterOperation["NotIn"] = "NotIn";
|
|
18
20
|
FilterOperation["Like"] = "Like";
|
|
19
21
|
FilterOperation["NotLike"] = "NotLike";
|
|
22
|
+
FilterOperation["ILike"] = "ILike";
|
|
23
|
+
FilterOperation["NotILike"] = "NotILike";
|
|
20
24
|
FilterOperation["IsNull"] = "IsNull";
|
|
21
25
|
FilterOperation["IsNotNull"] = "IsNotNull";
|
|
22
26
|
FilterOperation["Similarity"] = "Similarity";
|
|
@@ -67,6 +71,26 @@ export const IN = (field, values) => ({
|
|
|
67
71
|
operator: FilterOperation.In,
|
|
68
72
|
static_value: values,
|
|
69
73
|
});
|
|
74
|
+
export const CONTAINS = (field, value) => ({
|
|
75
|
+
column: field,
|
|
76
|
+
operator: FilterOperation.Contains,
|
|
77
|
+
static_value: value,
|
|
78
|
+
});
|
|
79
|
+
export const OVERLAP = (field, value) => ({
|
|
80
|
+
column: field,
|
|
81
|
+
operator: FilterOperation.Overlap,
|
|
82
|
+
static_value: value,
|
|
83
|
+
});
|
|
84
|
+
export const I_LIKE = (field, pattern) => ({
|
|
85
|
+
column: field,
|
|
86
|
+
operator: FilterOperation.ILike,
|
|
87
|
+
static_value: pattern,
|
|
88
|
+
});
|
|
89
|
+
export const NOT_I_LIKE = (field, pattern) => ({
|
|
90
|
+
column: field,
|
|
91
|
+
operator: FilterOperation.NotILike,
|
|
92
|
+
static_value: pattern,
|
|
93
|
+
});
|
|
70
94
|
export const NOT_IN = (field, values) => ({
|
|
71
95
|
column: field,
|
|
72
96
|
operator: FilterOperation.NotIn,
|
package/dist/types/requests.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Aggregate, Column, ForeignKey, GroupBy, Index, Join, Sort } from './common';
|
|
2
|
-
import { Filter
|
|
2
|
+
import { Filter } from './filter';
|
|
3
3
|
export interface TableCreate {
|
|
4
4
|
name: string;
|
|
5
5
|
description?: string;
|
|
@@ -58,7 +58,7 @@ export interface DeleteData {
|
|
|
58
58
|
}
|
|
59
59
|
export interface QueryPayload {
|
|
60
60
|
filter?: Filter;
|
|
61
|
-
sort?: Sort;
|
|
61
|
+
sort?: Sort[];
|
|
62
62
|
aggregate?: Aggregate[];
|
|
63
63
|
join?: Join[];
|
|
64
64
|
limit?: number;
|
|
@@ -70,42 +70,3 @@ export interface Query {
|
|
|
70
70
|
table_name: string;
|
|
71
71
|
query: QueryPayload;
|
|
72
72
|
}
|
|
73
|
-
export interface SyntropixDBSortItem {
|
|
74
|
-
column: string;
|
|
75
|
-
direction: SortType;
|
|
76
|
-
}
|
|
77
|
-
export type SyntropixDBSort = SyntropixDBSortItem[];
|
|
78
|
-
export interface SyntropixDBJoin {
|
|
79
|
-
table: string;
|
|
80
|
-
on: string;
|
|
81
|
-
}
|
|
82
|
-
export interface SyntropixDBAggregate {
|
|
83
|
-
function: string;
|
|
84
|
-
column: string;
|
|
85
|
-
alias: string;
|
|
86
|
-
}
|
|
87
|
-
export type SyntropixDBGroupBy = string[];
|
|
88
|
-
export type SyntropixDBDistinct = string[];
|
|
89
|
-
export interface SyntropixDBQuery {
|
|
90
|
-
filter: SyntropixDBFilter;
|
|
91
|
-
sort?: SyntropixDBSort;
|
|
92
|
-
limit?: number;
|
|
93
|
-
offset?: number;
|
|
94
|
-
select?: string[];
|
|
95
|
-
join?: SyntropixDBJoin[];
|
|
96
|
-
aggregate?: SyntropixDBAggregate[];
|
|
97
|
-
group_by?: SyntropixDBGroupBy;
|
|
98
|
-
distinct?: SyntropixDBDistinct;
|
|
99
|
-
}
|
|
100
|
-
export interface SyntropixDBInsert {
|
|
101
|
-
columns: string[];
|
|
102
|
-
values: any[][];
|
|
103
|
-
}
|
|
104
|
-
export interface SyntropixDBUpdate {
|
|
105
|
-
filter: SyntropixDBFilter;
|
|
106
|
-
columns: string[];
|
|
107
|
-
values: any[];
|
|
108
|
-
}
|
|
109
|
-
export interface SyntropixDBDelete {
|
|
110
|
-
filter: SyntropixDBFilter;
|
|
111
|
-
}
|