@bloque/sdk 0.0.1 → 0.0.3
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 +588 -324
- package/dist/accounts.d.ts +3 -0
- package/dist/bloque.d.ts +13 -0
- package/dist/compliance.d.ts +3 -0
- package/dist/config.d.ts +3 -0
- package/dist/identity.d.ts +3 -0
- package/dist/index.cjs +22 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.js +20 -2
- package/dist/init.d.ts +2 -0
- package/dist/orgs.d.ts +3 -0
- package/package.json +32 -2
package/README.md
CHANGED
|
@@ -1,46 +1,67 @@
|
|
|
1
|
-
# Bloque
|
|
1
|
+
# Bloque SDK
|
|
2
2
|
|
|
3
|
-
The official TypeScript/JavaScript SDK for integrating [Bloque](https://www.bloque.app)
|
|
3
|
+
The official TypeScript/JavaScript SDK for integrating [Bloque](https://www.bloque.app) into your applications.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- **TypeScript First**: Built with TypeScript for complete type safety
|
|
8
|
-
- **Simple API**: Intuitive interface for
|
|
9
|
-
- **Multiple Payment Methods**: Support for cards, PSE, and cash payments
|
|
8
|
+
- **Simple API**: Intuitive interface for managing organizations, compliance, accounts, and identity
|
|
10
9
|
- **Fully Async**: Promise-based API for modern JavaScript workflows
|
|
11
10
|
- **Lightweight**: Minimal dependencies for optimal bundle size
|
|
11
|
+
- **Modular**: Import only what you need with tree-shakeable exports
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
bun add @bloque/
|
|
16
|
+
bun add @bloque/sdk
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Quick Start
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
|
-
import {
|
|
22
|
+
import { SDK } from '@bloque/sdk';
|
|
23
|
+
import type { CreateOrgParams } from '@bloque/sdk/orgs';
|
|
23
24
|
|
|
24
25
|
// Initialize the SDK (server-side only)
|
|
25
|
-
const bloque = new
|
|
26
|
+
const bloque = new SDK({
|
|
26
27
|
apiKey: process.env.BLOQUE_API_KEY!,
|
|
27
|
-
|
|
28
|
+
mode: 'production', // or 'sandbox' for testing
|
|
28
29
|
});
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
// Create an organization
|
|
32
|
+
async function createOrganization() {
|
|
33
|
+
const params: CreateOrgParams = {
|
|
34
|
+
org_type: 'business',
|
|
35
|
+
profile: {
|
|
36
|
+
legal_name: 'Acme Corporation',
|
|
37
|
+
tax_id: '123456789',
|
|
38
|
+
incorporation_date: '2020-01-01',
|
|
39
|
+
business_type: 'llc',
|
|
40
|
+
incorporation_country_code: 'US',
|
|
41
|
+
incorporation_state: 'CA',
|
|
42
|
+
address_line1: '123 Main St',
|
|
43
|
+
postal_code: '12345',
|
|
44
|
+
city: 'San Francisco',
|
|
45
|
+
},
|
|
46
|
+
metadata: {
|
|
47
|
+
source: 'api',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
33
50
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
});
|
|
51
|
+
const organization = await bloque.orgs.create(params);
|
|
52
|
+
console.log('Organization created:', organization);
|
|
53
|
+
}
|
|
38
54
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
// Create a virtual card
|
|
56
|
+
async function createCard() {
|
|
57
|
+
const card = await bloque.accounts.card.create({
|
|
58
|
+
urn: 'did:bloque:user:123e4567',
|
|
59
|
+
name: 'My Virtual Card',
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
console.log('Card created:', card.urn);
|
|
63
|
+
console.log('Last four digits:', card.lastFour);
|
|
64
|
+
}
|
|
44
65
|
```
|
|
45
66
|
|
|
46
67
|
## Configuration
|
|
@@ -48,366 +69,551 @@ app.post('/api/payments', async (req, res) => {
|
|
|
48
69
|
### Initialize the SDK
|
|
49
70
|
|
|
50
71
|
```typescript
|
|
51
|
-
import {
|
|
72
|
+
import { SDK } from '@bloque/sdk';
|
|
73
|
+
import type { BloqueConfig } from '@bloque/sdk';
|
|
52
74
|
|
|
53
|
-
const bloque = new
|
|
75
|
+
const bloque = new SDK({
|
|
54
76
|
apiKey: 'your-api-key-here', // Required: Your Bloque API key
|
|
55
|
-
|
|
77
|
+
mode: 'sandbox', // Required: 'sandbox' or 'production'
|
|
56
78
|
});
|
|
57
79
|
```
|
|
58
80
|
|
|
59
|
-
###
|
|
81
|
+
### Configuration Options
|
|
60
82
|
|
|
61
|
-
- **`
|
|
62
|
-
- **`production
|
|
83
|
+
- **`apiKey`** (string, required): Your Bloque API key
|
|
84
|
+
- **`mode`** ('sandbox' | 'production', required): Environment mode
|
|
85
|
+
- `sandbox`: For testing and development
|
|
86
|
+
- `production`: For live operations
|
|
63
87
|
|
|
64
88
|
## API Reference
|
|
65
89
|
|
|
66
|
-
###
|
|
90
|
+
### Organizations
|
|
67
91
|
|
|
68
|
-
The
|
|
92
|
+
The organizations resource allows you to create and manage organizations in the Bloque platform.
|
|
69
93
|
|
|
70
|
-
#### Create
|
|
94
|
+
#### Create an Organization
|
|
71
95
|
|
|
72
96
|
```typescript
|
|
73
|
-
const
|
|
74
|
-
checkoutId: string; // Required: Checkout ID from an existing checkout
|
|
75
|
-
payment: {
|
|
76
|
-
type: 'card' | 'pse' | 'cash',
|
|
77
|
-
data: {
|
|
78
|
-
// Payment method specific data
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
97
|
+
const organization = await bloque.orgs.create(params);
|
|
82
98
|
```
|
|
83
99
|
|
|
84
|
-
**
|
|
100
|
+
**Parameters**:
|
|
85
101
|
|
|
86
|
-
**Card Payment**:
|
|
87
102
|
```typescript
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
103
|
+
interface CreateOrgParams {
|
|
104
|
+
org_type: 'business' | 'individual'; // Organization type
|
|
105
|
+
profile: OrgProfile; // Organization profile details
|
|
106
|
+
metadata?: Record<string, unknown>; // Optional custom metadata
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
interface OrgProfile {
|
|
110
|
+
legal_name: string; // Legal name of the organization
|
|
111
|
+
tax_id: string; // Tax ID number
|
|
112
|
+
incorporation_date: string; // Date of incorporation (YYYY-MM-DD)
|
|
113
|
+
business_type: string; // Type of business (e.g., 'llc', 'corporation')
|
|
114
|
+
incorporation_country_code: string; // Country code (ISO 3166-1 alpha-2)
|
|
115
|
+
incorporation_state?: string; // State/province (optional)
|
|
116
|
+
address_line1: string; // Primary address line
|
|
117
|
+
address_line2?: string; // Secondary address line (optional)
|
|
118
|
+
postal_code: string; // Postal/ZIP code
|
|
119
|
+
city: string; // City
|
|
120
|
+
logo_url?: string; // Logo URL (optional)
|
|
121
|
+
places?: Place[]; // Additional places/locations (optional)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface Place {
|
|
125
|
+
country_code: string; // Country code
|
|
126
|
+
state: string; // State/province
|
|
127
|
+
address_line1: string; // Address line 1
|
|
128
|
+
postal_code: string; // Postal code
|
|
129
|
+
city: string; // City
|
|
130
|
+
is_primary: boolean; // Whether this is the primary place
|
|
98
131
|
}
|
|
99
132
|
```
|
|
100
133
|
|
|
101
|
-
**
|
|
134
|
+
**Response**:
|
|
135
|
+
|
|
102
136
|
```typescript
|
|
103
|
-
{
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
bankCode: string; // Bank code
|
|
110
|
-
email: string; // Customer email
|
|
111
|
-
}
|
|
137
|
+
interface Organization {
|
|
138
|
+
urn: string; // Unique resource name
|
|
139
|
+
org_type: 'business' | 'individual'; // Organization type
|
|
140
|
+
profile: OrgProfile; // Organization profile
|
|
141
|
+
metadata?: Record<string, unknown>; // Custom metadata
|
|
142
|
+
status: OrgStatus; // Organization status
|
|
112
143
|
}
|
|
144
|
+
|
|
145
|
+
type OrgStatus =
|
|
146
|
+
| 'awaiting_compliance_verification'
|
|
147
|
+
| 'active'
|
|
148
|
+
| 'suspended'
|
|
149
|
+
| 'closed';
|
|
113
150
|
```
|
|
114
151
|
|
|
115
|
-
|
|
152
|
+
### Compliance
|
|
153
|
+
|
|
154
|
+
The compliance resource provides KYC (Know Your Customer) verification functionality.
|
|
155
|
+
|
|
156
|
+
#### Start KYC Verification
|
|
157
|
+
|
|
158
|
+
Start a KYC verification process for a user:
|
|
159
|
+
|
|
116
160
|
```typescript
|
|
117
|
-
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
email: string; // Customer email
|
|
121
|
-
documentType: string; // Document type
|
|
122
|
-
documentNumber: string; // Document number
|
|
123
|
-
fullName: string; // Full name
|
|
124
|
-
}
|
|
125
|
-
}
|
|
161
|
+
const verification = await bloque.compliance.kyc.startVerification({
|
|
162
|
+
urn: 'did:bloque:origin:user-id',
|
|
163
|
+
});
|
|
126
164
|
```
|
|
127
165
|
|
|
128
|
-
**
|
|
166
|
+
**Parameters**:
|
|
167
|
+
|
|
129
168
|
```typescript
|
|
130
|
-
{
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
169
|
+
interface KycVerificationParams {
|
|
170
|
+
/**
|
|
171
|
+
* URN (Uniform Resource Name) that uniquely identifies the user
|
|
172
|
+
* within the system. This value is used to associate the KYC
|
|
173
|
+
* verification process with a specific user.
|
|
174
|
+
*
|
|
175
|
+
* @example "did:bloque:origin:..."
|
|
176
|
+
*/
|
|
177
|
+
urn: string;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* URL where webhook notifications will be sent when the verification
|
|
181
|
+
* status changes (optional).
|
|
182
|
+
*
|
|
183
|
+
* @example "https://api.example.com/webhooks/kyc"
|
|
184
|
+
*/
|
|
185
|
+
webhookUrl?: string;
|
|
140
186
|
}
|
|
141
187
|
```
|
|
142
188
|
|
|
143
|
-
|
|
189
|
+
**Response**:
|
|
144
190
|
|
|
145
|
-
|
|
191
|
+
```typescript
|
|
192
|
+
interface KycVerificationResponse {
|
|
193
|
+
url: string; // URL where the user should complete the verification
|
|
194
|
+
status: 'awaiting_compliance_verification' | 'approved' | 'rejected';
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
#### Get KYC Verification Status
|
|
146
199
|
|
|
147
|
-
|
|
200
|
+
Get the current status of a KYC verification:
|
|
148
201
|
|
|
149
202
|
```typescript
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
description?: string; // Optional: Description
|
|
153
|
-
image_url?: string; // Optional: Product/checkout image URL
|
|
154
|
-
items: CheckoutItem[]; // Required: Items to be purchased
|
|
155
|
-
success_url: string; // Required: Redirect URL after success
|
|
156
|
-
cancel_url: string; // Required: Redirect URL after cancellation
|
|
157
|
-
metadata?: Record<string, string | number | boolean>; // Optional: Custom metadata
|
|
158
|
-
expires_at?: string; // Optional: Expiration date (ISO 8601)
|
|
203
|
+
const status = await bloque.compliance.kyc.getVerification({
|
|
204
|
+
urn: 'did:bloque:user:123e4567',
|
|
159
205
|
});
|
|
160
206
|
```
|
|
161
207
|
|
|
162
|
-
**
|
|
208
|
+
**Parameters**:
|
|
209
|
+
|
|
163
210
|
```typescript
|
|
164
|
-
{
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
211
|
+
interface GetKycVerificationParams {
|
|
212
|
+
/**
|
|
213
|
+
* URN (Uniform Resource Name) that uniquely identifies the user
|
|
214
|
+
* within the system.
|
|
215
|
+
*
|
|
216
|
+
* @example "did:bloque:user:123e4567"
|
|
217
|
+
*/
|
|
218
|
+
urn: string;
|
|
169
219
|
}
|
|
170
220
|
```
|
|
171
221
|
|
|
172
|
-
|
|
222
|
+
**Response**:
|
|
173
223
|
|
|
174
224
|
```typescript
|
|
175
|
-
{
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
status: string; // Current checkout status
|
|
180
|
-
amount_total: number; // Total amount
|
|
181
|
-
amount_subtotal: number; // Subtotal amount
|
|
182
|
-
currency: 'USD'; // Currency
|
|
183
|
-
items: CheckoutItem[]; // Items in the checkout
|
|
184
|
-
metadata?: Metadata; // Custom metadata
|
|
185
|
-
created_at: string; // Creation timestamp (ISO 8601)
|
|
186
|
-
updated_at: string; // Last update timestamp (ISO 8601)
|
|
187
|
-
expires_at: string; // Expiration timestamp (ISO 8601)
|
|
225
|
+
interface KycVerificationStatus {
|
|
226
|
+
status: 'awaiting_compliance_verification' | 'approved' | 'rejected';
|
|
227
|
+
url: string; // URL for verification
|
|
228
|
+
completedAt: string | null; // Completion date (ISO 8601)
|
|
188
229
|
}
|
|
189
230
|
```
|
|
190
231
|
|
|
191
|
-
|
|
232
|
+
### Accounts
|
|
192
233
|
|
|
193
|
-
|
|
234
|
+
The accounts resource allows you to create virtual cards for users.
|
|
235
|
+
|
|
236
|
+
#### Create a Virtual Card
|
|
237
|
+
|
|
238
|
+
Create a virtual card for a user:
|
|
194
239
|
|
|
195
240
|
```typescript
|
|
196
|
-
const
|
|
241
|
+
const card = await bloque.accounts.card.create({
|
|
242
|
+
urn: 'did:bloque:user:123e4567',
|
|
243
|
+
name: 'My Virtual Card', // Optional
|
|
244
|
+
});
|
|
197
245
|
```
|
|
198
246
|
|
|
199
247
|
**Parameters**:
|
|
200
|
-
- `checkoutId` (string): The ID of the checkout to retrieve
|
|
201
248
|
|
|
202
|
-
|
|
249
|
+
```typescript
|
|
250
|
+
interface CreateCardParams {
|
|
251
|
+
/**
|
|
252
|
+
* URN of the account holder (user or organization)
|
|
253
|
+
* @example "did:bloque:user:123e4567"
|
|
254
|
+
*/
|
|
255
|
+
urn: string;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Display name for the card (optional)
|
|
259
|
+
*/
|
|
260
|
+
name?: string;
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Response**:
|
|
265
|
+
|
|
266
|
+
```typescript
|
|
267
|
+
interface CardAccount {
|
|
268
|
+
urn: string; // Unique resource name
|
|
269
|
+
id: string; // Card account ID
|
|
270
|
+
lastFour: string; // Last four digits
|
|
271
|
+
productType: 'CREDIT' | 'DEBIT'; // Card product type
|
|
272
|
+
status: 'active' | 'disabled' | 'frozen' | 'deleted' | 'creation_in_progress' | 'creation_failed';
|
|
273
|
+
cardType: 'VIRTUAL' | 'PHYSICAL'; // Card type
|
|
274
|
+
detailsUrl: string; // PCI-compliant URL to view card details
|
|
275
|
+
ownerUrn: string; // Owner URN
|
|
276
|
+
webhookUrl: string | null; // Webhook URL (if configured)
|
|
277
|
+
metadata?: Record<string, unknown>; // Custom metadata
|
|
278
|
+
createdAt: string; // Creation timestamp (ISO 8601)
|
|
279
|
+
updatedAt: string; // Last update timestamp (ISO 8601)
|
|
280
|
+
}
|
|
281
|
+
```
|
|
203
282
|
|
|
204
|
-
|
|
283
|
+
### Identity
|
|
205
284
|
|
|
206
|
-
|
|
285
|
+
The identity resource allows you to retrieve user aliases (alternative identifiers like email or phone).
|
|
286
|
+
|
|
287
|
+
#### Get Alias
|
|
288
|
+
|
|
289
|
+
Retrieve alias information by the alias value:
|
|
207
290
|
|
|
208
291
|
```typescript
|
|
209
|
-
const
|
|
292
|
+
const alias = await bloque.identity.aliases.get('user@example.com');
|
|
210
293
|
```
|
|
211
294
|
|
|
212
295
|
**Parameters**:
|
|
213
|
-
- `checkoutId` (string): The ID of the checkout to cancel
|
|
214
296
|
|
|
215
|
-
|
|
297
|
+
```typescript
|
|
298
|
+
// Pass the alias string directly
|
|
299
|
+
const alias: string = 'user@example.com' | '+1234567890';
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**Response**:
|
|
303
|
+
|
|
304
|
+
```typescript
|
|
305
|
+
interface Alias {
|
|
306
|
+
id: string; // Unique alias ID
|
|
307
|
+
alias: string; // Alias value
|
|
308
|
+
type: 'phone' | 'email' | string; // Alias type
|
|
309
|
+
urn: string; // Associated user URN
|
|
310
|
+
origin: string; // Origin identifier
|
|
311
|
+
details: {
|
|
312
|
+
phone?: string; // Phone details (if applicable)
|
|
313
|
+
};
|
|
314
|
+
metadata: {
|
|
315
|
+
alias: string; // Alias in metadata
|
|
316
|
+
[key: string]: unknown; // Additional metadata
|
|
317
|
+
};
|
|
318
|
+
status: 'active' | 'inactive' | 'revoked'; // Alias status
|
|
319
|
+
is_public: boolean; // Whether alias is public
|
|
320
|
+
is_primary: boolean; // Whether this is the primary alias
|
|
321
|
+
created_at: string; // Creation timestamp (ISO 8601)
|
|
322
|
+
updated_at: string; // Last update timestamp (ISO 8601)
|
|
323
|
+
}
|
|
324
|
+
```
|
|
216
325
|
|
|
217
326
|
## Examples
|
|
218
327
|
|
|
219
|
-
###
|
|
328
|
+
### Creating a Business Organization
|
|
220
329
|
|
|
221
330
|
```typescript
|
|
222
|
-
import {
|
|
331
|
+
import { SDK } from '@bloque/sdk';
|
|
332
|
+
import type { CreateOrgParams } from '@bloque/sdk/orgs';
|
|
223
333
|
|
|
224
334
|
// Initialize SDK with your API key
|
|
225
|
-
const bloque = new
|
|
335
|
+
const bloque = new SDK({
|
|
226
336
|
apiKey: process.env.BLOQUE_API_KEY!,
|
|
227
|
-
|
|
337
|
+
mode: 'production',
|
|
228
338
|
});
|
|
229
339
|
|
|
230
|
-
//
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
340
|
+
// Create a business organization
|
|
341
|
+
const params: CreateOrgParams = {
|
|
342
|
+
org_type: 'business',
|
|
343
|
+
profile: {
|
|
344
|
+
legal_name: 'Acme Corporation',
|
|
345
|
+
tax_id: '12-3456789',
|
|
346
|
+
incorporation_date: '2020-01-15',
|
|
347
|
+
business_type: 'llc',
|
|
348
|
+
incorporation_country_code: 'US',
|
|
349
|
+
incorporation_state: 'CA',
|
|
350
|
+
address_line1: '123 Market Street',
|
|
351
|
+
address_line2: 'Suite 400',
|
|
352
|
+
postal_code: '94103',
|
|
353
|
+
city: 'San Francisco',
|
|
354
|
+
logo_url: 'https://example.com/logo.png',
|
|
355
|
+
},
|
|
356
|
+
metadata: {
|
|
357
|
+
source: 'web_app',
|
|
358
|
+
campaign: 'q1_2024',
|
|
359
|
+
},
|
|
360
|
+
};
|
|
240
361
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
})
|
|
362
|
+
try {
|
|
363
|
+
const organization = await bloque.orgs.create(params);
|
|
364
|
+
console.log('Organization created:', organization.urn);
|
|
365
|
+
console.log('Status:', organization.status);
|
|
366
|
+
} catch (error) {
|
|
367
|
+
console.error('Failed to create organization:', error);
|
|
368
|
+
}
|
|
246
369
|
```
|
|
247
370
|
|
|
248
|
-
###
|
|
249
|
-
|
|
250
|
-
#### Card Payment
|
|
371
|
+
### Creating an Individual Organization
|
|
251
372
|
|
|
252
373
|
```typescript
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
// cardNumber: '4111111111111111',
|
|
260
|
-
// cardholderName: 'John Doe',
|
|
261
|
-
// expiryMonth: '12',
|
|
262
|
-
// expiryYear: '2025',
|
|
263
|
-
// cvv: '123',
|
|
264
|
-
// email: 'john@example.com'
|
|
265
|
-
// }
|
|
266
|
-
// }
|
|
267
|
-
|
|
268
|
-
const payment = await bloque.payments.create({
|
|
269
|
-
payment: cardPayment,
|
|
374
|
+
import { SDK } from '@bloque/sdk';
|
|
375
|
+
import type { CreateOrgParams } from '@bloque/sdk/orgs';
|
|
376
|
+
|
|
377
|
+
const bloque = new SDK({
|
|
378
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
379
|
+
mode: 'sandbox',
|
|
270
380
|
});
|
|
381
|
+
|
|
382
|
+
const params: CreateOrgParams = {
|
|
383
|
+
org_type: 'individual',
|
|
384
|
+
profile: {
|
|
385
|
+
legal_name: 'John Doe',
|
|
386
|
+
tax_id: '123-45-6789',
|
|
387
|
+
incorporation_date: '1990-05-20',
|
|
388
|
+
business_type: 'sole_proprietorship',
|
|
389
|
+
incorporation_country_code: 'US',
|
|
390
|
+
address_line1: '456 Oak Avenue',
|
|
391
|
+
postal_code: '10001',
|
|
392
|
+
city: 'New York',
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
const organization = await bloque.orgs.create(params);
|
|
397
|
+
console.log('Individual organization created:', organization);
|
|
271
398
|
```
|
|
272
399
|
|
|
273
|
-
|
|
400
|
+
### Organization with Multiple Locations
|
|
274
401
|
|
|
275
402
|
```typescript
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
// personType: 'natural',
|
|
283
|
-
// documentType: 'CC',
|
|
284
|
-
// documentNumber: '1234567890',
|
|
285
|
-
// bankCode: '1022',
|
|
286
|
-
// email: 'maria@example.com'
|
|
287
|
-
// }
|
|
288
|
-
// }
|
|
289
|
-
|
|
290
|
-
const payment = await bloque.payments.create({
|
|
291
|
-
payment: psePayment,
|
|
403
|
+
import { SDK } from '@bloque/sdk';
|
|
404
|
+
import type { CreateOrgParams } from '@bloque/sdk/orgs';
|
|
405
|
+
|
|
406
|
+
const bloque = new SDK({
|
|
407
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
408
|
+
mode: 'production',
|
|
292
409
|
});
|
|
410
|
+
|
|
411
|
+
const params: CreateOrgParams = {
|
|
412
|
+
org_type: 'business',
|
|
413
|
+
profile: {
|
|
414
|
+
legal_name: 'Global Tech Solutions Inc.',
|
|
415
|
+
tax_id: '98-7654321',
|
|
416
|
+
incorporation_date: '2018-03-10',
|
|
417
|
+
business_type: 'corporation',
|
|
418
|
+
incorporation_country_code: 'US',
|
|
419
|
+
incorporation_state: 'DE',
|
|
420
|
+
address_line1: '789 Corporate Blvd',
|
|
421
|
+
postal_code: '19801',
|
|
422
|
+
city: 'Wilmington',
|
|
423
|
+
places: [
|
|
424
|
+
{
|
|
425
|
+
country_code: 'US',
|
|
426
|
+
state: 'CA',
|
|
427
|
+
address_line1: '100 Silicon Valley Drive',
|
|
428
|
+
postal_code: '94025',
|
|
429
|
+
city: 'Menlo Park',
|
|
430
|
+
is_primary: true,
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
country_code: 'US',
|
|
434
|
+
state: 'NY',
|
|
435
|
+
address_line1: '250 Broadway',
|
|
436
|
+
postal_code: '10007',
|
|
437
|
+
city: 'New York',
|
|
438
|
+
is_primary: false,
|
|
439
|
+
},
|
|
440
|
+
],
|
|
441
|
+
},
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
const organization = await bloque.orgs.create(params);
|
|
445
|
+
console.log('Multi-location organization created');
|
|
293
446
|
```
|
|
294
447
|
|
|
295
|
-
|
|
448
|
+
### Starting KYC Verification
|
|
296
449
|
|
|
297
450
|
```typescript
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
// email: 'carlos@example.com',
|
|
305
|
-
// documentType: 'CC',
|
|
306
|
-
// documentNumber: '9876543210',
|
|
307
|
-
// fullName: 'Carlos García'
|
|
308
|
-
// }
|
|
309
|
-
// }
|
|
310
|
-
|
|
311
|
-
const payment = await bloque.payments.create({
|
|
312
|
-
payment: cashPayment,
|
|
451
|
+
import { SDK } from '@bloque/sdk';
|
|
452
|
+
import type { KycVerificationParams } from '@bloque/sdk/compliance';
|
|
453
|
+
|
|
454
|
+
const bloque = new SDK({
|
|
455
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
456
|
+
mode: 'production',
|
|
313
457
|
});
|
|
314
|
-
```
|
|
315
458
|
|
|
316
|
-
|
|
459
|
+
// Start KYC verification for a user
|
|
460
|
+
const params: KycVerificationParams = {
|
|
461
|
+
urn: 'did:bloque:origin:user-123',
|
|
462
|
+
webhookUrl: 'https://api.example.com/webhooks/kyc', // Optional webhook URL
|
|
463
|
+
};
|
|
317
464
|
|
|
318
|
-
|
|
465
|
+
try {
|
|
466
|
+
const verification = await bloque.compliance.kyc.startVerification(params);
|
|
467
|
+
|
|
468
|
+
console.log('Verification URL:', verification.url);
|
|
469
|
+
console.log('Status:', verification.status);
|
|
470
|
+
|
|
471
|
+
// Redirect the user to verification.url to complete KYC
|
|
472
|
+
// Webhook notifications will be sent to the provided webhookUrl
|
|
473
|
+
} catch (error) {
|
|
474
|
+
console.error('Failed to start KYC verification:', error);
|
|
475
|
+
}
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
### Getting KYC Verification Status
|
|
319
479
|
|
|
320
480
|
```typescript
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
// TypeScript automatically narrows the type based on the 'type' field
|
|
324
|
-
switch (payload.type) {
|
|
325
|
-
case 'card':
|
|
326
|
-
// payload.data is CardPaymentFormData
|
|
327
|
-
console.log('Processing card ending in:', payload.data.cardNumber.slice(-4));
|
|
328
|
-
break;
|
|
329
|
-
|
|
330
|
-
case 'pse':
|
|
331
|
-
// payload.data is PSEPaymentFormData
|
|
332
|
-
console.log('Processing PSE for bank:', payload.data.bankCode);
|
|
333
|
-
break;
|
|
334
|
-
|
|
335
|
-
case 'cash':
|
|
336
|
-
// payload.data is CashPaymentFormData
|
|
337
|
-
console.log('Processing cash payment for:', payload.data.fullName);
|
|
338
|
-
break;
|
|
339
|
-
}
|
|
481
|
+
import { SDK } from '@bloque/sdk';
|
|
482
|
+
import type { GetKycVerificationParams } from '@bloque/sdk/compliance';
|
|
340
483
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
484
|
+
const bloque = new SDK({
|
|
485
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
486
|
+
mode: 'production',
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
// Get verification status
|
|
490
|
+
const params: GetKycVerificationParams = {
|
|
491
|
+
urn: 'did:bloque:user:123e4567',
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
try {
|
|
495
|
+
const status = await bloque.compliance.kyc.getVerification(params);
|
|
496
|
+
|
|
497
|
+
console.log('Status:', status.status);
|
|
498
|
+
console.log('Verification URL:', status.url);
|
|
499
|
+
console.log('Completed At:', status.completedAt);
|
|
500
|
+
|
|
501
|
+
if (status.status === 'approved') {
|
|
502
|
+
console.log('User verification approved!');
|
|
503
|
+
} else if (status.status === 'rejected') {
|
|
504
|
+
console.log('User verification rejected');
|
|
505
|
+
} else {
|
|
506
|
+
console.log('Verification still pending');
|
|
507
|
+
}
|
|
508
|
+
} catch (error) {
|
|
509
|
+
console.error('Failed to get verification status:', error);
|
|
345
510
|
}
|
|
346
511
|
```
|
|
347
512
|
|
|
348
|
-
###
|
|
513
|
+
### Creating a Virtual Card
|
|
349
514
|
|
|
350
515
|
```typescript
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
amount: 19_99,
|
|
358
|
-
quantity: 1,
|
|
359
|
-
},
|
|
360
|
-
],
|
|
361
|
-
success_url: 'https://yourapp.com/success',
|
|
362
|
-
cancel_url: 'https://yourapp.com/cancel',
|
|
516
|
+
import { SDK } from '@bloque/sdk';
|
|
517
|
+
import type { CreateCardParams } from '@bloque/sdk/accounts';
|
|
518
|
+
|
|
519
|
+
const bloque = new SDK({
|
|
520
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
521
|
+
mode: 'production',
|
|
363
522
|
});
|
|
523
|
+
|
|
524
|
+
// Create a virtual card
|
|
525
|
+
const params: CreateCardParams = {
|
|
526
|
+
urn: 'did:bloque:user:123e4567',
|
|
527
|
+
name: 'My Business Card', // Optional
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
try {
|
|
531
|
+
const card = await bloque.accounts.card.create(params);
|
|
532
|
+
|
|
533
|
+
console.log('Card created:', card.urn);
|
|
534
|
+
console.log('Last four digits:', card.lastFour);
|
|
535
|
+
console.log('Card type:', card.cardType);
|
|
536
|
+
console.log('Status:', card.status);
|
|
537
|
+
console.log('Details URL:', card.detailsUrl);
|
|
538
|
+
|
|
539
|
+
// Check if card is ready to use
|
|
540
|
+
if (card.status === 'active') {
|
|
541
|
+
console.log('Card is active and ready to use!');
|
|
542
|
+
} else if (card.status === 'creation_in_progress') {
|
|
543
|
+
console.log('Card is being created...');
|
|
544
|
+
}
|
|
545
|
+
} catch (error) {
|
|
546
|
+
console.error('Failed to create card:', error);
|
|
547
|
+
}
|
|
364
548
|
```
|
|
365
549
|
|
|
366
|
-
###
|
|
550
|
+
### Retrieving User Alias Information
|
|
367
551
|
|
|
368
552
|
```typescript
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
name: 'Wireless Mouse',
|
|
375
|
-
amount: 25_00,
|
|
376
|
-
quantity: 1,
|
|
377
|
-
image_url: 'https://example.com/mouse.jpg',
|
|
378
|
-
},
|
|
379
|
-
{
|
|
380
|
-
name: 'USB Cable',
|
|
381
|
-
amount: 10_00,
|
|
382
|
-
quantity: 2,
|
|
383
|
-
image_url: 'https://example.com/cable.jpg',
|
|
384
|
-
},
|
|
385
|
-
],
|
|
386
|
-
success_url: 'https://yourapp.com/success',
|
|
387
|
-
cancel_url: 'https://yourapp.com/cancel',
|
|
553
|
+
import { SDK } from '@bloque/sdk';
|
|
554
|
+
|
|
555
|
+
const bloque = new SDK({
|
|
556
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
557
|
+
mode: 'production',
|
|
388
558
|
});
|
|
559
|
+
|
|
560
|
+
// Get alias information by email
|
|
561
|
+
try {
|
|
562
|
+
const alias = await bloque.identity.aliases.get('user@example.com');
|
|
563
|
+
|
|
564
|
+
console.log('Alias ID:', alias.id);
|
|
565
|
+
console.log('Alias type:', alias.type);
|
|
566
|
+
console.log('Associated URN:', alias.urn);
|
|
567
|
+
console.log('Status:', alias.status);
|
|
568
|
+
console.log('Is primary:', alias.is_primary);
|
|
569
|
+
console.log('Is public:', alias.is_public);
|
|
570
|
+
|
|
571
|
+
if (alias.status === 'active') {
|
|
572
|
+
console.log('Alias is active');
|
|
573
|
+
}
|
|
574
|
+
} catch (error) {
|
|
575
|
+
console.error('Failed to retrieve alias:', error);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// Get alias information by phone number
|
|
579
|
+
try {
|
|
580
|
+
const phoneAlias = await bloque.identity.aliases.get('+1234567890');
|
|
581
|
+
|
|
582
|
+
console.log('Phone alias:', phoneAlias.alias);
|
|
583
|
+
console.log('Phone details:', phoneAlias.details.phone);
|
|
584
|
+
} catch (error) {
|
|
585
|
+
console.error('Failed to retrieve phone alias:', error);
|
|
586
|
+
}
|
|
389
587
|
```
|
|
390
588
|
|
|
391
|
-
###
|
|
589
|
+
### Using in an API Endpoint
|
|
392
590
|
|
|
393
591
|
```typescript
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
592
|
+
import { SDK } from '@bloque/sdk';
|
|
593
|
+
import type { CreateOrgParams } from '@bloque/sdk/orgs';
|
|
594
|
+
|
|
595
|
+
const bloque = new SDK({
|
|
596
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
597
|
+
mode: process.env.NODE_ENV === 'production' ? 'production' : 'sandbox',
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
app.post('/api/organizations', async (req, res) => {
|
|
601
|
+
try {
|
|
602
|
+
const params: CreateOrgParams = req.body;
|
|
603
|
+
|
|
604
|
+
const organization = await bloque.orgs.create(params);
|
|
605
|
+
|
|
606
|
+
res.json({
|
|
607
|
+
success: true,
|
|
608
|
+
organization,
|
|
609
|
+
});
|
|
610
|
+
} catch (error) {
|
|
611
|
+
console.error('Organization creation failed:', error);
|
|
612
|
+
res.status(500).json({
|
|
613
|
+
success: false,
|
|
614
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
615
|
+
});
|
|
616
|
+
}
|
|
411
617
|
});
|
|
412
618
|
```
|
|
413
619
|
|
|
@@ -417,15 +623,34 @@ const checkout = await bloque.checkout.create({
|
|
|
417
623
|
The SDK uses standard JavaScript errors. Always wrap API calls in try-catch blocks:
|
|
418
624
|
|
|
419
625
|
```typescript
|
|
626
|
+
import { SDK } from '@bloque/sdk';
|
|
627
|
+
|
|
628
|
+
const bloque = new SDK({
|
|
629
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
630
|
+
mode: 'production',
|
|
631
|
+
});
|
|
632
|
+
|
|
420
633
|
try {
|
|
421
|
-
const
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
634
|
+
const organization = await bloque.orgs.create({
|
|
635
|
+
org_type: 'business',
|
|
636
|
+
profile: {
|
|
637
|
+
legal_name: 'Acme Corp',
|
|
638
|
+
tax_id: '123456789',
|
|
639
|
+
incorporation_date: '2020-01-01',
|
|
640
|
+
business_type: 'llc',
|
|
641
|
+
incorporation_country_code: 'US',
|
|
642
|
+
address_line1: '123 Main St',
|
|
643
|
+
postal_code: '12345',
|
|
644
|
+
city: 'San Francisco',
|
|
645
|
+
},
|
|
426
646
|
});
|
|
647
|
+
console.log('Success:', organization);
|
|
427
648
|
} catch (error) {
|
|
428
|
-
|
|
649
|
+
if (error instanceof Error) {
|
|
650
|
+
console.error('Failed to create organization:', error.message);
|
|
651
|
+
} else {
|
|
652
|
+
console.error('Unknown error:', error);
|
|
653
|
+
}
|
|
429
654
|
}
|
|
430
655
|
```
|
|
431
656
|
|
|
@@ -434,61 +659,89 @@ try {
|
|
|
434
659
|
This SDK is written in TypeScript and includes complete type definitions. You'll get full autocomplete and type checking when using TypeScript or modern editors like VS Code:
|
|
435
660
|
|
|
436
661
|
```typescript
|
|
662
|
+
import { SDK } from '@bloque/sdk';
|
|
437
663
|
import type {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
amount: 5000,
|
|
452
|
-
quantity: 1,
|
|
664
|
+
BloqueConfig,
|
|
665
|
+
CreateOrgParams,
|
|
666
|
+
Organization,
|
|
667
|
+
OrgProfile,
|
|
668
|
+
OrgStatus,
|
|
669
|
+
OrgType,
|
|
670
|
+
Place,
|
|
671
|
+
} from '@bloque/sdk/orgs';
|
|
672
|
+
|
|
673
|
+
// Type-safe configuration
|
|
674
|
+
const config: BloqueConfig = {
|
|
675
|
+
apiKey: 'your-api-key',
|
|
676
|
+
mode: 'sandbox',
|
|
453
677
|
};
|
|
454
678
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
679
|
+
const bloque = new SDK(config);
|
|
680
|
+
|
|
681
|
+
// Type-safe organization profile
|
|
682
|
+
const profile: OrgProfile = {
|
|
683
|
+
legal_name: 'Tech Startup Inc.',
|
|
684
|
+
tax_id: '12-3456789',
|
|
685
|
+
incorporation_date: '2023-01-15',
|
|
686
|
+
business_type: 'llc',
|
|
687
|
+
incorporation_country_code: 'US',
|
|
688
|
+
incorporation_state: 'CA',
|
|
689
|
+
address_line1: '456 Innovation Dr',
|
|
690
|
+
postal_code: '94025',
|
|
691
|
+
city: 'Menlo Park',
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
// Type-safe organization creation
|
|
695
|
+
const params: CreateOrgParams = {
|
|
696
|
+
org_type: 'business',
|
|
697
|
+
profile,
|
|
698
|
+
metadata: {
|
|
699
|
+
vertical: 'fintech',
|
|
700
|
+
employees: 50,
|
|
464
701
|
},
|
|
465
702
|
};
|
|
703
|
+
|
|
704
|
+
// TypeScript infers the return type as Organization
|
|
705
|
+
const org = await bloque.orgs.create(params);
|
|
466
706
|
```
|
|
467
707
|
|
|
468
|
-
**
|
|
708
|
+
**Available Types**:
|
|
469
709
|
|
|
470
|
-
The SDK
|
|
710
|
+
The SDK exports all necessary types for type-safe development:
|
|
471
711
|
|
|
472
712
|
```typescript
|
|
473
|
-
//
|
|
474
|
-
|
|
475
|
-
switch (payment.type) {
|
|
476
|
-
case 'card':
|
|
477
|
-
// TypeScript knows payment.data is CardPaymentFormData
|
|
478
|
-
console.log('Card payment for:', payment.data.cardholderName);
|
|
479
|
-
break;
|
|
480
|
-
case 'pse':
|
|
481
|
-
// TypeScript knows payment.data is PSEPaymentFormData
|
|
482
|
-
console.log('PSE payment, bank:', payment.data.bankCode);
|
|
483
|
-
break;
|
|
484
|
-
case 'cash':
|
|
485
|
-
// TypeScript knows payment.data is CashPaymentFormData
|
|
486
|
-
console.log('Cash payment for:', payment.data.fullName);
|
|
487
|
-
break;
|
|
488
|
-
}
|
|
713
|
+
// Main SDK types
|
|
714
|
+
import type { SDK, BloqueConfig } from '@bloque/sdk';
|
|
489
715
|
|
|
490
|
-
|
|
491
|
-
|
|
716
|
+
// Organization types
|
|
717
|
+
import type {
|
|
718
|
+
Organization,
|
|
719
|
+
CreateOrgParams,
|
|
720
|
+
CreateOrgResponse,
|
|
721
|
+
OrgProfile,
|
|
722
|
+
OrgType,
|
|
723
|
+
OrgStatus,
|
|
724
|
+
Place,
|
|
725
|
+
} from '@bloque/sdk/orgs';
|
|
726
|
+
|
|
727
|
+
// Compliance types
|
|
728
|
+
import type {
|
|
729
|
+
KycVerificationParams,
|
|
730
|
+
KycVerificationResponse,
|
|
731
|
+
GetKycVerificationParams,
|
|
732
|
+
KycVerificationStatus,
|
|
733
|
+
} from '@bloque/sdk/compliance';
|
|
734
|
+
|
|
735
|
+
// Accounts types
|
|
736
|
+
import type {
|
|
737
|
+
CardAccount,
|
|
738
|
+
CreateCardParams,
|
|
739
|
+
} from '@bloque/sdk/accounts';
|
|
740
|
+
|
|
741
|
+
// Identity types
|
|
742
|
+
import type {
|
|
743
|
+
Alias,
|
|
744
|
+
} from '@bloque/sdk/identity';
|
|
492
745
|
```
|
|
493
746
|
|
|
494
747
|
## Development
|
|
@@ -526,8 +779,19 @@ bun run check
|
|
|
526
779
|
## Links
|
|
527
780
|
|
|
528
781
|
- [Homepage](https://www.bloque.app)
|
|
529
|
-
- [GitHub Repository](
|
|
530
|
-
- [Issue Tracker](
|
|
782
|
+
- [GitHub Repository](https://github.com/bloque-app/sdk)
|
|
783
|
+
- [Issue Tracker](https://github.com/bloque-app/sdk/issues)
|
|
784
|
+
|
|
785
|
+
## Package Structure
|
|
786
|
+
|
|
787
|
+
This monorepo contains the following packages:
|
|
788
|
+
|
|
789
|
+
- **`@bloque/sdk`**: Main SDK package
|
|
790
|
+
- **`@bloque/sdk-core`**: Core utilities and HTTP client
|
|
791
|
+
- **`@bloque/sdk-orgs`**: Organizations API client
|
|
792
|
+
- **`@bloque/sdk-compliance`**: Compliance and KYC verification API client
|
|
793
|
+
- **`@bloque/sdk-accounts`**: Accounts and virtual cards API client
|
|
794
|
+
- **`@bloque/sdk-identity`**: Identity and aliases API client
|
|
531
795
|
|
|
532
796
|
## License
|
|
533
797
|
|
package/dist/bloque.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AccountsClient } from '@bloque/sdk-accounts';
|
|
2
|
+
import { ComplianceClient } from '@bloque/sdk-compliance';
|
|
3
|
+
import { type BloqueConfig } from '@bloque/sdk-core';
|
|
4
|
+
import { IdentityClient } from '@bloque/sdk-identity';
|
|
5
|
+
import { OrgsClient } from '@bloque/sdk-orgs';
|
|
6
|
+
export declare class SDK {
|
|
7
|
+
private readonly httpClient;
|
|
8
|
+
readonly accounts: AccountsClient;
|
|
9
|
+
readonly compliance: ComplianceClient;
|
|
10
|
+
readonly identity: IdentityClient;
|
|
11
|
+
readonly orgs: OrgsClient;
|
|
12
|
+
constructor(config: BloqueConfig);
|
|
13
|
+
}
|
package/dist/config.d.ts
ADDED
package/dist/index.cjs
CHANGED
|
@@ -24,12 +24,30 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
27
|
+
SDK: ()=>SDK
|
|
28
28
|
});
|
|
29
|
-
const
|
|
30
|
-
|
|
29
|
+
const sdk_accounts_namespaceObject = require("@bloque/sdk-accounts");
|
|
30
|
+
const sdk_compliance_namespaceObject = require("@bloque/sdk-compliance");
|
|
31
|
+
const sdk_core_namespaceObject = require("@bloque/sdk-core");
|
|
32
|
+
const sdk_identity_namespaceObject = require("@bloque/sdk-identity");
|
|
33
|
+
const sdk_orgs_namespaceObject = require("@bloque/sdk-orgs");
|
|
34
|
+
class SDK {
|
|
35
|
+
httpClient;
|
|
36
|
+
accounts;
|
|
37
|
+
compliance;
|
|
38
|
+
identity;
|
|
39
|
+
orgs;
|
|
40
|
+
constructor(config){
|
|
41
|
+
this.httpClient = new sdk_core_namespaceObject.HttpClient(config);
|
|
42
|
+
this.accounts = new sdk_accounts_namespaceObject.AccountsClient(this.httpClient);
|
|
43
|
+
this.compliance = new sdk_compliance_namespaceObject.ComplianceClient(this.httpClient);
|
|
44
|
+
this.identity = new sdk_identity_namespaceObject.IdentityClient(this.httpClient);
|
|
45
|
+
this.orgs = new sdk_orgs_namespaceObject.OrgsClient(this.httpClient);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.SDK = __webpack_exports__.SDK;
|
|
31
49
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
32
|
-
"
|
|
50
|
+
"SDK"
|
|
33
51
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
34
52
|
Object.defineProperty(exports, '__esModule', {
|
|
35
53
|
value: true
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { SDK } from './bloque';
|
|
2
|
+
export type { BloqueConfig } from '@bloque/sdk-core';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { AccountsClient } from "@bloque/sdk-accounts";
|
|
2
|
+
import { ComplianceClient } from "@bloque/sdk-compliance";
|
|
3
|
+
import { HttpClient } from "@bloque/sdk-core";
|
|
4
|
+
import { IdentityClient } from "@bloque/sdk-identity";
|
|
5
|
+
import { OrgsClient } from "@bloque/sdk-orgs";
|
|
6
|
+
class SDK {
|
|
7
|
+
httpClient;
|
|
8
|
+
accounts;
|
|
9
|
+
compliance;
|
|
10
|
+
identity;
|
|
11
|
+
orgs;
|
|
12
|
+
constructor(config){
|
|
13
|
+
this.httpClient = new HttpClient(config);
|
|
14
|
+
this.accounts = new AccountsClient(this.httpClient);
|
|
15
|
+
this.compliance = new ComplianceClient(this.httpClient);
|
|
16
|
+
this.identity = new IdentityClient(this.httpClient);
|
|
17
|
+
this.orgs = new OrgsClient(this.httpClient);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export { SDK };
|
package/dist/init.d.ts
ADDED
package/dist/orgs.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloque/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Official Bloque SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -19,11 +19,37 @@
|
|
|
19
19
|
"url": "git+https://github.com/bloque-app/sdk.git",
|
|
20
20
|
"directory": "packages/sdk"
|
|
21
21
|
},
|
|
22
|
+
"sideEffects": false,
|
|
22
23
|
"exports": {
|
|
23
24
|
".": {
|
|
24
25
|
"types": "./dist/index.d.ts",
|
|
25
26
|
"import": "./dist/index.js",
|
|
26
27
|
"require": "./dist/index.cjs"
|
|
28
|
+
},
|
|
29
|
+
"./init": {
|
|
30
|
+
"types": "./dist/init.d.ts",
|
|
31
|
+
"import": "./dist/init.js",
|
|
32
|
+
"require": "./dist/init.cjs"
|
|
33
|
+
},
|
|
34
|
+
"./accounts": {
|
|
35
|
+
"types": "./dist/accounts.d.ts",
|
|
36
|
+
"import": "./dist/accounts.js",
|
|
37
|
+
"require": "./dist/accounts.cjs"
|
|
38
|
+
},
|
|
39
|
+
"./compliance": {
|
|
40
|
+
"types": "./dist/compliance.d.ts",
|
|
41
|
+
"import": "./dist/compliance.js",
|
|
42
|
+
"require": "./dist/compliance.cjs"
|
|
43
|
+
},
|
|
44
|
+
"./identity": {
|
|
45
|
+
"types": "./dist/identity.d.ts",
|
|
46
|
+
"import": "./dist/identity.js",
|
|
47
|
+
"require": "./dist/identity.cjs"
|
|
48
|
+
},
|
|
49
|
+
"./orgs": {
|
|
50
|
+
"types": "./dist/orgs.d.ts",
|
|
51
|
+
"import": "./dist/orgs.js",
|
|
52
|
+
"require": "./dist/orgs.cjs"
|
|
27
53
|
}
|
|
28
54
|
},
|
|
29
55
|
"main": "./dist/index.cjs",
|
|
@@ -42,7 +68,11 @@
|
|
|
42
68
|
"typecheck": "tsgo --noEmit"
|
|
43
69
|
},
|
|
44
70
|
"dependencies": {
|
|
45
|
-
"@bloque/sdk-
|
|
71
|
+
"@bloque/sdk-accounts": "workspace:*",
|
|
72
|
+
"@bloque/sdk-compliance": "workspace:*",
|
|
73
|
+
"@bloque/sdk-core": "workspace:*",
|
|
74
|
+
"@bloque/sdk-identity": "workspace:*",
|
|
75
|
+
"@bloque/sdk-orgs": "workspace:*"
|
|
46
76
|
},
|
|
47
77
|
"devDependencies": {
|
|
48
78
|
"@rslib/core": "catalog:",
|