@microsoft/rayfin-client 1.36.0-alpha.1818 → 1.36.0-alpha.1917
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/README.md +155 -24
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# @microsoft/rayfin-client
|
|
2
2
|
|
|
3
|
+
The main client SDK for interacting with Rayfin services.
|
|
4
|
+
This package provides a unified interface to access all Rayfin platform capabilities.
|
|
5
|
+
|
|
3
6
|
## Getting started
|
|
4
7
|
|
|
5
8
|
```bash
|
|
@@ -8,16 +11,155 @@ npm create @microsoft/rayfin@latest
|
|
|
8
11
|
|
|
9
12
|
For more details, [visit our docs](https://aka.ms/rayfin/docs).
|
|
10
13
|
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
The `@microsoft/rayfin-client` package serves as the primary entry point for applications using the Rayfin platform.
|
|
17
|
+
It integrates and orchestrates the various Rayfin modules:
|
|
18
|
+
|
|
19
|
+
- Authentication and user management via `@microsoft/rayfin-auth`
|
|
20
|
+
- Data API Builder (DAB) integration via `@microsoft/rayfin-core`
|
|
21
|
+
- Database access patterns via `@microsoft/rayfin-data`
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @microsoft/rayfin-client
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Basic Usage
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { RayfinClient } from '@microsoft/rayfin-client';
|
|
33
|
+
|
|
34
|
+
// Initialize the client
|
|
35
|
+
const client = new RayfinClient({
|
|
36
|
+
baseUrl: 'https://api.rayfin.io',
|
|
37
|
+
publishableKey: 'pk-your-key',
|
|
38
|
+
headers: {
|
|
39
|
+
'X-API-Version': '1.0',
|
|
40
|
+
},
|
|
41
|
+
timeout: 30000, // 30 seconds
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Authentication
|
|
45
|
+
try {
|
|
46
|
+
const result = await client.auth.signUpUser({
|
|
47
|
+
email: 'user@example.com',
|
|
48
|
+
password: 'SecurePassword123!',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
console.log('User registered successfully:', result);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
if (error instanceof RayfinClient.errors.AuthError) {
|
|
54
|
+
console.error('Authentication error:', error.message, error.code);
|
|
55
|
+
} else {
|
|
56
|
+
console.error('Unexpected error:', error);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Architecture
|
|
62
|
+
|
|
63
|
+
The Rayfin client follows a modular architecture, providing access to specialized service modules:
|
|
64
|
+
|
|
65
|
+
- **auth**: Authentication and user management
|
|
66
|
+
- **data**: Database and entity operations with REST and GraphQL interfaces
|
|
67
|
+
|
|
68
|
+
Each module is built to be lightweight and focused on its specific domain.
|
|
69
|
+
|
|
70
|
+
## Advanced Usage
|
|
71
|
+
|
|
72
|
+
### Error Handling
|
|
73
|
+
|
|
74
|
+
The client provides standardized error types for consistent error handling:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import RayfinClient, { AuthError } from '@microsoft/rayfin-client';
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
// Client operations
|
|
81
|
+
} catch (error) {
|
|
82
|
+
if (error instanceof RayfinClient.errors.AuthError) {
|
|
83
|
+
// Handle authentication errors
|
|
84
|
+
} else if (error instanceof RayfinClient.errors.NetworkError) {
|
|
85
|
+
// Handle network errors
|
|
86
|
+
} else if (error instanceof RayfinClient.errors.SdkError) {
|
|
87
|
+
// Handle general SDK errors
|
|
88
|
+
} else {
|
|
89
|
+
// Handle other errors
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Custom Configuration
|
|
95
|
+
|
|
96
|
+
You can customize the client's behavior with various configuration options:
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
const client = new RayfinClient({
|
|
100
|
+
baseUrl: 'https://api.rayfin.io',
|
|
101
|
+
publishableKey: 'pk-your-key',
|
|
102
|
+
headers: {
|
|
103
|
+
'X-Custom-Header': 'value',
|
|
104
|
+
},
|
|
105
|
+
timeout: 60000, // 60 seconds
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Service Integration
|
|
110
|
+
|
|
111
|
+
The client is designed to integrate seamlessly with your application services:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
class ProductService {
|
|
115
|
+
private client: RayfinClient;
|
|
116
|
+
|
|
117
|
+
constructor(client: RayfinClient) {
|
|
118
|
+
this.client = client;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async getProducts(category?: string) {
|
|
122
|
+
// Use client.data for database operations
|
|
123
|
+
// return await this.client.data.Product.findMany();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Create client and service
|
|
128
|
+
const client = new RayfinClient({
|
|
129
|
+
baseUrl: 'https://api.rayfin.io',
|
|
130
|
+
publishableKey: 'pk-your-key',
|
|
131
|
+
});
|
|
132
|
+
const productService = new ProductService(client);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## TypeScript Support
|
|
136
|
+
|
|
137
|
+
The Rayfin client is built with TypeScript and provides comprehensive type definitions for all APIs and models.
|
|
138
|
+
|
|
139
|
+
## Compatibility
|
|
140
|
+
|
|
141
|
+
- Node.js 16+
|
|
142
|
+
- Browsers (ES2020+)
|
|
143
|
+
- TypeScript 5.8+
|
|
144
|
+
|
|
145
|
+
## Related Packages
|
|
146
|
+
|
|
147
|
+
- [@microsoft/rayfin-auth](../auth): Authentication and user management
|
|
148
|
+
- [@microsoft/rayfin-lib](../lib): Core utilities and HTTP client
|
|
149
|
+
- [@microsoft/rayfin-core](../core): Data API Builder integration
|
|
150
|
+
- [@microsoft/rayfin-data](../data): Data access patterns
|
|
151
|
+
|
|
152
|
+
## Contributing
|
|
153
|
+
|
|
154
|
+
Please see the Project Rayfin [contributing guide](https://github.com/microsoft/project-rayfin/blob/main/CONTRIBUTING.md).
|
|
155
|
+
|
|
11
156
|
## Security
|
|
12
157
|
|
|
13
|
-
Microsoft takes the security of our software products and services seriously, which
|
|
14
|
-
includes all source code repositories in our GitHub organizations.
|
|
158
|
+
Microsoft takes the security of our software products and services seriously, which includes all source code repositories in our GitHub organizations.
|
|
15
159
|
|
|
16
160
|
**Please do not report security vulnerabilities through public GitHub issues.**
|
|
17
161
|
|
|
18
|
-
For security reporting information, locations, contact information, and policies,
|
|
19
|
-
please review the latest guidance for Microsoft repositories at
|
|
20
|
-
[https://aka.ms/SECURITY.md](https://aka.ms/SECURITY.md).
|
|
162
|
+
For security reporting information, locations, contact information, and policies, please review the latest guidance for Microsoft repositories at [https://aka.ms/SECURITY.md](https://aka.ms/SECURITY.md).
|
|
21
163
|
|
|
22
164
|
## Trademarks
|
|
23
165
|
|
|
@@ -30,22 +172,11 @@ Any use of third-party trademarks or logos is subject to those third parties' po
|
|
|
30
172
|
|
|
31
173
|
Copyright (c) Microsoft Corporation.
|
|
32
174
|
|
|
33
|
-
MIT License
|
|
34
|
-
|
|
35
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
36
|
-
|
|
37
|
-
in
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
The above copyright notice and this permission notice shall be included in all
|
|
43
|
-
copies or substantial portions of the Software.
|
|
44
|
-
|
|
45
|
-
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
46
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
47
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
48
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
49
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
50
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
51
|
-
SOFTWARE.
|
|
175
|
+
[MIT License](https://github.com/microsoft/project-rayfin/blob/main/LICENSE)
|
|
176
|
+
|
|
177
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
178
|
+
|
|
179
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
180
|
+
|
|
181
|
+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
182
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/rayfin-client",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "1.36.0-alpha.
|
|
4
|
+
"version": "1.36.0-alpha.1917",
|
|
5
5
|
"description": "Main client SDK for Rayfin services",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"assets/docs"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@microsoft/rayfin-
|
|
27
|
-
"@microsoft/rayfin-
|
|
28
|
-
"@microsoft/rayfin-
|
|
29
|
-
"@microsoft/rayfin-
|
|
30
|
-
"@microsoft/rayfin-
|
|
26
|
+
"@microsoft/rayfin-connectors": "1.36.0-alpha.1917",
|
|
27
|
+
"@microsoft/rayfin-auth": "1.36.0-alpha.1917",
|
|
28
|
+
"@microsoft/rayfin-data": "1.36.0-alpha.1917",
|
|
29
|
+
"@microsoft/rayfin-lib": "1.36.0-alpha.1917",
|
|
30
|
+
"@microsoft/rayfin-functions": "1.36.0-alpha.1917"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"typescript": "^5.8.3",
|