skapi-js 1.5.2-beta.0 → 1.5.2-beta.14

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.
@@ -838,6 +853,8 @@ declare class Skapi {
838
853
  clientSecretRequest(params: {
839
854
  url: string;
840
855
  clientSecretName: string;
856
+ poll?: boolean | number;
857
+ expires?: number;
841
858
  method: 'GET' | 'POST' | 'DELETE' | 'PUT';
842
859
  headers?: {
843
860
  [key: string]: string;
@@ -849,6 +866,19 @@ declare class Skapi {
849
866
  [key: string]: string;
850
867
  };
851
868
  }): Promise<any>;
869
+ /**
870
+ * Retrieves the history of client secret requests for a given URL and method.
871
+ * @param params Request parameters.
872
+ * @param fetchOptions Pagination and fetch behavior options.
873
+ * @returns A promise that resolves to Promise<any[]>.
874
+ */
875
+ clientSecretRequestHistory(params: {
876
+ url: string;
877
+ method: 'GET' | 'POST' | 'DELETE' | 'PUT';
878
+ poll?: number;
879
+ }, fetchOptions?: FetchOptions): Promise<DatabaseResponse<PollingResult[]> & {
880
+ pending: Promise<PollingResult>[];
881
+ }>;
852
882
  /**
853
883
  * Consumes a one-time ticket and executes the ticketed request payload.
854
884
  * @param params Request parameters.
@@ -908,7 +938,7 @@ declare class Skapi {
908
938
  email: string;
909
939
  subject: string;
910
940
  message: string;
911
- }>): Promise<"SUCCESS: Inquiry has been sent.">;
941
+ }>): Promise<'SUCCESS: Inquiry has been sent.'>;
912
942
  /**
913
943
  * Blocks a user account by user_id.
914
944
  * @param params Payload for the request.
@@ -916,7 +946,7 @@ declare class Skapi {
916
946
  */
917
947
  blockAccount(params: {
918
948
  user_id: string;
919
- }): Promise<"SUCCESS: The user has been blocked.">;
949
+ }): Promise<'SUCCESS: The user has been blocked.'>;
920
950
  /**
921
951
  * Unblocks a previously blocked user account by user_id.
922
952
  * @param params Payload for the request.
@@ -924,7 +954,7 @@ declare class Skapi {
924
954
  */
925
955
  unblockAccount(params: {
926
956
  user_id: string;
927
- }): Promise<"SUCCESS: The user has been unblocked.">;
957
+ }): Promise<'SUCCESS: The user has been unblocked.'>;
928
958
  /**
929
959
  * Deletes a user account by user_id.
930
960
  * @param params Payload for the request.
@@ -932,7 +962,7 @@ declare class Skapi {
932
962
  */
933
963
  deleteAccount(params: {
934
964
  user_id: string;
935
- }): Promise<"SUCCESS: Account has been deleted.">;
965
+ }): Promise<'SUCCESS: Account has been deleted.'>;
936
966
  /**
937
967
  * Invites a user by email with optional attributes and invitation email options.
938
968
  * @param params Payload for the request.
@@ -1134,7 +1164,7 @@ declare class Skapi {
1134
1164
  */
1135
1165
  recoverAccount(
1136
1166
  /** Redirect url on confirmation success. */
1137
- redirect?: boolean | string): Promise<"SUCCESS: Recovery e-mail has been sent.">;
1167
+ redirect?: boolean | string): Promise<'SUCCESS: Recovery e-mail has been sent.'>;
1138
1168
  /**
1139
1169
  * Queries users by supported profile/search fields with pagination.
1140
1170
  * @param params Request parameters.
@@ -1208,7 +1238,7 @@ declare class Skapi {
1208
1238
  pushNotification(params: {
1209
1239
  title: string;
1210
1240
  body: string;
1211
- }, user_ids?: string | string[]): Promise<"SUCCESS: Notification sent.">;
1241
+ }, user_ids?: string | string[]): Promise<'SUCCESS: Notification sent.'>;
1212
1242
  /**
1213
1243
  * Fetches newsletter delivery records with filters and pagination.
1214
1244
  * @param params Request parameters.
@@ -1399,7 +1429,7 @@ declare class Skapi {
1399
1429
  code: string | number;
1400
1430
  /** New password to set. Verification code is required. */
1401
1431
  new_password: string;
1402
- }>): Promise<"SUCCESS: New password has been set.">;
1432
+ }>): Promise<'SUCCESS: New password has been set.'>;
1403
1433
  /**
1404
1434
  * Verifies the user email address with a confirmation code.
1405
1435
  * @param params Payload for the request.
@@ -1424,7 +1454,7 @@ declare class Skapi {
1424
1454
  forgotPassword(params: Form<{
1425
1455
  /** Signin E-Mail. */
1426
1456
  email: string;
1427
- }>): Promise<"SUCCESS: Verification code has been sent.">;
1457
+ }>): Promise<'SUCCESS: Verification code has been sent.'>;
1428
1458
  /**
1429
1459
  * Changes password for the authenticated user.
1430
1460
  * @param params Request parameters.
@@ -1510,7 +1540,7 @@ declare class Skapi {
1510
1540
  group: number | 'public' | 'authorized' | 'admin';
1511
1541
  redirect?: string;
1512
1542
  }>): Promise<string>;
1513
- bulkPostRecords(config: PostRecordConfig): Promise<RecordData[]>;
1543
+ bulkPostRecords(config: PostRecordConfig[]): Promise<RecordData[]>;
1514
1544
  }
1515
1545
 
1516
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.
@@ -838,6 +853,8 @@ declare class Skapi {
838
853
  clientSecretRequest(params: {
839
854
  url: string;
840
855
  clientSecretName: string;
856
+ poll?: boolean | number;
857
+ expires?: number;
841
858
  method: 'GET' | 'POST' | 'DELETE' | 'PUT';
842
859
  headers?: {
843
860
  [key: string]: string;
@@ -849,6 +866,19 @@ declare class Skapi {
849
866
  [key: string]: string;
850
867
  };
851
868
  }): Promise<any>;
869
+ /**
870
+ * Retrieves the history of client secret requests for a given URL and method.
871
+ * @param params Request parameters.
872
+ * @param fetchOptions Pagination and fetch behavior options.
873
+ * @returns A promise that resolves to Promise<any[]>.
874
+ */
875
+ clientSecretRequestHistory(params: {
876
+ url: string;
877
+ method: 'GET' | 'POST' | 'DELETE' | 'PUT';
878
+ poll?: number;
879
+ }, fetchOptions?: FetchOptions): Promise<DatabaseResponse<PollingResult[]> & {
880
+ pending: Promise<PollingResult>[];
881
+ }>;
852
882
  /**
853
883
  * Consumes a one-time ticket and executes the ticketed request payload.
854
884
  * @param params Request parameters.
@@ -908,7 +938,7 @@ declare class Skapi {
908
938
  email: string;
909
939
  subject: string;
910
940
  message: string;
911
- }>): Promise<"SUCCESS: Inquiry has been sent.">;
941
+ }>): Promise<'SUCCESS: Inquiry has been sent.'>;
912
942
  /**
913
943
  * Blocks a user account by user_id.
914
944
  * @param params Payload for the request.
@@ -916,7 +946,7 @@ declare class Skapi {
916
946
  */
917
947
  blockAccount(params: {
918
948
  user_id: string;
919
- }): Promise<"SUCCESS: The user has been blocked.">;
949
+ }): Promise<'SUCCESS: The user has been blocked.'>;
920
950
  /**
921
951
  * Unblocks a previously blocked user account by user_id.
922
952
  * @param params Payload for the request.
@@ -924,7 +954,7 @@ declare class Skapi {
924
954
  */
925
955
  unblockAccount(params: {
926
956
  user_id: string;
927
- }): Promise<"SUCCESS: The user has been unblocked.">;
957
+ }): Promise<'SUCCESS: The user has been unblocked.'>;
928
958
  /**
929
959
  * Deletes a user account by user_id.
930
960
  * @param params Payload for the request.
@@ -932,7 +962,7 @@ declare class Skapi {
932
962
  */
933
963
  deleteAccount(params: {
934
964
  user_id: string;
935
- }): Promise<"SUCCESS: Account has been deleted.">;
965
+ }): Promise<'SUCCESS: Account has been deleted.'>;
936
966
  /**
937
967
  * Invites a user by email with optional attributes and invitation email options.
938
968
  * @param params Payload for the request.
@@ -1134,7 +1164,7 @@ declare class Skapi {
1134
1164
  */
1135
1165
  recoverAccount(
1136
1166
  /** Redirect url on confirmation success. */
1137
- redirect?: boolean | string): Promise<"SUCCESS: Recovery e-mail has been sent.">;
1167
+ redirect?: boolean | string): Promise<'SUCCESS: Recovery e-mail has been sent.'>;
1138
1168
  /**
1139
1169
  * Queries users by supported profile/search fields with pagination.
1140
1170
  * @param params Request parameters.
@@ -1208,7 +1238,7 @@ declare class Skapi {
1208
1238
  pushNotification(params: {
1209
1239
  title: string;
1210
1240
  body: string;
1211
- }, user_ids?: string | string[]): Promise<"SUCCESS: Notification sent.">;
1241
+ }, user_ids?: string | string[]): Promise<'SUCCESS: Notification sent.'>;
1212
1242
  /**
1213
1243
  * Fetches newsletter delivery records with filters and pagination.
1214
1244
  * @param params Request parameters.
@@ -1399,7 +1429,7 @@ declare class Skapi {
1399
1429
  code: string | number;
1400
1430
  /** New password to set. Verification code is required. */
1401
1431
  new_password: string;
1402
- }>): Promise<"SUCCESS: New password has been set.">;
1432
+ }>): Promise<'SUCCESS: New password has been set.'>;
1403
1433
  /**
1404
1434
  * Verifies the user email address with a confirmation code.
1405
1435
  * @param params Payload for the request.
@@ -1424,7 +1454,7 @@ declare class Skapi {
1424
1454
  forgotPassword(params: Form<{
1425
1455
  /** Signin E-Mail. */
1426
1456
  email: string;
1427
- }>): Promise<"SUCCESS: Verification code has been sent.">;
1457
+ }>): Promise<'SUCCESS: Verification code has been sent.'>;
1428
1458
  /**
1429
1459
  * Changes password for the authenticated user.
1430
1460
  * @param params Request parameters.
@@ -1510,7 +1540,7 @@ declare class Skapi {
1510
1540
  group: number | 'public' | 'authorized' | 'admin';
1511
1541
  redirect?: string;
1512
1542
  }>): Promise<string>;
1513
- bulkPostRecords(config: PostRecordConfig): Promise<RecordData[]>;
1543
+ bulkPostRecords(config: PostRecordConfig[]): Promise<RecordData[]>;
1514
1544
  }
1515
1545
 
1516
1546
  declare class SkapiError extends Error {