@microsoft/rayfin-client 1.33.1 → 1.34.0-alpha.1148
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 +34 -4
- package/dist/experimental/ConnectorsRayfinClient.d.ts +61 -0
- package/dist/experimental/ConnectorsRayfinClient.js +62 -0
- package/dist/experimental/index.d.ts +2 -0
- package/dist/experimental/index.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/package.json +6 -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,23 +12,39 @@ 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) {
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
// Legacy compatibility: before `useProxy` was deprecated, passing
|
|
30
|
+
// `useProxy: true` without a `baseUrl` meant "route same-origin through the
|
|
31
|
+
// dev-server proxy". Preserve that as `baseUrl: ''` during the deprecation
|
|
32
|
+
// window so existing consumers are not broken. The ApiClient emits the
|
|
33
|
+
// one-time `useProxy` deprecation warning.
|
|
34
|
+
const baseUrl = (config.baseUrl === undefined || config.baseUrl === null) &&
|
|
35
|
+
config.useProxy
|
|
36
|
+
? ''
|
|
37
|
+
: config.baseUrl;
|
|
38
|
+
if (baseUrl === undefined || baseUrl === null) {
|
|
39
|
+
throw new SdkError('SDK configuration requires a baseUrl. Pass an absolute URL to call a ' +
|
|
40
|
+
"backend directly, or an empty string ('') to keep requests " +
|
|
41
|
+
'same-origin so a development proxy can forward them.', 'MISSING_BASE_URL');
|
|
26
42
|
}
|
|
27
43
|
if (!config.publishableKey || config.publishableKey.trim() === '') {
|
|
28
44
|
throw new SdkError('SDK configuration requires a publishableKey for service-level authentication.', 'MISSING_PUBLISHABLE_KEY');
|
|
29
45
|
}
|
|
30
46
|
this.apiClient = new ApiClient({
|
|
31
|
-
baseUrl:
|
|
47
|
+
baseUrl: baseUrl,
|
|
32
48
|
publishableKey: config.publishableKey,
|
|
33
49
|
functionsBaseUrl: config.functionsBaseUrl,
|
|
34
50
|
useProxy: config.useProxy,
|
|
@@ -39,6 +55,7 @@ export class RayfinClientBase {
|
|
|
39
55
|
this.data = createDataApi(this.apiClient);
|
|
40
56
|
}
|
|
41
57
|
// Static access to custom errors for easy import by consumers
|
|
58
|
+
/** SDK error classes, exposed for convenient `instanceof` checks. */
|
|
42
59
|
static errors = {
|
|
43
60
|
SdkError,
|
|
44
61
|
AuthError,
|
|
@@ -72,8 +89,15 @@ export class RayfinClientBase {
|
|
|
72
89
|
* ```
|
|
73
90
|
*/
|
|
74
91
|
export class RayfinClient extends RayfinClientBase {
|
|
92
|
+
/** Authentication operations (sign up, sign in, sign out, session state). */
|
|
75
93
|
auth;
|
|
76
|
-
|
|
94
|
+
/** Typed, schema-aware accessors for invoking your backend functions. */
|
|
95
|
+
functions;
|
|
96
|
+
/**
|
|
97
|
+
* Creates a browser Rayfin client and wires up authentication.
|
|
98
|
+
*
|
|
99
|
+
* @param config - Client configuration, including optional auth-token storage.
|
|
100
|
+
*/
|
|
77
101
|
constructor(config) {
|
|
78
102
|
super(config);
|
|
79
103
|
this.auth = new Auth(this.apiClient, { storage: config.authStorage });
|
|
@@ -97,6 +121,12 @@ export class RayfinClient extends RayfinClientBase {
|
|
|
97
121
|
* ```
|
|
98
122
|
*/
|
|
99
123
|
export class RayfinServerClient extends RayfinClientBase {
|
|
124
|
+
/**
|
|
125
|
+
* Creates a server/worker Rayfin client using a supplied access token.
|
|
126
|
+
*
|
|
127
|
+
* @param config - Client configuration, including the access token (string or
|
|
128
|
+
* function form for per-request rotation).
|
|
129
|
+
*/
|
|
100
130
|
constructor(config) {
|
|
101
131
|
super(config);
|
|
102
132
|
if (config.accessToken !== undefined) {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createConnectorsApi, type ConnectorsSchema } from '@microsoft/rayfin-connectors';
|
|
2
|
+
import { type EntitySchema } from '@microsoft/rayfin-data';
|
|
3
|
+
import { type FunctionsSchema } from '@microsoft/rayfin-functions';
|
|
4
|
+
import RayfinClient, { RayfinClientConfig } from '../client.js';
|
|
5
|
+
/**
|
|
6
|
+
* (Experimental) Rayfin client that surfaces the typed connectors runtime as
|
|
7
|
+
* `client.connectors.<name>.<operation>(input, options?)`.
|
|
8
|
+
*
|
|
9
|
+
* The connector layer is being incubated under the experimental subpath while
|
|
10
|
+
* the API and configuration model stabilize. Public consumers should import
|
|
11
|
+
* from `@microsoft/rayfin-client/experimental` rather than the stable entry.
|
|
12
|
+
*
|
|
13
|
+
* @typeParam TSchema - Data entity schema (same shape as {@link RayfinClient}).
|
|
14
|
+
* @typeParam TFunctionsSchema - Functions schema (same shape as {@link RayfinClient}).
|
|
15
|
+
* @typeParam TConnectorsSchema - Connector schema mapping connector names
|
|
16
|
+
* (as declared in `rayfin.yml`) to typed connector markers such as
|
|
17
|
+
* `FabricSemanticModel<'executeQuery'>`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { ConnectorsRayfinClient } from '@microsoft/rayfin-client/experimental';
|
|
22
|
+
* import type { FabricSemanticModel } from '@microsoft/rayfin-connector-fabric-semanticmodel';
|
|
23
|
+
*
|
|
24
|
+
* type AppConnectorsSchema = {
|
|
25
|
+
* salesModel: FabricSemanticModel<'executeQuery'>;
|
|
26
|
+
* };
|
|
27
|
+
*
|
|
28
|
+
* const client = new ConnectorsRayfinClient<
|
|
29
|
+
* DataSchema,
|
|
30
|
+
* FunctionsSchema,
|
|
31
|
+
* AppConnectorsSchema
|
|
32
|
+
* >({
|
|
33
|
+
* baseUrl: import.meta.env.VITE_RAYFIN_BASE_URL,
|
|
34
|
+
* publishableKey: import.meta.env.VITE_RAYFIN_PUBLISHABLE_KEY,
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* const result = await client.connectors.salesModel.executeQuery({
|
|
38
|
+
* query: 'EVALUATE TOPN(10, Sales)',
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @alpha
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export declare class ConnectorsRayfinClient<TSchema extends EntitySchema = Record<string, any>, TFunctionsSchema extends FunctionsSchema = FunctionsSchema, TConnectorsSchema extends ConnectorsSchema = ConnectorsSchema> extends RayfinClient<TSchema, TFunctionsSchema> {
|
|
46
|
+
/**
|
|
47
|
+
* (Experimental) Typed accessors for connectors declared in `rayfin.yml`.
|
|
48
|
+
* Each property resolves lazily on first access; the underlying transport
|
|
49
|
+
* (`POST /connector-invoke`) is shared with the rest of the SDK.
|
|
50
|
+
*/
|
|
51
|
+
readonly connectors: ReturnType<typeof createConnectorsApi<TConnectorsSchema>>;
|
|
52
|
+
/**
|
|
53
|
+
* (Experimental) Creates a Rayfin client with the connectors runtime
|
|
54
|
+
* attached. Accepts the same configuration as {@link RayfinClient}.
|
|
55
|
+
*
|
|
56
|
+
* @param config - Client configuration, including optional auth-token storage.
|
|
57
|
+
*/
|
|
58
|
+
constructor(config: RayfinClientConfig);
|
|
59
|
+
}
|
|
60
|
+
export default ConnectorsRayfinClient;
|
|
61
|
+
//# sourceMappingURL=ConnectorsRayfinClient.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createConnectorsApi, } from '@microsoft/rayfin-connectors';
|
|
2
|
+
import RayfinClient from '../client.js';
|
|
3
|
+
/**
|
|
4
|
+
* (Experimental) Rayfin client that surfaces the typed connectors runtime as
|
|
5
|
+
* `client.connectors.<name>.<operation>(input, options?)`.
|
|
6
|
+
*
|
|
7
|
+
* The connector layer is being incubated under the experimental subpath while
|
|
8
|
+
* the API and configuration model stabilize. Public consumers should import
|
|
9
|
+
* from `@microsoft/rayfin-client/experimental` rather than the stable entry.
|
|
10
|
+
*
|
|
11
|
+
* @typeParam TSchema - Data entity schema (same shape as {@link RayfinClient}).
|
|
12
|
+
* @typeParam TFunctionsSchema - Functions schema (same shape as {@link RayfinClient}).
|
|
13
|
+
* @typeParam TConnectorsSchema - Connector schema mapping connector names
|
|
14
|
+
* (as declared in `rayfin.yml`) to typed connector markers such as
|
|
15
|
+
* `FabricSemanticModel<'executeQuery'>`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { ConnectorsRayfinClient } from '@microsoft/rayfin-client/experimental';
|
|
20
|
+
* import type { FabricSemanticModel } from '@microsoft/rayfin-connector-fabric-semanticmodel';
|
|
21
|
+
*
|
|
22
|
+
* type AppConnectorsSchema = {
|
|
23
|
+
* salesModel: FabricSemanticModel<'executeQuery'>;
|
|
24
|
+
* };
|
|
25
|
+
*
|
|
26
|
+
* const client = new ConnectorsRayfinClient<
|
|
27
|
+
* DataSchema,
|
|
28
|
+
* FunctionsSchema,
|
|
29
|
+
* AppConnectorsSchema
|
|
30
|
+
* >({
|
|
31
|
+
* baseUrl: import.meta.env.VITE_RAYFIN_BASE_URL,
|
|
32
|
+
* publishableKey: import.meta.env.VITE_RAYFIN_PUBLISHABLE_KEY,
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* const result = await client.connectors.salesModel.executeQuery({
|
|
36
|
+
* query: 'EVALUATE TOPN(10, Sales)',
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @alpha
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export class ConnectorsRayfinClient extends RayfinClient {
|
|
44
|
+
/**
|
|
45
|
+
* (Experimental) Typed accessors for connectors declared in `rayfin.yml`.
|
|
46
|
+
* Each property resolves lazily on first access; the underlying transport
|
|
47
|
+
* (`POST /connector-invoke`) is shared with the rest of the SDK.
|
|
48
|
+
*/
|
|
49
|
+
connectors;
|
|
50
|
+
/**
|
|
51
|
+
* (Experimental) Creates a Rayfin client with the connectors runtime
|
|
52
|
+
* attached. Accepts the same configuration as {@link RayfinClient}.
|
|
53
|
+
*
|
|
54
|
+
* @param config - Client configuration, including optional auth-token storage.
|
|
55
|
+
*/
|
|
56
|
+
constructor(config) {
|
|
57
|
+
super(config);
|
|
58
|
+
this.connectors = createConnectorsApi(this.apiClient);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export default ConnectorsRayfinClient;
|
|
62
|
+
//# sourceMappingURL=ConnectorsRayfinClient.js.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { ExtendableRayfinClient, ServicePlugin, } from './ExtendableRayfinClient.js';
|
|
2
2
|
export type { TServiceClasses, ServicePluginClass, } from './ExtendableRayfinClient.js';
|
|
3
|
+
export { ConnectorsRayfinClient } from './ConnectorsRayfinClient.js';
|
|
4
|
+
export type { ConnectorsSchema, ConnectorMarker, OperationCatalog, OperationDef, TypedConnectorsApi, TypedConnectorClient, } from '@microsoft/rayfin-connectors';
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './client.js';
|
|
2
2
|
export { default } from './client.js';
|
|
3
3
|
export type { TypedDataClients, EntitySchema } from '@microsoft/rayfin-data';
|
|
4
|
+
export type { FunctionsSchema } from '@microsoft/rayfin-functions';
|
|
4
5
|
export type { ApiClientConfig } from '@microsoft/rayfin-lib';
|
|
6
|
+
export { setDeprecationsSilenced, isDeprecationSilenced, } from '@microsoft/rayfin-lib';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
// Export all from client.ts
|
|
2
2
|
export * from './client.js';
|
|
3
3
|
export { default } from './client.js';
|
|
4
|
+
// Re-export deprecation silencing controls from rayfin-lib so consumers have a
|
|
5
|
+
// stable public import path here; emitter helpers stay internal to the SDK.
|
|
6
|
+
export { setDeprecationsSilenced, isDeprecationSilenced, } from '@microsoft/rayfin-lib';
|
|
4
7
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/rayfin-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.0-alpha.1148",
|
|
4
4
|
"description": "Main client SDK for Rayfin services",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -21,10 +21,11 @@
|
|
|
21
21
|
"assets/docs"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@microsoft/rayfin-auth": "1.
|
|
25
|
-
"@microsoft/rayfin-
|
|
26
|
-
"@microsoft/rayfin-
|
|
27
|
-
"@microsoft/rayfin-
|
|
24
|
+
"@microsoft/rayfin-auth": "1.34.0-alpha.1148",
|
|
25
|
+
"@microsoft/rayfin-connectors": "1.34.0-alpha.1148",
|
|
26
|
+
"@microsoft/rayfin-data": "1.34.0-alpha.1148",
|
|
27
|
+
"@microsoft/rayfin-lib": "1.34.0-alpha.1148",
|
|
28
|
+
"@microsoft/rayfin-functions": "1.34.0-alpha.1148"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"typescript": "^5.8.3",
|