skapi-js 2.0.0-rc.9 → 2.0.0
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 +6 -6
- package/dist/skapi.browser.mjs.map +1 -1
- package/dist/skapi.cjs +6 -6
- package/dist/skapi.cjs.map +1 -1
- package/dist/skapi.d.mts +75 -71
- package/dist/skapi.d.ts +75 -71
- package/dist/skapi.js +6 -6
- package/dist/skapi.js.map +1 -1
- package/dist/skapi.mjs +6 -6
- package/dist/skapi.mjs.map +1 -1
- package/package.json +3 -3
package/dist/skapi.d.mts
CHANGED
|
@@ -53,8 +53,8 @@ type GetRecordQuery = {
|
|
|
53
53
|
table?: string | {
|
|
54
54
|
/** Max 256 characters, where / ! * # % each count as 3. Blocks control chars and sentinel . */
|
|
55
55
|
name: string;
|
|
56
|
-
/** Number range: 0 ~ 99. Default: 'public' */
|
|
57
|
-
access_group?: number | 'private' | 'public' | 'authorized' | 'admin';
|
|
56
|
+
/** Number range: 0 ~ 99. 'public' = 0, 'authorized' = 1, 'admin' = 99. '*' is shorthand for 'private'. Default: 'public' */
|
|
57
|
+
access_group?: number | 'private' | '*' | 'public' | 'authorized' | 'admin';
|
|
58
58
|
/** User ID of subscription */
|
|
59
59
|
subscription?: string;
|
|
60
60
|
};
|
|
@@ -83,8 +83,8 @@ type PostRecordConfig = {
|
|
|
83
83
|
table?: {
|
|
84
84
|
/** Max 256 characters, where / ! * # % each count as 3. Blocks control chars and sentinel . */
|
|
85
85
|
name?: string;
|
|
86
|
-
/** Number range: 0 ~ 99. Default: 'public' */
|
|
87
|
-
access_group?: number | 'private' | 'public' | 'authorized' | 'admin';
|
|
86
|
+
/** Number range: 0 ~ 99. 'public' = 0, 'authorized' = 1, 'admin' = 99. '*' is shorthand for 'private'. Default: 'public' */
|
|
87
|
+
access_group?: number | 'private' | '*' | 'public' | 'authorized' | 'admin';
|
|
88
88
|
/** When true, Record will be only accessible for subscribed users. */
|
|
89
89
|
subscription?: {
|
|
90
90
|
is_subscription_record?: boolean;
|
|
@@ -170,7 +170,7 @@ type EncryptionOptions = boolean | {
|
|
|
170
170
|
* encrypted records are permanently unreadable.
|
|
171
171
|
*/
|
|
172
172
|
recovery?: 'code' | 'none';
|
|
173
|
-
/** Reserved keyring table name. Default '
|
|
173
|
+
/** Reserved keyring table name. Default '__skapi__keyring'. */
|
|
174
174
|
table?: string;
|
|
175
175
|
};
|
|
176
176
|
type RecordData = {
|
|
@@ -249,12 +249,11 @@ type Connection = {
|
|
|
249
249
|
prevent_signup: boolean;
|
|
250
250
|
prevent_anonymous: boolean;
|
|
251
251
|
/**
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
* has not set one, in which case the SDK's own default (0) stands.
|
|
252
|
+
* BunnyQuery: whether the embeddable chat requires an account before a
|
|
253
|
+
* visitor can use it. Unrelated to `prevent_anonymous`, which governs
|
|
254
|
+
* anonymous record WRITES. Defaults to true.
|
|
256
255
|
*/
|
|
257
|
-
|
|
256
|
+
require_login?: boolean;
|
|
258
257
|
};
|
|
259
258
|
ai_agent?: string;
|
|
260
259
|
};
|
|
@@ -551,6 +550,7 @@ type RequestHistory = {
|
|
|
551
550
|
latency?: number;
|
|
552
551
|
onResponse?: (res: any) => void;
|
|
553
552
|
onError?: (err: any) => void;
|
|
553
|
+
onStream?: (chunk: string, seq: number) => void;
|
|
554
554
|
}) => Promise<any>;
|
|
555
555
|
};
|
|
556
556
|
type DatabaseResponse<T> = {
|
|
@@ -571,20 +571,6 @@ type FileInfo = {
|
|
|
571
571
|
uploaded: number;
|
|
572
572
|
fileKey: string;
|
|
573
573
|
};
|
|
574
|
-
/**
|
|
575
|
-
* A project-wide default for `table.access_group`.
|
|
576
|
-
*
|
|
577
|
-
* Accepts everything `table.access_group` itself accepts (a number 0-99, or one
|
|
578
|
-
* of 'public' / 'private' / 'authorized' / 'admin'), plus 'ask'.
|
|
579
|
-
*
|
|
580
|
-
* 'ask' does not pick a group: it makes an OMITTED `access_group` an error, so
|
|
581
|
-
* the caller has to state one on every record it reads, writes or deletes by
|
|
582
|
-
* table. Meant for projects that hold data at more than one visibility and would
|
|
583
|
-
* rather fail loudly than quietly fall back to public. Calls addressed by
|
|
584
|
-
* `record_id` or `unique_id`, and updates to an existing record, are unaffected:
|
|
585
|
-
* they do not carry a table at all.
|
|
586
|
-
*/
|
|
587
|
-
type DefaultAccessGroup = number | 'public' | 'private' | 'authorized' | 'admin' | 'ask';
|
|
588
574
|
type ConnectionInfo = {
|
|
589
575
|
/** Public project ID (service + owner composed into the two-segment token). Empty when the service has no uuid owner. */
|
|
590
576
|
project_id: string;
|
|
@@ -601,12 +587,11 @@ type ConnectionInfo = {
|
|
|
601
587
|
prevent_inquiry: boolean;
|
|
602
588
|
prevent_anonymous: boolean;
|
|
603
589
|
/**
|
|
604
|
-
*
|
|
605
|
-
*
|
|
606
|
-
*
|
|
607
|
-
* has not set one, in which case the SDK's own default (0) stands.
|
|
590
|
+
* BunnyQuery: whether the embeddable chat requires an account before a
|
|
591
|
+
* visitor can use it. Unrelated to `prevent_anonymous`, which governs
|
|
592
|
+
* anonymous record WRITES. Defaults to true.
|
|
608
593
|
*/
|
|
609
|
-
|
|
594
|
+
require_login?: boolean;
|
|
610
595
|
};
|
|
611
596
|
};
|
|
612
597
|
type Table = {
|
|
@@ -655,7 +640,6 @@ type Types_Condition = Condition;
|
|
|
655
640
|
type Types_Connection = Connection;
|
|
656
641
|
type Types_ConnectionInfo = ConnectionInfo;
|
|
657
642
|
type Types_DatabaseResponse<T> = DatabaseResponse<T>;
|
|
658
|
-
type Types_DefaultAccessGroup = DefaultAccessGroup;
|
|
659
643
|
type Types_DelRecordQuery = DelRecordQuery;
|
|
660
644
|
type Types_EncryptionOptions = EncryptionOptions;
|
|
661
645
|
type Types_FetchOptions = FetchOptions;
|
|
@@ -684,7 +668,7 @@ type Types_UserProfile = UserProfile;
|
|
|
684
668
|
type Types_UserPublic = UserPublic;
|
|
685
669
|
type Types_WebSocketMessage = WebSocketMessage;
|
|
686
670
|
declare namespace Types {
|
|
687
|
-
export type { Types_BinaryFile as BinaryFile, Types_Condition as Condition, Types_Connection as Connection, Types_ConnectionInfo as ConnectionInfo, Types_DatabaseResponse as DatabaseResponse,
|
|
671
|
+
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_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_UniqueId as UniqueId, Types_UserAttributes as UserAttributes, Types_UserProfile as UserProfile, Types_UserPublic as UserPublic, Types_WebSocketMessage as WebSocketMessage };
|
|
688
672
|
}
|
|
689
673
|
|
|
690
674
|
declare function terminatePendingRequests(): void;
|
|
@@ -727,19 +711,6 @@ type Options = {
|
|
|
727
711
|
autoLogin: boolean;
|
|
728
712
|
refetchServiceInfo?: boolean;
|
|
729
713
|
requestBatchSize?: number;
|
|
730
|
-
/**
|
|
731
|
-
* Default value for `table.access_group` on getRecords, postRecord and
|
|
732
|
-
* deleteRecords when the caller omits one. Overrides the project's own
|
|
733
|
-
* `default_access_group` setting; when neither is set, the SDK's historical
|
|
734
|
-
* default of 0 (public) stands.
|
|
735
|
-
*
|
|
736
|
-
* 'ask' picks no group. It makes an omitted `access_group` an ERROR, for
|
|
737
|
-
* projects that hold data at more than one visibility and would rather fail
|
|
738
|
-
* loudly than quietly write to public. Calls addressed by `record_id` or
|
|
739
|
-
* `unique_id`, and updates to an existing record, carry no table and are
|
|
740
|
-
* unaffected.
|
|
741
|
-
*/
|
|
742
|
-
default_access_group?: DefaultAccessGroup;
|
|
743
714
|
/**
|
|
744
715
|
* Enable client-side encryption of `data` on records written to
|
|
745
716
|
* access_group 'private'. Off by default. See EncryptionOptions.
|
|
@@ -794,14 +765,6 @@ declare class Skapi {
|
|
|
794
765
|
private host;
|
|
795
766
|
private hostDomain;
|
|
796
767
|
private target_cdn;
|
|
797
|
-
/**
|
|
798
|
-
* The `default_access_group` INIT OPTION, if one was given. Kept separate
|
|
799
|
-
* from the project's own setting (connection.opt.default_access_group)
|
|
800
|
-
* because the two have a precedence order and collapsing them would lose it:
|
|
801
|
-
* an app that pins a value in code must not have it changed under it by a
|
|
802
|
-
* dashboard edit.
|
|
803
|
-
*/
|
|
804
|
-
private __default_access_group;
|
|
805
768
|
private customApiDomain;
|
|
806
769
|
private requestBatchSize;
|
|
807
770
|
private __disabledAccount;
|
|
@@ -880,25 +843,6 @@ declare class Skapi {
|
|
|
880
843
|
* @param params Request parameters. When `refresh` is true, the cached connection metadata is re-fetched before returning; otherwise the cached connection is returned.
|
|
881
844
|
* @returns A promise that resolves to Promise<ConnectionInfo>.
|
|
882
845
|
*/
|
|
883
|
-
/**
|
|
884
|
-
* The effective `default_access_group` for this instance, or null when there
|
|
885
|
-
* is none and the SDK's historical default (0) stands.
|
|
886
|
-
*
|
|
887
|
-
* Precedence: the INIT OPTION wins, then the project's own setting. An app
|
|
888
|
-
* that pins a value in code is stating an intent the dashboard must not
|
|
889
|
-
* silently override; a project that has set one is stating a default for
|
|
890
|
-
* every app that has not.
|
|
891
|
-
*
|
|
892
|
-
* Reads `this.connection` rather than awaiting it: every caller
|
|
893
|
-
* (getRecords / postRecord / deleteRecords) has already awaited
|
|
894
|
-
* `__connection` before it gets here, so the project value is populated. A
|
|
895
|
-
* miss degrades to "no default", never to a wrong one.
|
|
896
|
-
*
|
|
897
|
-
* A malformed project value is IGNORED rather than thrown: it arrives from
|
|
898
|
-
* the server, not from the caller, and taking down every record call over it
|
|
899
|
-
* would be a worse failure than falling back to the SDK default.
|
|
900
|
-
*/
|
|
901
|
-
private _defaultAccessGroup;
|
|
902
846
|
getConnectionInfo(params?: {
|
|
903
847
|
refresh?: boolean;
|
|
904
848
|
}): Promise<ConnectionInfo>;
|
|
@@ -1064,6 +1008,8 @@ declare class Skapi {
|
|
|
1064
1008
|
expires?: number;
|
|
1065
1009
|
onResponse?: (res: any) => void;
|
|
1066
1010
|
onError?: (err: any) => void;
|
|
1011
|
+
stream?: boolean;
|
|
1012
|
+
onStream?: (chunk: string, seq: number) => void;
|
|
1067
1013
|
}): Promise<any | {
|
|
1068
1014
|
id: string;
|
|
1069
1015
|
status: 'running' | 'pending';
|
|
@@ -1071,6 +1017,7 @@ declare class Skapi {
|
|
|
1071
1017
|
in_queue: number;
|
|
1072
1018
|
poll?: (arg?: {
|
|
1073
1019
|
latency?: number;
|
|
1020
|
+
onStream?: (chunk: string, seq: number) => void;
|
|
1074
1021
|
}) => Promise<any>;
|
|
1075
1022
|
}>;
|
|
1076
1023
|
/**
|
|
@@ -1102,6 +1049,63 @@ declare class Skapi {
|
|
|
1102
1049
|
* @param params Request parameters.
|
|
1103
1050
|
* @returns A promise that resolves to a result object with removed status and message.
|
|
1104
1051
|
*/
|
|
1052
|
+
/**
|
|
1053
|
+
* Reads a streamed clientSecretRequest that this call did not start: a page reload,
|
|
1054
|
+
* a second tab, or a turn from history that was never finalized.
|
|
1055
|
+
*
|
|
1056
|
+
* `onStream` receives the relayed text in order, exactly as the destination sent it.
|
|
1057
|
+
* skapi does not parse it; whatever grammar those bytes are in belongs to the caller
|
|
1058
|
+
* and its destination. Pass `since` to resume rather than re-read from the beginning.
|
|
1059
|
+
*
|
|
1060
|
+
* When the request is still running this polls until it settles. When it has already
|
|
1061
|
+
* settled it reads every chunk once and resolves.
|
|
1062
|
+
*
|
|
1063
|
+
* ```js
|
|
1064
|
+
* const parser = createMyParser();
|
|
1065
|
+
* await skapi.clientSecretRequestStream(requestId, {
|
|
1066
|
+
* url: 'https://api.example.com/v1/chat',
|
|
1067
|
+
* method: 'POST',
|
|
1068
|
+
* onStream: (chunk) => parser.feed(chunk)
|
|
1069
|
+
* });
|
|
1070
|
+
* ```
|
|
1071
|
+
*/
|
|
1072
|
+
clientSecretRequestStream(requestId: string, options: {
|
|
1073
|
+
url?: string;
|
|
1074
|
+
method?: 'GET' | 'POST' | 'DELETE' | 'PUT';
|
|
1075
|
+
onStream?: (chunk: string, seq: number) => void;
|
|
1076
|
+
since?: number;
|
|
1077
|
+
poll?: number;
|
|
1078
|
+
onResponse?: (res: any) => void;
|
|
1079
|
+
onError?: (err: any) => void;
|
|
1080
|
+
service?: string;
|
|
1081
|
+
owner?: string;
|
|
1082
|
+
}): Promise<any>;
|
|
1083
|
+
/**
|
|
1084
|
+
* Stores the version of a streamed response you want KEPT as history, and releases
|
|
1085
|
+
* the relayed chunks it was assembled from.
|
|
1086
|
+
*
|
|
1087
|
+
* The content is entirely yours. skapi neither validates nor interprets it: it stores
|
|
1088
|
+
* what you tell it to store. Only the caller who made the request may finalize it.
|
|
1089
|
+
*
|
|
1090
|
+
* Until you finalize, the chunks stay indefinitely and every read of that turn has to
|
|
1091
|
+
* fetch and re-parse all of them, so finalize as soon as you have rendered the answer.
|
|
1092
|
+
*
|
|
1093
|
+
* ```js
|
|
1094
|
+
* await skapi.clientSecretRequestFinalize(requestId, parser.result(), {
|
|
1095
|
+
* url: 'https://api.example.com/v1/chat',
|
|
1096
|
+
* method: 'POST'
|
|
1097
|
+
* });
|
|
1098
|
+
* ```
|
|
1099
|
+
*/
|
|
1100
|
+
clientSecretRequestFinalize(requestId: string, data?: any, options?: {
|
|
1101
|
+
url?: string;
|
|
1102
|
+
method?: 'GET' | 'POST' | 'DELETE' | 'PUT';
|
|
1103
|
+
service?: string;
|
|
1104
|
+
owner?: string;
|
|
1105
|
+
}): Promise<{
|
|
1106
|
+
finalized: boolean;
|
|
1107
|
+
message: string;
|
|
1108
|
+
}>;
|
|
1105
1109
|
cancelClientSecretRequest(params: {
|
|
1106
1110
|
url: string;
|
|
1107
1111
|
method: 'GET' | 'POST' | 'DELETE' | 'PUT';
|
package/dist/skapi.d.ts
CHANGED
|
@@ -53,8 +53,8 @@ type GetRecordQuery = {
|
|
|
53
53
|
table?: string | {
|
|
54
54
|
/** Max 256 characters, where / ! * # % each count as 3. Blocks control chars and sentinel . */
|
|
55
55
|
name: string;
|
|
56
|
-
/** Number range: 0 ~ 99. Default: 'public' */
|
|
57
|
-
access_group?: number | 'private' | 'public' | 'authorized' | 'admin';
|
|
56
|
+
/** Number range: 0 ~ 99. 'public' = 0, 'authorized' = 1, 'admin' = 99. '*' is shorthand for 'private'. Default: 'public' */
|
|
57
|
+
access_group?: number | 'private' | '*' | 'public' | 'authorized' | 'admin';
|
|
58
58
|
/** User ID of subscription */
|
|
59
59
|
subscription?: string;
|
|
60
60
|
};
|
|
@@ -83,8 +83,8 @@ type PostRecordConfig = {
|
|
|
83
83
|
table?: {
|
|
84
84
|
/** Max 256 characters, where / ! * # % each count as 3. Blocks control chars and sentinel . */
|
|
85
85
|
name?: string;
|
|
86
|
-
/** Number range: 0 ~ 99. Default: 'public' */
|
|
87
|
-
access_group?: number | 'private' | 'public' | 'authorized' | 'admin';
|
|
86
|
+
/** Number range: 0 ~ 99. 'public' = 0, 'authorized' = 1, 'admin' = 99. '*' is shorthand for 'private'. Default: 'public' */
|
|
87
|
+
access_group?: number | 'private' | '*' | 'public' | 'authorized' | 'admin';
|
|
88
88
|
/** When true, Record will be only accessible for subscribed users. */
|
|
89
89
|
subscription?: {
|
|
90
90
|
is_subscription_record?: boolean;
|
|
@@ -170,7 +170,7 @@ type EncryptionOptions = boolean | {
|
|
|
170
170
|
* encrypted records are permanently unreadable.
|
|
171
171
|
*/
|
|
172
172
|
recovery?: 'code' | 'none';
|
|
173
|
-
/** Reserved keyring table name. Default '
|
|
173
|
+
/** Reserved keyring table name. Default '__skapi__keyring'. */
|
|
174
174
|
table?: string;
|
|
175
175
|
};
|
|
176
176
|
type RecordData = {
|
|
@@ -249,12 +249,11 @@ type Connection = {
|
|
|
249
249
|
prevent_signup: boolean;
|
|
250
250
|
prevent_anonymous: boolean;
|
|
251
251
|
/**
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
* has not set one, in which case the SDK's own default (0) stands.
|
|
252
|
+
* BunnyQuery: whether the embeddable chat requires an account before a
|
|
253
|
+
* visitor can use it. Unrelated to `prevent_anonymous`, which governs
|
|
254
|
+
* anonymous record WRITES. Defaults to true.
|
|
256
255
|
*/
|
|
257
|
-
|
|
256
|
+
require_login?: boolean;
|
|
258
257
|
};
|
|
259
258
|
ai_agent?: string;
|
|
260
259
|
};
|
|
@@ -551,6 +550,7 @@ type RequestHistory = {
|
|
|
551
550
|
latency?: number;
|
|
552
551
|
onResponse?: (res: any) => void;
|
|
553
552
|
onError?: (err: any) => void;
|
|
553
|
+
onStream?: (chunk: string, seq: number) => void;
|
|
554
554
|
}) => Promise<any>;
|
|
555
555
|
};
|
|
556
556
|
type DatabaseResponse<T> = {
|
|
@@ -571,20 +571,6 @@ type FileInfo = {
|
|
|
571
571
|
uploaded: number;
|
|
572
572
|
fileKey: string;
|
|
573
573
|
};
|
|
574
|
-
/**
|
|
575
|
-
* A project-wide default for `table.access_group`.
|
|
576
|
-
*
|
|
577
|
-
* Accepts everything `table.access_group` itself accepts (a number 0-99, or one
|
|
578
|
-
* of 'public' / 'private' / 'authorized' / 'admin'), plus 'ask'.
|
|
579
|
-
*
|
|
580
|
-
* 'ask' does not pick a group: it makes an OMITTED `access_group` an error, so
|
|
581
|
-
* the caller has to state one on every record it reads, writes or deletes by
|
|
582
|
-
* table. Meant for projects that hold data at more than one visibility and would
|
|
583
|
-
* rather fail loudly than quietly fall back to public. Calls addressed by
|
|
584
|
-
* `record_id` or `unique_id`, and updates to an existing record, are unaffected:
|
|
585
|
-
* they do not carry a table at all.
|
|
586
|
-
*/
|
|
587
|
-
type DefaultAccessGroup = number | 'public' | 'private' | 'authorized' | 'admin' | 'ask';
|
|
588
574
|
type ConnectionInfo = {
|
|
589
575
|
/** Public project ID (service + owner composed into the two-segment token). Empty when the service has no uuid owner. */
|
|
590
576
|
project_id: string;
|
|
@@ -601,12 +587,11 @@ type ConnectionInfo = {
|
|
|
601
587
|
prevent_inquiry: boolean;
|
|
602
588
|
prevent_anonymous: boolean;
|
|
603
589
|
/**
|
|
604
|
-
*
|
|
605
|
-
*
|
|
606
|
-
*
|
|
607
|
-
* has not set one, in which case the SDK's own default (0) stands.
|
|
590
|
+
* BunnyQuery: whether the embeddable chat requires an account before a
|
|
591
|
+
* visitor can use it. Unrelated to `prevent_anonymous`, which governs
|
|
592
|
+
* anonymous record WRITES. Defaults to true.
|
|
608
593
|
*/
|
|
609
|
-
|
|
594
|
+
require_login?: boolean;
|
|
610
595
|
};
|
|
611
596
|
};
|
|
612
597
|
type Table = {
|
|
@@ -655,7 +640,6 @@ type Types_Condition = Condition;
|
|
|
655
640
|
type Types_Connection = Connection;
|
|
656
641
|
type Types_ConnectionInfo = ConnectionInfo;
|
|
657
642
|
type Types_DatabaseResponse<T> = DatabaseResponse<T>;
|
|
658
|
-
type Types_DefaultAccessGroup = DefaultAccessGroup;
|
|
659
643
|
type Types_DelRecordQuery = DelRecordQuery;
|
|
660
644
|
type Types_EncryptionOptions = EncryptionOptions;
|
|
661
645
|
type Types_FetchOptions = FetchOptions;
|
|
@@ -684,7 +668,7 @@ type Types_UserProfile = UserProfile;
|
|
|
684
668
|
type Types_UserPublic = UserPublic;
|
|
685
669
|
type Types_WebSocketMessage = WebSocketMessage;
|
|
686
670
|
declare namespace Types {
|
|
687
|
-
export type { Types_BinaryFile as BinaryFile, Types_Condition as Condition, Types_Connection as Connection, Types_ConnectionInfo as ConnectionInfo, Types_DatabaseResponse as DatabaseResponse,
|
|
671
|
+
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_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_UniqueId as UniqueId, Types_UserAttributes as UserAttributes, Types_UserProfile as UserProfile, Types_UserPublic as UserPublic, Types_WebSocketMessage as WebSocketMessage };
|
|
688
672
|
}
|
|
689
673
|
|
|
690
674
|
declare function terminatePendingRequests(): void;
|
|
@@ -727,19 +711,6 @@ type Options = {
|
|
|
727
711
|
autoLogin: boolean;
|
|
728
712
|
refetchServiceInfo?: boolean;
|
|
729
713
|
requestBatchSize?: number;
|
|
730
|
-
/**
|
|
731
|
-
* Default value for `table.access_group` on getRecords, postRecord and
|
|
732
|
-
* deleteRecords when the caller omits one. Overrides the project's own
|
|
733
|
-
* `default_access_group` setting; when neither is set, the SDK's historical
|
|
734
|
-
* default of 0 (public) stands.
|
|
735
|
-
*
|
|
736
|
-
* 'ask' picks no group. It makes an omitted `access_group` an ERROR, for
|
|
737
|
-
* projects that hold data at more than one visibility and would rather fail
|
|
738
|
-
* loudly than quietly write to public. Calls addressed by `record_id` or
|
|
739
|
-
* `unique_id`, and updates to an existing record, carry no table and are
|
|
740
|
-
* unaffected.
|
|
741
|
-
*/
|
|
742
|
-
default_access_group?: DefaultAccessGroup;
|
|
743
714
|
/**
|
|
744
715
|
* Enable client-side encryption of `data` on records written to
|
|
745
716
|
* access_group 'private'. Off by default. See EncryptionOptions.
|
|
@@ -794,14 +765,6 @@ declare class Skapi {
|
|
|
794
765
|
private host;
|
|
795
766
|
private hostDomain;
|
|
796
767
|
private target_cdn;
|
|
797
|
-
/**
|
|
798
|
-
* The `default_access_group` INIT OPTION, if one was given. Kept separate
|
|
799
|
-
* from the project's own setting (connection.opt.default_access_group)
|
|
800
|
-
* because the two have a precedence order and collapsing them would lose it:
|
|
801
|
-
* an app that pins a value in code must not have it changed under it by a
|
|
802
|
-
* dashboard edit.
|
|
803
|
-
*/
|
|
804
|
-
private __default_access_group;
|
|
805
768
|
private customApiDomain;
|
|
806
769
|
private requestBatchSize;
|
|
807
770
|
private __disabledAccount;
|
|
@@ -880,25 +843,6 @@ declare class Skapi {
|
|
|
880
843
|
* @param params Request parameters. When `refresh` is true, the cached connection metadata is re-fetched before returning; otherwise the cached connection is returned.
|
|
881
844
|
* @returns A promise that resolves to Promise<ConnectionInfo>.
|
|
882
845
|
*/
|
|
883
|
-
/**
|
|
884
|
-
* The effective `default_access_group` for this instance, or null when there
|
|
885
|
-
* is none and the SDK's historical default (0) stands.
|
|
886
|
-
*
|
|
887
|
-
* Precedence: the INIT OPTION wins, then the project's own setting. An app
|
|
888
|
-
* that pins a value in code is stating an intent the dashboard must not
|
|
889
|
-
* silently override; a project that has set one is stating a default for
|
|
890
|
-
* every app that has not.
|
|
891
|
-
*
|
|
892
|
-
* Reads `this.connection` rather than awaiting it: every caller
|
|
893
|
-
* (getRecords / postRecord / deleteRecords) has already awaited
|
|
894
|
-
* `__connection` before it gets here, so the project value is populated. A
|
|
895
|
-
* miss degrades to "no default", never to a wrong one.
|
|
896
|
-
*
|
|
897
|
-
* A malformed project value is IGNORED rather than thrown: it arrives from
|
|
898
|
-
* the server, not from the caller, and taking down every record call over it
|
|
899
|
-
* would be a worse failure than falling back to the SDK default.
|
|
900
|
-
*/
|
|
901
|
-
private _defaultAccessGroup;
|
|
902
846
|
getConnectionInfo(params?: {
|
|
903
847
|
refresh?: boolean;
|
|
904
848
|
}): Promise<ConnectionInfo>;
|
|
@@ -1064,6 +1008,8 @@ declare class Skapi {
|
|
|
1064
1008
|
expires?: number;
|
|
1065
1009
|
onResponse?: (res: any) => void;
|
|
1066
1010
|
onError?: (err: any) => void;
|
|
1011
|
+
stream?: boolean;
|
|
1012
|
+
onStream?: (chunk: string, seq: number) => void;
|
|
1067
1013
|
}): Promise<any | {
|
|
1068
1014
|
id: string;
|
|
1069
1015
|
status: 'running' | 'pending';
|
|
@@ -1071,6 +1017,7 @@ declare class Skapi {
|
|
|
1071
1017
|
in_queue: number;
|
|
1072
1018
|
poll?: (arg?: {
|
|
1073
1019
|
latency?: number;
|
|
1020
|
+
onStream?: (chunk: string, seq: number) => void;
|
|
1074
1021
|
}) => Promise<any>;
|
|
1075
1022
|
}>;
|
|
1076
1023
|
/**
|
|
@@ -1102,6 +1049,63 @@ declare class Skapi {
|
|
|
1102
1049
|
* @param params Request parameters.
|
|
1103
1050
|
* @returns A promise that resolves to a result object with removed status and message.
|
|
1104
1051
|
*/
|
|
1052
|
+
/**
|
|
1053
|
+
* Reads a streamed clientSecretRequest that this call did not start: a page reload,
|
|
1054
|
+
* a second tab, or a turn from history that was never finalized.
|
|
1055
|
+
*
|
|
1056
|
+
* `onStream` receives the relayed text in order, exactly as the destination sent it.
|
|
1057
|
+
* skapi does not parse it; whatever grammar those bytes are in belongs to the caller
|
|
1058
|
+
* and its destination. Pass `since` to resume rather than re-read from the beginning.
|
|
1059
|
+
*
|
|
1060
|
+
* When the request is still running this polls until it settles. When it has already
|
|
1061
|
+
* settled it reads every chunk once and resolves.
|
|
1062
|
+
*
|
|
1063
|
+
* ```js
|
|
1064
|
+
* const parser = createMyParser();
|
|
1065
|
+
* await skapi.clientSecretRequestStream(requestId, {
|
|
1066
|
+
* url: 'https://api.example.com/v1/chat',
|
|
1067
|
+
* method: 'POST',
|
|
1068
|
+
* onStream: (chunk) => parser.feed(chunk)
|
|
1069
|
+
* });
|
|
1070
|
+
* ```
|
|
1071
|
+
*/
|
|
1072
|
+
clientSecretRequestStream(requestId: string, options: {
|
|
1073
|
+
url?: string;
|
|
1074
|
+
method?: 'GET' | 'POST' | 'DELETE' | 'PUT';
|
|
1075
|
+
onStream?: (chunk: string, seq: number) => void;
|
|
1076
|
+
since?: number;
|
|
1077
|
+
poll?: number;
|
|
1078
|
+
onResponse?: (res: any) => void;
|
|
1079
|
+
onError?: (err: any) => void;
|
|
1080
|
+
service?: string;
|
|
1081
|
+
owner?: string;
|
|
1082
|
+
}): Promise<any>;
|
|
1083
|
+
/**
|
|
1084
|
+
* Stores the version of a streamed response you want KEPT as history, and releases
|
|
1085
|
+
* the relayed chunks it was assembled from.
|
|
1086
|
+
*
|
|
1087
|
+
* The content is entirely yours. skapi neither validates nor interprets it: it stores
|
|
1088
|
+
* what you tell it to store. Only the caller who made the request may finalize it.
|
|
1089
|
+
*
|
|
1090
|
+
* Until you finalize, the chunks stay indefinitely and every read of that turn has to
|
|
1091
|
+
* fetch and re-parse all of them, so finalize as soon as you have rendered the answer.
|
|
1092
|
+
*
|
|
1093
|
+
* ```js
|
|
1094
|
+
* await skapi.clientSecretRequestFinalize(requestId, parser.result(), {
|
|
1095
|
+
* url: 'https://api.example.com/v1/chat',
|
|
1096
|
+
* method: 'POST'
|
|
1097
|
+
* });
|
|
1098
|
+
* ```
|
|
1099
|
+
*/
|
|
1100
|
+
clientSecretRequestFinalize(requestId: string, data?: any, options?: {
|
|
1101
|
+
url?: string;
|
|
1102
|
+
method?: 'GET' | 'POST' | 'DELETE' | 'PUT';
|
|
1103
|
+
service?: string;
|
|
1104
|
+
owner?: string;
|
|
1105
|
+
}): Promise<{
|
|
1106
|
+
finalized: boolean;
|
|
1107
|
+
message: string;
|
|
1108
|
+
}>;
|
|
1105
1109
|
cancelClientSecretRequest(params: {
|
|
1106
1110
|
url: string;
|
|
1107
1111
|
method: 'GET' | 'POST' | 'DELETE' | 'PUT';
|