@epilot/sdk 2.20.76 → 2.20.78
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/definitions/app.json +82 -1
- package/definitions/external-values.json +34 -4
- package/definitions/validation-rules.json +12 -4
- package/dist/apis/access-token.cjs +6 -6
- package/dist/apis/access-token.js +1 -1
- package/dist/apis/address-suggestions.cjs +6 -6
- package/dist/apis/address-suggestions.js +1 -1
- package/dist/apis/address.cjs +6 -6
- package/dist/apis/address.js +1 -1
- package/dist/apis/ai-agents.cjs +6 -6
- package/dist/apis/ai-agents.js +1 -1
- package/dist/apis/app.cjs +6 -6
- package/dist/apis/app.d.cts +2 -2
- package/dist/apis/app.d.ts +2 -2
- package/dist/apis/app.js +1 -1
- package/dist/apis/audit-logs.cjs +6 -6
- package/dist/apis/audit-logs.js +1 -1
- package/dist/apis/automation.cjs +6 -6
- package/dist/apis/automation.js +1 -1
- package/dist/apis/billing.cjs +6 -6
- package/dist/apis/billing.js +1 -1
- package/dist/apis/blueprint-manifest.cjs +6 -6
- package/dist/apis/blueprint-manifest.js +1 -1
- package/dist/apis/calendar.cjs +6 -6
- package/dist/apis/calendar.js +1 -1
- package/dist/apis/chat.cjs +6 -6
- package/dist/apis/chat.js +1 -1
- package/dist/apis/configuration-hub.cjs +6 -6
- package/dist/apis/configuration-hub.js +1 -1
- package/dist/apis/consent.cjs +6 -6
- package/dist/apis/consent.js +1 -1
- package/dist/apis/customer-portal.cjs +6 -6
- package/dist/apis/customer-portal.js +1 -1
- package/dist/apis/dashboard.cjs +6 -6
- package/dist/apis/dashboard.js +1 -1
- package/dist/apis/data-governance.cjs +6 -6
- package/dist/apis/data-governance.js +1 -1
- package/dist/apis/deduplication.cjs +6 -6
- package/dist/apis/deduplication.js +1 -1
- package/dist/apis/design.cjs +6 -6
- package/dist/apis/design.js +1 -1
- package/dist/apis/document.cjs +6 -6
- package/dist/apis/document.js +1 -1
- package/dist/apis/email-settings.cjs +6 -6
- package/dist/apis/email-settings.js +1 -1
- package/dist/apis/email-template.cjs +6 -6
- package/dist/apis/email-template.js +1 -1
- package/dist/apis/entity-mapping.cjs +6 -6
- package/dist/apis/entity-mapping.js +1 -1
- package/dist/apis/entity.cjs +6 -6
- package/dist/apis/entity.js +1 -1
- package/dist/apis/environments.cjs +6 -6
- package/dist/apis/environments.js +1 -1
- package/dist/apis/event-catalog.cjs +6 -6
- package/dist/apis/event-catalog.js +1 -1
- package/dist/apis/external-values.cjs +6 -6
- package/dist/apis/external-values.d.cts +2 -2
- package/dist/apis/external-values.d.ts +2 -2
- package/dist/apis/external-values.js +1 -1
- package/dist/apis/file.cjs +6 -6
- package/dist/apis/file.js +1 -1
- package/dist/apis/iban.cjs +6 -6
- package/dist/apis/iban.js +1 -1
- package/dist/apis/identity.cjs +6 -6
- package/dist/apis/identity.js +1 -1
- package/dist/apis/integration-toolkit.cjs +6 -6
- package/dist/apis/integration-toolkit.js +1 -1
- package/dist/apis/journey.cjs +6 -6
- package/dist/apis/journey.js +1 -1
- package/dist/apis/kanban.cjs +6 -6
- package/dist/apis/kanban.js +1 -1
- package/dist/apis/message.cjs +6 -6
- package/dist/apis/message.js +1 -1
- package/dist/apis/metering.cjs +6 -6
- package/dist/apis/metering.js +1 -1
- package/dist/apis/notes.cjs +6 -6
- package/dist/apis/notes.js +1 -1
- package/dist/apis/notification.cjs +6 -6
- package/dist/apis/notification.js +1 -1
- package/dist/apis/organization.cjs +6 -6
- package/dist/apis/organization.js +1 -1
- package/dist/apis/partner-directory.cjs +6 -6
- package/dist/apis/partner-directory.js +1 -1
- package/dist/apis/permissions.cjs +6 -6
- package/dist/apis/permissions.js +1 -1
- package/dist/apis/phone-integration.cjs +6 -6
- package/dist/apis/phone-integration.js +1 -1
- package/dist/apis/pricing-tier.cjs +6 -6
- package/dist/apis/pricing-tier.js +1 -1
- package/dist/apis/pricing.cjs +6 -6
- package/dist/apis/pricing.js +1 -1
- package/dist/apis/purpose.cjs +6 -6
- package/dist/apis/purpose.js +1 -1
- package/dist/apis/query.cjs +6 -6
- package/dist/apis/query.js +1 -1
- package/dist/apis/sandbox.cjs +6 -6
- package/dist/apis/sandbox.js +1 -1
- package/dist/apis/sharing.cjs +6 -6
- package/dist/apis/sharing.js +1 -1
- package/dist/apis/snapshot.cjs +6 -6
- package/dist/apis/snapshot.js +1 -1
- package/dist/apis/submission.cjs +6 -6
- package/dist/apis/submission.js +1 -1
- package/dist/apis/target.cjs +6 -6
- package/dist/apis/target.js +1 -1
- package/dist/apis/targeting.cjs +6 -6
- package/dist/apis/targeting.js +1 -1
- package/dist/apis/template-variables.cjs +6 -6
- package/dist/apis/template-variables.js +1 -1
- package/dist/apis/user.cjs +6 -6
- package/dist/apis/user.js +1 -1
- package/dist/apis/validation-rules.cjs +6 -6
- package/dist/apis/validation-rules.d.cts +2 -2
- package/dist/apis/validation-rules.d.ts +2 -2
- package/dist/apis/validation-rules.js +1 -1
- package/dist/apis/webhooks.cjs +6 -6
- package/dist/apis/webhooks.js +1 -1
- package/dist/apis/workflow-definition.cjs +6 -6
- package/dist/apis/workflow-definition.js +1 -1
- package/dist/apis/workflow.cjs +6 -6
- package/dist/apis/workflow.js +1 -1
- package/dist/app-3WUZHA43.js +7 -0
- package/dist/app-7VPZV72D.cjs +7 -0
- package/dist/{app.d-CZELwNO3.d.cts → app.d-cnyQ-loP.d.cts} +46 -5
- package/dist/{app.d-CZELwNO3.d.ts → app.d-cnyQ-loP.d.ts} +46 -5
- package/dist/{chunk-H65UWQLJ.cjs → chunk-M5Z7JYJ3.cjs} +3 -3
- package/dist/{chunk-OETNMHSD.js → chunk-ZREXF3XS.js} +3 -3
- package/dist/external-values-66ANK66M.js +7 -0
- package/dist/external-values-WET4FHGU.cjs +7 -0
- package/dist/{external-values.d-23q55J5P.d.cts → external-values.d-DeDtCu_V.d.cts} +46 -12
- package/dist/{external-values.d-23q55J5P.d.ts → external-values.d-DeDtCu_V.d.ts} +46 -12
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/{validation-rules-QYVRILMT.cjs → validation-rules-2XORVEWP.cjs} +1 -1
- package/dist/{validation-rules-D4OW6VYI.js → validation-rules-Y5BLH5AA.js} +1 -1
- package/dist/{validation-rules.d-C1OtLama.d.cts → validation-rules.d-Dw7Qn8_e.d.cts} +88 -40
- package/dist/{validation-rules.d-C1OtLama.d.ts → validation-rules.d-Dw7Qn8_e.d.ts} +88 -40
- package/docs/app.md +60 -2
- package/docs/external-values.md +31 -2
- package/docs/validation-rules.md +87 -50
- package/package.json +1 -1
- package/dist/app-CKQAJ7EE.js +0 -7
- package/dist/app-ERJHXY64.cjs +0 -7
- package/dist/external-values-7BS76RVR.js +0 -7
- package/dist/external-values-R2XB2ALG.cjs +0 -7
|
@@ -152,19 +152,24 @@ declare namespace Components {
|
|
|
152
152
|
* are resolved only for authenticated consumers (epilot 360 users and portal end customers);
|
|
153
153
|
* in public journeys the dependent conditions are skipped.
|
|
154
154
|
*
|
|
155
|
+
* A hook may declare value inputs (`contexts` entries `{ "type": "value", "name", "value_type" }`)
|
|
156
|
+
* besides the entities it receives. `inputs` supplies them from rule parameters, which the
|
|
157
|
+
* consumer binds like any other parameter and sends to the hook as `Context.<name>`.
|
|
158
|
+
*
|
|
155
159
|
*/
|
|
156
160
|
ExternalValue | /**
|
|
157
|
-
* A comparison value supplied by the
|
|
158
|
-
* the rule chooses (e.g. `start_date`). The rule stores the name only. The
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
161
|
+
* A comparison value supplied by the consumer that evaluates the rule, identified by a name
|
|
162
|
+
* the rule chooses (e.g. `start_date`). The rule stores the name only. The consumer binds the
|
|
163
|
+
* name to a source of its own - a journey binds it to the value of another block - and
|
|
164
|
+
* resolves it at evaluation time, so the rule never references the consumer's objects and
|
|
165
|
+
* stays reusable across journeys and forms.
|
|
162
166
|
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
167
|
+
* A parameter's kind is determined by the field it is used in: `number`, `text` or `date`
|
|
168
|
+
* for comparison values, range bounds, adjustment amounts and relative date offsets, or a
|
|
169
|
+
* number, string or boolean as an `applies_when` value, or the `value_type` of the External
|
|
170
|
+
* Values hook input it supplies (`ExternalValue.inputs`). One name is compared as one kind
|
|
171
|
+
* throughout a rule; a rule using a name as two kinds is rejected at write time. A parameter
|
|
172
|
+
* the consumer leaves unbound or empty leaves the comparison unresolved.
|
|
168
173
|
*
|
|
169
174
|
*/
|
|
170
175
|
ParameterValue | /* A lower and upper bound for range operators (between, dateBetween, lengthBetween). Bounds are inclusive. */ RangeValue | /* No comparison value - used by unary operators such as notInFuture / notInPast. */ NoValue;
|
|
@@ -401,6 +406,10 @@ declare namespace Components {
|
|
|
401
406
|
* are resolved only for authenticated consumers (epilot 360 users and portal end customers);
|
|
402
407
|
* in public journeys the dependent conditions are skipped.
|
|
403
408
|
*
|
|
409
|
+
* A hook may declare value inputs (`contexts` entries `{ "type": "value", "name", "value_type" }`)
|
|
410
|
+
* besides the entities it receives. `inputs` supplies them from rule parameters, which the
|
|
411
|
+
* consumer binds like any other parameter and sends to the hook as `Context.<name>`.
|
|
412
|
+
*
|
|
404
413
|
*/
|
|
405
414
|
export interface ExternalValue {
|
|
406
415
|
source: "external";
|
|
@@ -416,6 +425,34 @@ declare namespace Components {
|
|
|
416
425
|
* ID of the result entry within the hook whose value is compared.
|
|
417
426
|
*/
|
|
418
427
|
result_id: string; // ^[a-zA-Z0-9_-]+$
|
|
428
|
+
/**
|
|
429
|
+
* Values for the hook's value inputs, keyed by the input name the hook declares
|
|
430
|
+
* (`contexts` entry of type `value`), e.g. `{ "reading_date": { "source": "parameter", "name": "reading_date" } }`.
|
|
431
|
+
* Only parameters are supported. Write-time validation checks that every key is a value input the
|
|
432
|
+
* hook declares and uses the input's `value_type` (`number`, `text`, `date` or `boolean`) as the
|
|
433
|
+
* parameter's kind, so the parameter must not be compared as another kind elsewhere in the rule.
|
|
434
|
+
* An input parameter must not carry an adjustment. Declared inputs without an entry are allowed;
|
|
435
|
+
* the consumer omits an input that has no value.
|
|
436
|
+
*
|
|
437
|
+
*/
|
|
438
|
+
inputs?: {
|
|
439
|
+
[name: string]: /**
|
|
440
|
+
* A comparison value supplied by the consumer that evaluates the rule, identified by a name
|
|
441
|
+
* the rule chooses (e.g. `start_date`). The rule stores the name only. The consumer binds the
|
|
442
|
+
* name to a source of its own - a journey binds it to the value of another block - and
|
|
443
|
+
* resolves it at evaluation time, so the rule never references the consumer's objects and
|
|
444
|
+
* stays reusable across journeys and forms.
|
|
445
|
+
*
|
|
446
|
+
* A parameter's kind is determined by the field it is used in: `number`, `text` or `date`
|
|
447
|
+
* for comparison values, range bounds, adjustment amounts and relative date offsets, or a
|
|
448
|
+
* number, string or boolean as an `applies_when` value, or the `value_type` of the External
|
|
449
|
+
* Values hook input it supplies (`ExternalValue.inputs`). One name is compared as one kind
|
|
450
|
+
* throughout a rule; a rule using a name as two kinds is rejected at write time. A parameter
|
|
451
|
+
* the consumer leaves unbound or empty leaves the comparison unresolved.
|
|
452
|
+
*
|
|
453
|
+
*/
|
|
454
|
+
ParameterValue;
|
|
455
|
+
};
|
|
419
456
|
adjust?: /**
|
|
420
457
|
* Adjusts a context-resolved numeric value before comparison, e.g. "context value plus 10 percent".
|
|
421
458
|
* Used to express tolerance bands such as "at most 10% above the current instalment amount".
|
|
@@ -597,17 +634,18 @@ declare namespace Components {
|
|
|
597
634
|
*/
|
|
598
635
|
export type Operator = "equal" | "notEqual" | "greaterThan" | "greaterThanInclusive" | "lessThan" | "lessThanInclusive" | "between" | "dateBefore" | "dateOnOrBefore" | "dateAfter" | "dateOnOrAfter" | "dateBetween" | "notInFuture" | "notInPast" | "contains" | "doesNotContain" | "startsWith" | "endsWith" | "regexMatch" | "lengthBetween" | "maxDigits" | "maxDecimals";
|
|
599
636
|
/**
|
|
600
|
-
* A comparison value supplied by the
|
|
601
|
-
* the rule chooses (e.g. `start_date`). The rule stores the name only. The
|
|
602
|
-
*
|
|
603
|
-
*
|
|
604
|
-
*
|
|
637
|
+
* A comparison value supplied by the consumer that evaluates the rule, identified by a name
|
|
638
|
+
* the rule chooses (e.g. `start_date`). The rule stores the name only. The consumer binds the
|
|
639
|
+
* name to a source of its own - a journey binds it to the value of another block - and
|
|
640
|
+
* resolves it at evaluation time, so the rule never references the consumer's objects and
|
|
641
|
+
* stays reusable across journeys and forms.
|
|
605
642
|
*
|
|
606
|
-
*
|
|
607
|
-
*
|
|
608
|
-
*
|
|
609
|
-
*
|
|
610
|
-
*
|
|
643
|
+
* A parameter's kind is determined by the field it is used in: `number`, `text` or `date`
|
|
644
|
+
* for comparison values, range bounds, adjustment amounts and relative date offsets, or a
|
|
645
|
+
* number, string or boolean as an `applies_when` value, or the `value_type` of the External
|
|
646
|
+
* Values hook input it supplies (`ExternalValue.inputs`). One name is compared as one kind
|
|
647
|
+
* throughout a rule; a rule using a name as two kinds is rejected at write time. A parameter
|
|
648
|
+
* the consumer leaves unbound or empty leaves the comparison unresolved.
|
|
611
649
|
*
|
|
612
650
|
*/
|
|
613
651
|
export interface ParameterValue {
|
|
@@ -941,19 +979,24 @@ declare namespace Components {
|
|
|
941
979
|
* are resolved only for authenticated consumers (epilot 360 users and portal end customers);
|
|
942
980
|
* in public journeys the dependent conditions are skipped.
|
|
943
981
|
*
|
|
982
|
+
* A hook may declare value inputs (`contexts` entries `{ "type": "value", "name", "value_type" }`)
|
|
983
|
+
* besides the entities it receives. `inputs` supplies them from rule parameters, which the
|
|
984
|
+
* consumer binds like any other parameter and sends to the hook as `Context.<name>`.
|
|
985
|
+
*
|
|
944
986
|
*/
|
|
945
987
|
ExternalValue | /**
|
|
946
|
-
* A comparison value supplied by the
|
|
947
|
-
* the rule chooses (e.g. `start_date`). The rule stores the name only. The
|
|
948
|
-
*
|
|
949
|
-
*
|
|
950
|
-
*
|
|
988
|
+
* A comparison value supplied by the consumer that evaluates the rule, identified by a name
|
|
989
|
+
* the rule chooses (e.g. `start_date`). The rule stores the name only. The consumer binds the
|
|
990
|
+
* name to a source of its own - a journey binds it to the value of another block - and
|
|
991
|
+
* resolves it at evaluation time, so the rule never references the consumer's objects and
|
|
992
|
+
* stays reusable across journeys and forms.
|
|
951
993
|
*
|
|
952
|
-
*
|
|
953
|
-
*
|
|
954
|
-
*
|
|
955
|
-
*
|
|
956
|
-
*
|
|
994
|
+
* A parameter's kind is determined by the field it is used in: `number`, `text` or `date`
|
|
995
|
+
* for comparison values, range bounds, adjustment amounts and relative date offsets, or a
|
|
996
|
+
* number, string or boolean as an `applies_when` value, or the `value_type` of the External
|
|
997
|
+
* Values hook input it supplies (`ExternalValue.inputs`). One name is compared as one kind
|
|
998
|
+
* throughout a rule; a rule using a name as two kinds is rejected at write time. A parameter
|
|
999
|
+
* the consumer leaves unbound or empty leaves the comparison unresolved.
|
|
957
1000
|
*
|
|
958
1001
|
*/
|
|
959
1002
|
ParameterValue;
|
|
@@ -1279,19 +1322,24 @@ declare namespace Components {
|
|
|
1279
1322
|
* are resolved only for authenticated consumers (epilot 360 users and portal end customers);
|
|
1280
1323
|
* in public journeys the dependent conditions are skipped.
|
|
1281
1324
|
*
|
|
1325
|
+
* A hook may declare value inputs (`contexts` entries `{ "type": "value", "name", "value_type" }`)
|
|
1326
|
+
* besides the entities it receives. `inputs` supplies them from rule parameters, which the
|
|
1327
|
+
* consumer binds like any other parameter and sends to the hook as `Context.<name>`.
|
|
1328
|
+
*
|
|
1282
1329
|
*/
|
|
1283
1330
|
ExternalValue | /**
|
|
1284
|
-
* A comparison value supplied by the
|
|
1285
|
-
* the rule chooses (e.g. `start_date`). The rule stores the name only. The
|
|
1286
|
-
*
|
|
1287
|
-
*
|
|
1288
|
-
*
|
|
1331
|
+
* A comparison value supplied by the consumer that evaluates the rule, identified by a name
|
|
1332
|
+
* the rule chooses (e.g. `start_date`). The rule stores the name only. The consumer binds the
|
|
1333
|
+
* name to a source of its own - a journey binds it to the value of another block - and
|
|
1334
|
+
* resolves it at evaluation time, so the rule never references the consumer's objects and
|
|
1335
|
+
* stays reusable across journeys and forms.
|
|
1289
1336
|
*
|
|
1290
|
-
*
|
|
1291
|
-
*
|
|
1292
|
-
*
|
|
1293
|
-
*
|
|
1294
|
-
*
|
|
1337
|
+
* A parameter's kind is determined by the field it is used in: `number`, `text` or `date`
|
|
1338
|
+
* for comparison values, range bounds, adjustment amounts and relative date offsets, or a
|
|
1339
|
+
* number, string or boolean as an `applies_when` value, or the `value_type` of the External
|
|
1340
|
+
* Values hook input it supplies (`ExternalValue.inputs`). One name is compared as one kind
|
|
1341
|
+
* throughout a rule; a rule using a name as two kinds is rejected at write time. A parameter
|
|
1342
|
+
* the consumer leaves unbound or empty leaves the comparison unresolved.
|
|
1295
1343
|
*
|
|
1296
1344
|
*/
|
|
1297
1345
|
ParameterValue;
|
package/docs/app.md
CHANGED
|
@@ -136,6 +136,9 @@ const { data } = await appClient.getPublicFacingComponent(...)
|
|
|
136
136
|
- [`ApiProxyConfig`](#apiproxyconfig)
|
|
137
137
|
- [`ExternalValuesConfig`](#externalvaluesconfig)
|
|
138
138
|
- [`ExternalValuesHook`](#externalvalueshook)
|
|
139
|
+
- [`ContextRequirement`](#contextrequirement)
|
|
140
|
+
- [`EntityContextRequirement`](#entitycontextrequirement)
|
|
141
|
+
- [`ValueContextRequirement`](#valuecontextrequirement)
|
|
139
142
|
- [`ExternalValuesResult`](#externalvaluesresult)
|
|
140
143
|
- [`Grants`](#grants)
|
|
141
144
|
- [`BlueprintRef`](#blueprintref)
|
|
@@ -2268,6 +2271,7 @@ type ExternalValuesComponent = {
|
|
|
2268
2271
|
result: { ... }
|
|
2269
2272
|
timeout_ms?: { ... }
|
|
2270
2273
|
on_unavailable?: { ... }
|
|
2274
|
+
contexts?: { ... }
|
|
2271
2275
|
cache?: { ... }
|
|
2272
2276
|
secure_proxy?: { ... }
|
|
2273
2277
|
}>
|
|
@@ -3797,6 +3801,14 @@ type ExternalValuesConfig = {
|
|
|
3797
3801
|
}>
|
|
3798
3802
|
timeout_ms?: number
|
|
3799
3803
|
on_unavailable?: "skip" | "block"
|
|
3804
|
+
contexts?: Array<{
|
|
3805
|
+
type: { ... }
|
|
3806
|
+
schema: { ... }
|
|
3807
|
+
} | {
|
|
3808
|
+
type: { ... }
|
|
3809
|
+
name: { ... }
|
|
3810
|
+
value_type: { ... }
|
|
3811
|
+
}>
|
|
3800
3812
|
cache?: {
|
|
3801
3813
|
ttl_seconds: { ... }
|
|
3802
3814
|
key?: { ... }
|
|
@@ -3811,9 +3823,9 @@ type ExternalValuesConfig = {
|
|
|
3811
3823
|
|
|
3812
3824
|
### `ExternalValuesHook`
|
|
3813
3825
|
|
|
3814
|
-
One external call that returns one or more typed results. Interpolated templates (Liquid) have access to `Context`, `Consumer`, `Options`, `Env` and — for `result` templates — `Response` and `AuthResponse` (each is also available snake_case, e.g. `{{ context.
|
|
3826
|
+
One external call that returns one or more typed results. Interpolated templates (Liquid) have access to `Context`, `Consumer`, `Options`, `Env` and — for `result` templates — `Response` and `AuthResponse` (each is also available snake_case, e.g. `{{ context.contract }}`).
|
|
3815
3827
|
|
|
3816
|
-
`Context` is the
|
|
3828
|
+
`Context` is the name → v
|
|
3817
3829
|
|
|
3818
3830
|
```ts
|
|
3819
3831
|
type ExternalValuesHook = {
|
|
@@ -3860,6 +3872,14 @@ type ExternalValuesHook = {
|
|
|
3860
3872
|
}>
|
|
3861
3873
|
timeout_ms?: number
|
|
3862
3874
|
on_unavailable?: "skip" | "block"
|
|
3875
|
+
contexts?: Array<{
|
|
3876
|
+
type: "entity"
|
|
3877
|
+
schema: string
|
|
3878
|
+
} | {
|
|
3879
|
+
type: "value"
|
|
3880
|
+
name: string
|
|
3881
|
+
value_type: "number" | "text" | "date" | "boolean"
|
|
3882
|
+
}>
|
|
3863
3883
|
cache?: {
|
|
3864
3884
|
ttl_seconds: number
|
|
3865
3885
|
key?: string
|
|
@@ -3871,6 +3891,44 @@ type ExternalValuesHook = {
|
|
|
3871
3891
|
}
|
|
3872
3892
|
```
|
|
3873
3893
|
|
|
3894
|
+
### `ContextRequirement`
|
|
3895
|
+
|
|
3896
|
+
A requirement a hook reads from `Context`, discriminated by `type`. More types will be added later; consumers must ignore types they do not know.
|
|
3897
|
+
|
|
3898
|
+
```ts
|
|
3899
|
+
type ContextRequirement = {
|
|
3900
|
+
type: "entity"
|
|
3901
|
+
schema: string
|
|
3902
|
+
} | {
|
|
3903
|
+
type: "value"
|
|
3904
|
+
name: string
|
|
3905
|
+
value_type: "number" | "text" | "date" | "boolean"
|
|
3906
|
+
}
|
|
3907
|
+
```
|
|
3908
|
+
|
|
3909
|
+
### `EntityContextRequirement`
|
|
3910
|
+
|
|
3911
|
+
The consumer supplies the bound entities of `schema` under `Context.`<schema>``.
|
|
3912
|
+
|
|
3913
|
+
```ts
|
|
3914
|
+
type EntityContextRequirement = {
|
|
3915
|
+
type: "entity"
|
|
3916
|
+
schema: string
|
|
3917
|
+
}
|
|
3918
|
+
```
|
|
3919
|
+
|
|
3920
|
+
### `ValueContextRequirement`
|
|
3921
|
+
|
|
3922
|
+
The consumer supplies one scalar value under `Context.`<name>``, e.g. a date the customer entered in a journey block. A value input is optional: the consumer sends it when it has a value and omits it otherwise, so the hook's templates must cope with its absence, e.g. `{{ Context.reading_date | default
|
|
3923
|
+
|
|
3924
|
+
```ts
|
|
3925
|
+
type ValueContextRequirement = {
|
|
3926
|
+
type: "value"
|
|
3927
|
+
name: string
|
|
3928
|
+
value_type: "number" | "text" | "date" | "boolean"
|
|
3929
|
+
}
|
|
3930
|
+
```
|
|
3931
|
+
|
|
3874
3932
|
### `ExternalValuesResult`
|
|
3875
3933
|
|
|
3876
3934
|
A single typed value extracted from the hook response. Exactly one of `template`, `path` or `jsonata` must be set.
|
package/docs/external-values.md
CHANGED
|
@@ -40,6 +40,7 @@ const { data } = await externalValuesClient.listExternalValues(...)
|
|
|
40
40
|
- [`ExternalValueHookSummary`](#externalvaluehooksummary)
|
|
41
41
|
- [`ContextRequirement`](#contextrequirement)
|
|
42
42
|
- [`EntityContextRequirement`](#entitycontextrequirement)
|
|
43
|
+
- [`ValueContextRequirement`](#valuecontextrequirement)
|
|
43
44
|
- [`ExternalValueHookList`](#externalvaluehooklist)
|
|
44
45
|
|
|
45
46
|
### `listExternalValues`
|
|
@@ -316,20 +317,29 @@ type ExternalValueHookSummary = {
|
|
|
316
317
|
contexts?: Array<{
|
|
317
318
|
type: "entity"
|
|
318
319
|
schema: string
|
|
320
|
+
} | {
|
|
321
|
+
type: "value"
|
|
322
|
+
name: string
|
|
323
|
+
value_type: "number" | "text" | "date" | "boolean"
|
|
319
324
|
}>
|
|
320
325
|
}
|
|
321
326
|
```
|
|
322
327
|
|
|
323
328
|
### `ContextRequirement`
|
|
324
329
|
|
|
325
|
-
Something a hook needs the consumer to supply in `context`, discriminated by `type
|
|
326
|
-
|
|
330
|
+
Something a hook needs the consumer to supply in `context`, discriminated by `type`:
|
|
331
|
+
bound entities (`entity`) or an optional scalar input (`value`). More types may follow;
|
|
332
|
+
consumers ignore types they do not know.
|
|
327
333
|
|
|
328
334
|
|
|
329
335
|
```ts
|
|
330
336
|
type ContextRequirement = {
|
|
331
337
|
type: "entity"
|
|
332
338
|
schema: string
|
|
339
|
+
} | {
|
|
340
|
+
type: "value"
|
|
341
|
+
name: string
|
|
342
|
+
value_type: "number" | "text" | "date" | "boolean"
|
|
333
343
|
}
|
|
334
344
|
```
|
|
335
345
|
|
|
@@ -347,6 +357,21 @@ type EntityContextRequirement = {
|
|
|
347
357
|
}
|
|
348
358
|
```
|
|
349
359
|
|
|
360
|
+
### `ValueContextRequirement`
|
|
361
|
+
|
|
362
|
+
An optional scalar input. When the consumer has a value it supplies it under
|
|
363
|
+
`Context.`<name>`` (dates as ISO 8601 strings, `YYYY-MM-DD` or a date-time); otherwise the
|
|
364
|
+
key is absent, so the hook template must provide a fallback, e.g.
|
|
365
|
+
`{{ Context.reading_date | default: "now" | date: "%Y-%m-%d" }}` dec
|
|
366
|
+
|
|
367
|
+
```ts
|
|
368
|
+
type ValueContextRequirement = {
|
|
369
|
+
type: "value"
|
|
370
|
+
name: string
|
|
371
|
+
value_type: "number" | "text" | "date" | "boolean"
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
350
375
|
### `ExternalValueHookList`
|
|
351
376
|
|
|
352
377
|
```ts
|
|
@@ -371,6 +396,10 @@ type ExternalValueHookList = {
|
|
|
371
396
|
contexts?: Array<{
|
|
372
397
|
type: { ... }
|
|
373
398
|
schema: { ... }
|
|
399
|
+
} | {
|
|
400
|
+
type: { ... }
|
|
401
|
+
name: { ... }
|
|
402
|
+
value_type: { ... }
|
|
374
403
|
}>
|
|
375
404
|
}>
|
|
376
405
|
}
|