skapi-js 2.2.6-beta.2 → 2.2.6-beta.4
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 +7 -7
- package/dist/skapi.browser.mjs.map +1 -1
- package/dist/skapi.cjs +7 -7
- package/dist/skapi.cjs.map +1 -1
- package/dist/skapi.d.mts +104 -50
- package/dist/skapi.d.ts +104 -50
- package/dist/skapi.js +7 -7
- package/dist/skapi.js.map +1 -1
- package/dist/skapi.mjs +7 -7
- package/dist/skapi.mjs.map +1 -1
- package/package.json +2 -2
package/dist/skapi.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
declare class SkapiError extends Error {
|
|
2
|
+
code: string | number;
|
|
3
|
+
/** The underlying Error, or the flat TicketError body of a failed ticket consumption (consumeTicket). */
|
|
4
|
+
cause: Error | TicketError;
|
|
5
|
+
constructor(error: any, options?: {
|
|
6
|
+
name?: string;
|
|
7
|
+
code?: string;
|
|
8
|
+
cause?: Error | TicketError;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
1
12
|
type Condition = 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | '>' | '>=' | '<' | '<=' | '=';
|
|
2
13
|
type RTCReceiverParams = {
|
|
3
14
|
ice?: string;
|
|
@@ -558,6 +569,48 @@ type ProgressCallback = (e: {
|
|
|
558
569
|
failed?: File[];
|
|
559
570
|
abort: () => void;
|
|
560
571
|
}) => void;
|
|
572
|
+
/** One file of an uploadFiles() call that storage did not accept. */
|
|
573
|
+
type FileUploadError = {
|
|
574
|
+
/** The File as it was given: the same object that is listed in `failed`. */
|
|
575
|
+
file: File;
|
|
576
|
+
/** The file's name. */
|
|
577
|
+
name: string;
|
|
578
|
+
/**
|
|
579
|
+
* Why it was not stored. `code` is the storage error code ('AccessDenied', 'EntityTooLarge' ...),
|
|
580
|
+
* or 'NETWORK_ERROR', 'TIMEOUT' (see UploadFilesParams.timeout), 'ABORTED' (the progress callback's
|
|
581
|
+
* abort()), 'TOO_MANY_REQUESTS', or 'UPLOAD_FAILED' when storage gave no code. `cause` holds the raw
|
|
582
|
+
* response or rejection, when there was one.
|
|
583
|
+
*/
|
|
584
|
+
error: SkapiError;
|
|
585
|
+
};
|
|
586
|
+
/** What uploadFiles() resolves with. */
|
|
587
|
+
type UploadFilesResult = {
|
|
588
|
+
/** Files that are stored. */
|
|
589
|
+
completed: File[];
|
|
590
|
+
/** Files storage did not accept. */
|
|
591
|
+
failed: File[];
|
|
592
|
+
/** Why each file in `failed` was not stored, one entry per file in the same order. Empty when every file was stored. */
|
|
593
|
+
errors: FileUploadError[];
|
|
594
|
+
/** Endpoint of every file, in the order they were given, whether or not it was stored. */
|
|
595
|
+
bin_endpoints: string[];
|
|
596
|
+
};
|
|
597
|
+
type UploadFilesParams = {
|
|
598
|
+
/** Record ID of the record to attach the files to. */
|
|
599
|
+
record_id: string;
|
|
600
|
+
/** Callback for upload progress. Useful when building a progress bar. */
|
|
601
|
+
progress?: ProgressCallback;
|
|
602
|
+
/**
|
|
603
|
+
* Milliseconds one file's upload may take. A file that takes longer is aborted and counted as failed with
|
|
604
|
+
* the code 'TIMEOUT'; the next file is then uploaded. Every file gets the full time. Omitted or 0: no limit.
|
|
605
|
+
*/
|
|
606
|
+
timeout?: number;
|
|
607
|
+
/**
|
|
608
|
+
* Reject at the first file storage does not accept, with that file's error (a SkapiError, see FileUploadError),
|
|
609
|
+
* instead of resolving with it listed in `failed` and `errors`. The files stored before it stay stored.
|
|
610
|
+
* Default false.
|
|
611
|
+
*/
|
|
612
|
+
throwOnFileError?: boolean;
|
|
613
|
+
};
|
|
561
614
|
type FetchOptions = {
|
|
562
615
|
/** Maximum number of records to fetch per call */
|
|
563
616
|
limit?: number;
|
|
@@ -691,8 +744,9 @@ type Subscription = {
|
|
|
691
744
|
*/
|
|
692
745
|
type TicketConditionOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
693
746
|
/**
|
|
694
|
-
* One row of a ticket condition list: `headers`, `
|
|
695
|
-
* condition, or `headers`, `data` or `user` of
|
|
747
|
+
* One row of a ticket condition list: `headers`, `body`, `params` or `user` of a ticket's
|
|
748
|
+
* condition, the `response` rows of a cond action, or `headers`, `data` or `user` of the
|
|
749
|
+
* response condition Skapi's own rows carry.
|
|
696
750
|
*
|
|
697
751
|
* How a list decides:
|
|
698
752
|
* - Rows on the same key are alternatives: the key passes when any one of them matches.
|
|
@@ -701,9 +755,14 @@ type TicketConditionOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'eq' | 'ne
|
|
|
701
755
|
* - A field missing from the request is a mismatch for its key, '!=' included, not an error.
|
|
702
756
|
* The only rows that pass on a missing field are `= undefined` and `!= null`.
|
|
703
757
|
* - Every row is read, in order. For each key the FIRST matching row wins: its `setValueWhenMatch`
|
|
704
|
-
*
|
|
705
|
-
*
|
|
706
|
-
*
|
|
758
|
+
* replaces the value (in the data itself where the field exists) and its `placeholder` captures
|
|
759
|
+
* the result. The later match rows on that key are skipped without being evaluated, so nothing
|
|
760
|
+
* is re-checked against the replaced value; a later row on another key whose path runs through
|
|
761
|
+
* the replaced field reads the replacement. A row that does not match captures nothing, so
|
|
762
|
+
* several rows on one key, each with its own `setValueWhenMatch`, followed by a catch-all row,
|
|
763
|
+
* work as a lookup table. At the ticket's condition keys and values are literal: `${...}` inside
|
|
764
|
+
* a row is plain text. In a cond action the key is literal but `value` and `setValueWhenMatch`
|
|
765
|
+
* may hold `${response...}` and `${placeholder[NAME]}`, resolved before the comparison.
|
|
707
766
|
* - A capture-only row (a `placeholder` and no `operator`) never counts toward passing. It
|
|
708
767
|
* captures whenever its field exists.
|
|
709
768
|
* - Header names ignore case, and header values are always strings. Query string values are
|
|
@@ -711,7 +770,7 @@ type TicketConditionOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'eq' | 'ne
|
|
|
711
770
|
* `?code=LAUNCH24` the string "LAUNCH24". '=' is strict, so it compares the parsed value: a
|
|
712
771
|
* `params` row needs `value: 2`, not "2", to match `?qty=2`.
|
|
713
772
|
*
|
|
714
|
-
* null and undefined (`
|
|
773
|
+
* null and undefined (`body` and `params` rows only, in a response condition too):
|
|
715
774
|
* - `= null` passes when the field is present and null. `!= null` passes otherwise, a missing field included.
|
|
716
775
|
* - `= undefined` passes when the field is missing. `!= undefined` passes when it is present, null included.
|
|
717
776
|
* - '>', '>=', '<' and '<=' never pass with null or undefined.
|
|
@@ -721,7 +780,7 @@ type TicketConditionOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'eq' | 'ne
|
|
|
721
780
|
type TicketConditionRow = {
|
|
722
781
|
/**
|
|
723
782
|
* Where the row looks, relative to its own list and written without `${ }`:
|
|
724
|
-
* - `
|
|
783
|
+
* - `body` rows: a path into the request body. "id" is the body's `id`, "order[id]" is `order.id`.
|
|
725
784
|
* - `params` rows: a path into the query string, read the same way.
|
|
726
785
|
* - `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
786
|
* - `headers` rows: the header name, matched case-insensitively.
|
|
@@ -735,13 +794,13 @@ type TicketConditionRow = {
|
|
|
735
794
|
/**
|
|
736
795
|
* A literal, never templated. A list is read as described in TicketConditionOperator.
|
|
737
796
|
* null, a list containing null, and undefined (an `operator` with no `value` key) are for
|
|
738
|
-
* `
|
|
797
|
+
* `body` and `params` rows only.
|
|
739
798
|
*/
|
|
740
799
|
value?: string | number | boolean | null | undefined | Array<string | number | boolean | null>;
|
|
741
|
-
/** `
|
|
800
|
+
/** `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
801
|
setValueWhenMatch?: any;
|
|
743
802
|
/**
|
|
744
|
-
* `
|
|
803
|
+
* `body` and `params` rows only. Remembers the value at `key` under this name, and the
|
|
745
804
|
* actions read it as `${placeholder[NAME]}`. A match row captures only when it is the first
|
|
746
805
|
* matching row of its key. A field that is missing captures nothing. Must match
|
|
747
806
|
* ^[A-Za-z_][A-Za-z0-9_]*$.
|
|
@@ -827,7 +886,8 @@ type TicketCondition = {
|
|
|
827
886
|
/** Rows against the request headers. See TicketConditionRow. Every row compares with a value: null, or no `value`, is refused. */
|
|
828
887
|
headers?: TicketConditionRow[];
|
|
829
888
|
/** Rows against the request body. Refused when `method` is 'GET': a GET request has no body. */
|
|
830
|
-
data
|
|
889
|
+
/** Rows against the request body ("data" before 2026-10-09; registration still accepts that name and stores "body"). */
|
|
890
|
+
body?: TicketConditionRow[];
|
|
831
891
|
/** Rows against the query string, read on GET and on POST. */
|
|
832
892
|
params?: TicketConditionRow[];
|
|
833
893
|
/**
|
|
@@ -848,9 +908,12 @@ type TicketCondition = {
|
|
|
848
908
|
* Skapi's own billing rows only (the super master registers them): the response check a `req`
|
|
849
909
|
* carried before 2026-10-09. Anyone else checks a response with a cond action in the req's
|
|
850
910
|
* Then chain. `headers` rows read the response headers and `data` row keys are paths into the
|
|
851
|
-
* parsed body; `user` and
|
|
911
|
+
* parsed body (they keep that name here: the ticket's own body rows are `body`); `user` and
|
|
912
|
+
* `record_access` check the consumer.
|
|
852
913
|
*/
|
|
853
|
-
type TicketResponseCondition = Pick<TicketCondition, 'headers' | '
|
|
914
|
+
type TicketResponseCondition = Pick<TicketCondition, 'headers' | 'user' | 'record_access'> & {
|
|
915
|
+
data?: TicketConditionRow[];
|
|
916
|
+
};
|
|
854
917
|
/**
|
|
855
918
|
* One step of a ticket's action chain. Actions run in order. When an action fails its `err`
|
|
856
919
|
* chain runs and the consumption stops. Nothing is rolled back.
|
|
@@ -863,7 +926,7 @@ type TicketResponseCondition = Pick<TicketCondition, 'headers' | 'data' | 'user'
|
|
|
863
926
|
*
|
|
864
927
|
* | Reference | Reads |
|
|
865
928
|
* |---|---|
|
|
866
|
-
* | `${
|
|
929
|
+
* | `${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
930
|
* | `${params}`, `${params[key]}` | The incoming query string, or one key of it. |
|
|
868
931
|
* | `${headers[name]}` | An incoming header, name case-insensitive. Authorization and Cookie read "<redacted>". |
|
|
869
932
|
* | `${placeholder[NAME]}` | A value a condition row captured with `placeholder`. |
|
|
@@ -878,7 +941,7 @@ type TicketResponseCondition = Pick<TicketCondition, 'headers' | 'data' | 'user'
|
|
|
878
941
|
* Registration refuses anything else inside `${ }` (an unknown root such as `${id}`, keys under
|
|
879
942
|
* a root that takes none such as `${ip[x]}`, `${placeholder}` or `${headers}` without a key,
|
|
880
943
|
* 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
|
|
944
|
+
* `${response}` in the action's Then chain, or captured there by a Check answer action), and a reference written
|
|
882
945
|
* where it can never resolve (`${response}` outside a Then chain, `${error}` outside an `err`
|
|
883
946
|
* chain, `${record_access}` when the condition names no record). When the action runs, a
|
|
884
947
|
* reference that does not resolve fails it before it does anything: PATH_NOT_FOUND,
|
|
@@ -890,7 +953,9 @@ type TicketResponseCondition = Pick<TicketCondition, 'headers' | 'data' | 'user'
|
|
|
890
953
|
* action in that chain checks the answer: its `response` rows read it whole (key "") or by key,
|
|
891
954
|
* whatever its shape. `retry: true` on acsg, acsr, pstr, req, mail and nlsd tries a failure again,
|
|
892
955
|
* up to 3 more times, 1, 2 and 4 seconds apart, while the time budget holds them; never for a
|
|
893
|
-
* failure inside Then
|
|
956
|
+
* failure inside Then, nor for a refusal waiting cannot change (a bad address, a missing template
|
|
957
|
+
* or newsletter, the month's e-mail sends used up). An e-mail or newsletter already queued is
|
|
958
|
+
* never sent twice: bookkeeping that fails afterwards is a `warning` on the log row, not a failure.
|
|
894
959
|
*/
|
|
895
960
|
type TicketAction = {
|
|
896
961
|
/** Set the access group of a user. Answers the SUCCESS text the grant returns. */
|
|
@@ -950,7 +1015,7 @@ type TicketAction = {
|
|
|
950
1015
|
act: 'req';
|
|
951
1016
|
exe: {
|
|
952
1017
|
/**
|
|
953
|
-
* http:// or https:// with a hostname, such as "https://api.example.com/orders/${
|
|
1018
|
+
* http:// or https:// with a hostname, such as "https://api.example.com/orders/${body[id]}".
|
|
954
1019
|
* The scheme is always written out, so a URL that is one whole reference is refused.
|
|
955
1020
|
* No IP literal, no userinfo, never under the api domain. Redirects are not followed.
|
|
956
1021
|
* A value put into the URL with `${...}` is percent-encoded, so it cannot add path
|
|
@@ -1011,12 +1076,12 @@ type TicketAction = {
|
|
|
1011
1076
|
};
|
|
1012
1077
|
/** Legacy. Registration moves these rows to the end of `condition.data`. */
|
|
1013
1078
|
match?: TicketConditionRow[];
|
|
1014
|
-
/** Skapi's own billing rows only. A response check is a
|
|
1079
|
+
/** Skapi's own billing rows only. A response check is a Check answer action (cond) in `actions`, whose `response` rows read the answer. */
|
|
1015
1080
|
condition?: TicketResponseCondition;
|
|
1016
1081
|
/**
|
|
1017
1082
|
* Nested chain, run on an answer below 300. It reads the response as `${response}`:
|
|
1018
1083
|
* `${response[status]}`, `${response[headers][content-type]}` (header names in
|
|
1019
|
-
* lowercase) and `${response[body][key]}`, while `${
|
|
1084
|
+
* lowercase) and `${response[body][key]}`, while `${body}` is still the incoming
|
|
1020
1085
|
* request body. A cond in it checks the response. Any action can nest, including
|
|
1021
1086
|
* another req with its own `secretName`.
|
|
1022
1087
|
*/
|
|
@@ -1035,10 +1100,10 @@ type TicketAction = {
|
|
|
1035
1100
|
exe: {
|
|
1036
1101
|
/** 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
1102
|
template: string;
|
|
1038
|
-
/** The recipient: one address, or a reference that gives one, such as "${user[email]}" or "${
|
|
1103
|
+
/** The recipient: one address, or a reference that gives one, such as "${user[email]}" or "${body[email]}". */
|
|
1039
1104
|
to: string;
|
|
1040
1105
|
/**
|
|
1041
|
-
* Values for the placeholders the template carries, by name: { "order": "${
|
|
1106
|
+
* Values for the placeholders the template carries, by name: { "order": "${body[order][id]}" } fills
|
|
1042
1107
|
* ${order}. Templated. "service_name" and "email" (the recipient) are filled by default and may be
|
|
1043
1108
|
* overwritten here. Up to 30.
|
|
1044
1109
|
*/
|
|
@@ -1090,18 +1155,20 @@ type TicketAction = {
|
|
|
1090
1155
|
err?: TicketAction[];
|
|
1091
1156
|
} | {
|
|
1092
1157
|
/**
|
|
1093
|
-
*
|
|
1094
|
-
*
|
|
1095
|
-
*
|
|
1096
|
-
*
|
|
1158
|
+
* Check answer: rows on the answer of the action whose Then chain this is, under the
|
|
1159
|
+
* rules of the ticket's own condition rows. A key no row matches fails the chain here with
|
|
1160
|
+
* CONDITION_FAILED (the enclosing action's `err` chain runs). Answers nothing. Inside a
|
|
1161
|
+
* Then chain only.
|
|
1097
1162
|
*/
|
|
1098
1163
|
act: 'cond';
|
|
1099
1164
|
exe: {
|
|
1100
1165
|
/**
|
|
1101
1166
|
* Rows on the answer of the action whose Then chain this Condition is in, whatever its shape: a key is
|
|
1102
1167
|
* 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
|
-
*
|
|
1168
|
+
* response), "" the whole answer as text. `value` and `setValueWhenMatch` may hold `${response...}` and
|
|
1169
|
+
* `${placeholder[NAME]}`, resolved right before the comparison; any other reference is refused. A row's
|
|
1170
|
+
* placeholder captures the replaced value when the row has one. A key no row matches fails the chain
|
|
1171
|
+
* here with CONDITION_FAILED. Inside a Then chain only; answers nothing.
|
|
1105
1172
|
*/
|
|
1106
1173
|
response: TicketConditionRow[];
|
|
1107
1174
|
};
|
|
@@ -1198,6 +1265,7 @@ type Types_DelRecordQuery = DelRecordQuery;
|
|
|
1198
1265
|
type Types_EncryptionOptions = EncryptionOptions;
|
|
1199
1266
|
type Types_FetchOptions = FetchOptions;
|
|
1200
1267
|
type Types_FileInfo = FileInfo;
|
|
1268
|
+
type Types_FileUploadError = FileUploadError;
|
|
1201
1269
|
type Types_Form<T> = Form<T>;
|
|
1202
1270
|
type Types_GetRecordQuery = GetRecordQuery;
|
|
1203
1271
|
type Types_Index = Index;
|
|
@@ -1228,12 +1296,14 @@ type Types_TicketReceipt = TicketReceipt;
|
|
|
1228
1296
|
type Types_TicketResponseCondition = TicketResponseCondition;
|
|
1229
1297
|
type Types_TicketSignatureCondition = TicketSignatureCondition;
|
|
1230
1298
|
type Types_UniqueId = UniqueId;
|
|
1299
|
+
type Types_UploadFilesParams = UploadFilesParams;
|
|
1300
|
+
type Types_UploadFilesResult = UploadFilesResult;
|
|
1231
1301
|
type Types_UserAttributes = UserAttributes;
|
|
1232
1302
|
type Types_UserProfile = UserProfile;
|
|
1233
1303
|
type Types_UserPublic = UserPublic;
|
|
1234
1304
|
type Types_WebSocketMessage = WebSocketMessage;
|
|
1235
1305
|
declare namespace Types {
|
|
1236
|
-
export type { Types_BinaryFile as BinaryFile, Types_Condition as Condition, Types_Connection as Connection, Types_ConnectionInfo as ConnectionInfo, Types_DatabaseResponse as DatabaseResponse, Types_DelRecordQuery as DelRecordQuery, Types_EncryptionOptions as EncryptionOptions, Types_FetchOptions as FetchOptions, Types_FileInfo as FileInfo, Types_Form as Form, Types_GetRecordQuery as GetRecordQuery, Types_Index as Index, Types_Newsletter as Newsletter, Types_NewsletterGroup as NewsletterGroup, Types_PostRecordConfig as PostRecordConfig, Types_ProgressCallback as ProgressCallback, Types_RTCConnector as RTCConnector, Types_RTCConnectorParams as RTCConnectorParams, Types_RTCEvent as RTCEvent, Types_RTCReceiverParams as RTCReceiverParams, Types_RTCResolved as RTCResolved, Types_RealtimeCallback as RealtimeCallback, Types_RecordData as RecordData, Types_RecordEncryptionInfo as RecordEncryptionInfo, Types_RequestHistory as RequestHistory, Types_Subscription as Subscription, Types_Table as Table, Types_Tag as Tag, Types_Ticket as Ticket, Types_TicketAction as TicketAction, Types_TicketCondition as TicketCondition, Types_TicketConditionOperator as TicketConditionOperator, Types_TicketConditionRow as TicketConditionRow, Types_TicketError as TicketError, Types_TicketErrorCode as TicketErrorCode, Types_TicketReceipt as TicketReceipt, Types_TicketResponseCondition as TicketResponseCondition, Types_TicketSignatureCondition as TicketSignatureCondition, Types_UniqueId as UniqueId, Types_UserAttributes as UserAttributes, Types_UserProfile as UserProfile, Types_UserPublic as UserPublic, Types_WebSocketMessage as WebSocketMessage };
|
|
1306
|
+
export type { Types_BinaryFile as BinaryFile, Types_Condition as Condition, Types_Connection as Connection, Types_ConnectionInfo as ConnectionInfo, Types_DatabaseResponse as DatabaseResponse, Types_DelRecordQuery as DelRecordQuery, Types_EncryptionOptions as EncryptionOptions, Types_FetchOptions as FetchOptions, Types_FileInfo as FileInfo, Types_FileUploadError as FileUploadError, Types_Form as Form, Types_GetRecordQuery as GetRecordQuery, Types_Index as Index, Types_Newsletter as Newsletter, Types_NewsletterGroup as NewsletterGroup, Types_PostRecordConfig as PostRecordConfig, Types_ProgressCallback as ProgressCallback, Types_RTCConnector as RTCConnector, Types_RTCConnectorParams as RTCConnectorParams, Types_RTCEvent as RTCEvent, Types_RTCReceiverParams as RTCReceiverParams, Types_RTCResolved as RTCResolved, Types_RealtimeCallback as RealtimeCallback, Types_RecordData as RecordData, Types_RecordEncryptionInfo as RecordEncryptionInfo, Types_RequestHistory as RequestHistory, Types_Subscription as Subscription, Types_Table as Table, Types_Tag as Tag, Types_Ticket as Ticket, Types_TicketAction as TicketAction, Types_TicketCondition as TicketCondition, Types_TicketConditionOperator as TicketConditionOperator, Types_TicketConditionRow as TicketConditionRow, Types_TicketError as TicketError, Types_TicketErrorCode as TicketErrorCode, Types_TicketReceipt as TicketReceipt, Types_TicketResponseCondition as TicketResponseCondition, Types_TicketSignatureCondition as TicketSignatureCondition, Types_UniqueId as UniqueId, Types_UploadFilesParams as UploadFilesParams, Types_UploadFilesResult as UploadFilesResult, Types_UserAttributes as UserAttributes, Types_UserProfile as UserProfile, Types_UserPublic as UserPublic, Types_WebSocketMessage as WebSocketMessage };
|
|
1237
1307
|
}
|
|
1238
1308
|
|
|
1239
1309
|
declare function terminatePendingRequests(): void;
|
|
@@ -2867,19 +2937,14 @@ declare class Skapi {
|
|
|
2867
2937
|
endpoints: string | string[];
|
|
2868
2938
|
}): Promise<RecordData[]>;
|
|
2869
2939
|
/**
|
|
2870
|
-
* Uploads files to an existing record
|
|
2940
|
+
* Uploads files to an existing record. Resolves with the files stored (`completed`), the files storage did not accept (`failed`) and why (`errors`, one entry per failed file with a SkapiError that carries the storage code).
|
|
2941
|
+
* `timeout` (milliseconds) aborts a file that takes longer and counts it as failed with the code 'TIMEOUT'; by default a file has no time limit.
|
|
2942
|
+
* `throwOnFileError` rejects at the first file that fails, with that file's error, instead of resolving; the files stored before it stay stored.
|
|
2871
2943
|
* @param fileList Files or form event containing files.
|
|
2872
2944
|
* @param params Request parameters.
|
|
2873
|
-
* @returns A promise that resolves to Promise<
|
|
2945
|
+
* @returns A promise that resolves to Promise<UploadFilesResult>.
|
|
2874
2946
|
*/
|
|
2875
|
-
uploadFiles(fileList: FormData | HTMLFormElement | SubmitEvent, params:
|
|
2876
|
-
record_id: string;
|
|
2877
|
-
progress?: ProgressCallback;
|
|
2878
|
-
}): Promise<{
|
|
2879
|
-
completed: File[];
|
|
2880
|
-
failed: File[];
|
|
2881
|
-
bin_endpoints: string[];
|
|
2882
|
-
}>;
|
|
2947
|
+
uploadFiles(fileList: FormData | HTMLFormElement | SubmitEvent, params: UploadFilesParams): Promise<UploadFilesResult>;
|
|
2883
2948
|
/**
|
|
2884
2949
|
* Calls the mock endpoint for testing request and error handling flows.
|
|
2885
2950
|
* @param data Data payload for the request.
|
|
@@ -3145,15 +3210,4 @@ declare class Skapi {
|
|
|
3145
3210
|
bulkPostRecords(config: PostRecordConfig[]): Promise<RecordData[]>;
|
|
3146
3211
|
}
|
|
3147
3212
|
|
|
3148
|
-
|
|
3149
|
-
code: string | number;
|
|
3150
|
-
/** The underlying Error, or the flat TicketError body of a failed ticket consumption (consumeTicket). */
|
|
3151
|
-
cause: Error | TicketError;
|
|
3152
|
-
constructor(error: any, options?: {
|
|
3153
|
-
name?: string;
|
|
3154
|
-
code?: string;
|
|
3155
|
-
cause?: Error | TicketError;
|
|
3156
|
-
});
|
|
3157
|
-
}
|
|
3158
|
-
|
|
3159
|
-
export { type BinaryFile, type Condition, type Connection, type ConnectionInfo, type DatabaseResponse, type DelRecordQuery, type FetchOptions, type FileInfo, type Form, type GetRecordQuery, type Index, type Newsletter, type NewsletterGroup, type PostRecordConfig, type ProgressCallback, type RTCConnector, type RTCConnectorParams, type RTCEvent, type RTCReceiverParams, type RTCResolved, type RealtimeCallback, type RecordData, Skapi, SkapiError, type Subscription, type Table, type Tag, type Ticket, type TicketAction, type TicketCondition, type TicketConditionOperator, type TicketConditionRow, type TicketError, type TicketErrorCode, type TicketReceipt, type TicketResponseCondition, type TicketSignatureCondition, Types, type UniqueId, type UserAttributes, type UserProfile, type UserPublic, type WebSocketMessage };
|
|
3213
|
+
export { type BinaryFile, type Condition, type Connection, type ConnectionInfo, type DatabaseResponse, type DelRecordQuery, type FetchOptions, type FileInfo, type FileUploadError, type Form, type GetRecordQuery, type Index, type Newsletter, type NewsletterGroup, type PostRecordConfig, type ProgressCallback, type RTCConnector, type RTCConnectorParams, type RTCEvent, type RTCReceiverParams, type RTCResolved, type RealtimeCallback, type RecordData, Skapi, SkapiError, type Subscription, type Table, type Tag, type Ticket, type TicketAction, type TicketCondition, type TicketConditionOperator, type TicketConditionRow, type TicketError, type TicketErrorCode, type TicketReceipt, type TicketResponseCondition, type TicketSignatureCondition, Types, type UniqueId, type UploadFilesParams, type UploadFilesResult, type UserAttributes, type UserProfile, type UserPublic, type WebSocketMessage };
|