@epilot/app-client 0.15.0 → 0.16.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.
package/dist/openapi.d.ts CHANGED
@@ -314,7 +314,11 @@ declare namespace Components {
314
314
  surfaces?: {
315
315
  [key: string]: any;
316
316
  };
317
- } & (JourneyBlockComponent | PortalBlockComponent | PortalExtensionComponent | CustomFlowActionComponent | ErpInformToolkitComponent | CustomCapabilityComponent | ExternalProductCatalogComponent | CustomPageComponent | ApiProxyComponent);
317
+ } & (JourneyBlockComponent | PortalBlockComponent | PortalExtensionComponent | CustomFlowActionComponent | ErpInformToolkitComponent | CustomCapabilityComponent | ExternalProductCatalogComponent | CustomPageComponent | ApiProxyComponent | /**
318
+ * Exposes typed values resolved from an external system at runtime (e.g. a meter reading prediction). Consumers such as validation rules reference a hook and one of its results by id. Resolution is performed by the external-values-api on behalf of authenticated epilot 360 users and portal end customers.
319
+ *
320
+ */
321
+ ExternalValuesComponent);
318
322
  export interface BaseComponentCommon {
319
323
  /**
320
324
  * Unique identifier for the component
@@ -547,7 +551,7 @@ declare namespace Components {
547
551
  /**
548
552
  * Type of app component
549
553
  */
550
- export type ComponentType = "CUSTOM_JOURNEY_BLOCK" | "CUSTOM_PORTAL_BLOCK" | "PORTAL_EXTENSION" | "CUSTOM_FLOW_ACTION" | "ERP_INFORM_TOOLKIT" | "CUSTOM_CAPABILITY" | "EXTERNAL_PRODUCT_CATALOG" | "CUSTOM_PAGE" | "API_PROXY" | "APP_FUNCTION";
554
+ export type ComponentType = "CUSTOM_JOURNEY_BLOCK" | "CUSTOM_PORTAL_BLOCK" | "PORTAL_EXTENSION" | "CUSTOM_FLOW_ACTION" | "ERP_INFORM_TOOLKIT" | "CUSTOM_CAPABILITY" | "EXTERNAL_PRODUCT_CATALOG" | "CUSTOM_PAGE" | "API_PROXY" | "EXTERNAL_VALUES" | "APP_FUNCTION";
551
555
  /**
552
556
  * Configuration of the published app
553
557
  */
@@ -1264,6 +1268,167 @@ declare namespace Components {
1264
1268
  };
1265
1269
  };
1266
1270
  }
1271
+ /**
1272
+ * Exposes typed values resolved from an external system at runtime (e.g. a meter reading prediction). Consumers such as validation rules reference a hook and one of its results by id. Resolution is performed by the external-values-api on behalf of authenticated epilot 360 users and portal end customers.
1273
+ *
1274
+ */
1275
+ export interface ExternalValuesComponent {
1276
+ component_type: "EXTERNAL_VALUES";
1277
+ configuration: /* Configuration for an EXTERNAL_VALUES component */ ExternalValuesConfig;
1278
+ }
1279
+ /**
1280
+ * Configuration for an EXTERNAL_VALUES component
1281
+ */
1282
+ export interface ExternalValuesConfig {
1283
+ /**
1284
+ * Hooks exposed by this component. Hook ids must be unique within the component.
1285
+ */
1286
+ hooks: /**
1287
+ * One external call that returns one or more typed results. Interpolated templates (Liquid) have access to `Input`, `Context`, `Consumer`, `Options`, `Env` and — for `result` templates — `Response` and `AuthResponse`.
1288
+ *
1289
+ */
1290
+ ExternalValuesHook[];
1291
+ }
1292
+ /**
1293
+ * One external call that returns one or more typed results. Interpolated templates (Liquid) have access to `Input`, `Context`, `Consumer`, `Options`, `Env` and — for `result` templates — `Response` and `AuthResponse`.
1294
+ *
1295
+ */
1296
+ export interface ExternalValuesHook {
1297
+ /**
1298
+ * Stable identifier; consumers (e.g. validation rules) reference it. Renaming breaks references.
1299
+ */
1300
+ id: string; // ^[a-zA-Z0-9_-]{1,100}$
1301
+ name: TranslatedString;
1302
+ description?: TranslatedString;
1303
+ /**
1304
+ * Static request authentication applied to the call.
1305
+ * - `none`: no static authentication.
1306
+ * - `header`: sends `auth_secret` in header `auth_header` (default `X-API-Key`).
1307
+ * - `bearer`: sends `Authorization: Bearer <auth_secret>`.
1308
+ * - `hmac`: signs the request per Standard Webhooks (headers `webhook-id`,
1309
+ * `webhook-timestamp`, `webhook-signature` = `v1,<base64 HMAC-SHA256>` over
1310
+ * `<id>.<timestamp>.<body>`) using `auth_secret` as a `whsec_`-prefixed
1311
+ * base64 secret, exactly as epilot webhooks do.
1312
+ *
1313
+ * `auth_secret` is required when `auth_type` is `header`, `bearer` or `hmac`.
1314
+ * Combine with `auth` (a pre-call that fetches a token) when the target needs both.
1315
+ *
1316
+ */
1317
+ auth_type?: "none" | "header" | "bearer" | "hmac";
1318
+ /**
1319
+ * Header name used when `auth_type` is `header`. Defaults to `X-API-Key`.
1320
+ */
1321
+ auth_header?: string;
1322
+ /**
1323
+ * Liquid template resolving to the secret, e.g. "{{Options.api_key}}". Must reference an option declared with `type: secret`; literals are rejected. Required when `auth_type` is `header`, `bearer` or `hmac`.
1324
+ * example:
1325
+ * {{Options.api_key}}
1326
+ */
1327
+ auth_secret?: string;
1328
+ auth?: PortalExtensionAuthBlock;
1329
+ call: {
1330
+ /**
1331
+ * HTTP method to use for the call
1332
+ */
1333
+ method?: "GET" | "POST" | "PUT" | "PATCH";
1334
+ /**
1335
+ * URL to call. Supports variable interpolation.
1336
+ */
1337
+ url: string;
1338
+ /**
1339
+ * Headers to send with the call. Supports variable interpolation.
1340
+ */
1341
+ headers?: {
1342
+ [name: string]: string;
1343
+ };
1344
+ /**
1345
+ * Query parameters to append to the URL. Supports variable interpolation.
1346
+ */
1347
+ params?: {
1348
+ [name: string]: string;
1349
+ };
1350
+ /**
1351
+ * JSON body to send. Values support variable interpolation. When omitted, `{ Input, Context, Consumer }` is sent as-is.
1352
+ */
1353
+ body?: {
1354
+ [name: string]: any;
1355
+ };
1356
+ };
1357
+ /**
1358
+ * Typed results extracted from the response. Result ids must be unique within the hook.
1359
+ */
1360
+ result: [
1361
+ /**
1362
+ * A single typed value extracted from the hook response. Exactly one of `template`, `path` or `jsonata` must be set.
1363
+ *
1364
+ */
1365
+ ExternalValuesResult,
1366
+ .../**
1367
+ * A single typed value extracted from the hook response. Exactly one of `template`, `path` or `jsonata` must be set.
1368
+ *
1369
+ */
1370
+ ExternalValuesResult[]
1371
+ ];
1372
+ /**
1373
+ * Timeout for the external call in milliseconds.
1374
+ */
1375
+ timeout_ms?: number;
1376
+ /**
1377
+ * Behaviour when the external system is unavailable (timeout, network or upstream error). `skip`: consumers ignore conditions depending on this hook. `block`: consumers treat the dependent action as not allowed.
1378
+ */
1379
+ on_unavailable?: "skip" | "block";
1380
+ /**
1381
+ * Response caching. Off when omitted.
1382
+ */
1383
+ cache?: {
1384
+ /**
1385
+ * Time to live in seconds. 0 disables caching.
1386
+ */
1387
+ ttl_seconds: number;
1388
+ /**
1389
+ * Liquid template for the cache key. Defaults to a hash of org, app, hook, `Input` and `Context`.
1390
+ */
1391
+ key?: string;
1392
+ };
1393
+ /**
1394
+ * If set, requests are sent from epilot's static egress IPs. Mutually exclusive with secure_proxy.
1395
+ */
1396
+ use_static_ips?: boolean;
1397
+ secure_proxy?: /* If set, requests are routed through the ERP Integration secure proxy. Mutually exclusive with use_static_ips. */ PortalExtensionSecureProxy;
1398
+ }
1399
+ /**
1400
+ * A single typed value extracted from the hook response. Exactly one of `template`, `path` or `jsonata` must be set.
1401
+ *
1402
+ */
1403
+ export interface ExternalValuesResult {
1404
+ /**
1405
+ * Stable identifier of the result within the hook. Renaming breaks references.
1406
+ */
1407
+ id: string; // ^[a-zA-Z0-9_-]{1,100}$
1408
+ /**
1409
+ * Type the extracted value is coerced to.
1410
+ */
1411
+ type: "number" | "text" | "date" | "boolean";
1412
+ name: TranslatedString;
1413
+ /**
1414
+ * Liquid template over `Response` etc.; output coerced to `type`.
1415
+ * example:
1416
+ * {{Response.value}}
1417
+ */
1418
+ template?: string;
1419
+ /**
1420
+ * Dot path into the response body, e.g. "data.limit".
1421
+ * example:
1422
+ * data.limit
1423
+ */
1424
+ path?: string;
1425
+ /**
1426
+ * JSONata expression over `{ Response, Input, Context, Options, Env }`.
1427
+ * example:
1428
+ * $sum(Response.items.amount)
1429
+ */
1430
+ jsonata?: string;
1431
+ }
1267
1432
  /**
1268
1433
  * A named server-side function belonging to the app. Runs in the epilot code-execution sandbox with an installation-scoped app token. Functions with a schedule are executed automatically once per installation.
1269
1434
  *
@@ -4510,6 +4675,10 @@ export type ExternalProductCatalogComponent = Components.Schemas.ExternalProduct
4510
4675
  export type ExternalProductCatalogConfig = Components.Schemas.ExternalProductCatalogConfig;
4511
4676
  export type ExternalProductCatalogHookProductRecommendations = Components.Schemas.ExternalProductCatalogHookProductRecommendations;
4512
4677
  export type ExternalProductCatalogHookProducts = Components.Schemas.ExternalProductCatalogHookProducts;
4678
+ export type ExternalValuesComponent = Components.Schemas.ExternalValuesComponent;
4679
+ export type ExternalValuesConfig = Components.Schemas.ExternalValuesConfig;
4680
+ export type ExternalValuesHook = Components.Schemas.ExternalValuesHook;
4681
+ export type ExternalValuesResult = Components.Schemas.ExternalValuesResult;
4513
4682
  export type FunctionDefinition = Components.Schemas.FunctionDefinition;
4514
4683
  export type FunctionRefCustomActionConfig = Components.Schemas.FunctionRefCustomActionConfig;
4515
4684
  export type Grants = Components.Schemas.Grants;
package/dist/openapi.json CHANGED
@@ -2204,6 +2204,7 @@
2204
2204
  "EXTERNAL_PRODUCT_CATALOG",
2205
2205
  "CUSTOM_PAGE",
2206
2206
  "API_PROXY",
2207
+ "EXTERNAL_VALUES",
2207
2208
  "APP_FUNCTION"
2208
2209
  ],
2209
2210
  "description": "Type of app component"
@@ -2400,7 +2401,8 @@
2400
2401
  "CUSTOM_CAPABILITY": "#/components/schemas/CustomCapabilityComponent",
2401
2402
  "EXTERNAL_PRODUCT_CATALOG": "#/components/schemas/ExternalProductCatalogComponent",
2402
2403
  "CUSTOM_PAGE": "#/components/schemas/CustomPageComponent",
2403
- "API_PROXY": "#/components/schemas/ApiProxyComponent"
2404
+ "API_PROXY": "#/components/schemas/ApiProxyComponent",
2405
+ "EXTERNAL_VALUES": "#/components/schemas/ExternalValuesComponent"
2404
2406
  }
2405
2407
  },
2406
2408
  "oneOf": [
@@ -2430,6 +2432,9 @@
2430
2432
  },
2431
2433
  {
2432
2434
  "$ref": "#/components/schemas/ApiProxyComponent"
2435
+ },
2436
+ {
2437
+ "$ref": "#/components/schemas/ExternalValuesComponent"
2433
2438
  }
2434
2439
  ]
2435
2440
  }
@@ -2453,6 +2458,25 @@
2453
2458
  }
2454
2459
  }
2455
2460
  },
2461
+ "ExternalValuesComponent": {
2462
+ "type": "object",
2463
+ "description": "Exposes typed values resolved from an external system at runtime (e.g. a meter reading prediction). Consumers such as validation rules reference a hook and one of its results by id. Resolution is performed by the external-values-api on behalf of authenticated epilot 360 users and portal end customers.\n",
2464
+ "required": [
2465
+ "component_type",
2466
+ "configuration"
2467
+ ],
2468
+ "properties": {
2469
+ "component_type": {
2470
+ "type": "string",
2471
+ "enum": [
2472
+ "EXTERNAL_VALUES"
2473
+ ]
2474
+ },
2475
+ "configuration": {
2476
+ "$ref": "#/components/schemas/ExternalValuesConfig"
2477
+ }
2478
+ }
2479
+ },
2456
2480
  "CustomCapabilityComponent": {
2457
2481
  "type": "object",
2458
2482
  "required": [
@@ -5107,6 +5131,204 @@
5107
5131
  }
5108
5132
  }
5109
5133
  },
5134
+ "ExternalValuesConfig": {
5135
+ "type": "object",
5136
+ "description": "Configuration for an EXTERNAL_VALUES component",
5137
+ "required": [
5138
+ "hooks"
5139
+ ],
5140
+ "properties": {
5141
+ "hooks": {
5142
+ "type": "array",
5143
+ "description": "Hooks exposed by this component. Hook ids must be unique within the component.",
5144
+ "items": {
5145
+ "$ref": "#/components/schemas/ExternalValuesHook"
5146
+ }
5147
+ }
5148
+ }
5149
+ },
5150
+ "ExternalValuesHook": {
5151
+ "type": "object",
5152
+ "description": "One external call that returns one or more typed results. Interpolated templates (Liquid) have access to `Input`, `Context`, `Consumer`, `Options`, `Env` and — for `result` templates — `Response` and `AuthResponse`.\n",
5153
+ "required": [
5154
+ "id",
5155
+ "name",
5156
+ "call",
5157
+ "result"
5158
+ ],
5159
+ "properties": {
5160
+ "id": {
5161
+ "type": "string",
5162
+ "pattern": "^[a-zA-Z0-9_-]{1,100}$",
5163
+ "description": "Stable identifier; consumers (e.g. validation rules) reference it. Renaming breaks references."
5164
+ },
5165
+ "name": {
5166
+ "$ref": "#/components/schemas/TranslatedString"
5167
+ },
5168
+ "description": {
5169
+ "$ref": "#/components/schemas/TranslatedString"
5170
+ },
5171
+ "auth_type": {
5172
+ "type": "string",
5173
+ "enum": [
5174
+ "none",
5175
+ "header",
5176
+ "bearer",
5177
+ "hmac"
5178
+ ],
5179
+ "default": "none",
5180
+ "description": "Static request authentication applied to the call.\n- `none`: no static authentication.\n- `header`: sends `auth_secret` in header `auth_header` (default `X-API-Key`).\n- `bearer`: sends `Authorization: Bearer <auth_secret>`.\n- `hmac`: signs the request per Standard Webhooks (headers `webhook-id`,\n `webhook-timestamp`, `webhook-signature` = `v1,<base64 HMAC-SHA256>` over\n `<id>.<timestamp>.<body>`) using `auth_secret` as a `whsec_`-prefixed\n base64 secret, exactly as epilot webhooks do.\n\n`auth_secret` is required when `auth_type` is `header`, `bearer` or `hmac`.\nCombine with `auth` (a pre-call that fetches a token) when the target needs both.\n"
5181
+ },
5182
+ "auth_header": {
5183
+ "type": "string",
5184
+ "description": "Header name used when `auth_type` is `header`. Defaults to `X-API-Key`."
5185
+ },
5186
+ "auth_secret": {
5187
+ "type": "string",
5188
+ "description": "Liquid template resolving to the secret, e.g. \"{{Options.api_key}}\". Must reference an option declared with `type: secret`; literals are rejected. Required when `auth_type` is `header`, `bearer` or `hmac`.",
5189
+ "example": "{{Options.api_key}}"
5190
+ },
5191
+ "auth": {
5192
+ "$ref": "#/components/schemas/PortalExtensionAuthBlock"
5193
+ },
5194
+ "call": {
5195
+ "type": "object",
5196
+ "required": [
5197
+ "url"
5198
+ ],
5199
+ "properties": {
5200
+ "method": {
5201
+ "type": "string",
5202
+ "enum": [
5203
+ "GET",
5204
+ "POST",
5205
+ "PUT",
5206
+ "PATCH"
5207
+ ],
5208
+ "default": "POST",
5209
+ "description": "HTTP method to use for the call"
5210
+ },
5211
+ "url": {
5212
+ "type": "string",
5213
+ "description": "URL to call. Supports variable interpolation."
5214
+ },
5215
+ "headers": {
5216
+ "type": "object",
5217
+ "description": "Headers to send with the call. Supports variable interpolation.",
5218
+ "additionalProperties": {
5219
+ "type": "string"
5220
+ }
5221
+ },
5222
+ "params": {
5223
+ "type": "object",
5224
+ "description": "Query parameters to append to the URL. Supports variable interpolation.",
5225
+ "additionalProperties": {
5226
+ "type": "string"
5227
+ }
5228
+ },
5229
+ "body": {
5230
+ "type": "object",
5231
+ "description": "JSON body to send. Values support variable interpolation. When omitted, `{ Input, Context, Consumer }` is sent as-is.",
5232
+ "additionalProperties": true
5233
+ }
5234
+ }
5235
+ },
5236
+ "result": {
5237
+ "type": "array",
5238
+ "minItems": 1,
5239
+ "description": "Typed results extracted from the response. Result ids must be unique within the hook.",
5240
+ "items": {
5241
+ "$ref": "#/components/schemas/ExternalValuesResult"
5242
+ }
5243
+ },
5244
+ "timeout_ms": {
5245
+ "type": "integer",
5246
+ "minimum": 500,
5247
+ "maximum": 5000,
5248
+ "default": 3000,
5249
+ "description": "Timeout for the external call in milliseconds."
5250
+ },
5251
+ "on_unavailable": {
5252
+ "type": "string",
5253
+ "enum": [
5254
+ "skip",
5255
+ "block"
5256
+ ],
5257
+ "default": "skip",
5258
+ "description": "Behaviour when the external system is unavailable (timeout, network or upstream error). `skip`: consumers ignore conditions depending on this hook. `block`: consumers treat the dependent action as not allowed."
5259
+ },
5260
+ "cache": {
5261
+ "type": "object",
5262
+ "description": "Response caching. Off when omitted.",
5263
+ "required": [
5264
+ "ttl_seconds"
5265
+ ],
5266
+ "properties": {
5267
+ "ttl_seconds": {
5268
+ "type": "integer",
5269
+ "minimum": 0,
5270
+ "maximum": 3600,
5271
+ "description": "Time to live in seconds. 0 disables caching."
5272
+ },
5273
+ "key": {
5274
+ "type": "string",
5275
+ "description": "Liquid template for the cache key. Defaults to a hash of org, app, hook, `Input` and `Context`."
5276
+ }
5277
+ }
5278
+ },
5279
+ "use_static_ips": {
5280
+ "type": "boolean",
5281
+ "description": "If set, requests are sent from epilot's static egress IPs. Mutually exclusive with secure_proxy."
5282
+ },
5283
+ "secure_proxy": {
5284
+ "$ref": "#/components/schemas/PortalExtensionSecureProxy"
5285
+ }
5286
+ }
5287
+ },
5288
+ "ExternalValuesResult": {
5289
+ "type": "object",
5290
+ "description": "A single typed value extracted from the hook response. Exactly one of `template`, `path` or `jsonata` must be set.\n",
5291
+ "required": [
5292
+ "id",
5293
+ "type",
5294
+ "name"
5295
+ ],
5296
+ "properties": {
5297
+ "id": {
5298
+ "type": "string",
5299
+ "pattern": "^[a-zA-Z0-9_-]{1,100}$",
5300
+ "description": "Stable identifier of the result within the hook. Renaming breaks references."
5301
+ },
5302
+ "type": {
5303
+ "type": "string",
5304
+ "enum": [
5305
+ "number",
5306
+ "text",
5307
+ "date",
5308
+ "boolean"
5309
+ ],
5310
+ "description": "Type the extracted value is coerced to."
5311
+ },
5312
+ "name": {
5313
+ "$ref": "#/components/schemas/TranslatedString"
5314
+ },
5315
+ "template": {
5316
+ "type": "string",
5317
+ "description": "Liquid template over `Response` etc.; output coerced to `type`.",
5318
+ "example": "{{Response.value}}"
5319
+ },
5320
+ "path": {
5321
+ "type": "string",
5322
+ "description": "Dot path into the response body, e.g. \"data.limit\".",
5323
+ "example": "data.limit"
5324
+ },
5325
+ "jsonata": {
5326
+ "type": "string",
5327
+ "description": "JSONata expression over `{ Response, Input, Context, Options, Env }`.",
5328
+ "example": "$sum(Response.items.amount)"
5329
+ }
5330
+ }
5331
+ },
5110
5332
  "Grants": {
5111
5333
  "type": "array",
5112
5334
  "description": "Required grants for the app in order to call APIs for the installing tenant",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/app-client",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "JavaScript client library for the epilot App API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",