@olympeio/runtime-node 9.2.2 → 9.3.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/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 {@link defineProperty} instead
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 {@link defineRelation} instead
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 {@link VisualBrick} instead */
34
+ /** @deprecated use {@apilink VisualBrick} instead */
35
35
  export class UIBrick extends VisualBrick {}
36
36
 
37
- /** @deprecated use {@link Brick} instead */
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 {@link CloudObject#get} instead */
57
+ /** @deprecated use static method {@apilink CloudObject.get} instead */
58
58
  static getInstance(instance: InstanceTag): Sync;
59
- /** @deprecated use static method {@link CloudObject#instancesOf} instead */
59
+ /** @deprecated use static method {@apilink CloudObject.instancesOf} instead */
60
60
  static getInstancesOf(model: InstanceTag): ListDef;
61
61
 
62
- /** @deprecated use {@link CloudObject#name} instead */
62
+ /** @deprecated use {@apilink CloudObject.name} instead */
63
63
  getName(): string;
64
- /** @deprecated use {@link CloudObject#observe} instead */
64
+ /** @deprecated use {@apilink CloudObject.observe} instead */
65
65
  observeProperty<T>(property: Property<T>): Observable<T>;
66
- /** @deprecated use {@link CloudObject#get} instead */
66
+ /** @deprecated use {@apilink base.CloudObject.get} instead */
67
67
  getProperty<T>(property: Property<T>): T | null;
68
68
  }
69
69
 
@@ -3,8 +3,7 @@
3
3
  // **********************************
4
4
  // @ts-ignore
5
5
  import Observable from 'rxjs';
6
- import {CloudObject, Context, Property} from "./base";
7
- import {Entry} from "./legacy";
6
+ import {CloudObject, Context, Property, Tag} from "./base";
8
7
 
9
8
  /**
10
9
  * Label of global properties used by convention through bricks and applications.
@@ -15,7 +14,7 @@ import {Entry} from "./legacy";
15
14
  * The brick "Begin Transaction" push a transaction inside the context so it can be reused by other bricks before the "End Transaction" brick.
16
15
  */
17
16
  export enum GlobalProperties {
18
- EDITION_MODE = '__editionMode',
17
+ EDITION = '__editionMode',
19
18
  PRODUCTION = '__production',
20
19
  TRANSACTION = '__transaction'
21
20
  }
@@ -25,7 +24,7 @@ export class BrickContext extends Context {
25
24
  * Returns a boolean indicating whether a property has a value or not.
26
25
  *
27
26
  * @param key the property or key string
28
- * @param global [=false] whether or not the method checks parent contexts
27
+ * @param global [=false] whether the method checks parent contexts
29
28
  * @return whether `property` has a value or not
30
29
  */
31
30
  has<T>(key: string | Property<T>, global?: boolean): boolean;
@@ -34,7 +33,7 @@ export class BrickContext extends Context {
34
33
  * Return the current value of the specified property. If there is currently no value, return null.
35
34
  *
36
35
  * @param key the property or key string
37
- * @param global [=false] whether or not the method checks parent contexts
36
+ * @param global [=false] whether the method checks parent contexts
38
37
  * @return the current value
39
38
  */
40
39
  get<T>(key: string | Property<T>, global?: boolean): T | null;
@@ -46,8 +45,8 @@ export class BrickContext extends Context {
46
45
  * If `global` is set to TRUE (FALSE by default), it observes values coming from other contexts accessible from the current one.
47
46
  *
48
47
  * @param key the property or key string
49
- * @param waitForValue [=true] whether or not the observable wait for a first value to get a value.
50
- * @param global [=false] whether or not listen to a value coming from other contexts.
48
+ * @param waitForValue [=true] whether the observable should wait for a first value to get a value.
49
+ * @param global [=false] whether to listen to a value coming from other contexts.
51
50
  * @return the observable
52
51
  */
53
52
  observe<T>(key: string | Property<T>, waitForValue?: boolean, global?: boolean): Observable<T>;
@@ -56,7 +55,7 @@ export class BrickContext extends Context {
56
55
  * Wait for the property to get a new value, wrapped in a promise.
57
56
  *
58
57
  * @param key the property
59
- * @param global [=false] whether or not the method checks parent contexts
58
+ * @param global [=false] whether the method checks parent contexts
60
59
  * @return a promise of the next value of property
61
60
  */
62
61
  waitFor<T>(key: string | Property<T>, global?: boolean): Promise<T>;
@@ -220,13 +219,13 @@ export abstract class Brick extends CloudObject {
220
219
  protected destroy($: BrickContext): void;
221
220
 
222
221
  /**
223
- * @deprecated use {@link BrickContext#init} instead
222
+ * @deprecated use {@apilink Brick.init} instead
224
223
  * @param $ the brick context
225
224
  */
226
225
  protected onInit($: BrickContext): void;
227
226
 
228
227
  /**
229
- * @deprecated use {@link BrickContext#update} instead
228
+ * @deprecated use {@apilink Brick.update} instead
230
229
  * @param $ the brick context
231
230
  * @param inputs array of input values
232
231
  * @param outputs array of output setter functions.
@@ -234,7 +233,7 @@ export abstract class Brick extends CloudObject {
234
233
  protected onUpdate($: BrickContext, inputs: Array<any>, outputs: Array<(value: any) => void>): void;
235
234
 
236
235
  /**
237
- * @deprecated use {@link BrickContext#destroy} instead
236
+ * @deprecated use {@apilink Brick.destroy} instead
238
237
  * @param $ the brick context
239
238
  */
240
239
  protected onDestroy($: BrickContext): void;
@@ -279,7 +278,7 @@ export abstract class VisualBrick extends Brick {
279
278
  /**
280
279
  * Called when the DOM Element associated to that brick has been added to the document and is ready to be drawn.
281
280
  *
282
- * @deprecated override {@link VisualBrick#render} and {@link VisualBrick#updateParent} instead.
281
+ * @deprecated override {@apilink VisualBrick.render} and {@apilink VisualBrick.updateParent} instead.
283
282
  * @param $ the brick context
284
283
  * @param domElement the associated DOM Element
285
284
  */
package/types/utils.d.ts CHANGED
@@ -17,6 +17,31 @@ export class Config {
17
17
  static getParameter(id: string): unknown | undefined;
18
18
  }
19
19
 
20
+ // Health check and shutdown
21
+ export class Process {
22
+
23
+ /**
24
+ * Static method to register a callback that is used to check the health status of the process.
25
+ * This is typically used by kubernetes environment to maintain backend healthy
26
+ *
27
+ * The callback must return a Promise which returns a string as valid message.
28
+ * The process is considered by the runtime as unhealthy if the promise is rejected.
29
+ *
30
+ * @param callback the callback executed each time the runtime check the health of the process.
31
+ */
32
+ static onHealthCheck(callback: () => Promise<string>): () => void;
33
+
34
+ /**
35
+ * Static method to register a callback called by the runtime when it receives the signal to be terminated.
36
+ * This is typically used to graceful shutdown some connections or drivers to external processes.
37
+ *
38
+ * The callback must return a Promise which is resolved when the shutdown process is done.
39
+ *
40
+ * @param callback the callback executed when the runtime terminates.
41
+ */
42
+ static onShutdown(callback: () => Promise<void>): () => void;
43
+ }
44
+
20
45
  // -- Primitive types classes --
21
46
  export class Color {
22
47
  static create(r: number, g: number, b: number, a?: number): Color;
@@ -137,7 +162,7 @@ export class Service {
137
162
  static publish(service: string, payload: Object): Promise<void>;
138
163
 
139
164
  /**
140
- * Send a request to a {@link Service} and wait for an ack.
165
+ * Send a request to a {@apilink Service} and wait for an ack.
141
166
  *
142
167
  * @param service the service id
143
168
  * @param payload the message payload, optional
@@ -146,7 +171,7 @@ export class Service {
146
171
  static send(service: string, payload?: Object): Promise<void>;
147
172
 
148
173
  /**
149
- * Send a request to a {@link Service} and wait for a reply with a payload..
174
+ * Send a request to a {@apilink Service} and wait for a reply with a payload..
150
175
  *
151
176
  * @param service the service id
152
177
  * @param payload the message payload
@@ -155,7 +180,7 @@ export class Service {
155
180
  static get(service: string, payload: Object): Promise<Object>;
156
181
 
157
182
  /**
158
- * Send a request to a {@link Service} and subscribe to notifications published from that service.
183
+ * Send a request to a {@apilink Service} and subscribe to notifications published from that service.
159
184
  *
160
185
  * @param service the service id
161
186
  * @param context the context used to link its lifecycle to this subscription
@@ -181,27 +206,32 @@ export class Auth {
181
206
 
182
207
  /**
183
208
  * Return the current state of the authentication manager
209
+ * @return the current state
184
210
  */
185
211
  static getState(): AuthState;
186
212
 
187
213
  /**
188
214
  * Return the token currently used to identify the current session.
215
+ * @return The current token
189
216
  */
190
217
  static getToken(): string;
191
218
 
192
219
  /**
193
220
  * Return the IDP token (zipped & base64 encoded XML) for the current user.
221
+ * @return The current IDP token
194
222
  */
195
223
  static getIDPToken(): string;
196
224
 
197
225
  /**
198
- * Returns an Observable that is updated each time the user tag changes.
226
+ * Returns an `Observable` that is updated each time the user tag changes.
199
227
  * @param context The brick context
228
+ * @return An `Observable`
200
229
  */
201
230
  static observeUser(context: Context): Observable<string>
202
231
 
203
232
  /**
204
233
  * Return the tag of the current authenticated user.
234
+ * @return The tag of the current user
205
235
  */
206
236
  static getCurrentUser(): string
207
237
 
@@ -240,7 +270,7 @@ export class Auth {
240
270
  * Try to login using SAML protocol with the specified username and password.
241
271
  * Returns a promise resolved when logged in or that catches an error if refused.
242
272
  *
243
- * @deprecated use {@link Auth#loginSSO} instead
273
+ * @deprecated use {@apilink Auth.loginSSO} instead
244
274
  * @throws {Error} If the provider's configuration is incorrect.
245
275
  */
246
276
  static loginSAML(): Promise<void>;
@@ -249,7 +279,7 @@ export class Auth {
249
279
  * Try to login using the configured OpenID Provider.
250
280
  * Returns a promise resolved when logged in or that catches an error if the login is not valid.
251
281
  *
252
- * @deprecated use {@link Auth#loginSSO} instead
282
+ * @deprecated use {@apilink Auth.loginSSO} instead
253
283
  * @throws {Error} If the provider's configuration is incorrect.
254
284
  */
255
285
  static loginOpenID(): Promise<void>;