skapi-js 1.6.0 → 1.6.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.browser.mjs +1 -1
- 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 +74 -52
- package/dist/skapi.d.ts +74 -52
- package/dist/skapi.js +1 -1
- 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
|
@@ -43,14 +43,14 @@ type WebSocketMessage = {
|
|
|
43
43
|
};
|
|
44
44
|
type RealtimeCallback = (rt: WebSocketMessage) => void;
|
|
45
45
|
type DelRecordQuery = GetRecordQuery & {
|
|
46
|
-
unique_id?: string
|
|
47
|
-
record_id?: string
|
|
46
|
+
unique_id?: string;
|
|
47
|
+
record_id?: string;
|
|
48
48
|
};
|
|
49
49
|
type GetRecordQuery = {
|
|
50
50
|
unique_id?: string;
|
|
51
51
|
record_id?: string;
|
|
52
|
-
/** Table name not required when "record_id" is given
|
|
53
|
-
table?: {
|
|
52
|
+
/** Table name not required when "record_id" is given. A bare string is shorthand for { name: <string> }. */
|
|
53
|
+
table?: string | {
|
|
54
54
|
/** Max 128 chars. Blocks: / ! * #, control chars, and sentinel . */
|
|
55
55
|
name: string;
|
|
56
56
|
/** Number range: 0 ~ 99. Default: 'public' */
|
|
@@ -58,7 +58,11 @@ type GetRecordQuery = {
|
|
|
58
58
|
/** User ID of subscription */
|
|
59
59
|
subscription?: string;
|
|
60
60
|
};
|
|
61
|
-
reference?: string
|
|
61
|
+
reference?: string | {
|
|
62
|
+
record_id?: string;
|
|
63
|
+
unique_id?: string;
|
|
64
|
+
user_id?: string;
|
|
65
|
+
};
|
|
62
66
|
/** Index condition and range cannot be used simultaneously.*/
|
|
63
67
|
index?: {
|
|
64
68
|
/** Custom names: max 128 chars, cannot start with "$", blocks / ! * #, control chars, and sentinel . Reserved names: $uploaded, $updated, $referenced_count, $user_id. */
|
|
@@ -509,6 +513,12 @@ type ConnectionInfo = {
|
|
|
509
513
|
service_description: string;
|
|
510
514
|
version: string;
|
|
511
515
|
ai_agent: string;
|
|
516
|
+
conf: {
|
|
517
|
+
freeze_database: boolean;
|
|
518
|
+
prevent_signup: boolean;
|
|
519
|
+
prevent_inquiry: boolean;
|
|
520
|
+
prevent_anonymous: boolean;
|
|
521
|
+
};
|
|
512
522
|
};
|
|
513
523
|
type Table = {
|
|
514
524
|
table: string;
|
|
@@ -720,11 +730,11 @@ declare class Skapi {
|
|
|
720
730
|
constructor(service: string, owner?: string | Options, options?: Options | any, __etc?: any);
|
|
721
731
|
/**
|
|
722
732
|
* Returns current connection metadata such as service name, client IP, user agent, locale, and SDK version.
|
|
723
|
-
* @param params Request parameters.
|
|
733
|
+
* @param params Request parameters. When `refresh` is true, the cached connection metadata is re-fetched before returning; otherwise the cached connection is returned.
|
|
724
734
|
* @returns A promise that resolves to Promise<ConnectionInfo>.
|
|
725
735
|
*/
|
|
726
736
|
getConnectionInfo(params?: {
|
|
727
|
-
refresh
|
|
737
|
+
refresh?: boolean;
|
|
728
738
|
}): Promise<ConnectionInfo>;
|
|
729
739
|
private _updateConnection;
|
|
730
740
|
private registerTicket;
|
|
@@ -762,12 +772,13 @@ declare class Skapi {
|
|
|
762
772
|
connectRTC(params: RTCConnectorParams, callback: (e: RTCEvent) => void): Promise<RTCConnector>;
|
|
763
773
|
/**
|
|
764
774
|
* Opens a realtime WebSocket connection and registers a callback for incoming realtime messages.
|
|
775
|
+
* The WebSocket is delivered through the callback (and stored on the instance); on the initial connection the returned promise resolves to undefined rather than the socket.
|
|
765
776
|
* @param callback Callback invoked for events or updates.
|
|
766
|
-
* @returns A promise that resolves to Promise<WebSocket>.
|
|
777
|
+
* @returns A promise that resolves to Promise<WebSocket | void>.
|
|
767
778
|
*/
|
|
768
|
-
connectRealtime(callback: RealtimeCallback): Promise<WebSocket>;
|
|
779
|
+
connectRealtime(callback: RealtimeCallback): Promise<WebSocket | void>;
|
|
769
780
|
/**
|
|
770
|
-
*
|
|
781
|
+
* Casts a spell (uploads the given spell/name). The server response is not surfaced; resolves to a fixed confirmation string.
|
|
771
782
|
* @param params Request parameters.
|
|
772
783
|
* @returns A promise that resolves to Promise<string>.
|
|
773
784
|
*/
|
|
@@ -790,25 +801,25 @@ declare class Skapi {
|
|
|
790
801
|
magic?: any;
|
|
791
802
|
}>>;
|
|
792
803
|
/**
|
|
793
|
-
*
|
|
804
|
+
* Uploads a dopamine message. In non-browser runtimes, resolves to a formatted string (including the video URL, and the previous message if one exists); in the browser it alerts and redirects, resolving to undefined.
|
|
794
805
|
* @param params Request parameters.
|
|
795
|
-
* @returns A promise that resolves to Promise<string>.
|
|
806
|
+
* @returns A promise that resolves to Promise<string | void>.
|
|
796
807
|
*/
|
|
797
808
|
dopamine(params: {
|
|
798
809
|
message: string;
|
|
799
810
|
name: string;
|
|
800
|
-
}): Promise<string>;
|
|
811
|
+
}): Promise<string | void>;
|
|
801
812
|
/**
|
|
802
813
|
* Queries unique ID records by unique_id or condition filters.
|
|
803
814
|
* @param params Request parameters.
|
|
804
815
|
* @param fetchOptions Pagination and fetch behavior options.
|
|
805
816
|
* @returns A promise that resolves to Promise<DatabaseResponse<UniqueId>>.
|
|
806
817
|
*/
|
|
807
|
-
getUniqueId(params
|
|
818
|
+
getUniqueId(params?: Form<{
|
|
808
819
|
/** Unique ID */
|
|
809
820
|
unique_id?: string;
|
|
810
|
-
/** String query condition for
|
|
811
|
-
condition?: Condition;
|
|
821
|
+
/** String query condition for the unique_id value. */
|
|
822
|
+
condition?: Condition | 'ne' | '!=';
|
|
812
823
|
}>, fetchOptions?: FetchOptions): Promise<DatabaseResponse<UniqueId>>;
|
|
813
824
|
/**
|
|
814
825
|
* Resends an existing user invitation email to the target address.
|
|
@@ -817,7 +828,6 @@ declare class Skapi {
|
|
|
817
828
|
*/
|
|
818
829
|
resendInvitation(params: Form<{
|
|
819
830
|
email: string;
|
|
820
|
-
confirmation_url?: string;
|
|
821
831
|
}>): Promise<'SUCCESS: Invitation has been re-sent. (User ID: xxx...)'>;
|
|
822
832
|
/**
|
|
823
833
|
* Cancels a pending invitation for the target email address.
|
|
@@ -833,9 +843,9 @@ declare class Skapi {
|
|
|
833
843
|
* @param fetchOptions Pagination and fetch behavior options.
|
|
834
844
|
* @returns A promise that resolves to Promise<DatabaseResponse<UserProfile>>.
|
|
835
845
|
*/
|
|
836
|
-
getInvitations(params
|
|
846
|
+
getInvitations(params?: Form<{
|
|
837
847
|
email?: string;
|
|
838
|
-
}>, fetchOptions
|
|
848
|
+
}>, fetchOptions?: FetchOptions): Promise<DatabaseResponse<UserProfile>>;
|
|
839
849
|
/**
|
|
840
850
|
* Completes OpenID login and optionally merges the OpenID identity with an existing account.
|
|
841
851
|
* @param params Request parameters.
|
|
@@ -895,7 +905,7 @@ declare class Skapi {
|
|
|
895
905
|
in_queue: number;
|
|
896
906
|
poll?: (arg?: {
|
|
897
907
|
latency?: number;
|
|
898
|
-
}) =>
|
|
908
|
+
}) => Promise<any>;
|
|
899
909
|
}>;
|
|
900
910
|
/**
|
|
901
911
|
* Retrieves the history of client secret requests for a given URL and method.
|
|
@@ -953,20 +963,20 @@ declare class Skapi {
|
|
|
953
963
|
* Lists consumed tickets with optional filters and pagination.
|
|
954
964
|
* @param params Request parameters.
|
|
955
965
|
* @param fetchOptions Pagination and fetch behavior options.
|
|
956
|
-
* @returns A promise that resolves to Promise<DatabaseResponse<any
|
|
966
|
+
* @returns A promise that resolves to Promise<DatabaseResponse<any>>.
|
|
957
967
|
*/
|
|
958
968
|
getConsumedTickets(params: {
|
|
959
969
|
ticket_id?: string;
|
|
960
|
-
}, fetchOptions?: FetchOptions): Promise<DatabaseResponse<any
|
|
970
|
+
}, fetchOptions?: FetchOptions): Promise<DatabaseResponse<any>>;
|
|
961
971
|
/**
|
|
962
972
|
* Lists issued tickets with optional filters and pagination.
|
|
963
973
|
* @param params Request parameters.
|
|
964
974
|
* @param fetchOptions Pagination and fetch behavior options.
|
|
965
|
-
* @returns A promise that resolves to Promise<DatabaseResponse<any
|
|
975
|
+
* @returns A promise that resolves to Promise<DatabaseResponse<any>>.
|
|
966
976
|
*/
|
|
967
977
|
getTickets(params: {
|
|
968
978
|
ticket_id?: string;
|
|
969
|
-
}, fetchOptions?: FetchOptions): Promise<DatabaseResponse<any
|
|
979
|
+
}, fetchOptions?: FetchOptions): Promise<DatabaseResponse<any>>;
|
|
970
980
|
/**
|
|
971
981
|
* Closes the active realtime WebSocket connection.
|
|
972
982
|
* @returns A promise that resolves to Promise<void>.
|
|
@@ -974,12 +984,12 @@ declare class Skapi {
|
|
|
974
984
|
closeRealtime(): Promise<void>;
|
|
975
985
|
/**
|
|
976
986
|
* Fetches currently connected users in a realtime group.
|
|
977
|
-
* @param params Request parameters.
|
|
987
|
+
* @param params Request parameters. When `group` is omitted, it defaults to the realtime group the user is currently joined to.
|
|
978
988
|
* @param fetchOptions Pagination and fetch behavior options.
|
|
979
989
|
* @returns A promise that resolves to Promise<DatabaseResponse<{ user_id: string; cid: string }[]>>.
|
|
980
990
|
*/
|
|
981
|
-
getRealtimeUsers(params
|
|
982
|
-
group
|
|
991
|
+
getRealtimeUsers(params?: {
|
|
992
|
+
group?: string;
|
|
983
993
|
user_id?: string;
|
|
984
994
|
}, fetchOptions?: FetchOptions): Promise<DatabaseResponse<{
|
|
985
995
|
user_id: string;
|
|
@@ -1024,11 +1034,11 @@ declare class Skapi {
|
|
|
1024
1034
|
* Invites a user by email with optional attributes and invitation email options.
|
|
1025
1035
|
* @param params Payload for the request.
|
|
1026
1036
|
* @param options Optional behavior configuration.
|
|
1027
|
-
* @returns A promise that resolves to Promise<'SUCCESS: Invitation has been sent.'>.
|
|
1037
|
+
* @returns A promise that resolves to Promise<'SUCCESS: Invitation has been sent. (User ID: xxx...)'>.
|
|
1028
1038
|
*/
|
|
1029
1039
|
inviteUser(params: UserAttributes & {
|
|
1030
|
-
openid_id
|
|
1031
|
-
access_group
|
|
1040
|
+
openid_id?: string;
|
|
1041
|
+
access_group?: number;
|
|
1032
1042
|
}, options?: {
|
|
1033
1043
|
confirmation_url?: string;
|
|
1034
1044
|
email_subscription?: boolean;
|
|
@@ -1036,15 +1046,16 @@ declare class Skapi {
|
|
|
1036
1046
|
url: string;
|
|
1037
1047
|
subject: string;
|
|
1038
1048
|
};
|
|
1039
|
-
}): Promise<'SUCCESS: Invitation has been sent.'>;
|
|
1049
|
+
}): Promise<'SUCCESS: Invitation has been sent. (User ID: xxx...)'>;
|
|
1040
1050
|
/**
|
|
1041
1051
|
* Creates a user account directly from admin context.
|
|
1042
1052
|
* @param params Payload for the request.
|
|
1043
1053
|
* @returns A promise that resolves to Promise<UserProfile & { email_admin: string; username: string; }>.
|
|
1044
1054
|
*/
|
|
1045
1055
|
createAccount(params: UserAttributes & {
|
|
1056
|
+
email: string;
|
|
1046
1057
|
password: string;
|
|
1047
|
-
access_group
|
|
1058
|
+
access_group?: number;
|
|
1048
1059
|
}): Promise<UserProfile & {
|
|
1049
1060
|
email_admin: string;
|
|
1050
1061
|
username: string;
|
|
@@ -1066,9 +1077,9 @@ declare class Skapi {
|
|
|
1066
1077
|
*/
|
|
1067
1078
|
getRealtimeGroups(params?: {
|
|
1068
1079
|
/** Index name to search. */
|
|
1069
|
-
searchFor
|
|
1080
|
+
searchFor?: 'group' | 'number_of_users';
|
|
1070
1081
|
/** Index value to search. */
|
|
1071
|
-
value
|
|
1082
|
+
value?: string | number;
|
|
1072
1083
|
/** Search condition. */
|
|
1073
1084
|
condition?: '>' | '>=' | '=' | '<' | '<=' | '!=' | 'gt' | 'gte' | 'eq' | 'lt' | 'lte' | 'ne';
|
|
1074
1085
|
/** Range of search. */
|
|
@@ -1111,7 +1122,7 @@ declare class Skapi {
|
|
|
1111
1122
|
* @returns A promise that resolves to Promise<UserProfile | null>.
|
|
1112
1123
|
*/
|
|
1113
1124
|
getProfile(options?: {
|
|
1114
|
-
refreshToken
|
|
1125
|
+
refreshToken?: boolean;
|
|
1115
1126
|
}): Promise<UserProfile | null>;
|
|
1116
1127
|
/**
|
|
1117
1128
|
* Retrieves a file by URL with optional conversion mode, expiration, and progress handling.
|
|
@@ -1164,9 +1175,9 @@ declare class Skapi {
|
|
|
1164
1175
|
* @returns A promise that resolves to Promise<DatabaseResponse<Table>>.
|
|
1165
1176
|
*/
|
|
1166
1177
|
getTables(
|
|
1167
|
-
/** If
|
|
1168
|
-
query
|
|
1169
|
-
table
|
|
1178
|
+
/** If omitted, fetches the full list of tables. */
|
|
1179
|
+
query?: {
|
|
1180
|
+
table?: string;
|
|
1170
1181
|
/** Condition operator of table name. */
|
|
1171
1182
|
condition?: Condition;
|
|
1172
1183
|
}, fetchOptions?: FetchOptions): Promise<DatabaseResponse<Table>>;
|
|
@@ -1184,7 +1195,7 @@ declare class Skapi {
|
|
|
1184
1195
|
/** Queries order by */
|
|
1185
1196
|
order?: {
|
|
1186
1197
|
/** Key name to order by. */
|
|
1187
|
-
by: 'average_number' | 'total_number' | 'number_count' | 'average_bool' | 'total_bool' | 'bool_count' | 'string_count' | 'index_name';
|
|
1198
|
+
by: 'average_number' | 'total_number' | 'number_count' | 'average_bool' | 'total_bool' | 'bool_count' | 'string_count' | 'index_name' | 'number_of_records';
|
|
1188
1199
|
/** Value to query. */
|
|
1189
1200
|
value?: number | boolean | string;
|
|
1190
1201
|
condition?: Condition;
|
|
@@ -1196,9 +1207,9 @@ declare class Skapi {
|
|
|
1196
1207
|
* @param fetchOptions Pagination and fetch behavior options.
|
|
1197
1208
|
* @returns A promise that resolves to Promise<DatabaseResponse<Tag>>.
|
|
1198
1209
|
*/
|
|
1199
|
-
getTags(query
|
|
1210
|
+
getTags(query?: {
|
|
1200
1211
|
/** Table name */
|
|
1201
|
-
table
|
|
1212
|
+
table?: string;
|
|
1202
1213
|
/** Tag name */
|
|
1203
1214
|
tag?: string;
|
|
1204
1215
|
/** String query condition for tag name. */
|
|
@@ -1234,13 +1245,13 @@ declare class Skapi {
|
|
|
1234
1245
|
*/
|
|
1235
1246
|
getUsers(params?: {
|
|
1236
1247
|
/** Index name to search. */
|
|
1237
|
-
searchFor: 'user_id' | 'email' | 'phone_number' | 'locale' | 'name' | 'address' | 'gender' | 'birthdate' | 'subscribers' | 'timestamp' | 'approved';
|
|
1248
|
+
searchFor: 'user_id' | 'email' | 'phone_number' | 'locale' | 'name' | 'address' | 'gender' | 'birthdate' | 'subscribers' | 'timestamp' | 'access_group' | 'approved';
|
|
1238
1249
|
/** Index value to search. */
|
|
1239
|
-
value: string | number |
|
|
1250
|
+
value: string | number | string[];
|
|
1240
1251
|
/** Search condition. */
|
|
1241
1252
|
condition?: '>' | '>=' | '=' | '<' | '<=' | 'gt' | 'gte' | 'eq' | 'lt' | 'lte';
|
|
1242
1253
|
/** Range of search. */
|
|
1243
|
-
range?: string | number
|
|
1254
|
+
range?: string | number;
|
|
1244
1255
|
}, fetchOptions?: FetchOptions): Promise<DatabaseResponse<UserPublic>>;
|
|
1245
1256
|
/**
|
|
1246
1257
|
* Disables the currently logged-in user account.
|
|
@@ -1261,7 +1272,7 @@ declare class Skapi {
|
|
|
1261
1272
|
* @returns A promise that resolves to Promise<string>.
|
|
1262
1273
|
*/
|
|
1263
1274
|
unsubscribeNewsletter(params: {
|
|
1264
|
-
group: number | 'public' | 'authorized' |
|
|
1275
|
+
group: number | 'public' | 'authorized' | 'admin';
|
|
1265
1276
|
}): Promise<string>;
|
|
1266
1277
|
/**
|
|
1267
1278
|
* Registers a web push subscription endpoint for notifications.
|
|
@@ -1312,9 +1323,9 @@ declare class Skapi {
|
|
|
1312
1323
|
* 'message_id' and 'subject' value should be string.<br>
|
|
1313
1324
|
* Others numbers.
|
|
1314
1325
|
*/
|
|
1315
|
-
searchFor: 'message_id' | 'timestamp' | 'read' | 'complaint' | 'subject';
|
|
1326
|
+
searchFor: 'message_id' | 'timestamp' | 'read' | 'complaint' | 'bounced' | 'subject';
|
|
1316
1327
|
value: string | number;
|
|
1317
|
-
range
|
|
1328
|
+
range?: string | number;
|
|
1318
1329
|
/**
|
|
1319
1330
|
* Defaults to '=',
|
|
1320
1331
|
* Condition does not work with range.
|
|
@@ -1330,12 +1341,18 @@ declare class Skapi {
|
|
|
1330
1341
|
*/
|
|
1331
1342
|
getNewsletterSubscription(params: {
|
|
1332
1343
|
group?: number | 'public' | 'authorized';
|
|
1344
|
+
user_id?: string;
|
|
1333
1345
|
}, fetchOptions?: FetchOptions): Promise<{
|
|
1334
1346
|
active: boolean;
|
|
1335
1347
|
timestamp: number;
|
|
1336
1348
|
group: number;
|
|
1337
1349
|
subscribed_email: string;
|
|
1338
|
-
}[]
|
|
1350
|
+
}[] | DatabaseResponse<{
|
|
1351
|
+
active: boolean;
|
|
1352
|
+
timestamp: number;
|
|
1353
|
+
group: number;
|
|
1354
|
+
subscribed_email: string;
|
|
1355
|
+
}>>;
|
|
1339
1356
|
/**
|
|
1340
1357
|
* Requests a username change confirmation flow for the current user.
|
|
1341
1358
|
* @param params Request parameters.
|
|
@@ -1553,7 +1570,7 @@ declare class Skapi {
|
|
|
1553
1570
|
/**
|
|
1554
1571
|
* Creates or updates a database record with optional file uploads.
|
|
1555
1572
|
* @param params Payload for the request.
|
|
1556
|
-
* @param config
|
|
1573
|
+
* @param config Required record configuration (table, record_id, index, tags, source, reference, etc.).
|
|
1557
1574
|
* @param files File list to process.
|
|
1558
1575
|
* @returns A promise that resolves to Promise<RecordData>.
|
|
1559
1576
|
*/
|
|
@@ -1562,7 +1579,7 @@ declare class Skapi {
|
|
|
1562
1579
|
file: File;
|
|
1563
1580
|
}[]): Promise<RecordData>;
|
|
1564
1581
|
/**
|
|
1565
|
-
* Fetches subscriber/subscription relationships with filters and pagination.
|
|
1582
|
+
* Fetches subscriber/subscription relationships with filters and pagination. At least one of `subscriber` or `subscription` must be provided.
|
|
1566
1583
|
* @param params Request parameters.
|
|
1567
1584
|
* @param fetchOptions Pagination and fetch behavior options.
|
|
1568
1585
|
* @returns A promise that resolves to Promise<DatabaseResponse<Subscription>>.
|
|
@@ -1616,10 +1633,15 @@ declare class Skapi {
|
|
|
1616
1633
|
* @returns A promise that resolves to Promise<string>.
|
|
1617
1634
|
*/
|
|
1618
1635
|
subscribeNewsletter(params: Form<{
|
|
1619
|
-
email?: string;
|
|
1620
|
-
group: number | 'public' | 'authorized' | 'admin';
|
|
1636
|
+
email?: string | string[];
|
|
1637
|
+
group: number | 'public' | 'authorized' | 'admin' | (string & {});
|
|
1621
1638
|
redirect?: string;
|
|
1622
1639
|
}>): Promise<string>;
|
|
1640
|
+
/**
|
|
1641
|
+
* Creates or updates multiple database records in a single bulk request. Requires a non-empty array, and all entries must share the same table/service.
|
|
1642
|
+
* @param config Non-empty array of record configurations to post.
|
|
1643
|
+
* @returns A promise that resolves to Promise<RecordData[]>.
|
|
1644
|
+
*/
|
|
1623
1645
|
bulkPostRecords(config: PostRecordConfig[]): Promise<RecordData[]>;
|
|
1624
1646
|
}
|
|
1625
1647
|
|