@ez4/database 0.35.0 → 0.36.0
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/README.md +119 -2
- package/dist/main.cjs +3 -3
- package/dist/services/contract.d.ts +4 -0
- package/dist/services/query.d.ts +66 -0
- package/dist/services/streams.d.ts +3 -3
- package/package.json +6 -6
- package/dist/services/database.d.ts +0 -142
package/README.md
CHANGED
|
@@ -1,15 +1,132 @@
|
|
|
1
1
|
# EZ4: Database
|
|
2
2
|
|
|
3
|
-
It uses the power of [reflection](
|
|
3
|
+
It uses the power of [reflection](../../foundation/reflection/) to provide a contract that determines how to build and connect database components.
|
|
4
4
|
|
|
5
5
|
## Getting started
|
|
6
6
|
|
|
7
7
|
#### Install
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
npm install @ez4/database -D
|
|
10
|
+
npm install @ez4/database @ez4/local-database @ez4/aws-aurora -D
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
> You can use `@ez4/aws-dynamodb` instead of `@ez4/aws-aurora` for NoSQL database.
|
|
14
|
+
|
|
15
|
+
#### Create database
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
// file: db.ts
|
|
19
|
+
import type { Environment, Service } from '@ez4/common';
|
|
20
|
+
import type { Database } from '@ez4/database';
|
|
21
|
+
|
|
22
|
+
// MyDb message
|
|
23
|
+
type MyTableSchema = {
|
|
24
|
+
foo: string;
|
|
25
|
+
bar: number;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// MyDb declaration
|
|
29
|
+
export declare class MyDb extends Database.Service {
|
|
30
|
+
client: Client<Db>;
|
|
31
|
+
|
|
32
|
+
engine: PostgresEngine;
|
|
33
|
+
|
|
34
|
+
tables: [
|
|
35
|
+
Database.UseTable<{
|
|
36
|
+
name: 'my_table';
|
|
37
|
+
schema: MyTableSchema;
|
|
38
|
+
indexes: {
|
|
39
|
+
foo: Index.Primary;
|
|
40
|
+
};
|
|
41
|
+
}>
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
#### Use database
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
// file: handler.ts
|
|
50
|
+
import type { Service } from '@ez4/common';
|
|
51
|
+
import type { MyDb } from './db';
|
|
52
|
+
|
|
53
|
+
// Any other handler that has injected MyDb service
|
|
54
|
+
export async function anyHandler(_request: any, context: Service.Context<DummyService>) {
|
|
55
|
+
const { MyDb } = context;
|
|
56
|
+
|
|
57
|
+
// Insert one record
|
|
58
|
+
await MyDb.my_table.insertOne({
|
|
59
|
+
data: {
|
|
60
|
+
foo: 'foo',
|
|
61
|
+
bar: 123
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Find one record
|
|
66
|
+
const result = await MyDb.my_table.findOne({
|
|
67
|
+
select: {
|
|
68
|
+
bar: true
|
|
69
|
+
},
|
|
70
|
+
where: {
|
|
71
|
+
foo: 'foo'
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Database properties
|
|
78
|
+
|
|
79
|
+
#### Service
|
|
80
|
+
|
|
81
|
+
| Name | Type | Description |
|
|
82
|
+
| ----------- | ------------------------- | ------------------------------------------------ |
|
|
83
|
+
| scalability | Database.UseScalability<> | Scalability configuration. |
|
|
84
|
+
| tables | Database.UseTable<> | Describe all available tables for the service. |
|
|
85
|
+
| engine | object | Determines which database engine to use. |
|
|
86
|
+
| variables | object | Environment variables associated to all streams. |
|
|
87
|
+
| services | object | Injected services associated to all streams. |
|
|
88
|
+
|
|
89
|
+
> Use type helpers for `scalability` and `tables` properties.
|
|
90
|
+
|
|
91
|
+
#### Tables
|
|
92
|
+
|
|
93
|
+
| Name | Type | Description |
|
|
94
|
+
| --------- | ------------------------- | --------------------------- |
|
|
95
|
+
| stream | Database.UseTableStream<> | Table stream configuration. |
|
|
96
|
+
| name | string | Table name. |
|
|
97
|
+
| schema | object | Table schema. |
|
|
98
|
+
| relations | object | Table relations. |
|
|
99
|
+
| indexes | object | Table indexes. |
|
|
100
|
+
|
|
101
|
+
#### Streams (DynamoDB)
|
|
102
|
+
|
|
103
|
+
| Name | Type | Description |
|
|
104
|
+
| ------------ | -------- | ------------------------------------------------ |
|
|
105
|
+
| listener | function | Life-cycle listener function for the stream. |
|
|
106
|
+
| handler | function | Entry-point handler function for the stream. |
|
|
107
|
+
| variables | object | Environment variables associated to the stream. |
|
|
108
|
+
| logRetention | integer | Log retention (in days) for the handler. |
|
|
109
|
+
| memory | integer | Memory available (in megabytes) for the handler. |
|
|
110
|
+
| timeout | integer | Max execution time (in seconds) for the route. |
|
|
111
|
+
|
|
112
|
+
> Streams is a DynamoDB feature, thus unavailable for Aurora Postgres.
|
|
113
|
+
|
|
114
|
+
## Examples
|
|
115
|
+
|
|
116
|
+
- [Get started with Aurora RDS](../../examples/hello-aws-aurora)
|
|
117
|
+
- [Get started with DynamoDB](../../examples/hello-aws-dynamodb)
|
|
118
|
+
- [Aurora RDS CRUDL](../../examples/aws-aurora-crudl)
|
|
119
|
+
- [DynamoDB CRUDL](../../examples/aws-dynamodb-crudl)
|
|
120
|
+
- [DynamoDB streams](../../examples/aws-dynamodb-streams)
|
|
121
|
+
- [Schedule manager](../../examples/aws-schedule-manager)
|
|
122
|
+
- [Storage manager](../../examples/aws-storage-manager)
|
|
123
|
+
|
|
124
|
+
## Providers
|
|
125
|
+
|
|
126
|
+
- [Local provider](../../providers/local/local-database)
|
|
127
|
+
- [AWS Aurora provider](../../providers/aws/aws-aurora)
|
|
128
|
+
- [AWS DynamoDB provider](../../providers/aws/aws-dynamodb)
|
|
129
|
+
|
|
13
130
|
## License
|
|
14
131
|
|
|
15
132
|
MIT License
|
package/dist/main.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var
|
|
2
|
-
typeof a=="object"||typeof a=="function")for(let t of I(a))!
|
|
3
|
-
o(n,t,{get:()=>a[t],enumerable:!(r=b(a,t))||r.enumerable});return n};var f=n=>g(o({},"__esModule",{value:!0}),n);var D={};
|
|
1
|
+
"use strict";var o=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var u=(n,a)=>{for(var e in a)o(n,e,{get:a[e],enumerable:!0})},g=(n,a,e,r)=>{if(a&&
|
|
2
|
+
typeof a=="object"||typeof a=="function")for(let t of I(a))!S.call(n,t)&&t!==e&&
|
|
3
|
+
o(n,t,{get:()=>a[t],enumerable:!(r=b(a,t))||r.enumerable});return n};var f=n=>g(o({},"__esModule",{value:!0}),n);var D={};u(D,{Database:()=>y,Index:()=>c,InsensitiveMode:()=>m,LockMode:()=>x,Order:()=>l,
|
|
4
4
|
OrderMode:()=>T,PaginationMode:()=>d,ParametersMode:()=>p,StreamChangeType:()=>s,
|
|
5
5
|
TransactionMode:()=>i});module.exports=f(D);var s=(r=>(r.Insert="insert",r.Update="update",r.Delete="delete",r))(s||{});var p=(e=>(e.NameAndIndex="both",e.OnlyIndex="index",e))(p||{});var i=(e=>(e.Interactive="interactive",e.Static="static",e))(i||{});var m=(e=>(e.Unsupported="unsupported",e.Enabled="enabled",e))(m||{});var d=(e=>(e.Cursor="cursor",e.Offset="offset",e))(d||{});var l=(e=>(e.Asc="asc",e.Desc="desc",e))(l||{}),T=(e=>(e.IndexColumns="index",e.
|
|
6
6
|
AnyColumns="any",e))(T||{});var x=(e=>(e.Unsupported="unsupported",e.Supported="supported",e))(x||{});var y;(n=>{})(y||={});var c=(t=>(t.Primary="primary",t.Secondary="secondary",t.Unique="unique",t.TTL="\
|
|
@@ -36,6 +36,10 @@ export declare namespace Database {
|
|
|
36
36
|
* Database Scalability definition.
|
|
37
37
|
*/
|
|
38
38
|
type UseScalability<T extends DatabaseScalability> = T;
|
|
39
|
+
/**
|
|
40
|
+
* Database Table stream definition.
|
|
41
|
+
*/
|
|
42
|
+
type UseTableStream<T extends Stream<any>> = T;
|
|
39
43
|
/**
|
|
40
44
|
* Database service.
|
|
41
45
|
*/
|
package/dist/services/query.d.ts
CHANGED
|
@@ -96,8 +96,17 @@ export declare namespace Query {
|
|
|
96
96
|
order?: StrictIncludeOrder<V>;
|
|
97
97
|
};
|
|
98
98
|
export type WhereInput<T extends TableMetadata, I extends boolean = false> = Prettify<WhereInputFilters<T, I extends true ? T['indexes'] : {}> & {
|
|
99
|
+
/**
|
|
100
|
+
* Check whether the expression is not true.
|
|
101
|
+
*/
|
|
99
102
|
NOT?: WhereInput<T>;
|
|
103
|
+
/**
|
|
104
|
+
* Check whether all the expressions are true.
|
|
105
|
+
*/
|
|
100
106
|
AND?: WhereInput<T>[];
|
|
107
|
+
/**
|
|
108
|
+
* Check whether any of all the expressions are true.
|
|
109
|
+
*/
|
|
101
110
|
OR?: WhereInput<T>[];
|
|
102
111
|
}>;
|
|
103
112
|
type SelectInputFields<T extends Database.Schema, R extends RelationMetadata> = IsObjectEmpty<R['selects']> extends true ? T : T & R['selects'];
|
|
@@ -108,8 +117,17 @@ export declare namespace Query {
|
|
|
108
117
|
[P in keyof V]?: WhereField<V[P], E>;
|
|
109
118
|
};
|
|
110
119
|
type WhereRelationField<V extends AnyObject, E extends DatabaseEngine> = WhereObjectField<V, E> & {
|
|
120
|
+
/**
|
|
121
|
+
* Check whether the expression is not true.
|
|
122
|
+
*/
|
|
111
123
|
NOT?: WhereRelationField<V, E>;
|
|
124
|
+
/**
|
|
125
|
+
* Check whether all the expressions are true.
|
|
126
|
+
*/
|
|
112
127
|
AND?: WhereRelationField<V, E>[];
|
|
128
|
+
/**
|
|
129
|
+
* Check whether any of all the expressions are true.
|
|
130
|
+
*/
|
|
113
131
|
OR?: WhereRelationField<V, E>[];
|
|
114
132
|
};
|
|
115
133
|
type WhereRelationFilters<V extends AnyObject, E extends DatabaseEngine> = {
|
|
@@ -128,39 +146,75 @@ export declare namespace Query {
|
|
|
128
146
|
type WhereInputFilters<T extends TableMetadata, I extends Database.Indexes> = WhereCommonFilters<T['schema'], T, I> & (IsObjectEmpty<T['relations']['filters']> extends false ? WhereRelationFilters<T['relations']['filters'], T['engine']> : {});
|
|
129
147
|
export type WhereOperators = keyof (WhereNegate<any, never> & WhereEqual<any, never> & WhereGreaterThan<any> & WhereGreaterThanOrEqual<any> & WhereLessThan<any> & WhereLessThanOrEqual<any> & WhereIn<any> & WhereBetween<any> & WhereIsMissing & WhereIsNull & WhereStartsWith<never> & WhereContains<any, never>);
|
|
130
148
|
type WhereNegate<V, E extends DatabaseEngine> = (V extends string ? InsensitiveModeUtils.Input<E> : {}) & {
|
|
149
|
+
/**
|
|
150
|
+
* Check whether the entity value is not equal to the given one.
|
|
151
|
+
*/
|
|
131
152
|
not: V;
|
|
132
153
|
};
|
|
133
154
|
type WhereEqual<V, E extends DatabaseEngine> = (V extends string ? InsensitiveModeUtils.Input<E> : {}) & {
|
|
155
|
+
/**
|
|
156
|
+
* Check whether the entity value is equal to the given one.
|
|
157
|
+
*/
|
|
134
158
|
equal: V;
|
|
135
159
|
};
|
|
136
160
|
type WhereGreaterThan<V> = {
|
|
161
|
+
/**
|
|
162
|
+
* Check whether the entity value is greater than the given one.
|
|
163
|
+
*/
|
|
137
164
|
gt: V;
|
|
138
165
|
};
|
|
139
166
|
type WhereGreaterThanOrEqual<V> = {
|
|
167
|
+
/**
|
|
168
|
+
* Check whether the entity value is greater than or equal the given one.
|
|
169
|
+
*/
|
|
140
170
|
gte: V;
|
|
141
171
|
};
|
|
142
172
|
type WhereLessThan<V> = {
|
|
173
|
+
/**
|
|
174
|
+
* Check whether the entity value is less than the given one.
|
|
175
|
+
*/
|
|
143
176
|
lt: V;
|
|
144
177
|
};
|
|
145
178
|
type WhereLessThanOrEqual<V> = {
|
|
179
|
+
/**
|
|
180
|
+
* Check whether the entity value is less than or equal the given one.
|
|
181
|
+
*/
|
|
146
182
|
lte: V;
|
|
147
183
|
};
|
|
148
184
|
type WhereIn<V> = {
|
|
185
|
+
/**
|
|
186
|
+
* Check whether the entity value is in the given ones.
|
|
187
|
+
*/
|
|
149
188
|
isIn: IsArray<V> extends true ? V : IsObject<V> extends true ? V : Exclude<V, undefined>[];
|
|
150
189
|
};
|
|
151
190
|
type WhereBetween<V> = {
|
|
191
|
+
/**
|
|
192
|
+
* Check whether the entity value is between the given ones.
|
|
193
|
+
*/
|
|
152
194
|
isBetween: [Exclude<V, undefined>, Exclude<V, undefined>];
|
|
153
195
|
};
|
|
154
196
|
type WhereIsMissing = {
|
|
197
|
+
/**
|
|
198
|
+
* Check whether the entity value is missing.
|
|
199
|
+
*/
|
|
155
200
|
isMissing: boolean;
|
|
156
201
|
};
|
|
157
202
|
type WhereIsNull = {
|
|
203
|
+
/**
|
|
204
|
+
* Check whether the entity value is null.
|
|
205
|
+
*/
|
|
158
206
|
isNull: boolean;
|
|
159
207
|
};
|
|
160
208
|
type WhereStartsWith<E extends DatabaseEngine> = InsensitiveModeUtils.Input<E> & {
|
|
209
|
+
/**
|
|
210
|
+
* Check whether the entity value starts with the given one.
|
|
211
|
+
*/
|
|
161
212
|
startsWith: string;
|
|
162
213
|
};
|
|
163
214
|
type WhereContains<V, E extends DatabaseEngine> = (V extends string ? InsensitiveModeUtils.Input<E> : {}) & {
|
|
215
|
+
/**
|
|
216
|
+
* Check whether the entity value contains all the given ones.
|
|
217
|
+
*/
|
|
164
218
|
contains: IsObject<V> extends true ? Partial<V> : V;
|
|
165
219
|
};
|
|
166
220
|
export type AtomicOperators = keyof (AtomicIncrement & AtomicDecrement & AtomicMultiply & AtomicDivide);
|
|
@@ -174,15 +228,27 @@ export declare namespace Query {
|
|
|
174
228
|
};
|
|
175
229
|
type AtomicOperation = AtomicIncrement | AtomicDecrement | AtomicMultiply | AtomicDivide;
|
|
176
230
|
type AtomicIncrement = {
|
|
231
|
+
/**
|
|
232
|
+
* Increment the entity value by the given amount.
|
|
233
|
+
*/
|
|
177
234
|
increment: number;
|
|
178
235
|
};
|
|
179
236
|
type AtomicDecrement = {
|
|
237
|
+
/**
|
|
238
|
+
* Decrement the entity value by the given amount.
|
|
239
|
+
*/
|
|
180
240
|
decrement: number;
|
|
181
241
|
};
|
|
182
242
|
type AtomicMultiply = {
|
|
243
|
+
/**
|
|
244
|
+
* Multiply the entity value by the given amount.
|
|
245
|
+
*/
|
|
183
246
|
multiply: number;
|
|
184
247
|
};
|
|
185
248
|
type AtomicDivide = {
|
|
249
|
+
/**
|
|
250
|
+
* Divide the entity value by the given amount.
|
|
251
|
+
*/
|
|
186
252
|
divide: number;
|
|
187
253
|
};
|
|
188
254
|
export {};
|
|
@@ -6,11 +6,11 @@ import type { TableSchema } from './schemas';
|
|
|
6
6
|
*/
|
|
7
7
|
export interface TableStream<T extends TableSchema> {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Life-cycle listener function for the stream.
|
|
10
10
|
*/
|
|
11
11
|
readonly listener?: TableStreamListener<T>;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Entry-point handler function for the stream.
|
|
14
14
|
*/
|
|
15
15
|
readonly handler: TableStreamHandler<T>;
|
|
16
16
|
/**
|
|
@@ -26,7 +26,7 @@ export interface TableStream<T extends TableSchema> {
|
|
|
26
26
|
*/
|
|
27
27
|
readonly timeout?: number;
|
|
28
28
|
/**
|
|
29
|
-
* Amount of memory available for the handler.
|
|
29
|
+
* Amount of memory available (in megabytes) for the handler.
|
|
30
30
|
*/
|
|
31
31
|
readonly memory?: number;
|
|
32
32
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ez4/database",
|
|
3
3
|
"description": "EZ4: Components to build database services",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.36.0",
|
|
5
5
|
"author": "Silas B.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"live:publish": "npm run build && npm publish --access public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@ez4/common": "^0.
|
|
50
|
-
"@ez4/project": "^0.
|
|
51
|
-
"@ez4/reflection": "^0.
|
|
52
|
-
"@ez4/schema": "^0.
|
|
53
|
-
"@ez4/utils": "^0.
|
|
49
|
+
"@ez4/common": "^0.36.0",
|
|
50
|
+
"@ez4/project": "^0.36.0",
|
|
51
|
+
"@ez4/reflection": "^0.36.0",
|
|
52
|
+
"@ez4/schema": "^0.36.0",
|
|
53
|
+
"@ez4/utils": "^0.36.0"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import type { Service as CommonService } from '@ez4/common';
|
|
2
|
-
import type { LinkedVariables } from '@ez4/project/library';
|
|
3
|
-
import type { StreamChange } from './streams';
|
|
4
|
-
import type { DatabaseEngine } from './engine';
|
|
5
|
-
import type { Client } from './client';
|
|
6
|
-
/**
|
|
7
|
-
* Given a database service `T`, it returns all its table.
|
|
8
|
-
*/
|
|
9
|
-
export type DatabaseTables<T> = T extends {
|
|
10
|
-
tables: infer U;
|
|
11
|
-
} ? U : [];
|
|
12
|
-
/**
|
|
13
|
-
* Provide all contracts for a self-managed database service.
|
|
14
|
-
*/
|
|
15
|
-
export declare namespace Database {
|
|
16
|
-
/**
|
|
17
|
-
* Table schema.
|
|
18
|
-
*/
|
|
19
|
-
interface Schema {
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Table relations.
|
|
23
|
-
*/
|
|
24
|
-
interface Relations {
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Table indexes.
|
|
28
|
-
*/
|
|
29
|
-
type Indexes = {};
|
|
30
|
-
/**
|
|
31
|
-
* Incoming stream event.
|
|
32
|
-
*/
|
|
33
|
-
type Incoming<T extends Schema> = StreamChange<T> & Request;
|
|
34
|
-
/**
|
|
35
|
-
* Incoming request.
|
|
36
|
-
*/
|
|
37
|
-
type Request = {
|
|
38
|
-
/**
|
|
39
|
-
* Request tracking Id.
|
|
40
|
-
*/
|
|
41
|
-
requestId: string;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Stream listener.
|
|
45
|
-
*/
|
|
46
|
-
type Listener<T extends Schema> = (event: CommonService.AnyEvent<Incoming<T>>, context: CommonService.Context<Database.Service>) => Promise<void> | void;
|
|
47
|
-
/**
|
|
48
|
-
* Stream handler.
|
|
49
|
-
*/
|
|
50
|
-
type Handler<T extends Schema> = (request: Incoming<T>, context: CommonService.Context<Database.Service>) => Promise<void> | void;
|
|
51
|
-
/**
|
|
52
|
-
* Service event.
|
|
53
|
-
*/
|
|
54
|
-
type ServiceEvent<T extends Schema = Schema> = CommonService.BeginEvent<Request> | CommonService.ReadyEvent<Incoming<T>> | CommonService.DoneEvent<Incoming<T>> | CommonService.ErrorEvent<Request | Incoming<T>> | CommonService.EndEvent<Request>;
|
|
55
|
-
/**
|
|
56
|
-
* Service engine.
|
|
57
|
-
*/
|
|
58
|
-
type Engine = DatabaseEngine;
|
|
59
|
-
/**
|
|
60
|
-
* Service scalability configuration.
|
|
61
|
-
*/
|
|
62
|
-
interface Scalability {
|
|
63
|
-
minCapacity: number;
|
|
64
|
-
maxCapacity: number;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Table stream.
|
|
68
|
-
*/
|
|
69
|
-
interface Stream<T extends Schema = Schema> {
|
|
70
|
-
/**
|
|
71
|
-
* Stream listener.
|
|
72
|
-
*/
|
|
73
|
-
listener?: Listener<T>;
|
|
74
|
-
/**
|
|
75
|
-
* Stream handler.
|
|
76
|
-
*/
|
|
77
|
-
handler: Handler<T>;
|
|
78
|
-
/**
|
|
79
|
-
* Variables associated to the handler.
|
|
80
|
-
*/
|
|
81
|
-
variables?: LinkedVariables;
|
|
82
|
-
/**
|
|
83
|
-
* Log retention (in days) for the handler.
|
|
84
|
-
*/
|
|
85
|
-
logRetention?: number;
|
|
86
|
-
/**
|
|
87
|
-
* Max execution time (in seconds) for the handler.
|
|
88
|
-
*/
|
|
89
|
-
timeout?: number;
|
|
90
|
-
/**
|
|
91
|
-
* Amount of memory available for the handler.
|
|
92
|
-
*/
|
|
93
|
-
memory?: number;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Database table.
|
|
97
|
-
*/
|
|
98
|
-
interface Table<T extends Schema = Schema> {
|
|
99
|
-
/**
|
|
100
|
-
* Table name.
|
|
101
|
-
*/
|
|
102
|
-
name: string;
|
|
103
|
-
/**
|
|
104
|
-
* Table schema.
|
|
105
|
-
*/
|
|
106
|
-
schema: T;
|
|
107
|
-
/**
|
|
108
|
-
* Table relations.
|
|
109
|
-
*/
|
|
110
|
-
relations?: Relations;
|
|
111
|
-
/**
|
|
112
|
-
* Table indexes.
|
|
113
|
-
*/
|
|
114
|
-
indexes: Indexes;
|
|
115
|
-
/**
|
|
116
|
-
* Table stream configuration.
|
|
117
|
-
*/
|
|
118
|
-
stream?: Stream<T>;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Database service.
|
|
122
|
-
*/
|
|
123
|
-
abstract class Service implements CommonService.Provider {
|
|
124
|
-
/**
|
|
125
|
-
* Determines which database engine to use.
|
|
126
|
-
* Check the provider package to know all the possible values.
|
|
127
|
-
*/
|
|
128
|
-
abstract engine: Engine;
|
|
129
|
-
/**
|
|
130
|
-
* Describe all available tables for the service.
|
|
131
|
-
*/
|
|
132
|
-
abstract tables: Table<any>[];
|
|
133
|
-
/**
|
|
134
|
-
* Scalability configuration.
|
|
135
|
-
*/
|
|
136
|
-
scalability: Scalability;
|
|
137
|
-
/**
|
|
138
|
-
* Service client.
|
|
139
|
-
*/
|
|
140
|
-
client: Client<Service>;
|
|
141
|
-
}
|
|
142
|
-
}
|