arky-sdk 0.7.93 → 0.7.102
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 +33 -19
- package/dist/admin.cjs +2327 -0
- package/dist/admin.cjs.map +1 -0
- package/dist/admin.d.cts +3 -0
- package/dist/admin.d.ts +3 -0
- package/dist/admin.js +2325 -0
- package/dist/admin.js.map +1 -0
- package/dist/index.cjs +581 -585
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +447 -305
- package/dist/index.d.ts +447 -305
- package/dist/index.js +581 -585
- package/dist/index.js.map +1 -1
- package/dist/storefront.cjs +1352 -0
- package/dist/storefront.cjs.map +1 -0
- package/dist/storefront.d.cts +3 -0
- package/dist/storefront.d.ts +3 -0
- package/dist/storefront.js +1349 -0
- package/dist/storefront.js.map +1 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +2280 -2117
- package/dist/types.d.ts +2280 -2117
- package/dist/types.js.map +1 -1
- package/package.json +13 -5
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# arky-sdk
|
|
2
2
|
|
|
3
|
-
Official TypeScript SDK for [Arky](https://arky.io) — Build online
|
|
3
|
+
Official TypeScript SDK for [Arky](https://arky.io) — Build online stores with headless CMS, e-commerce, and booking systems.
|
|
4
4
|
|
|
5
5
|
## What is Arky?
|
|
6
6
|
|
|
7
|
-
Arky is an **all-in-one platform** that gives you everything you need to run an online
|
|
7
|
+
Arky is an **all-in-one platform** that gives you everything you need to run an online store:
|
|
8
8
|
|
|
9
9
|
- 📝 **Headless CMS** - Manage content with flexible blocks, multilingual support, and AI-powered content generation
|
|
10
10
|
- 🛒 **E-commerce** - Sell products with multi-currency pricing, inventory, orders, and Stripe payments
|
|
@@ -13,7 +13,7 @@ Arky is an **all-in-one platform** that gives you everything you need to run an
|
|
|
13
13
|
- 👥 **User Management** - Authentication, roles, permissions, and user profiles
|
|
14
14
|
- 💳 **Payments** - Integrated Stripe checkout and promo codes
|
|
15
15
|
|
|
16
|
-
**Build any online
|
|
16
|
+
**Build any online store:** SaaS products, e-commerce shops, booking platforms, content sites, newsletters, or multi-tenant marketplaces.
|
|
17
17
|
|
|
18
18
|
## Why Use This SDK?
|
|
19
19
|
|
|
@@ -39,7 +39,7 @@ import { createArkySDK } from 'arky-sdk'
|
|
|
39
39
|
|
|
40
40
|
const arky = createArkySDK({
|
|
41
41
|
baseUrl: 'https://api.arky.io',
|
|
42
|
-
|
|
42
|
+
storeId: 'your-store-id',
|
|
43
43
|
market: 'us',
|
|
44
44
|
getToken: () => ({
|
|
45
45
|
accessToken: localStorage.getItem('accessToken') || '',
|
|
@@ -167,18 +167,18 @@ await arky.user.updateUser({ name, phoneNumber, addresses })
|
|
|
167
167
|
await arky.user.resetPassword({ oldPassword, newPassword })
|
|
168
168
|
```
|
|
169
169
|
|
|
170
|
-
###
|
|
170
|
+
### Store
|
|
171
171
|
```typescript
|
|
172
|
-
//
|
|
173
|
-
await arky.
|
|
174
|
-
await arky.
|
|
175
|
-
await arky.
|
|
176
|
-
await arky.
|
|
172
|
+
// Store CRUD
|
|
173
|
+
await arky.store.createStore({ name, slug })
|
|
174
|
+
await arky.store.getStore()
|
|
175
|
+
await arky.store.updateStore({ id, name })
|
|
176
|
+
await arky.store.deleteStore({ id })
|
|
177
177
|
|
|
178
178
|
// Subscriptions
|
|
179
|
-
await arky.
|
|
180
|
-
await arky.
|
|
181
|
-
await arky.
|
|
179
|
+
await arky.store.createSubscription({ planId })
|
|
180
|
+
await arky.store.getSubscription()
|
|
181
|
+
await arky.store.cancelSubscription({ immediately: true })
|
|
182
182
|
```
|
|
183
183
|
|
|
184
184
|
### CMS & Newsletters
|
|
@@ -247,16 +247,16 @@ await arky.reservation.searchReservations({ start, end })
|
|
|
247
247
|
### Media
|
|
248
248
|
```typescript
|
|
249
249
|
// Upload files
|
|
250
|
-
const media = await arky.media.
|
|
250
|
+
const media = await arky.media.uploadStoreMedia({
|
|
251
251
|
files: [file1, file2],
|
|
252
252
|
urls: ['https://example.com/image.jpg'],
|
|
253
253
|
})
|
|
254
254
|
|
|
255
255
|
// List media
|
|
256
|
-
const { items } = await arky.media.
|
|
256
|
+
const { items } = await arky.media.getStoreMedia({ limit: 20 })
|
|
257
257
|
|
|
258
258
|
// Delete media
|
|
259
|
-
await arky.media.
|
|
259
|
+
await arky.media.deleteStoreMedia({ id: storeId, mediaId })
|
|
260
260
|
```
|
|
261
261
|
|
|
262
262
|
### Notifications
|
|
@@ -338,7 +338,7 @@ await arky.utils.injectSvgIntoElement(mediaBlock, element, 'custom-class')
|
|
|
338
338
|
|
|
339
339
|
## What Can You Build?
|
|
340
340
|
|
|
341
|
-
- 🏪 **E-commerce
|
|
341
|
+
- 🏪 **E-commerce shops** - Product catalogs, shopping carts, checkout
|
|
342
342
|
- 📰 **Content websites** - Blogs, documentation, marketing sites
|
|
343
343
|
- 📅 **Booking platforms** - Appointment scheduling, service bookings
|
|
344
344
|
- 📬 **Newsletter platforms** - Subscriber management, email campaigns
|
|
@@ -351,7 +351,7 @@ await arky.utils.injectSvgIntoElement(mediaBlock, element, 'custom-class')
|
|
|
351
351
|
createArkySDK({
|
|
352
352
|
// Required
|
|
353
353
|
baseUrl: string, // API URL
|
|
354
|
-
|
|
354
|
+
storeId: string, // Your store ID
|
|
355
355
|
market: string, // Market code (e.g., 'us', 'eu')
|
|
356
356
|
|
|
357
357
|
// Token management
|
|
@@ -377,12 +377,26 @@ import type {
|
|
|
377
377
|
HttpClientConfig,
|
|
378
378
|
ApiResponse,
|
|
379
379
|
Block,
|
|
380
|
-
|
|
380
|
+
Store,
|
|
381
381
|
Price,
|
|
382
382
|
// ... and many more
|
|
383
383
|
} from 'arky-sdk'
|
|
384
384
|
```
|
|
385
385
|
|
|
386
|
+
## Adding a new endpoint
|
|
387
|
+
|
|
388
|
+
When adding a new SDK method, follow this checklist so the API surface stays typed end-to-end and request shapes stay aligned with the Rust DTOs on the server:
|
|
389
|
+
|
|
390
|
+
1. **Define the entity** in `src/types/index.ts` if it does not already exist. Mirror the Rust response struct field-for-field.
|
|
391
|
+
2. **Define the request params** in `src/types/api.ts`. Mirror the Rust DTO in `server/core/src/{module}/types/commands.rs` field-for-field. Two exceptions: `store_id?: string` and `market?: string` are optional in TS (the SDK auto-fills both from `apiConfig.storeId` and `apiConfig.market`). Do **not** use `[key: string]: any` index signatures.
|
|
392
|
+
3. **Annotate the SDK method's return type** using the matching entity from `src/types/index.ts`.
|
|
393
|
+
4. **Pass the response generic to the HTTP call**: `apiConfig.httpClient.post<EntityType>(...)`, `apiConfig.httpClient.get<PaginatedResponse<EntityType>>(...)`, etc. Never rely on inference.
|
|
394
|
+
5. **Inject `market` from `apiConfig`**: when a body needs a `market` field, write `{ market: apiConfig.market, ...payload }`. Never hardcode `"booking"`, `"eshop"`, or any other market string in `src/api/*.ts`.
|
|
395
|
+
6. **Re-export the entity** from `src/index.ts` if consumers (admin, storefront) will import it.
|
|
396
|
+
7. **Bump `SDK_VERSION`** in `src/index.ts` and the `version` in `package.json`. Patch only.
|
|
397
|
+
|
|
398
|
+
A guardrail script (`scripts/check-no-any.mjs`) runs on `npm run build` (via `prebuild`) and fails red if `: any`, `as any`, or hardcoded `market: "..."` literals show up in `src/api/*.ts`.
|
|
399
|
+
|
|
386
400
|
## License
|
|
387
401
|
|
|
388
402
|
MIT
|