skapi-js 2.2.6-beta.2 → 2.2.6-beta.3
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/skapi.browser.mjs +5 -5
- package/dist/skapi.browser.mjs.map +1 -1
- package/dist/skapi.cjs +1 -1
- package/dist/skapi.cjs.map +1 -1
- package/dist/skapi.d.mts +41 -27
- package/dist/skapi.d.ts +41 -27
- package/dist/skapi.js +5 -5
- package/dist/skapi.js.map +1 -1
- package/dist/skapi.mjs +1 -1
- package/dist/skapi.mjs.map +1 -1
- package/package.json +1 -1
package/dist/skapi.d.mts
CHANGED
|
@@ -691,8 +691,9 @@ type Subscription = {
|
|
|
691
691
|
*/
|
|
692
692
|
type TicketConditionOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
693
693
|
/**
|
|
694
|
-
* One row of a ticket condition list: `headers`, `
|
|
695
|
-
* condition, or `headers`, `data` or `user` of
|
|
694
|
+
* One row of a ticket condition list: `headers`, `body`, `params` or `user` of a ticket's
|
|
695
|
+
* condition, the `response` rows of a cond action, or `headers`, `data` or `user` of the
|
|
696
|
+
* response condition Skapi's own rows carry.
|
|
696
697
|
*
|
|
697
698
|
* How a list decides:
|
|
698
699
|
* - Rows on the same key are alternatives: the key passes when any one of them matches.
|
|
@@ -701,9 +702,14 @@ type TicketConditionOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'eq' | 'ne
|
|
|
701
702
|
* - A field missing from the request is a mismatch for its key, '!=' included, not an error.
|
|
702
703
|
* The only rows that pass on a missing field are `= undefined` and `!= null`.
|
|
703
704
|
* - Every row is read, in order. For each key the FIRST matching row wins: its `setValueWhenMatch`
|
|
704
|
-
*
|
|
705
|
-
*
|
|
706
|
-
*
|
|
705
|
+
* replaces the value (in the data itself where the field exists) and its `placeholder` captures
|
|
706
|
+
* the result. The later match rows on that key are skipped without being evaluated, so nothing
|
|
707
|
+
* is re-checked against the replaced value; a later row on another key whose path runs through
|
|
708
|
+
* the replaced field reads the replacement. A row that does not match captures nothing, so
|
|
709
|
+
* several rows on one key, each with its own `setValueWhenMatch`, followed by a catch-all row,
|
|
710
|
+
* work as a lookup table. At the ticket's condition keys and values are literal: `${...}` inside
|
|
711
|
+
* a row is plain text. In a cond action the key is literal but `value` and `setValueWhenMatch`
|
|
712
|
+
* may hold `${response...}` and `${placeholder[NAME]}`, resolved before the comparison.
|
|
707
713
|
* - A capture-only row (a `placeholder` and no `operator`) never counts toward passing. It
|
|
708
714
|
* captures whenever its field exists.
|
|
709
715
|
* - Header names ignore case, and header values are always strings. Query string values are
|
|
@@ -711,7 +717,7 @@ type TicketConditionOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'eq' | 'ne
|
|
|
711
717
|
* `?code=LAUNCH24` the string "LAUNCH24". '=' is strict, so it compares the parsed value: a
|
|
712
718
|
* `params` row needs `value: 2`, not "2", to match `?qty=2`.
|
|
713
719
|
*
|
|
714
|
-
* null and undefined (`
|
|
720
|
+
* null and undefined (`body` and `params` rows only, in a response condition too):
|
|
715
721
|
* - `= null` passes when the field is present and null. `!= null` passes otherwise, a missing field included.
|
|
716
722
|
* - `= undefined` passes when the field is missing. `!= undefined` passes when it is present, null included.
|
|
717
723
|
* - '>', '>=', '<' and '<=' never pass with null or undefined.
|
|
@@ -721,7 +727,7 @@ type TicketConditionOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'eq' | 'ne
|
|
|
721
727
|
type TicketConditionRow = {
|
|
722
728
|
/**
|
|
723
729
|
* Where the row looks, relative to its own list and written without `${ }`:
|
|
724
|
-
* - `
|
|
730
|
+
* - `body` rows: a path into the request body. "id" is the body's `id`, "order[id]" is `order.id`.
|
|
725
731
|
* - `params` rows: a path into the query string, read the same way.
|
|
726
732
|
* - `response` rows of a cond action: a path into the enclosing action's answer ("body[status]" is a response's body.status, "record_id" a posted record's id); "" is the whole answer as text.
|
|
727
733
|
* - `headers` rows: the header name, matched case-insensitively.
|
|
@@ -735,13 +741,13 @@ type TicketConditionRow = {
|
|
|
735
741
|
/**
|
|
736
742
|
* A literal, never templated. A list is read as described in TicketConditionOperator.
|
|
737
743
|
* null, a list containing null, and undefined (an `operator` with no `value` key) are for
|
|
738
|
-
* `
|
|
744
|
+
* `body` and `params` rows only.
|
|
739
745
|
*/
|
|
740
746
|
value?: string | number | boolean | null | undefined | Array<string | number | boolean | null>;
|
|
741
|
-
/** `
|
|
747
|
+
/** `body` and `params` rows only. When this row is the first matching row of its key, the value at `key` in the request data is replaced by this before anything else reads it. null replaces nothing. */
|
|
742
748
|
setValueWhenMatch?: any;
|
|
743
749
|
/**
|
|
744
|
-
* `
|
|
750
|
+
* `body` and `params` rows only. Remembers the value at `key` under this name, and the
|
|
745
751
|
* actions read it as `${placeholder[NAME]}`. A match row captures only when it is the first
|
|
746
752
|
* matching row of its key. A field that is missing captures nothing. Must match
|
|
747
753
|
* ^[A-Za-z_][A-Za-z0-9_]*$.
|
|
@@ -827,7 +833,8 @@ type TicketCondition = {
|
|
|
827
833
|
/** Rows against the request headers. See TicketConditionRow. Every row compares with a value: null, or no `value`, is refused. */
|
|
828
834
|
headers?: TicketConditionRow[];
|
|
829
835
|
/** Rows against the request body. Refused when `method` is 'GET': a GET request has no body. */
|
|
830
|
-
data
|
|
836
|
+
/** Rows against the request body ("data" before 2026-10-09; registration still accepts that name and stores "body"). */
|
|
837
|
+
body?: TicketConditionRow[];
|
|
831
838
|
/** Rows against the query string, read on GET and on POST. */
|
|
832
839
|
params?: TicketConditionRow[];
|
|
833
840
|
/**
|
|
@@ -848,9 +855,12 @@ type TicketCondition = {
|
|
|
848
855
|
* Skapi's own billing rows only (the super master registers them): the response check a `req`
|
|
849
856
|
* carried before 2026-10-09. Anyone else checks a response with a cond action in the req's
|
|
850
857
|
* Then chain. `headers` rows read the response headers and `data` row keys are paths into the
|
|
851
|
-
* parsed body; `user` and
|
|
858
|
+
* parsed body (they keep that name here: the ticket's own body rows are `body`); `user` and
|
|
859
|
+
* `record_access` check the consumer.
|
|
852
860
|
*/
|
|
853
|
-
type TicketResponseCondition = Pick<TicketCondition, 'headers' | '
|
|
861
|
+
type TicketResponseCondition = Pick<TicketCondition, 'headers' | 'user' | 'record_access'> & {
|
|
862
|
+
data?: TicketConditionRow[];
|
|
863
|
+
};
|
|
854
864
|
/**
|
|
855
865
|
* One step of a ticket's action chain. Actions run in order. When an action fails its `err`
|
|
856
866
|
* chain runs and the consumption stops. Nothing is rolled back.
|
|
@@ -863,7 +873,7 @@ type TicketResponseCondition = Pick<TicketCondition, 'headers' | 'data' | 'user'
|
|
|
863
873
|
*
|
|
864
874
|
* | Reference | Reads |
|
|
865
875
|
* |---|---|
|
|
866
|
-
* | `${
|
|
876
|
+
* | `${body}`, `${body[key]}` | The incoming request body (a text body too), or one key of it: `${body[id]}` is the body's `id`, `${body[order][id]}` its `order.id`. Always the incoming body, also in nested actions. |
|
|
867
877
|
* | `${params}`, `${params[key]}` | The incoming query string, or one key of it. |
|
|
868
878
|
* | `${headers[name]}` | An incoming header, name case-insensitive. Authorization and Cookie read "<redacted>". |
|
|
869
879
|
* | `${placeholder[NAME]}` | A value a condition row captured with `placeholder`. |
|
|
@@ -878,7 +888,7 @@ type TicketResponseCondition = Pick<TicketCondition, 'headers' | 'data' | 'user'
|
|
|
878
888
|
* Registration refuses anything else inside `${ }` (an unknown root such as `${id}`, keys under
|
|
879
889
|
* a root that takes none such as `${ip[x]}`, `${placeholder}` or `${headers}` without a key,
|
|
880
890
|
* broken brackets) with a message listing these forms, `${result}` (gone: an answer is read as
|
|
881
|
-
* `${response}` in the action's Then chain, or captured there by a
|
|
891
|
+
* `${response}` in the action's Then chain, or captured there by a Check answer action), and a reference written
|
|
882
892
|
* where it can never resolve (`${response}` outside a Then chain, `${error}` outside an `err`
|
|
883
893
|
* chain, `${record_access}` when the condition names no record). When the action runs, a
|
|
884
894
|
* reference that does not resolve fails it before it does anything: PATH_NOT_FOUND,
|
|
@@ -890,7 +900,9 @@ type TicketResponseCondition = Pick<TicketCondition, 'headers' | 'data' | 'user'
|
|
|
890
900
|
* action in that chain checks the answer: its `response` rows read it whole (key "") or by key,
|
|
891
901
|
* whatever its shape. `retry: true` on acsg, acsr, pstr, req, mail and nlsd tries a failure again,
|
|
892
902
|
* up to 3 more times, 1, 2 and 4 seconds apart, while the time budget holds them; never for a
|
|
893
|
-
* failure inside Then
|
|
903
|
+
* failure inside Then, nor for a refusal waiting cannot change (a bad address, a missing template
|
|
904
|
+
* or newsletter, the month's e-mail sends used up). An e-mail or newsletter already queued is
|
|
905
|
+
* never sent twice: bookkeeping that fails afterwards is a `warning` on the log row, not a failure.
|
|
894
906
|
*/
|
|
895
907
|
type TicketAction = {
|
|
896
908
|
/** Set the access group of a user. Answers the SUCCESS text the grant returns. */
|
|
@@ -950,7 +962,7 @@ type TicketAction = {
|
|
|
950
962
|
act: 'req';
|
|
951
963
|
exe: {
|
|
952
964
|
/**
|
|
953
|
-
* http:// or https:// with a hostname, such as "https://api.example.com/orders/${
|
|
965
|
+
* http:// or https:// with a hostname, such as "https://api.example.com/orders/${body[id]}".
|
|
954
966
|
* The scheme is always written out, so a URL that is one whole reference is refused.
|
|
955
967
|
* No IP literal, no userinfo, never under the api domain. Redirects are not followed.
|
|
956
968
|
* A value put into the URL with `${...}` is percent-encoded, so it cannot add path
|
|
@@ -1011,12 +1023,12 @@ type TicketAction = {
|
|
|
1011
1023
|
};
|
|
1012
1024
|
/** Legacy. Registration moves these rows to the end of `condition.data`. */
|
|
1013
1025
|
match?: TicketConditionRow[];
|
|
1014
|
-
/** Skapi's own billing rows only. A response check is a
|
|
1026
|
+
/** Skapi's own billing rows only. A response check is a Check answer action (cond) in `actions`, whose `response` rows read the answer. */
|
|
1015
1027
|
condition?: TicketResponseCondition;
|
|
1016
1028
|
/**
|
|
1017
1029
|
* Nested chain, run on an answer below 300. It reads the response as `${response}`:
|
|
1018
1030
|
* `${response[status]}`, `${response[headers][content-type]}` (header names in
|
|
1019
|
-
* lowercase) and `${response[body][key]}`, while `${
|
|
1031
|
+
* lowercase) and `${response[body][key]}`, while `${body}` is still the incoming
|
|
1020
1032
|
* request body. A cond in it checks the response. Any action can nest, including
|
|
1021
1033
|
* another req with its own `secretName`.
|
|
1022
1034
|
*/
|
|
@@ -1035,10 +1047,10 @@ type TicketAction = {
|
|
|
1035
1047
|
exe: {
|
|
1036
1048
|
/** The template's ID, as the Custom tab and the upload reply show it. Literal; it must be stored when the ticket is registered. */
|
|
1037
1049
|
template: string;
|
|
1038
|
-
/** The recipient: one address, or a reference that gives one, such as "${user[email]}" or "${
|
|
1050
|
+
/** The recipient: one address, or a reference that gives one, such as "${user[email]}" or "${body[email]}". */
|
|
1039
1051
|
to: string;
|
|
1040
1052
|
/**
|
|
1041
|
-
* Values for the placeholders the template carries, by name: { "order": "${
|
|
1053
|
+
* Values for the placeholders the template carries, by name: { "order": "${body[order][id]}" } fills
|
|
1042
1054
|
* ${order}. Templated. "service_name" and "email" (the recipient) are filled by default and may be
|
|
1043
1055
|
* overwritten here. Up to 30.
|
|
1044
1056
|
*/
|
|
@@ -1090,18 +1102,20 @@ type TicketAction = {
|
|
|
1090
1102
|
err?: TicketAction[];
|
|
1091
1103
|
} | {
|
|
1092
1104
|
/**
|
|
1093
|
-
*
|
|
1094
|
-
*
|
|
1095
|
-
*
|
|
1096
|
-
*
|
|
1105
|
+
* Check answer: rows on the answer of the action whose Then chain this is, under the
|
|
1106
|
+
* rules of the ticket's own condition rows. A key no row matches fails the chain here with
|
|
1107
|
+
* CONDITION_FAILED (the enclosing action's `err` chain runs). Answers nothing. Inside a
|
|
1108
|
+
* Then chain only.
|
|
1097
1109
|
*/
|
|
1098
1110
|
act: 'cond';
|
|
1099
1111
|
exe: {
|
|
1100
1112
|
/**
|
|
1101
1113
|
* Rows on the answer of the action whose Then chain this Condition is in, whatever its shape: a key is
|
|
1102
1114
|
* a path in the answer ("record_id" on a posted record, "body[status]" or "headers[content-type]" on a
|
|
1103
|
-
* response), "" the whole answer as text.
|
|
1104
|
-
*
|
|
1115
|
+
* response), "" the whole answer as text. `value` and `setValueWhenMatch` may hold `${response...}` and
|
|
1116
|
+
* `${placeholder[NAME]}`, resolved right before the comparison; any other reference is refused. A row's
|
|
1117
|
+
* placeholder captures the replaced value when the row has one. A key no row matches fails the chain
|
|
1118
|
+
* here with CONDITION_FAILED. Inside a Then chain only; answers nothing.
|
|
1105
1119
|
*/
|
|
1106
1120
|
response: TicketConditionRow[];
|
|
1107
1121
|
};
|
package/dist/skapi.d.ts
CHANGED
|
@@ -691,8 +691,9 @@ type Subscription = {
|
|
|
691
691
|
*/
|
|
692
692
|
type TicketConditionOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
693
693
|
/**
|
|
694
|
-
* One row of a ticket condition list: `headers`, `
|
|
695
|
-
* condition, or `headers`, `data` or `user` of
|
|
694
|
+
* One row of a ticket condition list: `headers`, `body`, `params` or `user` of a ticket's
|
|
695
|
+
* condition, the `response` rows of a cond action, or `headers`, `data` or `user` of the
|
|
696
|
+
* response condition Skapi's own rows carry.
|
|
696
697
|
*
|
|
697
698
|
* How a list decides:
|
|
698
699
|
* - Rows on the same key are alternatives: the key passes when any one of them matches.
|
|
@@ -701,9 +702,14 @@ type TicketConditionOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'eq' | 'ne
|
|
|
701
702
|
* - A field missing from the request is a mismatch for its key, '!=' included, not an error.
|
|
702
703
|
* The only rows that pass on a missing field are `= undefined` and `!= null`.
|
|
703
704
|
* - Every row is read, in order. For each key the FIRST matching row wins: its `setValueWhenMatch`
|
|
704
|
-
*
|
|
705
|
-
*
|
|
706
|
-
*
|
|
705
|
+
* replaces the value (in the data itself where the field exists) and its `placeholder` captures
|
|
706
|
+
* the result. The later match rows on that key are skipped without being evaluated, so nothing
|
|
707
|
+
* is re-checked against the replaced value; a later row on another key whose path runs through
|
|
708
|
+
* the replaced field reads the replacement. A row that does not match captures nothing, so
|
|
709
|
+
* several rows on one key, each with its own `setValueWhenMatch`, followed by a catch-all row,
|
|
710
|
+
* work as a lookup table. At the ticket's condition keys and values are literal: `${...}` inside
|
|
711
|
+
* a row is plain text. In a cond action the key is literal but `value` and `setValueWhenMatch`
|
|
712
|
+
* may hold `${response...}` and `${placeholder[NAME]}`, resolved before the comparison.
|
|
707
713
|
* - A capture-only row (a `placeholder` and no `operator`) never counts toward passing. It
|
|
708
714
|
* captures whenever its field exists.
|
|
709
715
|
* - Header names ignore case, and header values are always strings. Query string values are
|
|
@@ -711,7 +717,7 @@ type TicketConditionOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'eq' | 'ne
|
|
|
711
717
|
* `?code=LAUNCH24` the string "LAUNCH24". '=' is strict, so it compares the parsed value: a
|
|
712
718
|
* `params` row needs `value: 2`, not "2", to match `?qty=2`.
|
|
713
719
|
*
|
|
714
|
-
* null and undefined (`
|
|
720
|
+
* null and undefined (`body` and `params` rows only, in a response condition too):
|
|
715
721
|
* - `= null` passes when the field is present and null. `!= null` passes otherwise, a missing field included.
|
|
716
722
|
* - `= undefined` passes when the field is missing. `!= undefined` passes when it is present, null included.
|
|
717
723
|
* - '>', '>=', '<' and '<=' never pass with null or undefined.
|
|
@@ -721,7 +727,7 @@ type TicketConditionOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'eq' | 'ne
|
|
|
721
727
|
type TicketConditionRow = {
|
|
722
728
|
/**
|
|
723
729
|
* Where the row looks, relative to its own list and written without `${ }`:
|
|
724
|
-
* - `
|
|
730
|
+
* - `body` rows: a path into the request body. "id" is the body's `id`, "order[id]" is `order.id`.
|
|
725
731
|
* - `params` rows: a path into the query string, read the same way.
|
|
726
732
|
* - `response` rows of a cond action: a path into the enclosing action's answer ("body[status]" is a response's body.status, "record_id" a posted record's id); "" is the whole answer as text.
|
|
727
733
|
* - `headers` rows: the header name, matched case-insensitively.
|
|
@@ -735,13 +741,13 @@ type TicketConditionRow = {
|
|
|
735
741
|
/**
|
|
736
742
|
* A literal, never templated. A list is read as described in TicketConditionOperator.
|
|
737
743
|
* null, a list containing null, and undefined (an `operator` with no `value` key) are for
|
|
738
|
-
* `
|
|
744
|
+
* `body` and `params` rows only.
|
|
739
745
|
*/
|
|
740
746
|
value?: string | number | boolean | null | undefined | Array<string | number | boolean | null>;
|
|
741
|
-
/** `
|
|
747
|
+
/** `body` and `params` rows only. When this row is the first matching row of its key, the value at `key` in the request data is replaced by this before anything else reads it. null replaces nothing. */
|
|
742
748
|
setValueWhenMatch?: any;
|
|
743
749
|
/**
|
|
744
|
-
* `
|
|
750
|
+
* `body` and `params` rows only. Remembers the value at `key` under this name, and the
|
|
745
751
|
* actions read it as `${placeholder[NAME]}`. A match row captures only when it is the first
|
|
746
752
|
* matching row of its key. A field that is missing captures nothing. Must match
|
|
747
753
|
* ^[A-Za-z_][A-Za-z0-9_]*$.
|
|
@@ -827,7 +833,8 @@ type TicketCondition = {
|
|
|
827
833
|
/** Rows against the request headers. See TicketConditionRow. Every row compares with a value: null, or no `value`, is refused. */
|
|
828
834
|
headers?: TicketConditionRow[];
|
|
829
835
|
/** Rows against the request body. Refused when `method` is 'GET': a GET request has no body. */
|
|
830
|
-
data
|
|
836
|
+
/** Rows against the request body ("data" before 2026-10-09; registration still accepts that name and stores "body"). */
|
|
837
|
+
body?: TicketConditionRow[];
|
|
831
838
|
/** Rows against the query string, read on GET and on POST. */
|
|
832
839
|
params?: TicketConditionRow[];
|
|
833
840
|
/**
|
|
@@ -848,9 +855,12 @@ type TicketCondition = {
|
|
|
848
855
|
* Skapi's own billing rows only (the super master registers them): the response check a `req`
|
|
849
856
|
* carried before 2026-10-09. Anyone else checks a response with a cond action in the req's
|
|
850
857
|
* Then chain. `headers` rows read the response headers and `data` row keys are paths into the
|
|
851
|
-
* parsed body; `user` and
|
|
858
|
+
* parsed body (they keep that name here: the ticket's own body rows are `body`); `user` and
|
|
859
|
+
* `record_access` check the consumer.
|
|
852
860
|
*/
|
|
853
|
-
type TicketResponseCondition = Pick<TicketCondition, 'headers' | '
|
|
861
|
+
type TicketResponseCondition = Pick<TicketCondition, 'headers' | 'user' | 'record_access'> & {
|
|
862
|
+
data?: TicketConditionRow[];
|
|
863
|
+
};
|
|
854
864
|
/**
|
|
855
865
|
* One step of a ticket's action chain. Actions run in order. When an action fails its `err`
|
|
856
866
|
* chain runs and the consumption stops. Nothing is rolled back.
|
|
@@ -863,7 +873,7 @@ type TicketResponseCondition = Pick<TicketCondition, 'headers' | 'data' | 'user'
|
|
|
863
873
|
*
|
|
864
874
|
* | Reference | Reads |
|
|
865
875
|
* |---|---|
|
|
866
|
-
* | `${
|
|
876
|
+
* | `${body}`, `${body[key]}` | The incoming request body (a text body too), or one key of it: `${body[id]}` is the body's `id`, `${body[order][id]}` its `order.id`. Always the incoming body, also in nested actions. |
|
|
867
877
|
* | `${params}`, `${params[key]}` | The incoming query string, or one key of it. |
|
|
868
878
|
* | `${headers[name]}` | An incoming header, name case-insensitive. Authorization and Cookie read "<redacted>". |
|
|
869
879
|
* | `${placeholder[NAME]}` | A value a condition row captured with `placeholder`. |
|
|
@@ -878,7 +888,7 @@ type TicketResponseCondition = Pick<TicketCondition, 'headers' | 'data' | 'user'
|
|
|
878
888
|
* Registration refuses anything else inside `${ }` (an unknown root such as `${id}`, keys under
|
|
879
889
|
* a root that takes none such as `${ip[x]}`, `${placeholder}` or `${headers}` without a key,
|
|
880
890
|
* broken brackets) with a message listing these forms, `${result}` (gone: an answer is read as
|
|
881
|
-
* `${response}` in the action's Then chain, or captured there by a
|
|
891
|
+
* `${response}` in the action's Then chain, or captured there by a Check answer action), and a reference written
|
|
882
892
|
* where it can never resolve (`${response}` outside a Then chain, `${error}` outside an `err`
|
|
883
893
|
* chain, `${record_access}` when the condition names no record). When the action runs, a
|
|
884
894
|
* reference that does not resolve fails it before it does anything: PATH_NOT_FOUND,
|
|
@@ -890,7 +900,9 @@ type TicketResponseCondition = Pick<TicketCondition, 'headers' | 'data' | 'user'
|
|
|
890
900
|
* action in that chain checks the answer: its `response` rows read it whole (key "") or by key,
|
|
891
901
|
* whatever its shape. `retry: true` on acsg, acsr, pstr, req, mail and nlsd tries a failure again,
|
|
892
902
|
* up to 3 more times, 1, 2 and 4 seconds apart, while the time budget holds them; never for a
|
|
893
|
-
* failure inside Then
|
|
903
|
+
* failure inside Then, nor for a refusal waiting cannot change (a bad address, a missing template
|
|
904
|
+
* or newsletter, the month's e-mail sends used up). An e-mail or newsletter already queued is
|
|
905
|
+
* never sent twice: bookkeeping that fails afterwards is a `warning` on the log row, not a failure.
|
|
894
906
|
*/
|
|
895
907
|
type TicketAction = {
|
|
896
908
|
/** Set the access group of a user. Answers the SUCCESS text the grant returns. */
|
|
@@ -950,7 +962,7 @@ type TicketAction = {
|
|
|
950
962
|
act: 'req';
|
|
951
963
|
exe: {
|
|
952
964
|
/**
|
|
953
|
-
* http:// or https:// with a hostname, such as "https://api.example.com/orders/${
|
|
965
|
+
* http:// or https:// with a hostname, such as "https://api.example.com/orders/${body[id]}".
|
|
954
966
|
* The scheme is always written out, so a URL that is one whole reference is refused.
|
|
955
967
|
* No IP literal, no userinfo, never under the api domain. Redirects are not followed.
|
|
956
968
|
* A value put into the URL with `${...}` is percent-encoded, so it cannot add path
|
|
@@ -1011,12 +1023,12 @@ type TicketAction = {
|
|
|
1011
1023
|
};
|
|
1012
1024
|
/** Legacy. Registration moves these rows to the end of `condition.data`. */
|
|
1013
1025
|
match?: TicketConditionRow[];
|
|
1014
|
-
/** Skapi's own billing rows only. A response check is a
|
|
1026
|
+
/** Skapi's own billing rows only. A response check is a Check answer action (cond) in `actions`, whose `response` rows read the answer. */
|
|
1015
1027
|
condition?: TicketResponseCondition;
|
|
1016
1028
|
/**
|
|
1017
1029
|
* Nested chain, run on an answer below 300. It reads the response as `${response}`:
|
|
1018
1030
|
* `${response[status]}`, `${response[headers][content-type]}` (header names in
|
|
1019
|
-
* lowercase) and `${response[body][key]}`, while `${
|
|
1031
|
+
* lowercase) and `${response[body][key]}`, while `${body}` is still the incoming
|
|
1020
1032
|
* request body. A cond in it checks the response. Any action can nest, including
|
|
1021
1033
|
* another req with its own `secretName`.
|
|
1022
1034
|
*/
|
|
@@ -1035,10 +1047,10 @@ type TicketAction = {
|
|
|
1035
1047
|
exe: {
|
|
1036
1048
|
/** The template's ID, as the Custom tab and the upload reply show it. Literal; it must be stored when the ticket is registered. */
|
|
1037
1049
|
template: string;
|
|
1038
|
-
/** The recipient: one address, or a reference that gives one, such as "${user[email]}" or "${
|
|
1050
|
+
/** The recipient: one address, or a reference that gives one, such as "${user[email]}" or "${body[email]}". */
|
|
1039
1051
|
to: string;
|
|
1040
1052
|
/**
|
|
1041
|
-
* Values for the placeholders the template carries, by name: { "order": "${
|
|
1053
|
+
* Values for the placeholders the template carries, by name: { "order": "${body[order][id]}" } fills
|
|
1042
1054
|
* ${order}. Templated. "service_name" and "email" (the recipient) are filled by default and may be
|
|
1043
1055
|
* overwritten here. Up to 30.
|
|
1044
1056
|
*/
|
|
@@ -1090,18 +1102,20 @@ type TicketAction = {
|
|
|
1090
1102
|
err?: TicketAction[];
|
|
1091
1103
|
} | {
|
|
1092
1104
|
/**
|
|
1093
|
-
*
|
|
1094
|
-
*
|
|
1095
|
-
*
|
|
1096
|
-
*
|
|
1105
|
+
* Check answer: rows on the answer of the action whose Then chain this is, under the
|
|
1106
|
+
* rules of the ticket's own condition rows. A key no row matches fails the chain here with
|
|
1107
|
+
* CONDITION_FAILED (the enclosing action's `err` chain runs). Answers nothing. Inside a
|
|
1108
|
+
* Then chain only.
|
|
1097
1109
|
*/
|
|
1098
1110
|
act: 'cond';
|
|
1099
1111
|
exe: {
|
|
1100
1112
|
/**
|
|
1101
1113
|
* Rows on the answer of the action whose Then chain this Condition is in, whatever its shape: a key is
|
|
1102
1114
|
* a path in the answer ("record_id" on a posted record, "body[status]" or "headers[content-type]" on a
|
|
1103
|
-
* response), "" the whole answer as text.
|
|
1104
|
-
*
|
|
1115
|
+
* response), "" the whole answer as text. `value` and `setValueWhenMatch` may hold `${response...}` and
|
|
1116
|
+
* `${placeholder[NAME]}`, resolved right before the comparison; any other reference is refused. A row's
|
|
1117
|
+
* placeholder captures the replaced value when the row has one. A key no row matches fails the chain
|
|
1118
|
+
* here with CONDITION_FAILED. Inside a Then chain only; answers nothing.
|
|
1105
1119
|
*/
|
|
1106
1120
|
response: TicketConditionRow[];
|
|
1107
1121
|
};
|