@olympeio/runtime-node 9.2.2 → 9.3.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/import/olympe.dm/datamodel/05_permission_schema.updateInst.json +1 -1
- package/import/olympe.dm/datamodel/06_structure.newInst.json +1 -1
- package/import/olympe.sc/datamodel/01_language.newInst.json +1 -1
- package/import/olympe.sc/datamodel/01_language.newRel.json +1 -1
- package/index.js +820 -808
- package/package.json +1 -1
- package/types/base.d.ts +33 -30
- package/types/cloud.d.ts +48 -48
- package/types/legacy.d.ts +9 -9
- package/types/runtime.d.ts +9 -9
- package/types/utils.d.ts +36 -6
package/package.json
CHANGED
package/types/base.d.ts
CHANGED
|
@@ -6,15 +6,16 @@ import {PropertyModel, Query, QueryResult, QuerySingle} from "./cloud";
|
|
|
6
6
|
// Primitives
|
|
7
7
|
// **********************************
|
|
8
8
|
|
|
9
|
-
declare type Class<T> = { new(): T };
|
|
10
9
|
/**
|
|
11
10
|
* A Tag can be either a `string`, a `HasTag` (CloudObject instance, Property, Relation, ...)
|
|
12
11
|
* or the class constructor for a `CloudObject`
|
|
13
12
|
*/
|
|
14
|
-
export type Tag = string | HasTag |
|
|
13
|
+
export type Tag = string | HasTag | typeof CloudObject;
|
|
15
14
|
|
|
16
15
|
export type List<T> = Array<T> | (T extends CloudObject | CloudObject[] ? QueryResult<T> : never);
|
|
17
16
|
|
|
17
|
+
export type Class<T> = {new (): T};
|
|
18
|
+
|
|
18
19
|
/**
|
|
19
20
|
* Generates a unique olympe tag used to identify `CloudObjects`
|
|
20
21
|
*
|
|
@@ -50,11 +51,11 @@ export interface HasTag {
|
|
|
50
51
|
* Contexts have parents and children, they represent the lifecycle of bricks.
|
|
51
52
|
* They contain callbacks executed at specific time of the brick lifespan.
|
|
52
53
|
*
|
|
53
|
-
* Each time a brick is updated with new inputs, {@
|
|
54
|
-
* executing all callbacks registered with {@
|
|
54
|
+
* Each time a brick is updated with new inputs, {@apilink Context.clear} is called,
|
|
55
|
+
* executing all callbacks registered with {@apilink Context.onClear}.
|
|
55
56
|
*
|
|
56
|
-
* When a brick is destroyed, {@
|
|
57
|
-
* executing all callbacks registered with {@
|
|
57
|
+
* When a brick is destroyed, {@apilink Context.destroy} is called,
|
|
58
|
+
* executing all callbacks registered with {@apilink Context.onClear} and {@apilink Context.onDestroy}
|
|
58
59
|
*/
|
|
59
60
|
export abstract class Context {
|
|
60
61
|
/**
|
|
@@ -78,7 +79,7 @@ export abstract class Context {
|
|
|
78
79
|
onDestroy(callback: () => void): string;
|
|
79
80
|
|
|
80
81
|
/**
|
|
81
|
-
* Remove a previously registered callback with {@
|
|
82
|
+
* Remove a previously registered callback with {@apilink Context.onDestroy} method using its id.
|
|
82
83
|
*
|
|
83
84
|
* @param callbackId the id of the callback to unregister
|
|
84
85
|
*/
|
|
@@ -95,7 +96,7 @@ export abstract class Context {
|
|
|
95
96
|
onClear(callback: () => void): string;
|
|
96
97
|
|
|
97
98
|
/**
|
|
98
|
-
* Remove a previously registered callback with {@
|
|
99
|
+
* Remove a previously registered callback with {@apilink Context.onClear} method using its id.
|
|
99
100
|
*
|
|
100
101
|
* @param id the id of the callback to unregister
|
|
101
102
|
*/
|
|
@@ -107,18 +108,18 @@ export abstract class Context {
|
|
|
107
108
|
* In essence, it represents a remote reference to an object in the data cloud.
|
|
108
109
|
* It is identified by its unique ID, or tag. From a `CloudObject` you can access related `CloudObjects`.
|
|
109
110
|
*
|
|
110
|
-
* A `CloudObject` can be instantiated via the
|
|
111
|
+
* A `CloudObject` can be instantiated via the {@apilink Tag} of its model, and it can be instantiated multiple times with different properties values.
|
|
111
112
|
* *Data types* defined in DRAW are such `CloudObjects`, instances of Data types are also `CloudObjects`.
|
|
112
113
|
*
|
|
113
114
|
* **Example:**
|
|
114
115
|
* ```javascript
|
|
115
|
-
* const dcObject =
|
|
116
|
+
* const dcObject = CloudObject.get(tag);
|
|
116
117
|
* ```
|
|
117
118
|
*/
|
|
118
119
|
export abstract class CloudObject implements HasTag {
|
|
119
120
|
/**
|
|
120
121
|
* The attributes of a CloudObject are called properties. Properties can be of different types,
|
|
121
|
-
* e.g. `Property<string>`, `Property<number>`, Property<Date>`.
|
|
122
|
+
* e.g. `Property<string>`, `Property<number>`, `Property<Date>`.
|
|
122
123
|
*
|
|
123
124
|
* If a `Person` `CloudObject` has an `age` property, all the instances of `Person` can access
|
|
124
125
|
* the `age` property using the same tag, the tag of the `age` property. This method returns all
|
|
@@ -129,7 +130,7 @@ export abstract class CloudObject implements HasTag {
|
|
|
129
130
|
static getProperties(): Property<any>[];
|
|
130
131
|
|
|
131
132
|
/**
|
|
132
|
-
* Return all the relations whose origin OR destination is the
|
|
133
|
+
* Return all the relations whose origin OR destination is the {@apilink CloudObject} associated to this class.
|
|
133
134
|
*
|
|
134
135
|
* @return All relations defined on the current data type. It can be the destination or the origin of the relations.
|
|
135
136
|
*/
|
|
@@ -147,8 +148,9 @@ export abstract class CloudObject implements HasTag {
|
|
|
147
148
|
* Get the CloudObject whose tag is specified.
|
|
148
149
|
*
|
|
149
150
|
* This only works if the `CloudObject` is already present in the local datacloud cache.
|
|
150
|
-
* (NB: you can use a {@
|
|
151
|
+
* (NB: you can use a {@apilink Query} to retrieve a distant {@apilink CloudObject})
|
|
151
152
|
*
|
|
153
|
+
* @static
|
|
152
154
|
* @param tag tag of the `CloudObject`
|
|
153
155
|
* @return `CloudObject` specified by the tag
|
|
154
156
|
*/
|
|
@@ -161,6 +163,7 @@ export abstract class CloudObject implements HasTag {
|
|
|
161
163
|
*
|
|
162
164
|
* @param properties mappings of (propertyTag -> propertyValue)
|
|
163
165
|
* @param model tag of the model of the `CloudObject` you want to create.
|
|
166
|
+
* @param source
|
|
164
167
|
* @return newly created `CloudObject`
|
|
165
168
|
*/
|
|
166
169
|
static createWith<T>(this: Class<T>, properties: Map<Tag, any>, model?: Tag, source?: string): T;
|
|
@@ -223,7 +226,7 @@ export abstract class CloudObject implements HasTag {
|
|
|
223
226
|
/**
|
|
224
227
|
* Start a query from this instance and follow the relation given as argument.
|
|
225
228
|
* The query starts from this single instance, and follows a relation to an arbitrary
|
|
226
|
-
* number of destination instances. See
|
|
229
|
+
* number of destination instances. See {@apilink Query.follow | Query.follow(relation)}
|
|
227
230
|
*
|
|
228
231
|
* The following are equivalent:
|
|
229
232
|
* ```javascript
|
|
@@ -249,7 +252,7 @@ export abstract class CloudObject implements HasTag {
|
|
|
249
252
|
|
|
250
253
|
// Properties getters
|
|
251
254
|
/**
|
|
252
|
-
* Get the current value of the specified property for this
|
|
255
|
+
* Get the current value of the specified property for this {@apilink CloudObject} instance
|
|
253
256
|
*
|
|
254
257
|
* @param property property or property's tag
|
|
255
258
|
* @return property value
|
|
@@ -260,10 +263,10 @@ export abstract class CloudObject implements HasTag {
|
|
|
260
263
|
* Get an observable to the current value of the specified property for this `CloudObject` instance.
|
|
261
264
|
*
|
|
262
265
|
* The observable gets the new value each time the property gets updated in the datacloud.
|
|
263
|
-
* The observable gets completed automatically once the specified context is
|
|
266
|
+
* The observable gets completed automatically once the specified context is {@apilink Context.onClear | cleared}.
|
|
264
267
|
* If `waitForValue` is set to FALSE (TRUE by default), the first value received by the observable is null if there is no value at call time.
|
|
265
268
|
*
|
|
266
|
-
* @param context
|
|
269
|
+
* @param context context to which the Observable is attached
|
|
267
270
|
* @param property property or property's tag to observe
|
|
268
271
|
* @param waitForValue [=true] whether the observable wait for a first value to get a value.
|
|
269
272
|
* @return Observable of property values
|
|
@@ -274,9 +277,9 @@ export abstract class CloudObject implements HasTag {
|
|
|
274
277
|
* Get an observable to pair [property, value] for this `CloudObject` instance.
|
|
275
278
|
*
|
|
276
279
|
* The observable gets the new value each time any property gets updated in the datacloud.
|
|
277
|
-
* The observable gets completed automatically once the specified context is
|
|
280
|
+
* The observable gets completed automatically once the specified context is {@apilink Context.onClear | cleared}.
|
|
278
281
|
*
|
|
279
|
-
* @param context
|
|
282
|
+
* @param context Context to which the Observable will be attached
|
|
280
283
|
* @return Observable of property values
|
|
281
284
|
*/
|
|
282
285
|
observeProperties<T>(context: Context): Observable<[Property<T>, T]>;
|
|
@@ -296,12 +299,12 @@ export abstract class CloudObject implements HasTag {
|
|
|
296
299
|
|
|
297
300
|
/**
|
|
298
301
|
* Relation between a `CloudObject`and its model
|
|
299
|
-
* instance --modelRel-> model
|
|
302
|
+
* `instance --modelRel-> model`
|
|
300
303
|
*/
|
|
301
304
|
static modelRel: Relation<CloudObject, CloudObject>;
|
|
302
305
|
|
|
303
306
|
/**
|
|
304
|
-
* Inverse relation of {@
|
|
307
|
+
* Inverse relation of {@apilink modelRel} between a model and its instances
|
|
305
308
|
* Equivalent to `modelRel.getInverse()`
|
|
306
309
|
*/
|
|
307
310
|
static instancesRel: Relation<CloudObject, CloudObject>;
|
|
@@ -310,12 +313,12 @@ export abstract class CloudObject implements HasTag {
|
|
|
310
313
|
* from another `CloudObject` model to mimic their behaviour.
|
|
311
314
|
*
|
|
312
315
|
* Relation from a model to the CloudObject model it extends.
|
|
313
|
-
* A --extendRel-> B
|
|
316
|
+
* `A --extendRel-> B`
|
|
314
317
|
* A inherits B's properties and relations.
|
|
315
318
|
*/
|
|
316
319
|
static extendRel: Relation<CloudObject, CloudObject>;
|
|
317
320
|
/**
|
|
318
|
-
* Inverse relation of {@
|
|
321
|
+
* Inverse relation of {@apilink extendRel}
|
|
319
322
|
*/
|
|
320
323
|
static extendedByRel: Relation<CloudObject, CloudObject>;
|
|
321
324
|
/**
|
|
@@ -337,15 +340,15 @@ export abstract class CloudObject implements HasTag {
|
|
|
337
340
|
export interface Property<T> extends HasTag {}
|
|
338
341
|
|
|
339
342
|
/**
|
|
340
|
-
* Relations are directed from A
|
|
343
|
+
* Relations are directed from A to B and can be followed in either direction.
|
|
341
344
|
*/
|
|
342
345
|
export enum Direction {
|
|
343
346
|
/**
|
|
344
|
-
* For relation A
|
|
347
|
+
* For relation A to B, go to A, the origin
|
|
345
348
|
*/
|
|
346
349
|
ORIGIN = '<',
|
|
347
350
|
/**
|
|
348
|
-
* For relation A
|
|
351
|
+
* For relation A to B, go to B, the destination
|
|
349
352
|
*/
|
|
350
353
|
DESTINATION = '>'
|
|
351
354
|
}
|
|
@@ -412,12 +415,12 @@ export interface Relation<O extends CloudObject, D extends CloudObject> extends
|
|
|
412
415
|
*
|
|
413
416
|
* This creates the link between a class and an DataType in the database.
|
|
414
417
|
* Once this link is created, all the instances of the DataType (model)
|
|
415
|
-
* are instantiated as JS objects using the specified class (see
|
|
418
|
+
* are instantiated as JS objects using the specified class (see {@apilink CloudObject.get})
|
|
416
419
|
*
|
|
417
420
|
* @param tag tag of the DataType
|
|
418
421
|
* @param object `CloudObject` constructor
|
|
419
422
|
*/
|
|
420
|
-
export function register(tag: Tag, object:
|
|
423
|
+
export function register(tag: Tag, object: typeof CloudObject): void;
|
|
421
424
|
|
|
422
425
|
/**
|
|
423
426
|
* Create a constant property object which has the specified tag and type to be used in coded bricks.
|
|
@@ -431,7 +434,7 @@ export function defineProperty<T>(tag: Tag, type?: Class<T>): Property<T>;
|
|
|
431
434
|
/**
|
|
432
435
|
* Create a constant relation object between two specified DataTypes.
|
|
433
436
|
*
|
|
434
|
-
* That constant is used especially to create queries see
|
|
437
|
+
* That constant is used especially to create queries see {@apilink Query.follow | Query.follow(relation)}
|
|
435
438
|
*
|
|
436
439
|
* @param tag tag of the relation
|
|
437
440
|
* @param origin origin DataType of the relation
|
|
@@ -443,7 +446,7 @@ export function defineRelation<O extends CloudObject, D extends CloudObject>(tag
|
|
|
443
446
|
/**
|
|
444
447
|
* Create a constant relation object between two generic `CloudObjects`
|
|
445
448
|
*
|
|
446
|
-
* That constant is used especially to create queries see
|
|
449
|
+
* That constant is used especially to create queries see {@apilink Query.follow | Query.follow(relation)}
|
|
447
450
|
*
|
|
448
451
|
* @param tag tag of the relation
|
|
449
452
|
* @param direction direction of the relation, pointing towards origin or destination. Default is `DESTINATION`
|
package/types/cloud.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export class RelationModel extends CloudObject {
|
|
|
48
48
|
/**
|
|
49
49
|
* Relation from the origin data type to the RelationModel
|
|
50
50
|
* */
|
|
51
|
-
static originModelRel: Relation<
|
|
51
|
+
static originModelRel: Relation<RelationModel, CloudObject>;
|
|
52
52
|
/**
|
|
53
53
|
* Relation from a RelationModel to the destination data type
|
|
54
54
|
* */
|
|
@@ -68,35 +68,35 @@ export class RelationModel extends CloudObject {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
* StringModel represents a {@
|
|
71
|
+
* StringModel represents a {@apilink PropertyModel} for a string property of a data type.
|
|
72
72
|
*/
|
|
73
73
|
export class StringModel extends CloudObject {
|
|
74
74
|
static valueProp: Property<string>;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
* NumberModel represents a {@
|
|
78
|
+
* NumberModel represents a {@apilink PropertyModel} for a number property of a data type.
|
|
79
79
|
*/
|
|
80
80
|
export class NumberModel extends CloudObject {
|
|
81
81
|
static valueProp: Property<number>;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
* BooleanModel represents a {@
|
|
85
|
+
* BooleanModel represents a {@apilink PropertyModel} for a boolean property of a data type.
|
|
86
86
|
*/
|
|
87
87
|
export class BooleanModel extends CloudObject {
|
|
88
88
|
static valueProp: Property<boolean>;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
|
-
* DatetimeModel represents a {@
|
|
92
|
+
* DatetimeModel represents a {@apilink PropertyModel} for a datetime property of a data type.
|
|
93
93
|
*/
|
|
94
94
|
export class DatetimeModel extends CloudObject {
|
|
95
95
|
static valueProp: Property<Date>;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* ColorModel represents a {@
|
|
99
|
+
* ColorModel represents a {@apilink PropertyModel} for a color property of a data type.
|
|
100
100
|
*/
|
|
101
101
|
export class ColorModel extends CloudObject {
|
|
102
102
|
static valueProp: Property<Color>;
|
|
@@ -188,7 +188,7 @@ export class Enum extends CloudObject {
|
|
|
188
188
|
/**
|
|
189
189
|
* Create an empty `Enum?` without any value
|
|
190
190
|
*
|
|
191
|
-
* See {@
|
|
191
|
+
* See {@apilink EnumValue.createValue} to create values for an Enum.
|
|
192
192
|
*
|
|
193
193
|
* @param transaction transaction in which to create the Enum
|
|
194
194
|
* @param name optional name of the Enum
|
|
@@ -239,28 +239,28 @@ export class EnumValue extends CloudObject {
|
|
|
239
239
|
// -------------------------
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
|
-
* A `Workflow` is a sequence of {@
|
|
243
|
-
* {@
|
|
244
|
-
* The `Workflow` also historize the {@
|
|
242
|
+
* A `Workflow` is a sequence of {@apilink WorkflowState} in which instances of a model goes through.
|
|
243
|
+
* {@apilink WorkflowState} are linked by {@apilink WorkflowTransition} that can have an optional _process function_.
|
|
244
|
+
* The `Workflow` also historize the {@apilink WorkflowState} of the instance and optionally serialize the object itself in a {@apilink WorkflowObjectState}.
|
|
245
245
|
*/
|
|
246
246
|
export class Workflow extends CloudObject {
|
|
247
247
|
/** Is the instance serialization enabled or not */
|
|
248
248
|
static serializationEnabledProp: Property<boolean>;
|
|
249
249
|
/** The model to which the `Workflow` is associated */
|
|
250
250
|
static dataTypeRel: Relation<Workflow, CloudObject>;
|
|
251
|
-
/** The {@
|
|
251
|
+
/** The {@apilink WorkflowState} that are in the `Workflow` */
|
|
252
252
|
static statesRel: Relation<Workflow, WorkflowState>;
|
|
253
|
-
/** The initial {@
|
|
253
|
+
/** The initial {@apilink WorkflowState} of the `Workflow` */
|
|
254
254
|
static initialStateRel: Relation<Workflow, WorkflowState>;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
/**
|
|
258
|
-
* A `WorkflowState` defines a state in a {@
|
|
258
|
+
* A `WorkflowState` defines a state in a {@apilink Workflow}.
|
|
259
259
|
*/
|
|
260
260
|
export class WorkflowState extends CloudObject { /* empty */ }
|
|
261
261
|
|
|
262
262
|
/**
|
|
263
|
-
* A `WorkflowTransition` defines a transition between 2 {@
|
|
263
|
+
* A `WorkflowTransition` defines a transition between 2 {@apilink WorkflowState}.
|
|
264
264
|
* It has a direction (`fromStateRel` to `toStateRel`) and can have an optional _process function_.
|
|
265
265
|
* The _process function_ (`processRefProp`) is automatically triggered when the transition occurs.
|
|
266
266
|
*/
|
|
@@ -270,26 +270,26 @@ export class WorkflowTransition extends CloudObject {
|
|
|
270
270
|
* It has this signature: (ControlFlow, CloudObject, User, Map) -> (ControlFlow, ErrorFlow)
|
|
271
271
|
*/
|
|
272
272
|
static processRefProp: Property<Brick>;
|
|
273
|
-
/** The {@
|
|
273
|
+
/** The {@apilink WorkflowState} from which this transition starts */
|
|
274
274
|
static fromStateRel: Relation<WorkflowTransition, WorkflowState>;
|
|
275
|
-
/** The {@
|
|
275
|
+
/** The {@apilink WorkflowState} to which this transition ends */
|
|
276
276
|
static toStateRel: Relation<WorkflowTransition, WorkflowState>;
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
/**
|
|
280
280
|
* A `WorkflowObjectState` represents the state of an instance at a certain point in time.
|
|
281
|
-
* It is automatically created when initializing a {@
|
|
281
|
+
* It is automatically created when initializing a {@apilink Workflow} on an instance or when triggering a {@apilink WorkflowTransition}.
|
|
282
282
|
*/
|
|
283
283
|
export class WorkflowObjectState extends CloudObject {
|
|
284
|
-
/** The name of the {@
|
|
284
|
+
/** The name of the {@apilink Workflow} associated */
|
|
285
285
|
static workflowProp: Property<string>;
|
|
286
|
-
/** The name of the {@
|
|
286
|
+
/** The name of the {@apilink WorkflowState} */
|
|
287
287
|
static stateProp: Property<string>;
|
|
288
|
-
/** The name (login) of the {@
|
|
288
|
+
/** The name (login) of the {@apilink User} */
|
|
289
289
|
static assigneeProp: Property<string>;
|
|
290
290
|
/** The point in time of this object state */
|
|
291
291
|
static dateTimeProp: Property<Date>;
|
|
292
|
-
/** If the {@
|
|
292
|
+
/** If the {@apilink Workflow} has serialization enabled, the object's property are saved here in JSON */
|
|
293
293
|
static serializedObjectProp: Property<string>;
|
|
294
294
|
/** The related instance this object state represents */
|
|
295
295
|
static objectRel: Relation<WorkflowObjectState, CloudObject>;
|
|
@@ -373,7 +373,7 @@ export class Transaction {
|
|
|
373
373
|
* A custom map can specify property values for the instance.
|
|
374
374
|
*
|
|
375
375
|
* A source can be the orchestrator ('server'), local ('self') or
|
|
376
|
-
* an external data source (
|
|
376
|
+
* an external data source (tag of DBConnector). The source is where
|
|
377
377
|
* the object is persisted and its true value outside local scopes.
|
|
378
378
|
*
|
|
379
379
|
* @param model tag of the model of the instance to be created
|
|
@@ -398,7 +398,7 @@ export class Transaction {
|
|
|
398
398
|
* Update multiple properties of a single instance
|
|
399
399
|
*
|
|
400
400
|
* @param instance tag of the instance to be updated
|
|
401
|
-
* @param properties
|
|
401
|
+
* @param properties map of properties to update
|
|
402
402
|
* @return this transaction
|
|
403
403
|
*/
|
|
404
404
|
multiUpdate(instance: Tag, properties: Map<Tag, any>): this;
|
|
@@ -476,7 +476,7 @@ export class Transaction {
|
|
|
476
476
|
* `source` can be specified as :
|
|
477
477
|
* 1. the orchestrator ('server'),
|
|
478
478
|
* 2. local ('self') or
|
|
479
|
-
* 3. an external data source (
|
|
479
|
+
* 3. an external data source (Tag of a `DBConnector`)
|
|
480
480
|
*
|
|
481
481
|
* The source of a data object is where the object is persisted.
|
|
482
482
|
*
|
|
@@ -569,14 +569,14 @@ export class BurstTransaction {
|
|
|
569
569
|
* Push all property values from specified Observable to update specified object
|
|
570
570
|
*
|
|
571
571
|
* @param object the object to update
|
|
572
|
-
* @param values observable
|
|
572
|
+
* @param values observable mapping properties to new values
|
|
573
573
|
*/
|
|
574
574
|
push<T>(object: CloudObject, values: Observable<Map<Property<T>, T>>): void;
|
|
575
575
|
|
|
576
576
|
/**
|
|
577
577
|
* Commit and close the burst transaction
|
|
578
578
|
*
|
|
579
|
-
* @return Promise
|
|
579
|
+
* @return A `Promise` completing with commit success/failure
|
|
580
580
|
*/
|
|
581
581
|
complete(): Promise<void>;
|
|
582
582
|
}
|
|
@@ -590,7 +590,7 @@ export class BurstTransaction {
|
|
|
590
590
|
* It contains the result of a query at a specific time.
|
|
591
591
|
*
|
|
592
592
|
* The keys are tags (e.g. `myTag`) that correspond to a `CloudObject` (e.g. `myCloudObject`).
|
|
593
|
-
* When the {@
|
|
593
|
+
* When the {@apilink Query} contains more than one {@apilink Query.andReturn Query.andReturn()} clause,
|
|
594
594
|
* keys are composite tags (e.g. `'tag1.tag2.tag3'`) and values are tuples of `CloudObjects` (e.g. `[cloudObj1, cloudObj2, cloudObj3]`).
|
|
595
595
|
* Such a QueryResult can be obtained via:
|
|
596
596
|
* ```javascript
|
|
@@ -697,7 +697,7 @@ export class QueryResult<T extends CloudObject | CloudObject[]> {
|
|
|
697
697
|
getAt(index: number): T | null;
|
|
698
698
|
|
|
699
699
|
/**
|
|
700
|
-
* Returns an array equivalent to
|
|
700
|
+
* Returns an array equivalent to {@apilink QueryResult.toArray | this.toArray().push(...object)}
|
|
701
701
|
*
|
|
702
702
|
* This operation returns a new array and does not modify this QueryResult.
|
|
703
703
|
*
|
|
@@ -709,7 +709,7 @@ export class QueryResult<T extends CloudObject | CloudObject[]> {
|
|
|
709
709
|
/**
|
|
710
710
|
* Returns the QueryResult values as an array whose last value has been removed.
|
|
711
711
|
*
|
|
712
|
-
* If
|
|
712
|
+
* If {@apilink QueryResult.size} is 0 or 1, this method returns an empty array.
|
|
713
713
|
*
|
|
714
714
|
* This operation returns a new array and does not modify this QueryResult.
|
|
715
715
|
*
|
|
@@ -720,7 +720,7 @@ export class QueryResult<T extends CloudObject | CloudObject[]> {
|
|
|
720
720
|
/**
|
|
721
721
|
* Returns the QueryResult values as an array whose first value has been removed.
|
|
722
722
|
*
|
|
723
|
-
* If
|
|
723
|
+
* If {@apilink QueryResult.size} is 0 or 1, this method returns an empty array.
|
|
724
724
|
*
|
|
725
725
|
* This operation returns a new array and does not modify this QueryResult.
|
|
726
726
|
*
|
|
@@ -732,7 +732,7 @@ export class QueryResult<T extends CloudObject | CloudObject[]> {
|
|
|
732
732
|
* Returns the new values added since the last `QueryResult` update.
|
|
733
733
|
* In other words, `getAdded` returns the new values that exists in this query result, but did not in the previous query result pushed by the Observable.
|
|
734
734
|
*
|
|
735
|
-
* This applies only when
|
|
735
|
+
* This applies only when {@apilink Query.observe | observing} a {@apilink Query}.
|
|
736
736
|
*
|
|
737
737
|
* @return values added
|
|
738
738
|
*/
|
|
@@ -742,7 +742,7 @@ export class QueryResult<T extends CloudObject | CloudObject[]> {
|
|
|
742
742
|
* Returns the keys of values removed since the last `QueryResult` update.
|
|
743
743
|
* In other words, `getRemoved` returns the old values that existed in the previous query result, but are no longer present in this query result pushed by the Observable.
|
|
744
744
|
*
|
|
745
|
-
* This applies only when
|
|
745
|
+
* This applies only when {@apilink Query.observe | observing} a {@apilink Query}.
|
|
746
746
|
*
|
|
747
747
|
* @return keys of the removed values
|
|
748
748
|
*/
|
|
@@ -751,7 +751,7 @@ export class QueryResult<T extends CloudObject | CloudObject[]> {
|
|
|
751
751
|
/**
|
|
752
752
|
* Returns an array containing the values matching the provided filter predicate.
|
|
753
753
|
*
|
|
754
|
-
* @param predicate filter {@
|
|
754
|
+
* @param predicate filter {@apilink Predicate}
|
|
755
755
|
* @return array of matching values
|
|
756
756
|
*/
|
|
757
757
|
filter(predicate: (entry: T, index: number) => boolean): T[];
|
|
@@ -798,7 +798,7 @@ export class QueryResult<T extends CloudObject | CloudObject[]> {
|
|
|
798
798
|
/**
|
|
799
799
|
* Return a reduced value for this QueryResult.
|
|
800
800
|
*
|
|
801
|
-
* The specified `reducer` callback reduces the QueryResult values
|
|
801
|
+
* The specified `reducer` callback reduces the QueryResult values. Similar to `Array.reduce()`.
|
|
802
802
|
*
|
|
803
803
|
* @param reducer callback
|
|
804
804
|
* @param initial initial value of the accumulator
|
|
@@ -813,8 +813,8 @@ export class QueryResult<T extends CloudObject | CloudObject[]> {
|
|
|
813
813
|
*
|
|
814
814
|
* - the keys of the QueryResults are concatenated
|
|
815
815
|
* - the values of the QueryResults are concatenated
|
|
816
|
-
* - the arrays returned by {@
|
|
817
|
-
* - the arrays returned by {@
|
|
816
|
+
* - the arrays returned by {@apilink QueryResult.getAdded} are concatenated
|
|
817
|
+
* - the arrays returned by {@apilink QueryResult.getRemoved} are concatenated
|
|
818
818
|
*
|
|
819
819
|
* Example : ```javascript
|
|
820
820
|
* const result1 = Query.fromInstances(myModel1).executeFromCache();
|
|
@@ -898,14 +898,14 @@ export class Query<T extends CloudObject, R> {
|
|
|
898
898
|
* @param model tag/class of the model to find the instances of
|
|
899
899
|
* @param source optional source of the data to answer the query
|
|
900
900
|
* A source can be the orchestrator ('server'), local ('self') or
|
|
901
|
-
* an external data source (
|
|
901
|
+
* an external data source (Tag of a `DBConnectorTag`)
|
|
902
902
|
* @return a new query object starting from model instances
|
|
903
903
|
*/
|
|
904
904
|
static instancesOf<T extends Tag>(model: Class<T> | Tag, source?: string): Query<T extends CloudObject ? T : CloudObject, never>;
|
|
905
905
|
|
|
906
906
|
/**
|
|
907
907
|
* Instruct the query to follow a specified relation. This does not add any key-value pair to the result.
|
|
908
|
-
* (see {@
|
|
908
|
+
* (see {@apilink Query.andReturn}). This operation defines a new step in the path defined by our graph query.
|
|
909
909
|
*
|
|
910
910
|
* Example:
|
|
911
911
|
* Find the model of a single object.
|
|
@@ -919,7 +919,7 @@ export class Query<T extends CloudObject, R> {
|
|
|
919
919
|
follow<D extends CloudObject>(relation: Relation<T, D>): Query<D, R>;
|
|
920
920
|
|
|
921
921
|
/**
|
|
922
|
-
* Follow a relation recursively, see {@
|
|
922
|
+
* Follow a relation recursively, see {@apilink Query.follow}.
|
|
923
923
|
* The relation that is followed is automatically recursively followed.
|
|
924
924
|
* All nodes that are recursively followed are part of the same step in the path defined by this graph query.
|
|
925
925
|
*
|
|
@@ -948,7 +948,7 @@ export class Query<T extends CloudObject, R> {
|
|
|
948
948
|
|
|
949
949
|
/**
|
|
950
950
|
* Define a filter operation on the current working set of nodes.
|
|
951
|
-
* It filters out instances that don't match the given {@
|
|
951
|
+
* It filters out instances that don't match the given {@apilink Predicate}
|
|
952
952
|
*
|
|
953
953
|
* @param predicate
|
|
954
954
|
* @return a new query object with the new filter operation
|
|
@@ -1007,7 +1007,7 @@ export class Query<T extends CloudObject, R> {
|
|
|
1007
1007
|
* ascending order.
|
|
1008
1008
|
*
|
|
1009
1009
|
* @param property the property used for sorting
|
|
1010
|
-
* @param order optional
|
|
1010
|
+
* @param order optional {@apilink Order.ASC} (default) or {@apilink Order.DESC} order
|
|
1011
1011
|
* @return new query with sort operation
|
|
1012
1012
|
*/
|
|
1013
1013
|
sortBy(property: Property<any>, order?: Order): Query<T, R>;
|
|
@@ -1027,9 +1027,9 @@ export class Query<T extends CloudObject, R> {
|
|
|
1027
1027
|
*
|
|
1028
1028
|
* The observable gets the new value each time data modification in the datacloud changes the result of the query.
|
|
1029
1029
|
*
|
|
1030
|
-
* The observable gets completed automatically once the specified context is
|
|
1030
|
+
* The observable gets completed automatically once the specified context is {@apilink Context.onClear | cleared}.
|
|
1031
1031
|
*
|
|
1032
|
-
* @param context
|
|
1032
|
+
* @param context {@apilink Context} to which the Observable is attached
|
|
1033
1033
|
* @return Observable of QueryResult values
|
|
1034
1034
|
*/
|
|
1035
1035
|
observe(context: Context): Observable<QueryResult<R extends never ? T : R extends CloudObject | CloudObject[] ? R : never>>;
|
|
@@ -1054,7 +1054,7 @@ export class Query<T extends CloudObject, R> {
|
|
|
1054
1054
|
export class QuerySingle<T extends CloudObject> {
|
|
1055
1055
|
/**
|
|
1056
1056
|
* Create a `query single` from a single node.
|
|
1057
|
-
* See
|
|
1057
|
+
* See {@apilink Query.from}
|
|
1058
1058
|
*
|
|
1059
1059
|
* @param object starting node for the graph query single
|
|
1060
1060
|
* @return new query single only accepting 0..1 relations
|
|
@@ -1063,7 +1063,7 @@ export class QuerySingle<T extends CloudObject> {
|
|
|
1063
1063
|
|
|
1064
1064
|
/**
|
|
1065
1065
|
* Follow a 0..1 relation
|
|
1066
|
-
* See
|
|
1066
|
+
* See {@apilink Query.follow | Query.follow()}
|
|
1067
1067
|
*
|
|
1068
1068
|
* @param relation relation to next node
|
|
1069
1069
|
* @return new query single with follow operation
|
|
@@ -1071,7 +1071,7 @@ export class QuerySingle<T extends CloudObject> {
|
|
|
1071
1071
|
follow<D extends CloudObject>(relation: Relation<T, D>): QuerySingle<D>;
|
|
1072
1072
|
|
|
1073
1073
|
/**
|
|
1074
|
-
* See
|
|
1074
|
+
* See {@apilink Query.cast | Query.cast()}
|
|
1075
1075
|
*
|
|
1076
1076
|
* @param type the new type
|
|
1077
1077
|
* @return query single on a node of the specified type
|
|
@@ -1079,7 +1079,7 @@ export class QuerySingle<T extends CloudObject> {
|
|
|
1079
1079
|
cast<S extends CloudObject>(type: Class<S>): QuerySingle<S>;
|
|
1080
1080
|
|
|
1081
1081
|
/**
|
|
1082
|
-
* Execute the query single, see
|
|
1082
|
+
* Execute the query single, see {@apilink Query.execute | Query.execute()}
|
|
1083
1083
|
*
|
|
1084
1084
|
* @param context
|
|
1085
1085
|
* @return promise containing the single result or `null`
|
|
@@ -1088,7 +1088,7 @@ export class QuerySingle<T extends CloudObject> {
|
|
|
1088
1088
|
|
|
1089
1089
|
/**
|
|
1090
1090
|
* Execute the query single on the local data cloud,
|
|
1091
|
-
* see
|
|
1091
|
+
* see {@apilink Query.executeFromCache | Query.executeFromCache()}
|
|
1092
1092
|
*
|
|
1093
1093
|
* @return single result value or `null`
|
|
1094
1094
|
*/
|
package/types/legacy.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare interface Entry extends HasTag {
|
|
|
15
15
|
/**
|
|
16
16
|
* Register a property on the brick with the specified tag.
|
|
17
17
|
*
|
|
18
|
-
* @deprecated use {@
|
|
18
|
+
* @deprecated use {@apilink defineProperty} instead
|
|
19
19
|
* @param tag
|
|
20
20
|
* @return the property descriptor
|
|
21
21
|
*/
|
|
@@ -24,17 +24,17 @@ declare interface Entry extends HasTag {
|
|
|
24
24
|
/**
|
|
25
25
|
* Register a new relation type with the specified tag and direction
|
|
26
26
|
*
|
|
27
|
-
* @deprecated use {@
|
|
27
|
+
* @deprecated use {@apilink defineRelation} instead
|
|
28
28
|
* @param tag
|
|
29
29
|
* @param direction
|
|
30
30
|
*/
|
|
31
31
|
addRelation(tag: string, direction: Direction): transformers.Related<any, any>;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
/** @deprecated use {@
|
|
34
|
+
/** @deprecated use {@apilink VisualBrick} instead */
|
|
35
35
|
export class UIBrick extends VisualBrick {}
|
|
36
36
|
|
|
37
|
-
/** @deprecated use {@
|
|
37
|
+
/** @deprecated use {@apilink Brick} instead */
|
|
38
38
|
export type FunctionBrick = Brick;
|
|
39
39
|
|
|
40
40
|
/* ======================
|
|
@@ -54,16 +54,16 @@ export function registerSync(tag: string, brick: new () => Sync, ...args: any):
|
|
|
54
54
|
|
|
55
55
|
/** @deprecated */
|
|
56
56
|
export class Sync extends CloudObject {
|
|
57
|
-
/** @deprecated use static method {@
|
|
57
|
+
/** @deprecated use static method {@apilink CloudObject.get} instead */
|
|
58
58
|
static getInstance(instance: InstanceTag): Sync;
|
|
59
|
-
/** @deprecated use static method {@
|
|
59
|
+
/** @deprecated use static method {@apilink CloudObject.instancesOf} instead */
|
|
60
60
|
static getInstancesOf(model: InstanceTag): ListDef;
|
|
61
61
|
|
|
62
|
-
/** @deprecated use {@
|
|
62
|
+
/** @deprecated use {@apilink CloudObject.name} instead */
|
|
63
63
|
getName(): string;
|
|
64
|
-
/** @deprecated use {@
|
|
64
|
+
/** @deprecated use {@apilink CloudObject.observe} instead */
|
|
65
65
|
observeProperty<T>(property: Property<T>): Observable<T>;
|
|
66
|
-
/** @deprecated use {@
|
|
66
|
+
/** @deprecated use {@apilink base.CloudObject.get} instead */
|
|
67
67
|
getProperty<T>(property: Property<T>): T | null;
|
|
68
68
|
}
|
|
69
69
|
|