@olympeio/runtime-node 9.8.1 → 9.9.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/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@olympeio/runtime-node",
3
- "version": "9.8.1",
3
+ "version": "9.9.1",
4
4
  "description": "Olympe Node Runtime Environment",
5
5
  "types": "types/index.d.ts",
6
6
  "dependencies": {
7
- "ws": "~8.11.0",
8
- "bufferutil": "~4.0.7",
9
- "utf-8-validate": "~5.0.10",
10
- "rxjs": "7.8.1",
11
- "fastify": "~4.24.3"
7
+ "ws": "~8.18.0",
8
+ "bufferutil": "~4.0.8",
9
+ "utf-8-validate": "~6.0.4",
10
+ "rxjs": "~7.8.1",
11
+ "fastify": "~4.28.1"
12
12
  },
13
13
  "codeAsData": "import",
14
14
  "author": "Olympe S.A. <dev@olympe.ch>",
package/types/cloud.d.ts CHANGED
@@ -169,28 +169,58 @@ export class File extends CloudObject {
169
169
  static createFromURL(transaction: Transaction, name: string, url: string, mimeType?: string, source?: Source, tag?: string): string;
170
170
 
171
171
  /**
172
- * Retrieve content from this file asynchronously
172
+ * Gets the file content as an ArrayBuffer.
173
173
  *
174
- * @param onSuccess callback to execute when byte content has been retrieved successfully
175
- * @param onFailure callback to execute when content retrieval has failed
174
+ * @deprecated consider using the new `getContentAsBinary` method returning a Promise instead
175
+ * @param onSuccess (deprecated) callback to execute when byte content has been retrieved successfully
176
+ * @param onFailure (deprecated) callback to execute when content retrieval has failed
176
177
  */
177
- getContentAsBinary(onSuccess: (content: ArrayBuffer) => void, onFailure?: (errMsg: string) => void): void;
178
+ getContentAsBinary(onSuccess: (content: ArrayBuffer) => void, onFailure?: (errMsg: string) => void);
178
179
 
179
180
  /**
180
- * Retrieve string content from this file asynchronously
181
+ * Gets the file content as an ArrayBuffer.
181
182
  *
182
- * @param onSuccess callback to execute when string content has been retrieved successfully
183
- * @param onFailure callback to execute when content retrieval has failed
183
+ * @return promise resolving with the content as a byte array
184
184
  */
185
- getContentAsString(onSuccess: (content: string) => void, onFailure?: (errMsg: string) => void): void;
185
+ getContentAsBinary():Promise<ArrayBuffer>;
186
186
 
187
187
  /**
188
- * Retrieve string content from URL asynchronously
188
+ * Get the content of this file and returns it as an UTF-8 string.
189
+ * **Note:** this method should be used only when the file is a text file.
189
190
  *
190
- * @param onSuccess callback to execute when content has been retrieved successfully
191
- * @param onFailure callback to execute when content retrieval has failed
191
+ * @deprecated consider using the new `getContentAsString` method returning a Promise instead
192
+ * @param onSuccess (deprecated) callback to execute when string content has been retrieved successfully
193
+ * @param onFailure (deprecated) callback to execute when content retrieval has failed
192
194
  */
193
- getContentUrl(onSuccess: (content: string) => void, onFailure?: () => void): void;
195
+ getContentAsString(onSuccess: (content: string) => void, onFailure?: (errMsg: string) => void);
196
+
197
+ /**
198
+ * Get the content of this file and returns it as an UTF-8 string.
199
+ * **Note:** this method should be used only when the file is a text file.
200
+ *
201
+ * @return promise resolving with the content as a string
202
+ */
203
+ getContentAsString(): Promise<string>;
204
+
205
+ /**
206
+ * Gets the URL that gives direct access to the file content:
207
+ * - For files that are external to Olympe, gives the normal URL
208
+ * - For the files stored by Olympe, provides a dataURL, with the content embedded in Base64
209
+ *
210
+ * @deprecated consider using the new `getContentUrl` method returning a Promise instead
211
+ * @param onSuccess (deprecated) callback to execute when content has been retrieved successfully
212
+ * @param onFailure (deprecated) callback to execute when content retrieval has failed
213
+ */
214
+ getContentUrl(onSuccess: (content: string) => void, onFailure?: () => void);
215
+
216
+ /**
217
+ * Gets the URL that gives direct access to the file content:
218
+ * - For files that are external to Olympe, gives the normal URL
219
+ * - For the files stored by Olympe, provides a dataURL, with the content embedded in Base64
220
+ *
221
+ * @return promise resolving with the content as a string
222
+ */
223
+ getContentUrl(): Promise<string>;
194
224
 
195
225
  /**
196
226
  * Save this file with specified name
@@ -144,11 +144,12 @@ export class BrickContext extends Context {
144
144
 
145
145
  /**
146
146
  * Return the closest parent of a given type
147
+ * If no context of the specified type is found from the hierarchy, returns the root context.
147
148
  *
148
149
  * @param selector the context selector
149
150
  * @param selector.modelTag tag of the "type" of context you want to find in the parent tree
150
151
  */
151
- getClosest(selector: {modelTag: InstanceOrTag}): BrickContext | null;
152
+ getClosest(selector: {modelTag: InstanceOrTag}): BrickContext;
152
153
 
153
154
  /**
154
155
  * Listen to the creation of the context with the specified id.
package/types/utils.d.ts CHANGED
@@ -19,6 +19,18 @@ export class Config {
19
19
  static getParameter(id: string): unknown | undefined;
20
20
  }
21
21
 
22
+ /**
23
+ * Types of probe that can be used to check the health of the process:
24
+ * - LIVENESS: used to check if the process is alive
25
+ * - READINESS: used to check if the process is ready to operate
26
+ * - ALL: used to check both liveness and readiness
27
+ */
28
+ export enum ProbeType {
29
+ LIVENESS = 'liveness',
30
+ READINESS = 'readiness',
31
+ ALL = 'all'
32
+ }
33
+
22
34
  // Health check and shutdown
23
35
  export class Process {
24
36
 
@@ -29,10 +41,15 @@ export class Process {
29
41
  * The callback must return a Promise which returns a string as valid message.
30
42
  * The process is considered by the runtime as unhealthy if the promise is rejected.
31
43
  *
44
+ * The options parameter can be used to specify the type of probe to register:
45
+ * - LIVENESS: used to check if the process is alive
46
+ * - READINESS: used to check if the process is ready to operate
47
+ * - ALL: used to check both liveness and readiness
48
+ *
32
49
  * @param callback the callback executed each time the runtime check the health of the process.
33
- * @param healthCheckId optional id to name the healthCheck hook, mainly for debug purpose
50
+ * @param options options to specify the type of probe to register
34
51
  */
35
- static onHealthCheck(callback: () => Promise<string>, healthCheckId?: string): () => void;
52
+ static onHealthCheck(callback: () => Promise<string>, options?: {type: ProbeType}): () => void;
36
53
 
37
54
  /**
38
55
  * Static method to register a callback called by the runtime when it receives the signal to be terminated.