@optimizely-opal/opal-tools-sdk 0.1.3-dev → 0.1.5-dev
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/README.md +5 -1
- package/dist/models.d.ts +10 -3
- package/dist/models.js +11 -4
- package/package.json +6 -7
- package/src/models.ts +13 -4
package/README.md
CHANGED
|
@@ -215,7 +215,9 @@ async function getWeather(parameters: WeatherParameters) {
|
|
|
215
215
|
'/tools/get_weather',
|
|
216
216
|
'update'
|
|
217
217
|
)
|
|
218
|
-
]
|
|
218
|
+
],
|
|
219
|
+
'button', // Optional island type
|
|
220
|
+
'plus' // Optional island icon
|
|
219
221
|
);
|
|
220
222
|
|
|
221
223
|
return IslandResponse.create([island]);
|
|
@@ -245,6 +247,8 @@ Actions represent buttons or operations:
|
|
|
245
247
|
Contains the complete island configuration:
|
|
246
248
|
- `fields`: Array of IslandConfig.Field objects
|
|
247
249
|
- `actions`: Array of IslandConfig.Action objects
|
|
250
|
+
- `type`: Optional island type for custom rendering (optional)
|
|
251
|
+
- `icon`: Optional icon identifier for the island (optional)
|
|
248
252
|
|
|
249
253
|
#### IslandResponse
|
|
250
254
|
The response wrapper for islands:
|
package/dist/models.d.ts
CHANGED
|
@@ -175,14 +175,18 @@ export declare class IslandAction {
|
|
|
175
175
|
export declare class IslandConfig {
|
|
176
176
|
fields: IslandField[];
|
|
177
177
|
actions: IslandAction[];
|
|
178
|
+
type?: string | undefined;
|
|
179
|
+
icon?: string | undefined;
|
|
178
180
|
static Field: typeof IslandField;
|
|
179
181
|
static Action: typeof IslandAction;
|
|
180
182
|
/**
|
|
181
183
|
* Create a new island configuration
|
|
182
184
|
* @param fields List of island fields
|
|
183
185
|
* @param actions List of island actions
|
|
186
|
+
* @param type Optional island type
|
|
187
|
+
* @param icon Optional island icon
|
|
184
188
|
*/
|
|
185
|
-
constructor(fields: IslandField[], actions: IslandAction[]);
|
|
189
|
+
constructor(fields: IslandField[], actions: IslandAction[], type?: string | undefined, icon?: string | undefined);
|
|
186
190
|
/**
|
|
187
191
|
* Convert to JSON for the discovery endpoint
|
|
188
192
|
*/
|
|
@@ -242,19 +246,22 @@ export declare class IslandResponseConfig {
|
|
|
242
246
|
*/
|
|
243
247
|
export declare class IslandResponse {
|
|
244
248
|
config: IslandResponseConfig;
|
|
249
|
+
message?: string | undefined;
|
|
245
250
|
static ResponseConfig: typeof IslandResponseConfig;
|
|
246
251
|
type: "island";
|
|
247
252
|
/**
|
|
248
253
|
* Create a new island response
|
|
249
254
|
* @param config Response configuration
|
|
255
|
+
* @param message Optional message for the island response
|
|
250
256
|
*/
|
|
251
|
-
constructor(config: IslandResponseConfig);
|
|
257
|
+
constructor(config: IslandResponseConfig, message?: string | undefined);
|
|
252
258
|
/**
|
|
253
259
|
* Create an island response with a list of islands
|
|
254
260
|
* @param islands List of island configurations
|
|
261
|
+
* @param message Optional message for the island response
|
|
255
262
|
* @returns New IslandResponse instance
|
|
256
263
|
*/
|
|
257
|
-
static create(islands: IslandConfig[]): IslandResponse;
|
|
264
|
+
static create(islands: IslandConfig[], message?: string): IslandResponse;
|
|
258
265
|
/**
|
|
259
266
|
* Convert to JSON for the discovery endpoint
|
|
260
267
|
*/
|
package/dist/models.js
CHANGED
|
@@ -188,10 +188,14 @@ class IslandConfig {
|
|
|
188
188
|
* Create a new island configuration
|
|
189
189
|
* @param fields List of island fields
|
|
190
190
|
* @param actions List of island actions
|
|
191
|
+
* @param type Optional island type
|
|
192
|
+
* @param icon Optional island icon
|
|
191
193
|
*/
|
|
192
|
-
constructor(fields, actions) {
|
|
194
|
+
constructor(fields, actions, type, icon) {
|
|
193
195
|
this.fields = fields;
|
|
194
196
|
this.actions = actions;
|
|
197
|
+
this.type = type;
|
|
198
|
+
this.icon = icon;
|
|
195
199
|
}
|
|
196
200
|
/**
|
|
197
201
|
* Convert to JSON for the discovery endpoint
|
|
@@ -234,18 +238,21 @@ class IslandResponse {
|
|
|
234
238
|
/**
|
|
235
239
|
* Create a new island response
|
|
236
240
|
* @param config Response configuration
|
|
241
|
+
* @param message Optional message for the island response
|
|
237
242
|
*/
|
|
238
|
-
constructor(config) {
|
|
243
|
+
constructor(config, message) {
|
|
239
244
|
this.config = config;
|
|
245
|
+
this.message = message;
|
|
240
246
|
this.type = "island";
|
|
241
247
|
}
|
|
242
248
|
/**
|
|
243
249
|
* Create an island response with a list of islands
|
|
244
250
|
* @param islands List of island configurations
|
|
251
|
+
* @param message Optional message for the island response
|
|
245
252
|
* @returns New IslandResponse instance
|
|
246
253
|
*/
|
|
247
|
-
static create(islands) {
|
|
248
|
-
return new IslandResponse(new IslandResponseConfig(islands));
|
|
254
|
+
static create(islands, message) {
|
|
255
|
+
return new IslandResponse(new IslandResponseConfig(islands), message);
|
|
249
256
|
}
|
|
250
257
|
/**
|
|
251
258
|
* Convert to JSON for the discovery endpoint
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optimizely-opal/opal-tools-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5-dev",
|
|
4
4
|
"description": "SDK for creating Opal-compatible tools services",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,19 +19,18 @@
|
|
|
19
19
|
"author": "Optimizely",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"express": "^4.18.2",
|
|
23
|
-
"axios": "^1.6.0",
|
|
24
22
|
"reflect-metadata": "^0.1.13"
|
|
25
23
|
},
|
|
26
24
|
"devDependencies": {
|
|
27
|
-
"@types/express": "^4.17.17",
|
|
28
25
|
"@types/jest": "^29.5.3",
|
|
29
|
-
"@types/node": "^20.4.5",
|
|
30
26
|
"jest": "^29.6.2",
|
|
31
|
-
"ts-jest": "^29.1.1"
|
|
32
|
-
"typescript": "^5.1.6"
|
|
27
|
+
"ts-jest": "^29.1.1"
|
|
33
28
|
},
|
|
34
29
|
"peerDependencies": {
|
|
30
|
+
"typescript": "^5.1.6",
|
|
31
|
+
"@types/node": "^20.4.5",
|
|
32
|
+
"@types/express": "^4.17.17",
|
|
33
|
+
"axios": "^1.6.0",
|
|
35
34
|
"express": "^4.18.2"
|
|
36
35
|
},
|
|
37
36
|
"repository": {
|
package/src/models.ts
CHANGED
|
@@ -222,10 +222,14 @@ export class IslandConfig {
|
|
|
222
222
|
* Create a new island configuration
|
|
223
223
|
* @param fields List of island fields
|
|
224
224
|
* @param actions List of island actions
|
|
225
|
+
* @param type Optional island type
|
|
226
|
+
* @param icon Optional island icon
|
|
225
227
|
*/
|
|
226
228
|
constructor(
|
|
227
229
|
public fields: IslandField[],
|
|
228
|
-
public actions: IslandAction[]
|
|
230
|
+
public actions: IslandAction[],
|
|
231
|
+
public type?: string,
|
|
232
|
+
public icon?: string
|
|
229
233
|
) {}
|
|
230
234
|
|
|
231
235
|
/**
|
|
@@ -270,16 +274,21 @@ export class IslandResponse {
|
|
|
270
274
|
/**
|
|
271
275
|
* Create a new island response
|
|
272
276
|
* @param config Response configuration
|
|
277
|
+
* @param message Optional message for the island response
|
|
273
278
|
*/
|
|
274
|
-
constructor(
|
|
279
|
+
constructor(
|
|
280
|
+
public config: IslandResponseConfig,
|
|
281
|
+
public message?: string
|
|
282
|
+
) {}
|
|
275
283
|
|
|
276
284
|
/**
|
|
277
285
|
* Create an island response with a list of islands
|
|
278
286
|
* @param islands List of island configurations
|
|
287
|
+
* @param message Optional message for the island response
|
|
279
288
|
* @returns New IslandResponse instance
|
|
280
289
|
*/
|
|
281
|
-
static create(islands: IslandConfig[]): IslandResponse {
|
|
282
|
-
return new IslandResponse(new IslandResponseConfig(islands));
|
|
290
|
+
static create(islands: IslandConfig[], message?: string): IslandResponse {
|
|
291
|
+
return new IslandResponse(new IslandResponseConfig(islands), message);
|
|
283
292
|
}
|
|
284
293
|
|
|
285
294
|
/**
|