@olympeio/runtime-node 9.10.5 → 9.11.1
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/import/olympe.dm/datamodel/.Primordial.newInst.json +1 -1
- package/import/olympe.dm/datamodel/05_permission_schema.updateInst.json +1 -1
- package/import/olympe.sc/datamodel/01_language.newInst.json +1 -1
- package/index.js +988 -940
- package/package.json +3 -2
- package/types/composition.d.ts +122 -0
- package/types/data-connector.d.ts +356 -0
- package/types/{base.d.ts → data.d.ts} +168 -158
- package/types/index.d.ts +9 -3
- package/types/legacy.d.ts +2 -1
- package/types/models.d.ts +203 -0
- package/types/{utils.d.ts → other.d.ts} +158 -285
- package/types/query.d.ts +726 -0
- package/types/runtime.d.ts +49 -35
- package/types/service.d.ts +190 -0
- package/types/transaction-advanced.d.ts +34 -0
- package/types/transaction.d.ts +266 -0
- package/types/cloud.d.ts +0 -1726
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olympeio/runtime-node",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.11.1",
|
|
4
4
|
"description": "Olympe Node Runtime Environment",
|
|
5
5
|
"types": "types/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"bufferutil": "~4.0.8",
|
|
9
9
|
"utf-8-validate": "~6.0.4",
|
|
10
10
|
"rxjs": "~7.8.1",
|
|
11
|
-
"fastify": "~
|
|
11
|
+
"fastify": "~5.2.1",
|
|
12
|
+
"@cloudamqp/amqp-client": "3.2.0"
|
|
12
13
|
},
|
|
13
14
|
"codeAsData": "import",
|
|
14
15
|
"author": "Olympe S.A. <dev@olympe.ch>",
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Brick } from "./runtime";
|
|
2
|
+
import { Class } from "./other";
|
|
3
|
+
import { CloudObject, InstanceOrTag } from "./data";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Generates a unique olympe tag used to identify `CloudObjects`
|
|
7
|
+
*
|
|
8
|
+
* @return {string} tag
|
|
9
|
+
*/
|
|
10
|
+
export function generateTag(): string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Get the unique identifier of the specified InstanceOrTag as a string
|
|
14
|
+
*
|
|
15
|
+
* If the given tag is a `CloudObject` instance, the tag of that instance is returned.
|
|
16
|
+
* If a class constructor is given, the tag of the corresponding `CloudObject` is returned.
|
|
17
|
+
*
|
|
18
|
+
* @param tag
|
|
19
|
+
* @return string tag of given input
|
|
20
|
+
*/
|
|
21
|
+
export function tagToString(tag: InstanceOrTag): string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The HasTag interface defines objects that have a tag.
|
|
25
|
+
* The tag of these objects must be returned by the overridden method: `getTag()`
|
|
26
|
+
*/
|
|
27
|
+
export interface HasTag {
|
|
28
|
+
/**
|
|
29
|
+
* @return tag of this instance
|
|
30
|
+
*/
|
|
31
|
+
getTag(): string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A property of a model defines an attribute. A property has a `tag`.
|
|
36
|
+
* Each instance of a model can have value for these defined properties.
|
|
37
|
+
*/
|
|
38
|
+
export interface Property<T> extends HasTag {}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Relations are directed from A to B and can be followed in either direction.
|
|
42
|
+
*/
|
|
43
|
+
export enum Direction {
|
|
44
|
+
/**
|
|
45
|
+
* For relation A to B, go to A, the origin
|
|
46
|
+
*/
|
|
47
|
+
ORIGIN = '<',
|
|
48
|
+
/**
|
|
49
|
+
* For relation A to B, go to B, the destination
|
|
50
|
+
*/
|
|
51
|
+
DESTINATION = '>'
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface RelationConstructor {
|
|
55
|
+
/**
|
|
56
|
+
* Create a relation between two CloudObject classes
|
|
57
|
+
* @param tag tag of the relation to create
|
|
58
|
+
* @param direction whether the relation points to the origin or destination
|
|
59
|
+
*/
|
|
60
|
+
new(tag: InstanceOrTag, direction?: Direction): Relation<CloudObject, CloudObject>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Create a relation between two CloudObject classes
|
|
64
|
+
* @param tag tag of the relation to create
|
|
65
|
+
* @param direction whether the relation points to the origin or destination
|
|
66
|
+
* @param origin origin class of the relation
|
|
67
|
+
* @param destination destination class of the relation
|
|
68
|
+
*/
|
|
69
|
+
new<O extends CloudObject, D extends CloudObject>(tag: InstanceOrTag, direction?: Direction, origin?: Class<O>, destination?: Class<D>): Relation<O, D>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Global variable, constructor of class Relation.
|
|
75
|
+
*/
|
|
76
|
+
export declare const Relation: RelationConstructor;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Relations can be defined between from a `CloudObject` to another, for example between two data types.
|
|
80
|
+
* Relations are directed and have two types: the origin type, the destination type.
|
|
81
|
+
*
|
|
82
|
+
* Defining a relation between two data types means that instances of these data types can be related with that relation.
|
|
83
|
+
*/
|
|
84
|
+
export interface Relation<O extends CloudObject, D extends CloudObject> extends HasTag {
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @return tag of the relation
|
|
88
|
+
*/
|
|
89
|
+
getTag(): string;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @return direction of the relation, whether it points to origin or destination
|
|
93
|
+
*/
|
|
94
|
+
getDirection(): Direction;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @return class type for the destination of the relation
|
|
98
|
+
*/
|
|
99
|
+
type(): Class<D>;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @return class type for the origin of the relation
|
|
103
|
+
*/
|
|
104
|
+
originType(): Class<O>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @return inverse relation where newOrigin = oldDestination, newDestination = oldOrigin
|
|
108
|
+
*/
|
|
109
|
+
getInverse(): Relation<D, O>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Static function that must be called for every brick used in an application.
|
|
116
|
+
* It registers the brick code in the registry with the specified tag and return the Entry for that brick.
|
|
117
|
+
*
|
|
118
|
+
* @param tag the brick unique id
|
|
119
|
+
* @param brick the brick class
|
|
120
|
+
* @param args Extra arguments
|
|
121
|
+
*/
|
|
122
|
+
export function registerBrick(tag: string, brick: new () => Brick, ...args: any): void;
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { BrickContext } from "./runtime";
|
|
2
|
+
import { CloudObject, InstanceOrTag } from "./data";
|
|
3
|
+
import { Order, Query } from "./query";
|
|
4
|
+
import { Property, Relation } from "./composition";
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import { Readable } from "node:stream";
|
|
7
|
+
|
|
8
|
+
export type FollowRule = Property<number>;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Predefined data sources that can be used for {@link Transaction.setSource}.
|
|
14
|
+
*/
|
|
15
|
+
export enum PredefinedDataSource {
|
|
16
|
+
/**
|
|
17
|
+
* Local DataSource. By using this source, objects are not persisted
|
|
18
|
+
*/
|
|
19
|
+
SELF = 'self',
|
|
20
|
+
/**
|
|
21
|
+
* Embedded Graph Database
|
|
22
|
+
*/
|
|
23
|
+
SERVER = 'server'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* When manipulating CloudObjects, sometimes it is required to manually set the data source of that object.
|
|
28
|
+
* `Source` determines where the object comes from: what data source is the owner of the object across the ecosystem.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
export type Source = PredefinedDataSource | string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A class representing the necessary operations to create the result of a query in the client database
|
|
35
|
+
* that emitted the query.
|
|
36
|
+
*/
|
|
37
|
+
export class DataResult {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Create a new {@link DataResult} instance from the specified {@link Query}.
|
|
41
|
+
* @param query The {@link Query} to create a {@link DataResult} from.
|
|
42
|
+
* @return A new {@link DataResult} instance.
|
|
43
|
+
*/
|
|
44
|
+
static fromQuery(query: Query<CloudObject, any>): DataResult;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Create a new Data Type instance with the specified {@link InstanceOrTag}, Data Type and properties.
|
|
48
|
+
* @param tag The unique identifier of the object instance to create.
|
|
49
|
+
* @param model The Data Type of the instance to create.
|
|
50
|
+
* @param properties The properties to set on the instance.
|
|
51
|
+
* @return This {@link DataResult} instance.
|
|
52
|
+
*/
|
|
53
|
+
create(tag: InstanceOrTag, model: InstanceOrTag, properties?: Map<InstanceOrTag, any>): this;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Create a relation between two instances with the specified {@link Relation}, `from`, and `to` instance tags.
|
|
57
|
+
* @param relation The type of relation to create.
|
|
58
|
+
* @param from The unique identifier of the source instance.
|
|
59
|
+
* @param to The unique identifier of the destination instance.
|
|
60
|
+
* @return This {@link DataResult} instance.
|
|
61
|
+
*/
|
|
62
|
+
createRelation(relation: InstanceOrTag, from: InstanceOrTag, to: InstanceOrTag): this;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Represents an operation that can be performed regarding data type instances.
|
|
67
|
+
*/
|
|
68
|
+
export type Operation =
|
|
69
|
+
{
|
|
70
|
+
/** Creates a new instance of a data type with the given properties. */
|
|
71
|
+
type: 'CREATE',
|
|
72
|
+
/** The tag of the new instance. */
|
|
73
|
+
object: string,
|
|
74
|
+
/** The data type tag of the instance being created. */
|
|
75
|
+
model: string,
|
|
76
|
+
/** A map that maps the tag of a property to a new/updated value.
|
|
77
|
+
* You may need to parse this value to store it in your data source (e.g. JS date)
|
|
78
|
+
* */
|
|
79
|
+
properties?: Map<string, any>
|
|
80
|
+
} |
|
|
81
|
+
{
|
|
82
|
+
/** Updates an existing instance of a data type with the given properties. */
|
|
83
|
+
type: 'UPDATE',
|
|
84
|
+
/** The tag of the instance being updated. */
|
|
85
|
+
object: string,
|
|
86
|
+
/** The data type tag of the instance being updated. */
|
|
87
|
+
model: string,
|
|
88
|
+
/** A map that maps the tag of a property to a new/updated value.
|
|
89
|
+
* You may need to parse this value to store it in your data source (e.g. JS date)
|
|
90
|
+
* */
|
|
91
|
+
properties: Map<string, any>
|
|
92
|
+
} |
|
|
93
|
+
{
|
|
94
|
+
/** Deletes an existing instance of a data type. */
|
|
95
|
+
type: 'DELETE',
|
|
96
|
+
/** The tag of the instance being deleted. */
|
|
97
|
+
object: string,
|
|
98
|
+
/** The data type tag of the instance being deleted. */
|
|
99
|
+
model: string
|
|
100
|
+
} |
|
|
101
|
+
{
|
|
102
|
+
/** Creates a new relation between two instances of a data type. */
|
|
103
|
+
type: 'CREATE_RELATION',
|
|
104
|
+
/** The tag of the relation being created. */
|
|
105
|
+
relation: string,
|
|
106
|
+
/** The tag of the starting instance. */
|
|
107
|
+
from: string,
|
|
108
|
+
/** The tag of the ending instance. */
|
|
109
|
+
to: string,
|
|
110
|
+
/** The data type tag of the starting instance. */
|
|
111
|
+
fromModel: string,
|
|
112
|
+
/** The data type tag of the ending instance. */
|
|
113
|
+
toModel: string
|
|
114
|
+
} |
|
|
115
|
+
{
|
|
116
|
+
/** Deletes an existing relation between two instances of a data type. */
|
|
117
|
+
type: 'DELETE_RELATION',
|
|
118
|
+
/** The tag of the relation being deleted. */
|
|
119
|
+
relation: string,
|
|
120
|
+
/** The tag of the starting instance. */
|
|
121
|
+
from: string,
|
|
122
|
+
/** The tag of the ending instance. */
|
|
123
|
+
to: string,
|
|
124
|
+
/** The data type tag of the starting instance. */
|
|
125
|
+
fromModel: string,
|
|
126
|
+
/** The data type tag of the ending instance. */
|
|
127
|
+
toModel: string
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Details for a predicate from the OLYMPE query API
|
|
131
|
+
*/
|
|
132
|
+
export type ParsedPredicate =
|
|
133
|
+
{
|
|
134
|
+
/** Checks if the instance has any of the specified tags. */
|
|
135
|
+
name: 'IS',
|
|
136
|
+
/** An array of tags to check against. */
|
|
137
|
+
tags: string[]
|
|
138
|
+
} |
|
|
139
|
+
{
|
|
140
|
+
/** Checks if a string type property contains a specific string value. */
|
|
141
|
+
name: 'CONTAINS',
|
|
142
|
+
/** The tag of the property being checked. */
|
|
143
|
+
property: string,
|
|
144
|
+
/** The value being searched for. */
|
|
145
|
+
value: string,
|
|
146
|
+
/** Whether the search should be case-sensitive or not. */
|
|
147
|
+
caseSensitive: boolean
|
|
148
|
+
} |
|
|
149
|
+
{
|
|
150
|
+
/** Checks if a property equals a specific value. */
|
|
151
|
+
name: 'EQUALS',
|
|
152
|
+
/** The tag of the property being checked. */
|
|
153
|
+
property: string,
|
|
154
|
+
/** The value being compared to. */
|
|
155
|
+
value: any
|
|
156
|
+
} |
|
|
157
|
+
{
|
|
158
|
+
/** Checks if a property is greater than or less than a specific value. */
|
|
159
|
+
name: 'INEQUALITY_OPERATOR',
|
|
160
|
+
/** The tag of the property being compared. */
|
|
161
|
+
property: string,
|
|
162
|
+
/** The value being compared to. */
|
|
163
|
+
value: any,
|
|
164
|
+
/** The operator being used in the comparison (e.g. `<`, `>`). */
|
|
165
|
+
operator: string,
|
|
166
|
+
/** Whether the comparison should be strict (e.g. "\<" vs. "\<="). */
|
|
167
|
+
strict: boolean
|
|
168
|
+
} |
|
|
169
|
+
{
|
|
170
|
+
/** Negates a predicate. */
|
|
171
|
+
name: 'NOT',
|
|
172
|
+
/** The predicate being negated. */
|
|
173
|
+
predicate: ParsedPredicate
|
|
174
|
+
} |
|
|
175
|
+
{
|
|
176
|
+
/** Checks if a property matches a regular expression pattern. */
|
|
177
|
+
name: 'REGEX',
|
|
178
|
+
/** The tag of the property being checked. */
|
|
179
|
+
property: string,
|
|
180
|
+
/** The regular expression pattern being matched. */
|
|
181
|
+
pattern: RegExp,
|
|
182
|
+
/** Whether the matching should be case-sensitive or not. */
|
|
183
|
+
caseSensitive: boolean
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* The first part of a {@link Query}.
|
|
189
|
+
* It breaks down the starting point of the query.
|
|
190
|
+
*/
|
|
191
|
+
export interface RootQueryPart extends QueryPart {
|
|
192
|
+
/**
|
|
193
|
+
* The tag of the starting point of a query built using {@link Query.from()}
|
|
194
|
+
* It is the tag of the instance where the first relation followed using {@link Query.follow()} starts from.
|
|
195
|
+
* For queries on instances of a data type, started with {@link Query.instancesOf()}, this will be null.
|
|
196
|
+
*/
|
|
197
|
+
root?: string
|
|
198
|
+
/**
|
|
199
|
+
* The tag of the Data Type of the instance(s) determining the starting point of the query.
|
|
200
|
+
* It is the tag of the Data Type provided to {@link Query.instancesOf()}, or the Data Type of the root instance provided
|
|
201
|
+
* to {@link Query.from()}
|
|
202
|
+
*/
|
|
203
|
+
dataType: string
|
|
204
|
+
/**
|
|
205
|
+
* Specifies whether instances of the data types inheriting from the root data type should be included in the query or not.
|
|
206
|
+
* It is always `false` if `root` is specified.
|
|
207
|
+
*/
|
|
208
|
+
inheritance: boolean
|
|
209
|
+
/**
|
|
210
|
+
* Limits the number of results retrieved by the query.
|
|
211
|
+
*/
|
|
212
|
+
limit: number
|
|
213
|
+
/**
|
|
214
|
+
* Skips a specified number of results retrieved by the query.
|
|
215
|
+
*/
|
|
216
|
+
offset: number
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* A part of a {@link Query} that specifies a relationship to traverse.
|
|
221
|
+
*/
|
|
222
|
+
export interface QueryPart {
|
|
223
|
+
/**
|
|
224
|
+
* Determines whether the relationship should be traversed recursively and whether the starting object should be included.
|
|
225
|
+
* `false`: Traverse the relationship once.
|
|
226
|
+
* `'EXCLUDE_SELF'`: Traverse the relationship recursively, excluding the starting object.
|
|
227
|
+
* `'INCLUDE_SELF'`: Traverse the relationship recursively, including the starting object.
|
|
228
|
+
*/
|
|
229
|
+
recursive: false | 'EXCLUDE_SELF' | 'INCLUDE_SELF',
|
|
230
|
+
/**
|
|
231
|
+
* Specifies a relationship to traverse in the query.
|
|
232
|
+
*/
|
|
233
|
+
relation: Relation<any, any>
|
|
234
|
+
/**
|
|
235
|
+
* Determines whether the relationship this part specifies is optional or not to traverse.
|
|
236
|
+
* If `true`, result tuples may have a null if this relationship can not be followed from some data objects.
|
|
237
|
+
* If `false`, all result tuples must contain this relationship.
|
|
238
|
+
*/
|
|
239
|
+
optional: boolean,
|
|
240
|
+
/**
|
|
241
|
+
* Determines whether the related objects should be included in the result tuples.
|
|
242
|
+
* If `true`, related objects will be included.
|
|
243
|
+
* If `false`, the related objects are not included.
|
|
244
|
+
* This does not impact whether the relationship is `optional` to be traversed.
|
|
245
|
+
*/
|
|
246
|
+
returned: boolean,
|
|
247
|
+
/**
|
|
248
|
+
* Specify if the instances obtained by following the relation should satisfy some condition
|
|
249
|
+
* See {@link ParsedPredicate}
|
|
250
|
+
*/
|
|
251
|
+
filter: ParsedPredicate[][],
|
|
252
|
+
/**
|
|
253
|
+
* Set a sorting order on the result tuples according to the related objects.
|
|
254
|
+
* It will sort using native order of the type of the property.
|
|
255
|
+
* For multiple parts with sort information, the latest part will prevail.
|
|
256
|
+
*/
|
|
257
|
+
sort?: {property: Property<any>, order: Order}
|
|
258
|
+
/**
|
|
259
|
+
* Returns the remaining {@link QueryPart}s of the query, empty if no {@link QueryPart}s are left.
|
|
260
|
+
*/
|
|
261
|
+
next: QueryPart[]
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Represents a data source that can be used to retrieve, manipulate and store data outside the Olympe application environment.
|
|
266
|
+
* This class provides several methods for performing CRUD (create, read, update, delete) operations on data,
|
|
267
|
+
* as well as file upload and download functionality.
|
|
268
|
+
*
|
|
269
|
+
* To create a new data source, add a _Data Connector_ in your project in DRAW and download the boilerplate.
|
|
270
|
+
* Then implement or extend the required methods: `init`, `destroy`, `healthCheck`, `executeQuery` and `applyTransaction`
|
|
271
|
+
* For file capabilities, you must also implement: `uploadFileContent`, `downloadFileContent` and `deleteFileContent`
|
|
272
|
+
*
|
|
273
|
+
* The CORE library already provide some default connectors such as PostgreSQL and MSSQL.
|
|
274
|
+
* Their implementation is open source and available in [CORE on Github](https://github.com/olympeio/CORE/tree/master/src/core/data/connectors).
|
|
275
|
+
*
|
|
276
|
+
* @abstract
|
|
277
|
+
* @extends {@link CloudObject}
|
|
278
|
+
*/
|
|
279
|
+
export abstract class DataSource extends CloudObject {
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Returns the tag of the data source.
|
|
283
|
+
* @return tag of the data source.
|
|
284
|
+
*/
|
|
285
|
+
getId(): string;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Retrieves the configuration value associated with the provided key in the data source oConfig.
|
|
289
|
+
* @param key - Key to retrieve the configuration value for.
|
|
290
|
+
* @return The configuration value associated with the provided key.
|
|
291
|
+
*/
|
|
292
|
+
getConfig(key: string): any;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Initializes the data source connection with custom parameters provided in oConfig.
|
|
296
|
+
* It can also perform a health check to ensure the connection is active.
|
|
297
|
+
* Subscribes to the {@link DataSource.observeDataTypes} observable to handle changes to the data types in the data source.
|
|
298
|
+
*
|
|
299
|
+
* @param context a context with the same livecycle as the Data Source
|
|
300
|
+
* @return A promise that resolves with void when initialization is complete. Reject if initialization did not complete.
|
|
301
|
+
*/
|
|
302
|
+
protected init(context: BrickContext): Promise<void>;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Performs a health check on the data source, checking if the connection is alive.
|
|
306
|
+
* @return A Promise that resolves when the health check is completed successfully, rejects otherwise.
|
|
307
|
+
*/
|
|
308
|
+
protected healthCheck(): Promise<void>;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Disconnects the data source.
|
|
312
|
+
* @return A Promise that resolves when the data source is destroyed.
|
|
313
|
+
*/
|
|
314
|
+
protected destroy(): Promise<void>;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Executes the provided {@link Query} once and returns a {@link DataResult}.
|
|
318
|
+
* @param query - The {@link Query} object to execute.
|
|
319
|
+
* @return A Promise that resolves with the {@link DataResult} object.
|
|
320
|
+
*/
|
|
321
|
+
protected executeQuery(query: Query<CloudObject, any>): Promise<DataResult>;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Applies the provided {@link Operation} array to the data source as one transaction
|
|
325
|
+
* @param transaction - The {@link Operation} array to apply.
|
|
326
|
+
* @param options the options
|
|
327
|
+
* @param options.batch if true, it means that the transaction has been executed using the {@link Transaction.executeAsLarge()} function.
|
|
328
|
+
* @return A Promise that resolves when the transaction is completed. Rejects when the transaction fails.
|
|
329
|
+
*/
|
|
330
|
+
protected applyTransaction(transaction: Operation[], options?: {batch: boolean}): Promise<void>;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Uploads one file's content to the data source.
|
|
334
|
+
* @param fileTag - The tag of the file.
|
|
335
|
+
* @param dataType - The file data type
|
|
336
|
+
* @param binary - The binary data of the file.
|
|
337
|
+
* @return A Promise that resolves when the file content is uploaded. Rejects otherwise.
|
|
338
|
+
*/
|
|
339
|
+
protected uploadFileContent(fileTag: string, dataType: string, binary: Uint8Array): Promise<void>;
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Downloads one file's content from the data source.
|
|
343
|
+
* @param fileTag - The tag of the file.
|
|
344
|
+
* @param dataType - The file data type
|
|
345
|
+
* @return A Promise that resolves with the binary data of the file as an Uint8Array or a node Readable Stream. Rejects otherwise.
|
|
346
|
+
*/
|
|
347
|
+
protected downloadFileContent(fileTag: string, dataType: string): Promise<Uint8Array | Readable>;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Deletes file content from the data source.
|
|
351
|
+
* @param fileTag - The tag of the file.
|
|
352
|
+
* @param dataType - The file data type
|
|
353
|
+
* @return A Promise that resolves when the file content is successfully deleted. Rejects otherwise.
|
|
354
|
+
*/
|
|
355
|
+
protected deleteFileContent(fileTag: string, dataType: string): Promise<void>;
|
|
356
|
+
}
|