skapi-js 1.5.2-beta.9 → 1.5.2

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
@@ -463,6 +463,15 @@ type FetchOptions = {
463
463
  /** Callback for database request progress. Useful when building progress bar. */
464
464
  progress?: ProgressCallback;
465
465
  };
466
+ type PollingResult = {
467
+ response_body: any;
468
+ error: any;
469
+ updated: number;
470
+ request_body: any;
471
+ status_code: number | null;
472
+ expires: number | null;
473
+ status: 'resolved' | 'failed' | 'pending';
474
+ };
466
475
  type DatabaseResponse<T> = {
467
476
  list: T[];
468
477
  startKey: {
@@ -492,6 +501,11 @@ type Table = {
492
501
  table: string;
493
502
  number_of_records: string;
494
503
  size: number;
504
+ number_of_records_in_access_group_public?: number;
505
+ number_of_records_in_access_group_private?: number;
506
+ number_of_records_in_access_group_authorized?: number;
507
+ number_of_records_in_access_group_admin?: number;
508
+ [number_of_records_in_access_group_xx: string]: number | string | undefined;
495
509
  };
496
510
  type Index = {
497
511
  table: string;
@@ -536,6 +550,7 @@ type Types_Form<T> = Form<T>;
536
550
  type Types_GetRecordQuery = GetRecordQuery;
537
551
  type Types_Index = Index;
538
552
  type Types_Newsletter = Newsletter;
553
+ type Types_PollingResult = PollingResult;
539
554
  type Types_PostRecordConfig = PostRecordConfig;
540
555
  type Types_ProgressCallback = ProgressCallback;
541
556
  type Types_RTCConnector = RTCConnector;
@@ -554,7 +569,7 @@ type Types_UserProfile = UserProfile;
554
569
  type Types_UserPublic = UserPublic;
555
570
  type Types_WebSocketMessage = WebSocketMessage;
556
571
  declare namespace Types {
557
- 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_FetchOptions as FetchOptions, Types_FileInfo as FileInfo, Types_Form as Form, Types_GetRecordQuery as GetRecordQuery, Types_Index as Index, Types_Newsletter as Newsletter, 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_Subscription as Subscription, Types_Table as Table, Types_Tag as Tag, Types_UniqueId as UniqueId, Types_UserAttributes as UserAttributes, Types_UserProfile as UserProfile, Types_UserPublic as UserPublic, Types_WebSocketMessage as WebSocketMessage };
572
+ 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_FetchOptions as FetchOptions, Types_FileInfo as FileInfo, Types_Form as Form, Types_GetRecordQuery as GetRecordQuery, Types_Index as Index, Types_Newsletter as Newsletter, Types_PollingResult as PollingResult, 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_Subscription as Subscription, Types_Table as Table, Types_Tag as Tag, Types_UniqueId as UniqueId, Types_UserAttributes as UserAttributes, Types_UserProfile as UserProfile, Types_UserPublic as UserPublic, Types_WebSocketMessage as WebSocketMessage };
558
573
  }
559
574
 
560
575
  declare function terminatePendingRequests(): void;
@@ -787,7 +802,7 @@ declare class Skapi {
787
802
  resendInvitation(params: Form<{
788
803
  email: string;
789
804
  confirmation_url?: string;
790
- }>): Promise<"SUCCESS: Invitation has been re-sent. (User ID: xxx...)">;
805
+ }>): Promise<'SUCCESS: Invitation has been re-sent. (User ID: xxx...)'>;
791
806
  /**
792
807
  * Cancels a pending invitation for the target email address.
793
808
  * @param params Request parameters.
@@ -795,7 +810,7 @@ declare class Skapi {
795
810
  */
796
811
  cancelInvitation(params: Form<{
797
812
  email: string;
798
- }>): Promise<"SUCCESS: Invitation has been canceled.">;
813
+ }>): Promise<'SUCCESS: Invitation has been canceled.'>;
799
814
  /**
800
815
  * Lists invitation records with optional email filtering and pagination.
801
816
  * @param params Request parameters.
@@ -839,6 +854,7 @@ declare class Skapi {
839
854
  url: string;
840
855
  clientSecretName: string;
841
856
  poll?: boolean | number;
857
+ expires?: number;
842
858
  method: 'GET' | 'POST' | 'DELETE' | 'PUT';
843
859
  headers?: {
844
860
  [key: string]: string;
@@ -859,12 +875,10 @@ declare class Skapi {
859
875
  clientSecretRequestHistory(params: {
860
876
  url: string;
861
877
  method: 'GET' | 'POST' | 'DELETE' | 'PUT';
862
- }, fetchOptions?: FetchOptions): DatabaseResponse<{
863
- response_body: any;
864
- error: any;
865
- updated: number;
866
- request_body: any;
867
- }[]>;
878
+ poll?: number;
879
+ }, fetchOptions?: FetchOptions): Promise<DatabaseResponse<PollingResult[]> & {
880
+ pending: Promise<PollingResult>[];
881
+ }>;
868
882
  /**
869
883
  * Consumes a one-time ticket and executes the ticketed request payload.
870
884
  * @param params Request parameters.
@@ -924,7 +938,7 @@ declare class Skapi {
924
938
  email: string;
925
939
  subject: string;
926
940
  message: string;
927
- }>): Promise<"SUCCESS: Inquiry has been sent.">;
941
+ }>): Promise<'SUCCESS: Inquiry has been sent.'>;
928
942
  /**
929
943
  * Blocks a user account by user_id.
930
944
  * @param params Payload for the request.
@@ -932,7 +946,7 @@ declare class Skapi {
932
946
  */
933
947
  blockAccount(params: {
934
948
  user_id: string;
935
- }): Promise<"SUCCESS: The user has been blocked.">;
949
+ }): Promise<'SUCCESS: The user has been blocked.'>;
936
950
  /**
937
951
  * Unblocks a previously blocked user account by user_id.
938
952
  * @param params Payload for the request.
@@ -940,7 +954,7 @@ declare class Skapi {
940
954
  */
941
955
  unblockAccount(params: {
942
956
  user_id: string;
943
- }): Promise<"SUCCESS: The user has been unblocked.">;
957
+ }): Promise<'SUCCESS: The user has been unblocked.'>;
944
958
  /**
945
959
  * Deletes a user account by user_id.
946
960
  * @param params Payload for the request.
@@ -948,7 +962,7 @@ declare class Skapi {
948
962
  */
949
963
  deleteAccount(params: {
950
964
  user_id: string;
951
- }): Promise<"SUCCESS: Account has been deleted.">;
965
+ }): Promise<'SUCCESS: Account has been deleted.'>;
952
966
  /**
953
967
  * Invites a user by email with optional attributes and invitation email options.
954
968
  * @param params Payload for the request.
@@ -1150,7 +1164,7 @@ declare class Skapi {
1150
1164
  */
1151
1165
  recoverAccount(
1152
1166
  /** Redirect url on confirmation success. */
1153
- redirect?: boolean | string): Promise<"SUCCESS: Recovery e-mail has been sent.">;
1167
+ redirect?: boolean | string): Promise<'SUCCESS: Recovery e-mail has been sent.'>;
1154
1168
  /**
1155
1169
  * Queries users by supported profile/search fields with pagination.
1156
1170
  * @param params Request parameters.
@@ -1224,7 +1238,7 @@ declare class Skapi {
1224
1238
  pushNotification(params: {
1225
1239
  title: string;
1226
1240
  body: string;
1227
- }, user_ids?: string | string[]): Promise<"SUCCESS: Notification sent.">;
1241
+ }, user_ids?: string | string[]): Promise<'SUCCESS: Notification sent.'>;
1228
1242
  /**
1229
1243
  * Fetches newsletter delivery records with filters and pagination.
1230
1244
  * @param params Request parameters.
@@ -1415,7 +1429,7 @@ declare class Skapi {
1415
1429
  code: string | number;
1416
1430
  /** New password to set. Verification code is required. */
1417
1431
  new_password: string;
1418
- }>): Promise<"SUCCESS: New password has been set.">;
1432
+ }>): Promise<'SUCCESS: New password has been set.'>;
1419
1433
  /**
1420
1434
  * Verifies the user email address with a confirmation code.
1421
1435
  * @param params Payload for the request.
@@ -1440,7 +1454,7 @@ declare class Skapi {
1440
1454
  forgotPassword(params: Form<{
1441
1455
  /** Signin E-Mail. */
1442
1456
  email: string;
1443
- }>): Promise<"SUCCESS: Verification code has been sent.">;
1457
+ }>): Promise<'SUCCESS: Verification code has been sent.'>;
1444
1458
  /**
1445
1459
  * Changes password for the authenticated user.
1446
1460
  * @param params Request parameters.
@@ -1526,7 +1540,7 @@ declare class Skapi {
1526
1540
  group: number | 'public' | 'authorized' | 'admin';
1527
1541
  redirect?: string;
1528
1542
  }>): Promise<string>;
1529
- bulkPostRecords(config: PostRecordConfig): Promise<RecordData[]>;
1543
+ bulkPostRecords(config: PostRecordConfig[]): Promise<RecordData[]>;
1530
1544
  }
1531
1545
 
1532
1546
  declare class SkapiError extends Error {
package/dist/skapi.d.ts CHANGED
@@ -463,6 +463,15 @@ type FetchOptions = {
463
463
  /** Callback for database request progress. Useful when building progress bar. */
464
464
  progress?: ProgressCallback;
465
465
  };
466
+ type PollingResult = {
467
+ response_body: any;
468
+ error: any;
469
+ updated: number;
470
+ request_body: any;
471
+ status_code: number | null;
472
+ expires: number | null;
473
+ status: 'resolved' | 'failed' | 'pending';
474
+ };
466
475
  type DatabaseResponse<T> = {
467
476
  list: T[];
468
477
  startKey: {
@@ -492,6 +501,11 @@ type Table = {
492
501
  table: string;
493
502
  number_of_records: string;
494
503
  size: number;
504
+ number_of_records_in_access_group_public?: number;
505
+ number_of_records_in_access_group_private?: number;
506
+ number_of_records_in_access_group_authorized?: number;
507
+ number_of_records_in_access_group_admin?: number;
508
+ [number_of_records_in_access_group_xx: string]: number | string | undefined;
495
509
  };
496
510
  type Index = {
497
511
  table: string;
@@ -536,6 +550,7 @@ type Types_Form<T> = Form<T>;
536
550
  type Types_GetRecordQuery = GetRecordQuery;
537
551
  type Types_Index = Index;
538
552
  type Types_Newsletter = Newsletter;
553
+ type Types_PollingResult = PollingResult;
539
554
  type Types_PostRecordConfig = PostRecordConfig;
540
555
  type Types_ProgressCallback = ProgressCallback;
541
556
  type Types_RTCConnector = RTCConnector;
@@ -554,7 +569,7 @@ type Types_UserProfile = UserProfile;
554
569
  type Types_UserPublic = UserPublic;
555
570
  type Types_WebSocketMessage = WebSocketMessage;
556
571
  declare namespace Types {
557
- 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_FetchOptions as FetchOptions, Types_FileInfo as FileInfo, Types_Form as Form, Types_GetRecordQuery as GetRecordQuery, Types_Index as Index, Types_Newsletter as Newsletter, 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_Subscription as Subscription, Types_Table as Table, Types_Tag as Tag, Types_UniqueId as UniqueId, Types_UserAttributes as UserAttributes, Types_UserProfile as UserProfile, Types_UserPublic as UserPublic, Types_WebSocketMessage as WebSocketMessage };
572
+ 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_FetchOptions as FetchOptions, Types_FileInfo as FileInfo, Types_Form as Form, Types_GetRecordQuery as GetRecordQuery, Types_Index as Index, Types_Newsletter as Newsletter, Types_PollingResult as PollingResult, 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_Subscription as Subscription, Types_Table as Table, Types_Tag as Tag, Types_UniqueId as UniqueId, Types_UserAttributes as UserAttributes, Types_UserProfile as UserProfile, Types_UserPublic as UserPublic, Types_WebSocketMessage as WebSocketMessage };
558
573
  }
559
574
 
560
575
  declare function terminatePendingRequests(): void;
@@ -787,7 +802,7 @@ declare class Skapi {
787
802
  resendInvitation(params: Form<{
788
803
  email: string;
789
804
  confirmation_url?: string;
790
- }>): Promise<"SUCCESS: Invitation has been re-sent. (User ID: xxx...)">;
805
+ }>): Promise<'SUCCESS: Invitation has been re-sent. (User ID: xxx...)'>;
791
806
  /**
792
807
  * Cancels a pending invitation for the target email address.
793
808
  * @param params Request parameters.
@@ -795,7 +810,7 @@ declare class Skapi {
795
810
  */
796
811
  cancelInvitation(params: Form<{
797
812
  email: string;
798
- }>): Promise<"SUCCESS: Invitation has been canceled.">;
813
+ }>): Promise<'SUCCESS: Invitation has been canceled.'>;
799
814
  /**
800
815
  * Lists invitation records with optional email filtering and pagination.
801
816
  * @param params Request parameters.
@@ -839,6 +854,7 @@ declare class Skapi {
839
854
  url: string;
840
855
  clientSecretName: string;
841
856
  poll?: boolean | number;
857
+ expires?: number;
842
858
  method: 'GET' | 'POST' | 'DELETE' | 'PUT';
843
859
  headers?: {
844
860
  [key: string]: string;
@@ -859,12 +875,10 @@ declare class Skapi {
859
875
  clientSecretRequestHistory(params: {
860
876
  url: string;
861
877
  method: 'GET' | 'POST' | 'DELETE' | 'PUT';
862
- }, fetchOptions?: FetchOptions): DatabaseResponse<{
863
- response_body: any;
864
- error: any;
865
- updated: number;
866
- request_body: any;
867
- }[]>;
878
+ poll?: number;
879
+ }, fetchOptions?: FetchOptions): Promise<DatabaseResponse<PollingResult[]> & {
880
+ pending: Promise<PollingResult>[];
881
+ }>;
868
882
  /**
869
883
  * Consumes a one-time ticket and executes the ticketed request payload.
870
884
  * @param params Request parameters.
@@ -924,7 +938,7 @@ declare class Skapi {
924
938
  email: string;
925
939
  subject: string;
926
940
  message: string;
927
- }>): Promise<"SUCCESS: Inquiry has been sent.">;
941
+ }>): Promise<'SUCCESS: Inquiry has been sent.'>;
928
942
  /**
929
943
  * Blocks a user account by user_id.
930
944
  * @param params Payload for the request.
@@ -932,7 +946,7 @@ declare class Skapi {
932
946
  */
933
947
  blockAccount(params: {
934
948
  user_id: string;
935
- }): Promise<"SUCCESS: The user has been blocked.">;
949
+ }): Promise<'SUCCESS: The user has been blocked.'>;
936
950
  /**
937
951
  * Unblocks a previously blocked user account by user_id.
938
952
  * @param params Payload for the request.
@@ -940,7 +954,7 @@ declare class Skapi {
940
954
  */
941
955
  unblockAccount(params: {
942
956
  user_id: string;
943
- }): Promise<"SUCCESS: The user has been unblocked.">;
957
+ }): Promise<'SUCCESS: The user has been unblocked.'>;
944
958
  /**
945
959
  * Deletes a user account by user_id.
946
960
  * @param params Payload for the request.
@@ -948,7 +962,7 @@ declare class Skapi {
948
962
  */
949
963
  deleteAccount(params: {
950
964
  user_id: string;
951
- }): Promise<"SUCCESS: Account has been deleted.">;
965
+ }): Promise<'SUCCESS: Account has been deleted.'>;
952
966
  /**
953
967
  * Invites a user by email with optional attributes and invitation email options.
954
968
  * @param params Payload for the request.
@@ -1150,7 +1164,7 @@ declare class Skapi {
1150
1164
  */
1151
1165
  recoverAccount(
1152
1166
  /** Redirect url on confirmation success. */
1153
- redirect?: boolean | string): Promise<"SUCCESS: Recovery e-mail has been sent.">;
1167
+ redirect?: boolean | string): Promise<'SUCCESS: Recovery e-mail has been sent.'>;
1154
1168
  /**
1155
1169
  * Queries users by supported profile/search fields with pagination.
1156
1170
  * @param params Request parameters.
@@ -1224,7 +1238,7 @@ declare class Skapi {
1224
1238
  pushNotification(params: {
1225
1239
  title: string;
1226
1240
  body: string;
1227
- }, user_ids?: string | string[]): Promise<"SUCCESS: Notification sent.">;
1241
+ }, user_ids?: string | string[]): Promise<'SUCCESS: Notification sent.'>;
1228
1242
  /**
1229
1243
  * Fetches newsletter delivery records with filters and pagination.
1230
1244
  * @param params Request parameters.
@@ -1415,7 +1429,7 @@ declare class Skapi {
1415
1429
  code: string | number;
1416
1430
  /** New password to set. Verification code is required. */
1417
1431
  new_password: string;
1418
- }>): Promise<"SUCCESS: New password has been set.">;
1432
+ }>): Promise<'SUCCESS: New password has been set.'>;
1419
1433
  /**
1420
1434
  * Verifies the user email address with a confirmation code.
1421
1435
  * @param params Payload for the request.
@@ -1440,7 +1454,7 @@ declare class Skapi {
1440
1454
  forgotPassword(params: Form<{
1441
1455
  /** Signin E-Mail. */
1442
1456
  email: string;
1443
- }>): Promise<"SUCCESS: Verification code has been sent.">;
1457
+ }>): Promise<'SUCCESS: Verification code has been sent.'>;
1444
1458
  /**
1445
1459
  * Changes password for the authenticated user.
1446
1460
  * @param params Request parameters.
@@ -1526,7 +1540,7 @@ declare class Skapi {
1526
1540
  group: number | 'public' | 'authorized' | 'admin';
1527
1541
  redirect?: string;
1528
1542
  }>): Promise<string>;
1529
- bulkPostRecords(config: PostRecordConfig): Promise<RecordData[]>;
1543
+ bulkPostRecords(config: PostRecordConfig[]): Promise<RecordData[]>;
1530
1544
  }
1531
1545
 
1532
1546
  declare class SkapiError extends Error {