@olympeio/runtime-node 9.3.1 → 9.4.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.
Files changed (28) hide show
  1. package/import/dcInitConfig.json +1 -1
  2. package/import/olympe.dm/datamodel/00_bootstrap.newInst.json +1 -1
  3. package/import/olympe.dm/datamodel/00_bootstrap.newRel.json +1 -1
  4. package/import/olympe.dm/datamodel/01_primitives.newInst.json +1 -1
  5. package/import/olympe.dm/datamodel/01_primitives.newRel.json +1 -1
  6. package/import/olympe.dm/datamodel/02_permissions.newInst.json +1 -1
  7. package/import/olympe.dm/datamodel/02_permissions.newRel.json +1 -1
  8. package/import/olympe.dm/datamodel/03_file.newInst.json +1 -1
  9. package/import/olympe.dm/datamodel/03_file.newRel.json +1 -1
  10. package/import/olympe.dm/datamodel/04_modules.newInst.json +1 -1
  11. package/import/olympe.dm/datamodel/04_modules.newRel.json +1 -1
  12. package/import/olympe.dm/datamodel/05_permission_schema.newInst.json +1 -1
  13. package/import/olympe.dm/datamodel/05_permission_schema.newRel.json +1 -1
  14. package/import/olympe.dm/datamodel/05_permission_schema.updateInst.json +1 -1
  15. package/import/olympe.dm/datamodel/06_structure.newInst.json +1 -1
  16. package/import/olympe.dm/datamodel/06_structure.newRel.json +1 -1
  17. package/import/olympe.sc/datamodel/00_primordial.newInst.json +1 -1
  18. package/import/olympe.sc/datamodel/00_primordial.newRel.json +1 -1
  19. package/import/olympe.sc/datamodel/01_language.newInst.json +1 -1
  20. package/import/olympe.sc/datamodel/01_language.newRel.json +1 -1
  21. package/import/olympe.sc/datamodel/02_bricks.newInst.json +1 -1
  22. package/import/olympe.sc/datamodel/02_bricks.newRel.json +1 -1
  23. package/index.js +765 -832
  24. package/package.json +7 -10
  25. package/types/base.d.ts +22 -2
  26. package/types/cloud.d.ts +458 -44
  27. package/types/runtime.d.ts +4 -3
  28. package/types/utils.d.ts +47 -3
@@ -164,13 +164,15 @@ export abstract class Brick extends CloudObject {
164
164
 
165
165
  /**
166
166
  * Return the list of inputs tags as an ordered array.
167
+ * @const
167
168
  */
168
- readonly getInputs: () => string[];
169
+ getInputs(): string[];
169
170
 
170
171
  /**
171
172
  * Return the list of outputs tags as an ordered array
173
+ * @const
172
174
  */
173
- readonly getOutputs: () => string[];
175
+ getOutputs(): string[];
174
176
 
175
177
  /**
176
178
  * Run the brick itself using the specified context.
@@ -284,4 +286,3 @@ export abstract class VisualBrick extends Brick {
284
286
  */
285
287
  protected draw($: BrickContext, domElement: Element);
286
288
  }
287
-
package/types/utils.d.ts CHANGED
@@ -129,6 +129,20 @@ export class ServiceRequest {
129
129
  fail(error: Error): Promise<void>;
130
130
  }
131
131
 
132
+ interface ServiceConfig {
133
+ /**
134
+ * After how much time (in ms) the message must be considered as timeout by the service.
135
+ */
136
+ timeout?: number
137
+ }
138
+
139
+ interface SubscriptionServiceConfig extends ServiceConfig {
140
+ /**
141
+ * A callback to be called in case the subscription to the service is re-sent to the service (eg: after a reconnection).
142
+ */
143
+ onRetry?: () => void;
144
+ }
145
+
132
146
  /**
133
147
  * A service that processes requests coming from other VMs connected to the data cloud.
134
148
  */
@@ -166,18 +180,20 @@ export class Service {
166
180
  *
167
181
  * @param service the service id
168
182
  * @param payload the message payload, optional
183
+ * @param config optional parameters for the message
169
184
  * @return a Promise that completes when the call has been executed
170
185
  */
171
- static send(service: string, payload?: Object): Promise<void>;
186
+ static send(service: string, payload?: Object, config?: ServiceConfig): Promise<void>;
172
187
 
173
188
  /**
174
189
  * Send a request to a {@apilink Service} and wait for a reply with a payload..
175
190
  *
176
191
  * @param service the service id
177
192
  * @param payload the message payload
193
+ * @param config optional parameters for the message
178
194
  * @return a Promise wrapping the resulting value
179
195
  */
180
- static get(service: string, payload: Object): Promise<Object>;
196
+ static get(service: string, payload: Object, config?: ServiceConfig): Promise<Object>;
181
197
 
182
198
  /**
183
199
  * Send a request to a {@apilink Service} and subscribe to notifications published from that service.
@@ -185,17 +201,43 @@ export class Service {
185
201
  * @param service the service id
186
202
  * @param context the context used to link its lifecycle to this subscription
187
203
  * @param payload the message payload, optional
204
+ * @param config optional parameters for the message
188
205
  * @return an Observable emitting notifications
189
206
  */
190
- static observe(service: string, context: Context, payload?: Object): Observable<Object>;
207
+ static observe(service: string, context: Context, payload?: Object, config?: SubscriptionServiceConfig): Observable<Object>;
191
208
  }
192
209
 
193
210
  // -- Authentication --
211
+
212
+ declare type UserToken = {
213
+ user: string, // The username
214
+ userTag: string, // Tag of the User in the datacloud
215
+ nonce: string, // Nonce that identify the user in the auth service of Olympe
216
+ protocol: AuthProtocol, // The protocol used to authenticate the user
217
+ idpName: string, // The name of the IDP used to authenticate the user
218
+ payload: Object // The raw payload sent by the IDP (ie: JWT for 0Auth2 or SAML response or empty for SP)
219
+ }
220
+
221
+ declare enum AuthProtocol {
222
+ SAML = 'saml',
223
+ OAUTH2 = 'oauth2',
224
+ SRP = 'srp'
225
+ }
226
+
194
227
  /**
195
228
  * A static class that gathers all the required methods to handle the authentication and sessions with Olympe.
196
229
  */
197
230
  export class Auth {
198
231
 
232
+ /**
233
+ * Returns the full token of the current user. It contains:
234
+ * - the username, the unique ID of the user for the IDP used
235
+ * - the tag of the user in the datacloud
236
+ * - the protocol and IDP used
237
+ * - the raw payload sent by the IDP (eg: JWT for OAuth2 or SAML response).
238
+ */
239
+ static getUserToken(): UserToken;
240
+
199
241
  /**
200
242
  * Based on the username and password, it generates a salt and verifier to configure a SRP user
201
243
  *
@@ -212,12 +254,14 @@ export class Auth {
212
254
 
213
255
  /**
214
256
  * Return the token currently used to identify the current session.
257
+ * @deprecated see {@apilink Auth.getUserToken}
215
258
  * @return The current token
216
259
  */
217
260
  static getToken(): string;
218
261
 
219
262
  /**
220
263
  * Return the IDP token (zipped & base64 encoded XML) for the current user.
264
+ * @deprecated use {@apilink Auth.getUserToken} instead
221
265
  * @return The current IDP token
222
266
  */
223
267
  static getIDPToken(): string;