skapi-js 2.2.6-beta.3 → 2.2.6-beta.5

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.d.mts 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,70 @@ 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
+ /** One item of postRecords(): the two arguments postRecord() takes, as one object. */
587
+ type PostRecordsItem = {
588
+ /**
589
+ * The record's data, as postRecord()'s first argument: an object, or null. Leave it out (undefined)
590
+ * to keep a record's stored data as it is on an update. Files are not attached here: attach them
591
+ * with uploadFiles() to the saved record.
592
+ */
593
+ data?: Record<string, any> | null;
594
+ /** The record's configuration, as postRecord()'s second argument. */
595
+ config: PostRecordConfig;
596
+ };
597
+ /** What postRecords() resolves with. `list.length + failed.length` is the number of items given. */
598
+ type PostRecordsResult = {
599
+ /** The records that were saved, in the order their items were given. */
600
+ list: RecordData[];
601
+ /** The items that were not saved, in the order they were given. `index` is the item's position in the input. */
602
+ failed: {
603
+ index: number;
604
+ code: string;
605
+ message: string;
606
+ }[];
607
+ };
608
+ /** What uploadFiles() resolves with. */
609
+ type UploadFilesResult = {
610
+ /** Files that are stored. */
611
+ completed: File[];
612
+ /** Files storage did not accept. */
613
+ failed: File[];
614
+ /** Why each file in `failed` was not stored, one entry per file in the same order. Empty when every file was stored. */
615
+ errors: FileUploadError[];
616
+ /** Endpoint of every file, in the order they were given, whether or not it was stored. */
617
+ bin_endpoints: string[];
618
+ };
619
+ type UploadFilesParams = {
620
+ /** Record ID of the record to attach the files to. */
621
+ record_id: string;
622
+ /** Callback for upload progress. Useful when building a progress bar. */
623
+ progress?: ProgressCallback;
624
+ /**
625
+ * Milliseconds one file's upload may take. A file that takes longer is aborted and counted as failed with
626
+ * the code 'TIMEOUT'; the next file is then uploaded. Every file gets the full time. Omitted or 0: no limit.
627
+ */
628
+ timeout?: number;
629
+ /**
630
+ * Reject at the first file storage does not accept, with that file's error (a SkapiError, see FileUploadError),
631
+ * instead of resolving with it listed in `failed` and `errors`. The files stored before it stay stored.
632
+ * Default false.
633
+ */
634
+ throwOnFileError?: boolean;
635
+ };
561
636
  type FetchOptions = {
562
637
  /** Maximum number of records to fetch per call */
563
638
  limit?: number;
@@ -1212,12 +1287,15 @@ type Types_DelRecordQuery = DelRecordQuery;
1212
1287
  type Types_EncryptionOptions = EncryptionOptions;
1213
1288
  type Types_FetchOptions = FetchOptions;
1214
1289
  type Types_FileInfo = FileInfo;
1290
+ type Types_FileUploadError = FileUploadError;
1215
1291
  type Types_Form<T> = Form<T>;
1216
1292
  type Types_GetRecordQuery = GetRecordQuery;
1217
1293
  type Types_Index = Index;
1218
1294
  type Types_Newsletter = Newsletter;
1219
1295
  type Types_NewsletterGroup = NewsletterGroup;
1220
1296
  type Types_PostRecordConfig = PostRecordConfig;
1297
+ type Types_PostRecordsItem = PostRecordsItem;
1298
+ type Types_PostRecordsResult = PostRecordsResult;
1221
1299
  type Types_ProgressCallback = ProgressCallback;
1222
1300
  type Types_RTCConnector = RTCConnector;
1223
1301
  type Types_RTCConnectorParams = RTCConnectorParams;
@@ -1242,12 +1320,14 @@ type Types_TicketReceipt = TicketReceipt;
1242
1320
  type Types_TicketResponseCondition = TicketResponseCondition;
1243
1321
  type Types_TicketSignatureCondition = TicketSignatureCondition;
1244
1322
  type Types_UniqueId = UniqueId;
1323
+ type Types_UploadFilesParams = UploadFilesParams;
1324
+ type Types_UploadFilesResult = UploadFilesResult;
1245
1325
  type Types_UserAttributes = UserAttributes;
1246
1326
  type Types_UserProfile = UserProfile;
1247
1327
  type Types_UserPublic = UserPublic;
1248
1328
  type Types_WebSocketMessage = WebSocketMessage;
1249
1329
  declare namespace Types {
1250
- 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 };
1330
+ 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_PostRecordsItem as PostRecordsItem, Types_PostRecordsResult as PostRecordsResult, 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 };
1251
1331
  }
1252
1332
 
1253
1333
  declare function terminatePendingRequests(): void;
@@ -2881,19 +2961,14 @@ declare class Skapi {
2881
2961
  endpoints: string | string[];
2882
2962
  }): Promise<RecordData[]>;
2883
2963
  /**
2884
- * Uploads files to an existing record and returns completed and failed results.
2964
+ * 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).
2965
+ * `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.
2966
+ * `throwOnFileError` rejects at the first file that fails, with that file's error, instead of resolving; the files stored before it stay stored.
2885
2967
  * @param fileList Files or form event containing files.
2886
2968
  * @param params Request parameters.
2887
- * @returns A promise that resolves to Promise<{ completed: File[], failed: File[], bin_endpoints: string[] }>.
2969
+ * @returns A promise that resolves to Promise<UploadFilesResult>.
2888
2970
  */
2889
- uploadFiles(fileList: FormData | HTMLFormElement | SubmitEvent, params: {
2890
- record_id: string;
2891
- progress?: ProgressCallback;
2892
- }): Promise<{
2893
- completed: File[];
2894
- failed: File[];
2895
- bin_endpoints: string[];
2896
- }>;
2971
+ uploadFiles(fileList: FormData | HTMLFormElement | SubmitEvent, params: UploadFilesParams): Promise<UploadFilesResult>;
2897
2972
  /**
2898
2973
  * Calls the mock endpoint for testing request and error handling flows.
2899
2974
  * @param data Data payload for the request.
@@ -3088,6 +3163,15 @@ declare class Skapi {
3088
3163
  name: string;
3089
3164
  file: File;
3090
3165
  }[]): Promise<RecordData>;
3166
+ /**
3167
+ * Creates or updates several records in one call, 100 records to a request. Each item is the two arguments of postRecord() as one object: `{ data, config }`.
3168
+ * Resolves with `list`, the records that were saved in the order their items were given, and `failed`, the items that were not saved, each with its `index` in the input, a `code` and a `message`.
3169
+ * A refused item never rejects the call, and the items after it are still posted; only a failure of a request itself (connection, sign-in, a server error) rejects, and the records saved before it stay saved.
3170
+ * Files are not attached here: use uploadFiles() on a saved record.
3171
+ * @param items Non-empty array of `{ data, config }` items.
3172
+ * @returns A promise that resolves to Promise<PostRecordsResult>.
3173
+ */
3174
+ postRecords(items: PostRecordsItem[]): Promise<PostRecordsResult>;
3091
3175
  /**
3092
3176
  * Fetches subscriber/subscription relationships with filters and pagination. At least one of `subscriber` or `subscription` must be provided.
3093
3177
  * @param params Request parameters.
@@ -3159,15 +3243,4 @@ declare class Skapi {
3159
3243
  bulkPostRecords(config: PostRecordConfig[]): Promise<RecordData[]>;
3160
3244
  }
3161
3245
 
3162
- declare class SkapiError extends Error {
3163
- code: string | number;
3164
- /** The underlying Error, or the flat TicketError body of a failed ticket consumption (consumeTicket). */
3165
- cause: Error | TicketError;
3166
- constructor(error: any, options?: {
3167
- name?: string;
3168
- code?: string;
3169
- cause?: Error | TicketError;
3170
- });
3171
- }
3172
-
3173
- 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 };
3246
+ 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 };
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,70 @@ 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
+ /** One item of postRecords(): the two arguments postRecord() takes, as one object. */
587
+ type PostRecordsItem = {
588
+ /**
589
+ * The record's data, as postRecord()'s first argument: an object, or null. Leave it out (undefined)
590
+ * to keep a record's stored data as it is on an update. Files are not attached here: attach them
591
+ * with uploadFiles() to the saved record.
592
+ */
593
+ data?: Record<string, any> | null;
594
+ /** The record's configuration, as postRecord()'s second argument. */
595
+ config: PostRecordConfig;
596
+ };
597
+ /** What postRecords() resolves with. `list.length + failed.length` is the number of items given. */
598
+ type PostRecordsResult = {
599
+ /** The records that were saved, in the order their items were given. */
600
+ list: RecordData[];
601
+ /** The items that were not saved, in the order they were given. `index` is the item's position in the input. */
602
+ failed: {
603
+ index: number;
604
+ code: string;
605
+ message: string;
606
+ }[];
607
+ };
608
+ /** What uploadFiles() resolves with. */
609
+ type UploadFilesResult = {
610
+ /** Files that are stored. */
611
+ completed: File[];
612
+ /** Files storage did not accept. */
613
+ failed: File[];
614
+ /** Why each file in `failed` was not stored, one entry per file in the same order. Empty when every file was stored. */
615
+ errors: FileUploadError[];
616
+ /** Endpoint of every file, in the order they were given, whether or not it was stored. */
617
+ bin_endpoints: string[];
618
+ };
619
+ type UploadFilesParams = {
620
+ /** Record ID of the record to attach the files to. */
621
+ record_id: string;
622
+ /** Callback for upload progress. Useful when building a progress bar. */
623
+ progress?: ProgressCallback;
624
+ /**
625
+ * Milliseconds one file's upload may take. A file that takes longer is aborted and counted as failed with
626
+ * the code 'TIMEOUT'; the next file is then uploaded. Every file gets the full time. Omitted or 0: no limit.
627
+ */
628
+ timeout?: number;
629
+ /**
630
+ * Reject at the first file storage does not accept, with that file's error (a SkapiError, see FileUploadError),
631
+ * instead of resolving with it listed in `failed` and `errors`. The files stored before it stay stored.
632
+ * Default false.
633
+ */
634
+ throwOnFileError?: boolean;
635
+ };
561
636
  type FetchOptions = {
562
637
  /** Maximum number of records to fetch per call */
563
638
  limit?: number;
@@ -1212,12 +1287,15 @@ type Types_DelRecordQuery = DelRecordQuery;
1212
1287
  type Types_EncryptionOptions = EncryptionOptions;
1213
1288
  type Types_FetchOptions = FetchOptions;
1214
1289
  type Types_FileInfo = FileInfo;
1290
+ type Types_FileUploadError = FileUploadError;
1215
1291
  type Types_Form<T> = Form<T>;
1216
1292
  type Types_GetRecordQuery = GetRecordQuery;
1217
1293
  type Types_Index = Index;
1218
1294
  type Types_Newsletter = Newsletter;
1219
1295
  type Types_NewsletterGroup = NewsletterGroup;
1220
1296
  type Types_PostRecordConfig = PostRecordConfig;
1297
+ type Types_PostRecordsItem = PostRecordsItem;
1298
+ type Types_PostRecordsResult = PostRecordsResult;
1221
1299
  type Types_ProgressCallback = ProgressCallback;
1222
1300
  type Types_RTCConnector = RTCConnector;
1223
1301
  type Types_RTCConnectorParams = RTCConnectorParams;
@@ -1242,12 +1320,14 @@ type Types_TicketReceipt = TicketReceipt;
1242
1320
  type Types_TicketResponseCondition = TicketResponseCondition;
1243
1321
  type Types_TicketSignatureCondition = TicketSignatureCondition;
1244
1322
  type Types_UniqueId = UniqueId;
1323
+ type Types_UploadFilesParams = UploadFilesParams;
1324
+ type Types_UploadFilesResult = UploadFilesResult;
1245
1325
  type Types_UserAttributes = UserAttributes;
1246
1326
  type Types_UserProfile = UserProfile;
1247
1327
  type Types_UserPublic = UserPublic;
1248
1328
  type Types_WebSocketMessage = WebSocketMessage;
1249
1329
  declare namespace Types {
1250
- 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 };
1330
+ 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_PostRecordsItem as PostRecordsItem, Types_PostRecordsResult as PostRecordsResult, 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 };
1251
1331
  }
1252
1332
 
1253
1333
  declare function terminatePendingRequests(): void;
@@ -2881,19 +2961,14 @@ declare class Skapi {
2881
2961
  endpoints: string | string[];
2882
2962
  }): Promise<RecordData[]>;
2883
2963
  /**
2884
- * Uploads files to an existing record and returns completed and failed results.
2964
+ * 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).
2965
+ * `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.
2966
+ * `throwOnFileError` rejects at the first file that fails, with that file's error, instead of resolving; the files stored before it stay stored.
2885
2967
  * @param fileList Files or form event containing files.
2886
2968
  * @param params Request parameters.
2887
- * @returns A promise that resolves to Promise<{ completed: File[], failed: File[], bin_endpoints: string[] }>.
2969
+ * @returns A promise that resolves to Promise<UploadFilesResult>.
2888
2970
  */
2889
- uploadFiles(fileList: FormData | HTMLFormElement | SubmitEvent, params: {
2890
- record_id: string;
2891
- progress?: ProgressCallback;
2892
- }): Promise<{
2893
- completed: File[];
2894
- failed: File[];
2895
- bin_endpoints: string[];
2896
- }>;
2971
+ uploadFiles(fileList: FormData | HTMLFormElement | SubmitEvent, params: UploadFilesParams): Promise<UploadFilesResult>;
2897
2972
  /**
2898
2973
  * Calls the mock endpoint for testing request and error handling flows.
2899
2974
  * @param data Data payload for the request.
@@ -3088,6 +3163,15 @@ declare class Skapi {
3088
3163
  name: string;
3089
3164
  file: File;
3090
3165
  }[]): Promise<RecordData>;
3166
+ /**
3167
+ * Creates or updates several records in one call, 100 records to a request. Each item is the two arguments of postRecord() as one object: `{ data, config }`.
3168
+ * Resolves with `list`, the records that were saved in the order their items were given, and `failed`, the items that were not saved, each with its `index` in the input, a `code` and a `message`.
3169
+ * A refused item never rejects the call, and the items after it are still posted; only a failure of a request itself (connection, sign-in, a server error) rejects, and the records saved before it stay saved.
3170
+ * Files are not attached here: use uploadFiles() on a saved record.
3171
+ * @param items Non-empty array of `{ data, config }` items.
3172
+ * @returns A promise that resolves to Promise<PostRecordsResult>.
3173
+ */
3174
+ postRecords(items: PostRecordsItem[]): Promise<PostRecordsResult>;
3091
3175
  /**
3092
3176
  * Fetches subscriber/subscription relationships with filters and pagination. At least one of `subscriber` or `subscription` must be provided.
3093
3177
  * @param params Request parameters.
@@ -3159,15 +3243,4 @@ declare class Skapi {
3159
3243
  bulkPostRecords(config: PostRecordConfig[]): Promise<RecordData[]>;
3160
3244
  }
3161
3245
 
3162
- declare class SkapiError extends Error {
3163
- code: string | number;
3164
- /** The underlying Error, or the flat TicketError body of a failed ticket consumption (consumeTicket). */
3165
- cause: Error | TicketError;
3166
- constructor(error: any, options?: {
3167
- name?: string;
3168
- code?: string;
3169
- cause?: Error | TicketError;
3170
- });
3171
- }
3172
-
3173
- 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 };
3246
+ 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 };