@microsoft/rayfin-client 1.33.0 → 1.33.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/client.d.ts +28 -0
- package/dist/client.js +20 -1
- package/package.json +5 -5
package/dist/client.d.ts
CHANGED
|
@@ -12,8 +12,16 @@ import { ApiClient, ApiClientConfig } from '@microsoft/rayfin-lib';
|
|
|
12
12
|
* Auth error specific to the Rayfin SDK.
|
|
13
13
|
*/
|
|
14
14
|
export declare class AuthError extends SdkError {
|
|
15
|
+
/**
|
|
16
|
+
* @param message - Human-readable error description.
|
|
17
|
+
* @param code - Optional stable error code (defaults to `'AUTH_ERROR'`).
|
|
18
|
+
*/
|
|
15
19
|
constructor(message: string, code?: string);
|
|
16
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Configuration for the browser-oriented {@link RayfinClient}, extending the
|
|
23
|
+
* base HTTP client configuration with auth-token storage options.
|
|
24
|
+
*/
|
|
17
25
|
export interface RayfinClientConfig extends ApiClientConfig {
|
|
18
26
|
/**
|
|
19
27
|
* Storage implementation for authentication tokens.
|
|
@@ -23,15 +31,22 @@ export interface RayfinClientConfig extends ApiClientConfig {
|
|
|
23
31
|
*/
|
|
24
32
|
authStorage?: AuthStorage | boolean;
|
|
25
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Configuration for the server/worker-oriented {@link RayfinServerClient}.
|
|
36
|
+
* Omits the browser-only `getAccessToken` hook in favor of a supplied
|
|
37
|
+
* access token.
|
|
38
|
+
*/
|
|
26
39
|
export interface RayfinServerClientConfig extends Omit<ApiClientConfig, 'getAccessToken'> {
|
|
27
40
|
/** Access token (string or function) for Authorization: Bearer <token>. Use the function form to rotate per request. */
|
|
28
41
|
accessToken?: string | (() => string | null);
|
|
29
42
|
}
|
|
30
43
|
/** Shared base for Rayfin clients: owns the typed data API and the underlying HTTP client. */
|
|
31
44
|
export declare abstract class RayfinClientBase<TSchema extends EntitySchema = Record<string, any>> {
|
|
45
|
+
/** Typed data API for querying and mutating your entities. */
|
|
32
46
|
readonly data: ReturnType<typeof createDataApi<TSchema>>;
|
|
33
47
|
protected apiClient: ApiClient;
|
|
34
48
|
protected constructor(config: ApiClientConfig);
|
|
49
|
+
/** SDK error classes, exposed for convenient `instanceof` checks. */
|
|
35
50
|
static readonly errors: {
|
|
36
51
|
SdkError: typeof SdkError;
|
|
37
52
|
AuthError: typeof AuthError;
|
|
@@ -65,8 +80,15 @@ export declare abstract class RayfinClientBase<TSchema extends EntitySchema = Re
|
|
|
65
80
|
* ```
|
|
66
81
|
*/
|
|
67
82
|
export declare class RayfinClient<TSchema extends EntitySchema = Record<string, any>, TFunctionsSchema extends FunctionsSchema = FunctionsSchema> extends RayfinClientBase<TSchema> {
|
|
83
|
+
/** Authentication operations (sign up, sign in, sign out, session state). */
|
|
68
84
|
readonly auth: Auth;
|
|
85
|
+
/** Typed, schema-aware accessors for invoking your backend functions. */
|
|
69
86
|
readonly functions: ReturnType<typeof createFunctionsApi<TFunctionsSchema>>;
|
|
87
|
+
/**
|
|
88
|
+
* Creates a browser Rayfin client and wires up authentication.
|
|
89
|
+
*
|
|
90
|
+
* @param config - Client configuration, including optional auth-token storage.
|
|
91
|
+
*/
|
|
70
92
|
constructor(config: RayfinClientConfig);
|
|
71
93
|
}
|
|
72
94
|
/**
|
|
@@ -85,6 +107,12 @@ export declare class RayfinClient<TSchema extends EntitySchema = Record<string,
|
|
|
85
107
|
* ```
|
|
86
108
|
*/
|
|
87
109
|
export declare class RayfinServerClient<TSchema extends EntitySchema = Record<string, any>> extends RayfinClientBase<TSchema> {
|
|
110
|
+
/**
|
|
111
|
+
* Creates a server/worker Rayfin client using a supplied access token.
|
|
112
|
+
*
|
|
113
|
+
* @param config - Client configuration, including the access token (string or
|
|
114
|
+
* function form for per-request rotation).
|
|
115
|
+
*/
|
|
88
116
|
constructor(config: RayfinServerClientConfig);
|
|
89
117
|
}
|
|
90
118
|
export default RayfinClient;
|
package/dist/client.js
CHANGED
|
@@ -12,12 +12,17 @@ import { ApiClient } from '@microsoft/rayfin-lib';
|
|
|
12
12
|
* Auth error specific to the Rayfin SDK.
|
|
13
13
|
*/
|
|
14
14
|
export class AuthError extends SdkError {
|
|
15
|
+
/**
|
|
16
|
+
* @param message - Human-readable error description.
|
|
17
|
+
* @param code - Optional stable error code (defaults to `'AUTH_ERROR'`).
|
|
18
|
+
*/
|
|
15
19
|
constructor(message, code) {
|
|
16
20
|
super(message, code || 'AUTH_ERROR');
|
|
17
21
|
}
|
|
18
22
|
}
|
|
19
23
|
/** Shared base for Rayfin clients: owns the typed data API and the underlying HTTP client. */
|
|
20
24
|
export class RayfinClientBase {
|
|
25
|
+
/** Typed data API for querying and mutating your entities. */
|
|
21
26
|
data;
|
|
22
27
|
apiClient;
|
|
23
28
|
constructor(config) {
|
|
@@ -39,6 +44,7 @@ export class RayfinClientBase {
|
|
|
39
44
|
this.data = createDataApi(this.apiClient);
|
|
40
45
|
}
|
|
41
46
|
// Static access to custom errors for easy import by consumers
|
|
47
|
+
/** SDK error classes, exposed for convenient `instanceof` checks. */
|
|
42
48
|
static errors = {
|
|
43
49
|
SdkError,
|
|
44
50
|
AuthError,
|
|
@@ -72,8 +78,15 @@ export class RayfinClientBase {
|
|
|
72
78
|
* ```
|
|
73
79
|
*/
|
|
74
80
|
export class RayfinClient extends RayfinClientBase {
|
|
81
|
+
/** Authentication operations (sign up, sign in, sign out, session state). */
|
|
75
82
|
auth;
|
|
76
|
-
|
|
83
|
+
/** Typed, schema-aware accessors for invoking your backend functions. */
|
|
84
|
+
functions;
|
|
85
|
+
/**
|
|
86
|
+
* Creates a browser Rayfin client and wires up authentication.
|
|
87
|
+
*
|
|
88
|
+
* @param config - Client configuration, including optional auth-token storage.
|
|
89
|
+
*/
|
|
77
90
|
constructor(config) {
|
|
78
91
|
super(config);
|
|
79
92
|
this.auth = new Auth(this.apiClient, { storage: config.authStorage });
|
|
@@ -97,6 +110,12 @@ export class RayfinClient extends RayfinClientBase {
|
|
|
97
110
|
* ```
|
|
98
111
|
*/
|
|
99
112
|
export class RayfinServerClient extends RayfinClientBase {
|
|
113
|
+
/**
|
|
114
|
+
* Creates a server/worker Rayfin client using a supplied access token.
|
|
115
|
+
*
|
|
116
|
+
* @param config - Client configuration, including the access token (string or
|
|
117
|
+
* function form for per-request rotation).
|
|
118
|
+
*/
|
|
100
119
|
constructor(config) {
|
|
101
120
|
super(config);
|
|
102
121
|
if (config.accessToken !== undefined) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/rayfin-client",
|
|
3
|
-
"version": "1.33.
|
|
3
|
+
"version": "1.33.2",
|
|
4
4
|
"description": "Main client SDK for Rayfin services",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"assets/docs"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@microsoft/rayfin-auth": "1.33.
|
|
25
|
-
"@microsoft/rayfin-data": "1.33.
|
|
26
|
-
"@microsoft/rayfin-lib": "1.33.
|
|
27
|
-
"@microsoft/rayfin-functions": "1.33.
|
|
24
|
+
"@microsoft/rayfin-auth": "1.33.2",
|
|
25
|
+
"@microsoft/rayfin-data": "1.33.2",
|
|
26
|
+
"@microsoft/rayfin-lib": "1.33.2",
|
|
27
|
+
"@microsoft/rayfin-functions": "1.33.2"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"typescript": "^5.8.3",
|