@bloque/sdk 0.0.1
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 +535 -0
- package/dist/index.cjs +36 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
# Bloque Payments SDK
|
|
2
|
+
|
|
3
|
+
The official TypeScript/JavaScript SDK for integrating [Bloque](https://www.bloque.app) payments into your applications.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **TypeScript First**: Built with TypeScript for complete type safety
|
|
8
|
+
- **Simple API**: Intuitive interface for creating and managing checkouts
|
|
9
|
+
- **Multiple Payment Methods**: Support for cards, PSE, and cash payments
|
|
10
|
+
- **Fully Async**: Promise-based API for modern JavaScript workflows
|
|
11
|
+
- **Lightweight**: Minimal dependencies for optimal bundle size
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bun add @bloque/payments
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { Bloque, type PaymentSubmitPayload } from '@bloque/payments';
|
|
23
|
+
|
|
24
|
+
// Initialize the SDK (server-side only)
|
|
25
|
+
const bloque = new Bloque({
|
|
26
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
27
|
+
server: 'production', // or 'sandbox' for testing
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
app.post('/api/payments', async (req, res) => {
|
|
31
|
+
try {
|
|
32
|
+
const payload: PaymentSubmitPayload = req.body;
|
|
33
|
+
|
|
34
|
+
// Create payment using SDK
|
|
35
|
+
const payment = await bloque.payments.create({
|
|
36
|
+
payment: payload,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
res.json({ success: true, payment });
|
|
40
|
+
} catch (error) {
|
|
41
|
+
res.status(500).json({ success: false, error: error.message });
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Configuration
|
|
47
|
+
|
|
48
|
+
### Initialize the SDK
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { Bloque } from '@bloque/payments';
|
|
52
|
+
|
|
53
|
+
const bloque = new Bloque({
|
|
54
|
+
apiKey: 'your-api-key-here', // Required: Your Bloque API key
|
|
55
|
+
server: 'sandbox', // Required: 'sandbox' or 'production'
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Environment Options
|
|
60
|
+
|
|
61
|
+
- **`sandbox`**: For testing and development
|
|
62
|
+
- **`production`**: For live payments
|
|
63
|
+
|
|
64
|
+
## API Reference
|
|
65
|
+
|
|
66
|
+
### Payments
|
|
67
|
+
|
|
68
|
+
The payments resource allows you to create payments for existing checkout sessions.
|
|
69
|
+
|
|
70
|
+
#### Create a Payment
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
const payment = await bloque.payments.create({
|
|
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
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Payment Types**:
|
|
85
|
+
|
|
86
|
+
**Card Payment**:
|
|
87
|
+
```typescript
|
|
88
|
+
{
|
|
89
|
+
type: 'card',
|
|
90
|
+
data: {
|
|
91
|
+
cardNumber: string; // 16-digit card number
|
|
92
|
+
cardholderName: string; // Name on the card
|
|
93
|
+
expiryMonth: string; // MM format
|
|
94
|
+
expiryYear: string; // YY or YYYY format
|
|
95
|
+
cvv: string; // 3-4 digit CVV
|
|
96
|
+
email?: string; // Optional customer email
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**PSE Payment** (Colombian online banking):
|
|
102
|
+
```typescript
|
|
103
|
+
{
|
|
104
|
+
type: 'pse',
|
|
105
|
+
data: {
|
|
106
|
+
personType: 'natural' | 'juridica'; // Person type
|
|
107
|
+
documentType: string; // Document type (e.g., 'CC', 'NIT')
|
|
108
|
+
documentNumber: string; // Document number
|
|
109
|
+
bankCode: string; // Bank code
|
|
110
|
+
email: string; // Customer email
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Cash Payment**:
|
|
116
|
+
```typescript
|
|
117
|
+
{
|
|
118
|
+
type: 'cash',
|
|
119
|
+
data: {
|
|
120
|
+
email: string; // Customer email
|
|
121
|
+
documentType: string; // Document type
|
|
122
|
+
documentNumber: string; // Document number
|
|
123
|
+
fullName: string; // Full name
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Payment Response**:
|
|
129
|
+
```typescript
|
|
130
|
+
{
|
|
131
|
+
id: string; // Payment ID
|
|
132
|
+
object: 'payment'; // Object type
|
|
133
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
134
|
+
checkout: Checkout; // Associated checkout
|
|
135
|
+
payment_method: 'card' | 'pse' | 'cash';
|
|
136
|
+
amount: number; // Payment amount
|
|
137
|
+
currency: string; // Currency
|
|
138
|
+
created_at: string; // Creation timestamp
|
|
139
|
+
updated_at: string; // Last update timestamp
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Checkout
|
|
144
|
+
|
|
145
|
+
The checkout resource allows you to create payment sessions.
|
|
146
|
+
|
|
147
|
+
#### Create a Checkout
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
const checkout = await bloque.checkout.create({
|
|
151
|
+
name: string; // Required: Name of the checkout
|
|
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)
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Checkout Item**:
|
|
163
|
+
```typescript
|
|
164
|
+
{
|
|
165
|
+
name: string; // Item name
|
|
166
|
+
amount: number; // Price in smallest currency unit (e.g., cents)
|
|
167
|
+
quantity: number; // Quantity
|
|
168
|
+
image_url?: string; // Item image URL
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### Checkout Response
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
{
|
|
176
|
+
id: string; // Unique checkout identifier
|
|
177
|
+
object: 'checkout'; // Object type
|
|
178
|
+
url: string; // Public payment URL for the customer
|
|
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)
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### Retrieve a Checkout
|
|
192
|
+
|
|
193
|
+
Retrieve the details of an existing checkout by its ID.
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
const checkout = await bloque.checkout.retrieve('checkout_id_here');
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Parameters**:
|
|
200
|
+
- `checkoutId` (string): The ID of the checkout to retrieve
|
|
201
|
+
|
|
202
|
+
**Returns**: A `Checkout` object with all the checkout details.
|
|
203
|
+
|
|
204
|
+
#### Cancel a Checkout
|
|
205
|
+
|
|
206
|
+
Cancel an existing checkout that hasn't been completed yet.
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
const checkout = await bloque.checkout.cancel('checkout_id_here');
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Parameters**:
|
|
213
|
+
- `checkoutId` (string): The ID of the checkout to cancel
|
|
214
|
+
|
|
215
|
+
**Returns**: A `Checkout` object with updated status reflecting the cancellation.
|
|
216
|
+
|
|
217
|
+
## Examples
|
|
218
|
+
|
|
219
|
+
### Processing Payments
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
import { Bloque, type PaymentSubmitPayload } from '@bloque/payments';
|
|
223
|
+
|
|
224
|
+
// Initialize SDK with your API key
|
|
225
|
+
const bloque = new Bloque({
|
|
226
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
227
|
+
server: 'production',
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// API endpoint handler
|
|
231
|
+
app.post('/api/payments', async (req, res) => {
|
|
232
|
+
try {
|
|
233
|
+
// Receive payment data from frontend
|
|
234
|
+
const payload: PaymentSubmitPayload = req.body;
|
|
235
|
+
|
|
236
|
+
// Create payment using SDK
|
|
237
|
+
const payment = await bloque.payments.create({
|
|
238
|
+
payment: payload,
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
res.json({ success: true, payment });
|
|
242
|
+
} catch (error) {
|
|
243
|
+
res.status(500).json({ success: false, error: error.message });
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Payment Methods Examples
|
|
249
|
+
|
|
250
|
+
#### Card Payment
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
// Receive payload from frontend
|
|
254
|
+
const cardPayment: PaymentSubmitPayload = req.body;
|
|
255
|
+
// Example payload:
|
|
256
|
+
// {
|
|
257
|
+
// type: 'card',
|
|
258
|
+
// data: {
|
|
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,
|
|
270
|
+
});
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
#### PSE Payment (Colombian online banking)
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
// Receive payload from frontend
|
|
277
|
+
const psePayment: PaymentSubmitPayload = req.body;
|
|
278
|
+
// Example payload:
|
|
279
|
+
// {
|
|
280
|
+
// type: 'pse',
|
|
281
|
+
// data: {
|
|
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,
|
|
292
|
+
});
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
#### Cash Payment
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
// Receive payload from frontend
|
|
299
|
+
const cashPayment: PaymentSubmitPayload = req.body;
|
|
300
|
+
// Example payload:
|
|
301
|
+
// {
|
|
302
|
+
// type: 'cash',
|
|
303
|
+
// data: {
|
|
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,
|
|
313
|
+
});
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Type-Safe Payment Creation
|
|
317
|
+
|
|
318
|
+
The `PaymentSubmitPayload` type is a discriminated union that provides automatic type narrowing:
|
|
319
|
+
|
|
320
|
+
```typescript
|
|
321
|
+
// Backend API handler
|
|
322
|
+
async function handlePayment(payload: PaymentSubmitPayload) {
|
|
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
|
+
}
|
|
340
|
+
|
|
341
|
+
// Create payment using SDK
|
|
342
|
+
return await bloque.payments.create({
|
|
343
|
+
payment: payload,
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Basic Checkout with Single Item
|
|
349
|
+
|
|
350
|
+
```typescript
|
|
351
|
+
const checkout = await bloque.checkout.create({
|
|
352
|
+
name: 'E-book Purchase',
|
|
353
|
+
description: 'Learn TypeScript in 30 Days',
|
|
354
|
+
items: [
|
|
355
|
+
{
|
|
356
|
+
name: 'TypeScript E-book',
|
|
357
|
+
amount: 19_99,
|
|
358
|
+
quantity: 1,
|
|
359
|
+
},
|
|
360
|
+
],
|
|
361
|
+
success_url: 'https://yourapp.com/success',
|
|
362
|
+
cancel_url: 'https://yourapp.com/cancel',
|
|
363
|
+
});
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Checkout with Multiple Items
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
const checkout = await bloque.checkout.create({
|
|
370
|
+
name: 'Shopping Cart',
|
|
371
|
+
description: 'Your selected items',
|
|
372
|
+
items: [
|
|
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',
|
|
388
|
+
});
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Checkout with Metadata and Expiration
|
|
392
|
+
|
|
393
|
+
```typescript
|
|
394
|
+
const checkout = await bloque.checkout.create({
|
|
395
|
+
name: 'Limited Time Offer',
|
|
396
|
+
items: [
|
|
397
|
+
{
|
|
398
|
+
name: 'Premium Course',
|
|
399
|
+
amount: 99_00,
|
|
400
|
+
quantity: 1,
|
|
401
|
+
},
|
|
402
|
+
],
|
|
403
|
+
success_url: 'https://yourapp.com/success',
|
|
404
|
+
cancel_url: 'https://yourapp.com/cancel',
|
|
405
|
+
metadata: {
|
|
406
|
+
user_id: '12345',
|
|
407
|
+
campaign: 'summer_sale',
|
|
408
|
+
discount_applied: true,
|
|
409
|
+
},
|
|
410
|
+
expires_at: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(), // 24 hours
|
|
411
|
+
});
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
## Error Handling
|
|
416
|
+
|
|
417
|
+
The SDK uses standard JavaScript errors. Always wrap API calls in try-catch blocks:
|
|
418
|
+
|
|
419
|
+
```typescript
|
|
420
|
+
try {
|
|
421
|
+
const checkout = await bloque.checkout.create({
|
|
422
|
+
name: 'Product',
|
|
423
|
+
items: [{ name: 'Item', amount: 1000, quantity: 1 }],
|
|
424
|
+
success_url: 'https://yourapp.com/success',
|
|
425
|
+
cancel_url: 'https://yourapp.com/cancel',
|
|
426
|
+
});
|
|
427
|
+
} catch (error) {
|
|
428
|
+
console.error('Failed to create checkout:', error);
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## TypeScript Support
|
|
433
|
+
|
|
434
|
+
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
|
+
|
|
436
|
+
```typescript
|
|
437
|
+
import type {
|
|
438
|
+
// Payment types
|
|
439
|
+
PaymentSubmitPayload,
|
|
440
|
+
PaymentResponse,
|
|
441
|
+
CreatePaymentParams,
|
|
442
|
+
// Checkout types
|
|
443
|
+
Checkout,
|
|
444
|
+
CheckoutStatus,
|
|
445
|
+
CheckoutItem,
|
|
446
|
+
CheckoutParams,
|
|
447
|
+
} from '@bloque/payments';
|
|
448
|
+
|
|
449
|
+
const item: CheckoutItem = {
|
|
450
|
+
name: 'Product',
|
|
451
|
+
amount: 5000,
|
|
452
|
+
quantity: 1,
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
// Type-safe payment data
|
|
456
|
+
const cardPayment: PaymentSubmitPayload = {
|
|
457
|
+
type: 'card',
|
|
458
|
+
data: {
|
|
459
|
+
cardNumber: '4111111111111111',
|
|
460
|
+
cardholderName: 'John Doe',
|
|
461
|
+
expiryMonth: '12',
|
|
462
|
+
expiryYear: '2025',
|
|
463
|
+
cvv: '123',
|
|
464
|
+
},
|
|
465
|
+
};
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
**Discriminated Union Types**:
|
|
469
|
+
|
|
470
|
+
The SDK uses TypeScript discriminated unions for payment types, which enables automatic type narrowing:
|
|
471
|
+
|
|
472
|
+
```typescript
|
|
473
|
+
// Backend API handler
|
|
474
|
+
async function handlePaymentFromFrontend(payment: PaymentSubmitPayload) {
|
|
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
|
+
}
|
|
489
|
+
|
|
490
|
+
return await bloque.payments.create({ payment });
|
|
491
|
+
}
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
## Development
|
|
495
|
+
|
|
496
|
+
### Building the SDK
|
|
497
|
+
|
|
498
|
+
```bash
|
|
499
|
+
bun install
|
|
500
|
+
bun run build
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
### Development Mode (Watch)
|
|
504
|
+
|
|
505
|
+
```bash
|
|
506
|
+
bun run dev
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
### Type Checking
|
|
510
|
+
|
|
511
|
+
```bash
|
|
512
|
+
bun run typecheck
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
### Code Quality
|
|
516
|
+
|
|
517
|
+
```bash
|
|
518
|
+
bun run check
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
## Requirements
|
|
522
|
+
|
|
523
|
+
- Node.js 22.x or higher / Bun 1.x or higher
|
|
524
|
+
- TypeScript 5.x or higher (for TypeScript projects)
|
|
525
|
+
|
|
526
|
+
## Links
|
|
527
|
+
|
|
528
|
+
- [Homepage](https://www.bloque.app)
|
|
529
|
+
- [GitHub Repository](git+https://github.com/bloque-app/bloque-payments.git)
|
|
530
|
+
- [Issue Tracker](git+https://github.com/bloque-app/bloque-payments.git/issues)
|
|
531
|
+
|
|
532
|
+
## License
|
|
533
|
+
|
|
534
|
+
[MIT](../../LICENSE)
|
|
535
|
+
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
sum: ()=>sum
|
|
28
|
+
});
|
|
29
|
+
const sum = (a, b)=>a + b;
|
|
30
|
+
exports.sum = __webpack_exports__.sum;
|
|
31
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
32
|
+
"sum"
|
|
33
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
34
|
+
Object.defineProperty(exports, '__esModule', {
|
|
35
|
+
value: true
|
|
36
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sum: (a: number, b: number) => number;
|
package/dist/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bloque/sdk",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Official Bloque SDK",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"bloque",
|
|
8
|
+
"sdk",
|
|
9
|
+
"api"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public",
|
|
14
|
+
"provenance": true
|
|
15
|
+
},
|
|
16
|
+
"homepage": "git+https://github.com/bloque-app/sdk.git#readme",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/bloque-app/sdk.git",
|
|
20
|
+
"directory": "packages/sdk"
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js",
|
|
26
|
+
"require": "./dist/index.cjs"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"main": "./dist/index.cjs",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=22"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "rslib build",
|
|
39
|
+
"dev": "rslib build --watch",
|
|
40
|
+
"clean": "rm -rf node_modules && rm -rf dist",
|
|
41
|
+
"check": "biome check --write",
|
|
42
|
+
"typecheck": "tsgo --noEmit"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@bloque/sdk-core": "workspace:*"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@rslib/core": "catalog:",
|
|
49
|
+
"@types/node": "catalog:",
|
|
50
|
+
"@typescript/native-preview": "catalog:",
|
|
51
|
+
"typescript": "catalog:"
|
|
52
|
+
}
|
|
53
|
+
}
|