@olympeio/runtime-node 9.3.1 → 9.4.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/dcInitConfig.json +1 -1
- package/import/olympe.dm/datamodel/00_bootstrap.newInst.json +1 -1
- package/import/olympe.dm/datamodel/00_bootstrap.newRel.json +1 -1
- package/import/olympe.dm/datamodel/01_primitives.newInst.json +1 -1
- package/import/olympe.dm/datamodel/01_primitives.newRel.json +1 -1
- package/import/olympe.dm/datamodel/02_permissions.newInst.json +1 -1
- package/import/olympe.dm/datamodel/02_permissions.newRel.json +1 -1
- package/import/olympe.dm/datamodel/03_file.newInst.json +1 -1
- package/import/olympe.dm/datamodel/03_file.newRel.json +1 -1
- package/import/olympe.dm/datamodel/04_modules.newInst.json +1 -1
- package/import/olympe.dm/datamodel/04_modules.newRel.json +1 -1
- package/import/olympe.dm/datamodel/05_permission_schema.newInst.json +1 -1
- package/import/olympe.dm/datamodel/05_permission_schema.newRel.json +1 -1
- 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.dm/datamodel/06_structure.newRel.json +1 -1
- package/import/olympe.sc/datamodel/00_primordial.newInst.json +1 -1
- package/import/olympe.sc/datamodel/00_primordial.newRel.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/import/olympe.sc/datamodel/02_bricks.newInst.json +1 -1
- package/import/olympe.sc/datamodel/02_bricks.newRel.json +1 -1
- package/index.js +770 -832
- package/package.json +7 -10
- package/types/base.d.ts +22 -2
- package/types/cloud.d.ts +458 -44
- package/types/runtime.d.ts +4 -3
- package/types/utils.d.ts +86 -5
package/types/runtime.d.ts
CHANGED
|
@@ -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
|
-
|
|
169
|
+
getInputs(): string[];
|
|
169
170
|
|
|
170
171
|
/**
|
|
171
172
|
* Return the list of outputs tags as an ordered array
|
|
173
|
+
* @const
|
|
172
174
|
*/
|
|
173
|
-
|
|
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
|
@@ -78,6 +78,17 @@ export class ErrorFlow {
|
|
|
78
78
|
getCode(): number;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Types of requests that can be received in a Service.
|
|
83
|
+
* This is used to know what method call on the request to answer the requester.
|
|
84
|
+
*/
|
|
85
|
+
export type ServiceRequestType = {
|
|
86
|
+
PUBLISH,
|
|
87
|
+
SEND,
|
|
88
|
+
GET,
|
|
89
|
+
SUBSCRIBE
|
|
90
|
+
};
|
|
91
|
+
|
|
81
92
|
/**
|
|
82
93
|
* A request consumed by a service.
|
|
83
94
|
*/
|
|
@@ -90,6 +101,13 @@ export class ServiceRequest {
|
|
|
90
101
|
*/
|
|
91
102
|
userTag(): Promise<string>;
|
|
92
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Return the type of this Service Request
|
|
106
|
+
*
|
|
107
|
+
* @return the type of this request.
|
|
108
|
+
*/
|
|
109
|
+
requestType(): ServiceRequestType;
|
|
110
|
+
|
|
93
111
|
/**
|
|
94
112
|
* Get the request body.
|
|
95
113
|
*
|
|
@@ -114,11 +132,13 @@ export class ServiceRequest {
|
|
|
114
132
|
|
|
115
133
|
/**
|
|
116
134
|
* Send the topic where the requester should listen to get notifications. Used for OBSERVE requests.
|
|
135
|
+
* The string returned by the Promise is the id of that subscription. It can be used in parallel with
|
|
136
|
+
* the {@apilink Service.setUnsubscriptionHandler} method of the service to execute instructions when a subscription is removed.
|
|
117
137
|
*
|
|
118
138
|
* @param topic the topic where the client should
|
|
119
|
-
* @return a Promise that completes once the
|
|
139
|
+
* @return a Promise that completes once the consumer has started to the listen to notifications. The
|
|
120
140
|
*/
|
|
121
|
-
notifyOn(topic: string): Promise<
|
|
141
|
+
notifyOn(topic: string): Promise<string>;
|
|
122
142
|
|
|
123
143
|
/**
|
|
124
144
|
* Reply to the request with and error.
|
|
@@ -129,6 +149,20 @@ export class ServiceRequest {
|
|
|
129
149
|
fail(error: Error): Promise<void>;
|
|
130
150
|
}
|
|
131
151
|
|
|
152
|
+
interface ServiceConfig {
|
|
153
|
+
/**
|
|
154
|
+
* After how much time (in ms) the message must be considered as timeout by the service.
|
|
155
|
+
*/
|
|
156
|
+
timeout?: number
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
interface SubscriptionServiceConfig extends ServiceConfig {
|
|
160
|
+
/**
|
|
161
|
+
* A callback to be called in case the subscription to the service is re-sent to the service (eg: after a reconnection).
|
|
162
|
+
*/
|
|
163
|
+
onRetry?: () => void;
|
|
164
|
+
}
|
|
165
|
+
|
|
132
166
|
/**
|
|
133
167
|
* A service that processes requests coming from other VMs connected to the data cloud.
|
|
134
168
|
*/
|
|
@@ -148,6 +182,16 @@ export class Service {
|
|
|
148
182
|
*/
|
|
149
183
|
listen(): Observable<ServiceRequest>;
|
|
150
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Set a function to be executed each time a subscription to that service is closed.
|
|
187
|
+
* The function receives the subscription id that has been closed.
|
|
188
|
+
* The subscription id is the one that has been set and returned by the {@apilink ServiceRequest.notifyOn} method.
|
|
189
|
+
*
|
|
190
|
+
* @param handler the handler function to be executed when a subscription is closed.
|
|
191
|
+
* @return this Service instance.
|
|
192
|
+
*/
|
|
193
|
+
setUnsubscriptionHandler(handler: (subId: string) => void): this
|
|
194
|
+
|
|
151
195
|
/**
|
|
152
196
|
* Stop the service.
|
|
153
197
|
*/
|
|
@@ -166,18 +210,20 @@ export class Service {
|
|
|
166
210
|
*
|
|
167
211
|
* @param service the service id
|
|
168
212
|
* @param payload the message payload, optional
|
|
213
|
+
* @param config optional parameters for the message
|
|
169
214
|
* @return a Promise that completes when the call has been executed
|
|
170
215
|
*/
|
|
171
|
-
static send(service: string, payload?: Object): Promise<void>;
|
|
216
|
+
static send(service: string, payload?: Object, config?: ServiceConfig): Promise<void>;
|
|
172
217
|
|
|
173
218
|
/**
|
|
174
219
|
* Send a request to a {@apilink Service} and wait for a reply with a payload..
|
|
175
220
|
*
|
|
176
221
|
* @param service the service id
|
|
177
222
|
* @param payload the message payload
|
|
223
|
+
* @param config optional parameters for the message
|
|
178
224
|
* @return a Promise wrapping the resulting value
|
|
179
225
|
*/
|
|
180
|
-
static get(service: string, payload: Object): Promise<Object>;
|
|
226
|
+
static get(service: string, payload: Object, config?: ServiceConfig): Promise<Object>;
|
|
181
227
|
|
|
182
228
|
/**
|
|
183
229
|
* Send a request to a {@apilink Service} and subscribe to notifications published from that service.
|
|
@@ -185,17 +231,43 @@ export class Service {
|
|
|
185
231
|
* @param service the service id
|
|
186
232
|
* @param context the context used to link its lifecycle to this subscription
|
|
187
233
|
* @param payload the message payload, optional
|
|
234
|
+
* @param config optional parameters for the message
|
|
188
235
|
* @return an Observable emitting notifications
|
|
189
236
|
*/
|
|
190
|
-
static observe(service: string, context: Context, payload?: Object): Observable<Object>;
|
|
237
|
+
static observe(service: string, context: Context, payload?: Object, config?: SubscriptionServiceConfig): Observable<Object>;
|
|
191
238
|
}
|
|
192
239
|
|
|
193
240
|
// -- Authentication --
|
|
241
|
+
|
|
242
|
+
declare type UserToken = {
|
|
243
|
+
user: string, // The username
|
|
244
|
+
userTag: string, // Tag of the User in the datacloud
|
|
245
|
+
nonce: string, // Nonce that identify the user in the auth service of Olympe
|
|
246
|
+
protocol: AuthProtocol, // The protocol used to authenticate the user
|
|
247
|
+
idpName: string, // The name of the IDP used to authenticate the user
|
|
248
|
+
payload: Object // The raw payload sent by the IDP (ie: JWT for 0Auth2 or SAML response or empty for SP)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
declare enum AuthProtocol {
|
|
252
|
+
SAML = 'saml',
|
|
253
|
+
OAUTH2 = 'oauth2',
|
|
254
|
+
SRP = 'srp'
|
|
255
|
+
}
|
|
256
|
+
|
|
194
257
|
/**
|
|
195
258
|
* A static class that gathers all the required methods to handle the authentication and sessions with Olympe.
|
|
196
259
|
*/
|
|
197
260
|
export class Auth {
|
|
198
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Returns the full token of the current user. It contains:
|
|
264
|
+
* - the username, the unique ID of the user for the IDP used
|
|
265
|
+
* - the tag of the user in the datacloud
|
|
266
|
+
* - the protocol and IDP used
|
|
267
|
+
* - the raw payload sent by the IDP (eg: JWT for OAuth2 or SAML response).
|
|
268
|
+
*/
|
|
269
|
+
static getUserToken(): UserToken;
|
|
270
|
+
|
|
199
271
|
/**
|
|
200
272
|
* Based on the username and password, it generates a salt and verifier to configure a SRP user
|
|
201
273
|
*
|
|
@@ -212,16 +284,25 @@ export class Auth {
|
|
|
212
284
|
|
|
213
285
|
/**
|
|
214
286
|
* Return the token currently used to identify the current session.
|
|
287
|
+
* @deprecated see {@apilink Auth.getUserToken}
|
|
215
288
|
* @return The current token
|
|
216
289
|
*/
|
|
217
290
|
static getToken(): string;
|
|
218
291
|
|
|
219
292
|
/**
|
|
220
293
|
* Return the IDP token (zipped & base64 encoded XML) for the current user.
|
|
294
|
+
* @deprecated use {@apilink Auth.getUserToken} instead
|
|
221
295
|
* @return The current IDP token
|
|
222
296
|
*/
|
|
223
297
|
static getIDPToken(): string;
|
|
224
298
|
|
|
299
|
+
/**
|
|
300
|
+
* Refresh the expiration time for the current authentication token
|
|
301
|
+
*
|
|
302
|
+
* @return Promise success when the refresh is done
|
|
303
|
+
*/
|
|
304
|
+
static refreshToken(): Promise<void>;
|
|
305
|
+
|
|
225
306
|
/**
|
|
226
307
|
* Returns an `Observable` that is updated each time the user tag changes.
|
|
227
308
|
* @param context The brick context
|