@yasad/client 0.0.0-stage → 0.1.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 CHANGED
@@ -1,3 +1,134 @@
1
- # Temporary Holding Version
1
+ # @yasad/client
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Server-only TypeScript client for the Yasad API. It wraps the HTTP API and acts with the workspace and permissions of its key. It has no database or UI. Requires Node 24.
4
+
5
+ ## Quickstart
6
+
7
+ 1. In Yasad, open **Apps**, choose your app (or **Add an app**), and press **Create API key**. Pick the narrowest permission it needs. Yasad shows the key once, as two lines.
8
+ 2. Paste them into your app's server-side `.env` (add `.env` to `.gitignore`), or your host's secret settings:
9
+
10
+ ```dotenv
11
+ YASAD_API_URL=https://YOUR-YASAD-API-URL
12
+ YASAD_API_KEY=ysk_...
13
+ ```
14
+
15
+ 3. Install and check the connection:
16
+
17
+ ```sh
18
+ npm install @yasad/client
19
+ ```
20
+
21
+ ```js
22
+ // check.mjs
23
+ import { Yasad } from '@yasad/client';
24
+
25
+ const yasad = new Yasad(); // reads YASAD_API_URL and YASAD_API_KEY from the environment
26
+ const me = await yasad.capabilities();
27
+ console.log(me.workspaceId, me.role);
28
+ ```
29
+
30
+ ```sh
31
+ node --env-file=.env check.mjs
32
+ ```
33
+
34
+ Plain Node does not read `.env` by itself; `--env-file` loads it. On Windows, save `.env` as UTF-8 (Windows PowerShell 5's `>` writes UTF-16, which `--env-file` misreads); `new Yasad({ envFile: '.env' })` and `npx @yasad/cli doctor --env .env` read either encoding, and `doctor` tells you which settings it found. Next.js and most frameworks load `.env` for server code. Never put the key in a `NEXT_PUBLIC_`/`VITE_` variable, browser code, Git or logs. Yasad stores only a fingerprint (SHA-256) of the key; the key itself is sent only to its own `YASAD_API_URL`, over HTTPS (plain HTTP is allowed only for local development addresses).
35
+
36
+ Creating a customer needs a key with **Staff tools** (`operator`):
37
+
38
+ ```ts
39
+ import { randomUUID } from 'node:crypto';
40
+ import { Yasad } from '@yasad/client';
41
+
42
+ const yasad = new Yasad();
43
+ const requestId = randomUUID(); // keep this and reuse it if you retry the same create
44
+ const customer = await yasad.customers.create({ requestId, name: 'Jane Smith', email: 'jane@example.com' });
45
+ ```
46
+
47
+ AI assistants connect with their own keys through `npx @yasad/cli` (see its README); an app doesn't need the CLI.
48
+
49
+ Credentials always come from one place, and a key is only ever sent to its own origin:
50
+
51
+ - `new Yasad({ envFile })` reads the key and URL together from the file and ignores inherited settings.
52
+ - `new Yasad()` reads `YASAD_API_KEY` with `YASAD_API_URL`, or else the legacy `FRESH_API_KEY` with `FRESH_API_URL`, never mixing the two. An empty variable counts as unset.
53
+ - `new Yasad({ apiKey, baseUrl })` uses exactly what you pass. No URL means an error, never a guessed default. `baseUrl` alone is refused, so an inherited key is never sent to a different origin. Without `baseUrl`, it uses only the URL configured for that same key (`YASAD_API_URL` for `YASAD_API_KEY`, `FRESH_API_URL` for `FRESH_API_KEY`), and refuses an unrelated key while any API URL is set.
54
+
55
+ For a retriable mutation, generate and keep a UUID before the first attempt and pass it as `requestId` on every retry; the client returns the original business object. Catch `YasadError` for the status, code, message and `details.recovery`. A configuration problem (missing `YASAD_API_KEY` or `YASAD_API_URL`, an `http://` public address, a URL with a path such as `/v1`) throws before any request is sent. Find the current contract at `/openapi.json` and the operations your key may use with `await yasad.capabilities()`.
56
+
57
+ Upgrading from the alpha tarball: env files with `FRESH_API_URL`/`FRESH_API_KEY` still work, and `Fresh`/`FreshError` remain exported as aliases. Change the import to `@yasad/client`. For an offline install, `curl -fsS "$YASAD_API_URL/sdk/yasad-client.tgz" -o yasad-client.tgz && npm install ./yasad-client.tgz` installs the same package.
58
+
59
+ | Interface | Operations |
60
+ | --- | --- |
61
+ | `yasad.capabilities()`, `yasad.export()` | Discover permitted operations and retrieve a workspace snapshot |
62
+ | `yasad.customers`, `yasad.customRecords` | List and create |
63
+ | `yasad.resources` | List, create and update capacity, price and buffers |
64
+ | `yasad.reservations` | List, check availability, hold, confirm and cancel |
65
+ | `yasad.orders` | List, get, create and update |
66
+ | `yasad.payments` | List and record manual USD-cent payments |
67
+
68
+ Use the installed TypeScript declarations or GET /openapi.json for input fields. The API applies roles and workspace scope to every call. Availability takes UTC timestamps with milliseconds and a list of resource/quantity allocations. For an order, include the displayed total in cents. The server checks price and capacity together.
69
+
70
+ ```js
71
+ // Store this intent durably before the first call and reload it for every retry.
72
+ const intent = {requestId: crypto.randomUUID(), name: 'Avery Lee', email: 'avery@example.test'};
73
+ const customer = await yasad.customers.create(intent);
74
+ ```
75
+
76
+ An SDK mutation without a requestId creates a new ID on each invocation. Pass an explicit ID for any retriable action. After uncertain delivery reuse the same actor key, ID and original input. On a conflict inspect the current state and revision before deciding on a new intent. A revoked key returns 401. An operation outside the key's role returns 403.
77
+
78
+ ## Collections
79
+
80
+ `await yasad.collections.list()` returns names, fields, versions and the legacy flag. Define fields with `type` plus optional `required` and `default`. String permits 255 characters, text permits 24,000. Integer is a safe integer. Number is finite. Dates use YYYY-MM-DD. Datetime uses UTC ISO with milliseconds. Boolean and JSON accept their JSON representations. Enum takes a list of string `values`. Reference fields take a UUID value and a `target`. For native fields the target is customers, resources, reservations, orders or payments. For record fields it is a collection name.
81
+
82
+ ```ts
83
+ await yasad.collections.create({name:'recipes', fields:{
84
+ name:{type:'string',required:true}, flourGrams:{type:'number',default:500}
85
+ }});
86
+ const loaf = await yasad.data.create('recipes',{name:'Country sourdough'},crypto.randomUUID());
87
+ const {records,nextOffset} = await yasad.data.query('recipes',{
88
+ filter:{flourGrams:500},sort:'name',limit:50,offset:0
89
+ });
90
+ await yasad.data.update(loaf.id,{revision:loaf.revision,data:{...loaf.data,flourGrams:510}});
91
+ ```
92
+
93
+ Get by ID with `yasad.data.get(id)`. Delete with `yasad.data.delete(id,{revision})`. Detach incoming references and files before deleting a record. Schema changes use `collections.update({name,version,fields})` with the complete new field map. Add optional fields or broaden enums. Existing field types and targets persist. A legacy collection accepts open JSON. Export includes every schema version and each record's revision and schema version.
94
+
95
+ ## Checkout and refunds
96
+
97
+ Using an integrations key, call `payments.connect({origins,returnUrl,refreshUrl,depositBps})` with HTTPS application origins. A deposit of 2500 basis points is 25%. Poll `payments.operation(id)` until complete and direct the authorized merchant to the returned hosted onboarding URL. Refresh and inspect merchant readiness. A connected workspace's new paid orders are held for five minutes awaiting the required payment.
98
+
99
+ ```ts
100
+ const intent=await yasad.payments.checkout({orderId:order.id,amount:'deposit',
101
+ successUrl:'https://shop.example.test/done',cancelUrl:'https://shop.example.test/cart',requestId});
102
+ const current=await yasad.payments.operation(intent.id);
103
+ ```
104
+
105
+ Poll queued operations. A hosted checkout becomes open and exposes a shopper URL. In local simulation an integrations key calls `payments.simulate({checkoutId,status:'paid'})`. The simulator also accepts expired. Reconcile with `payments.reconcile({checkoutId})`. Refresh the order to read its confirmed status. A late paid order can require payment_review. Issue refunds against a checkout using `payments.refund({checkoutId,amountCents})`; omit cents for the refundable balance. Use `remaining` for a balance checkout after an accepted deposit. Access and poll the same operation after interruption.
106
+
107
+ ## Files, email and events
108
+
109
+ ```ts
110
+ const upload=await yasad.files.createUpload({name:'service.jpg',contentType:'image/jpeg',sizeBytes:bytes.length});
111
+ const response=await fetch(upload.uploadUrl,{method:'PUT',headers:{'content-type':'image/jpeg'},body:bytes});
112
+ if(!response.ok) throw Error('Upload failed');
113
+ await yasad.files.finalize(upload.id);
114
+ await yasad.files.attach(upload.id,{target:{entity:'record',id:equipment.id}});
115
+ const link=await yasad.files.download(upload.id);
116
+ ```
117
+
118
+ Create reserves quota for ten minutes. Files are private initially. The maximum is 8 MiB per object and 64 MiB reserved or stored per workspace. The allowed types are JPEG, PNG, PDF, UTF-8 plain text and JSON. Supply a hex SHA-256 to verify expected content. REST URLs beginning with a slash resolve against the API origin. Object PUT and GET use the signed URL alone. Set target to null to detach. Integrations keys can publish a file or revoke public access.
119
+
120
+ Use a mailer key to call `yasad.emails.send({to,subject,html,text,requestId})`, then `emails.list()` for provider IDs and delivery states. The current limits are 20 intents per minute and 500 per rolling 24 hours. Suppressed addresses do not receive further messages. Sender addresses come from workspace settings.
121
+
122
+ List recent events with `yasad.events.list()`. With an integrations key call `webhooks.create({url,types})` and store the Ed25519 public key at the receiver. Check the Fresh-Timestamp (Unix seconds) within five minutes, then verify the base64 Fresh-Signature over the UTF-8 timestamp, a period and the exact raw body. Deduplicate by event ID before applying effects. Return a 2xx only after persisting receipt. Inspect `webhooks.deliveries()` and retry an exhausted delivery with `webhooks.retry(id)`. The receiver can use entityId to fetch current data.
123
+
124
+ `yasad.usage()` returns observational counts with current object and record bytes and rolling 30-day API, mail, webhook and payment activity. Identity emails are outside workspace usage. Yasad API keys and provider configuration belong on the server. The provider setup guide is available from the running API at `/providers/guide`.
125
+
126
+ Use the owner’s connection instructions to obtain a caller-specific grant. Read `yasad.capabilities()` before choosing a workflow. Its optional context includes the workspace name, sandbox environment, this caller’s registered identity and paths to the current guides. A reader can export business records. Each independently hosted app needs its own server-side credential. Keep the same actor and original request ID when retrying a business operation.
127
+
128
+ ### Extensions and hosting history
129
+
130
+ `client.summarizeRecords({ collection: 'equipment', field: 'hours' })` returns a count and numeric aggregates as decimal strings. Missing values are excluded from the numeric aggregates. `unique: true` on a bounded typed field or reference enforces workspace-and-collection-local uniqueness. Explicitly detach a reference before removing its target. Workspace export v1 also carries relationships, application identities and finalized file metadata. Download authorized original bytes separately.
131
+
132
+ `client.deployments()` lists up to 50 recent operations for the application bound to the current reader or operator credential. Local provisioning rehearsals identify simulated operations. An owner approves application grants and infrastructure changes separately. Use the same stable request ID and body after an uncertain business mutation.
133
+
134
+ Use `client.pageBusinessRecords({entity:'customers',ids})` to resolve up to 100 external references per request. Omit IDs and pass the returned cursor as `after` for keyset pagination.
@@ -0,0 +1,495 @@
1
+ /**
2
+ * The API origin a key may be sent to. HTTPS is required except for loopback and private-network
3
+ * development addresses, matching the MCP bridge. Paths, queries and URL credentials are refused so a
4
+ * key is only ever sent to a bare origin.
5
+ */
6
+ export declare function apiOrigin(raw: string): string;
7
+ export type CustomerInput = {
8
+ name: string;
9
+ email: string;
10
+ };
11
+ export type Customer = CustomerInput & {
12
+ id: string;
13
+ };
14
+ export type ResourceInput = {
15
+ name: string;
16
+ kind: string;
17
+ capacity: number;
18
+ unitCents?: number | null;
19
+ archived?: boolean;
20
+ bufferBeforeMinutes?: number;
21
+ bufferAfterMinutes?: number;
22
+ };
23
+ export type Resource = Required<ResourceInput> & {
24
+ id: string;
25
+ tenantId: string;
26
+ revision: number;
27
+ };
28
+ export type Allocation = {
29
+ resourceId: string;
30
+ quantity: number;
31
+ };
32
+ export type ReservationWindow = {
33
+ startsAt: string;
34
+ endsAt: string;
35
+ };
36
+ export type Demand = ReservationWindow & {
37
+ allocations: Allocation[];
38
+ };
39
+ export type AllocatedWindow = Allocation & ReservationWindow & {
40
+ resourceName: string;
41
+ resourceKind: string;
42
+ };
43
+ export type Availability = ReservationWindow & {
44
+ allocations: AllocatedWindow[];
45
+ };
46
+ export type Reservation = Availability & {
47
+ id: string;
48
+ revision: number;
49
+ tenantId: string;
50
+ customerLabel: string;
51
+ expiresAt: string;
52
+ status: 'held' | 'confirmed' | 'cancelled' | 'expired' | 'requested' | 'pending' | 'completed';
53
+ };
54
+ export type OrderStatus = 'awaiting_payment' | 'payment_expired' | 'payment_review' | 'placed' | 'ready' | 'fulfilled' | 'cancelled';
55
+ export type OrderInput = ReservationWindow & {
56
+ customer: CustomerInput;
57
+ lines: (Allocation & {
58
+ expectedUnitCents: number;
59
+ })[];
60
+ };
61
+ export type Order = ReservationWindow & {
62
+ id: string;
63
+ customerId: string;
64
+ reservationId: string;
65
+ status: OrderStatus;
66
+ requiredCents?: number;
67
+ holdExpiresAt?: string;
68
+ revision: number;
69
+ createdAt: string;
70
+ lines: (Allocation & {
71
+ name: string;
72
+ unitCents: number;
73
+ })[];
74
+ totalCents: number;
75
+ currency: 'USD';
76
+ };
77
+ export type Payment = {
78
+ id: string;
79
+ orderId: string;
80
+ amountCents: number;
81
+ currency: 'USD';
82
+ method: 'manual' | 'stripe';
83
+ checkoutId?: string;
84
+ recordedAt: string;
85
+ };
86
+ export type CustomRecord = {
87
+ id: string;
88
+ collection: string;
89
+ data: Record<string, unknown>;
90
+ };
91
+ export type WorkspaceFile = {
92
+ id: string;
93
+ name: string;
94
+ contentType: string;
95
+ sizeBytes: number;
96
+ sha256: string | null;
97
+ status: string;
98
+ public: boolean;
99
+ entity: string | null;
100
+ entityId: string | null;
101
+ expiresAt: string;
102
+ };
103
+ export type EmailMessage = {
104
+ id: string;
105
+ to: string;
106
+ from: string;
107
+ createdAt: string;
108
+ status: string;
109
+ attempts: number;
110
+ providerId: string | null;
111
+ error: string | null;
112
+ };
113
+ export type PaymentJob = {
114
+ id: string;
115
+ kind: string;
116
+ orderId: string | null;
117
+ amountCents: number;
118
+ status: string;
119
+ url?: string | null;
120
+ error?: string | null;
121
+ refundedCents?: number;
122
+ };
123
+ export type Merchant = {
124
+ mode: string;
125
+ ready: boolean;
126
+ reason: string;
127
+ capabilities?: Record<string, string>;
128
+ depositBps?: number;
129
+ origins?: string[];
130
+ };
131
+ export type BusinessEvent = {
132
+ id: string;
133
+ type: string;
134
+ entityId: string;
135
+ at: string;
136
+ };
137
+ export type Subscription = {
138
+ id: string;
139
+ url: string;
140
+ types: string[];
141
+ enabled: boolean;
142
+ };
143
+ export type Delivery = {
144
+ id: string;
145
+ subscriptionId: string;
146
+ eventId: string;
147
+ status: string;
148
+ attempts: number;
149
+ nextAt: string;
150
+ history: {
151
+ at: string;
152
+ attempt: number;
153
+ outcome: string;
154
+ }[];
155
+ };
156
+ export type Field = {
157
+ type: 'string' | 'text' | 'integer' | 'number' | 'boolean' | 'date' | 'datetime' | 'enum' | 'json' | 'record' | 'native';
158
+ required?: boolean;
159
+ default?: unknown;
160
+ values?: string[];
161
+ target?: string;
162
+ unique?: boolean;
163
+ };
164
+ export type CollectionInput = {
165
+ name: string;
166
+ fields: Record<string, Field>;
167
+ };
168
+ export type Collection = CollectionInput & {
169
+ version: number;
170
+ legacy: boolean;
171
+ };
172
+ export type DataRecord = CustomRecord & {
173
+ revision: number;
174
+ schemaVersion: number;
175
+ };
176
+ export type RecordQuery = {
177
+ filter?: Record<string, unknown>;
178
+ sort?: string;
179
+ descending?: boolean;
180
+ limit?: number;
181
+ offset?: number;
182
+ };
183
+ export type WorkspaceExport = {
184
+ version: 1;
185
+ workspace: {
186
+ id: string;
187
+ name: string;
188
+ };
189
+ customers: Customer[];
190
+ resources: Resource[];
191
+ reservations: Reservation[];
192
+ orders: Order[];
193
+ payments: Payment[];
194
+ customRecords: CustomRecord[];
195
+ collections: Collection[];
196
+ collectionVersions: Collection[];
197
+ records: DataRecord[];
198
+ relationships?: {
199
+ source: string;
200
+ field: string;
201
+ target: string;
202
+ kind: string;
203
+ }[];
204
+ files?: {
205
+ id: string;
206
+ name: string;
207
+ content_type: string;
208
+ size_bytes: number;
209
+ sha256: string | null;
210
+ entity: string | null;
211
+ entity_id: string | null;
212
+ record_id: string | null;
213
+ }[];
214
+ applications?: {
215
+ id: string;
216
+ name: string;
217
+ app_type: string;
218
+ revision: number;
219
+ }[];
220
+ };
221
+ export type Capabilities = {
222
+ /** Older servers may omit workspace context. A null caller denotes a standalone grant. */
223
+ context?: {
224
+ workspaceName: string;
225
+ environment: 'sandbox';
226
+ caller: {
227
+ id: string;
228
+ kind: 'application' | 'assistant';
229
+ name: string;
230
+ } | null;
231
+ businessDescription?: string;
232
+ documentation: {
233
+ guide: string;
234
+ sdk: string;
235
+ contract: string;
236
+ };
237
+ };
238
+ version: number;
239
+ workspaceId: string;
240
+ role: 'reader' | 'operator' | 'storefront' | 'integrations' | 'mailer';
241
+ capabilities: string[];
242
+ payments: boolean;
243
+ operations: string[];
244
+ openapi: string;
245
+ currency: 'USD';
246
+ paymentMethods: string[];
247
+ maxRequestBytes: number;
248
+ };
249
+ type Mutation<T> = T & {
250
+ requestId?: string;
251
+ };
252
+ type Version = {
253
+ revision: number;
254
+ };
255
+ export type RecoveryDetails = {
256
+ reference?: string;
257
+ outcome: 'unconfirmed' | 'read_failed' | 'rejected';
258
+ recovery: string;
259
+ retryable: boolean;
260
+ retryAfterSeconds?: number;
261
+ field?: string;
262
+ requestId?: string;
263
+ };
264
+ export declare class YasadError extends Error {
265
+ readonly details?: RecoveryDetails;
266
+ readonly status: number;
267
+ readonly code: string;
268
+ constructor(status: number, code: string, message: string, details?: RecoveryDetails);
269
+ }
270
+ export declare class Yasad {
271
+ #private;
272
+ /**
273
+ * Credentials come from exactly one place, and a key is only ever paired with its own origin:
274
+ * - `envFile`: the key and URL are read together from that file (inherited settings are ignored);
275
+ * - `apiKey`: pass `baseUrl` too; otherwise only the URL configured for that same key is used;
276
+ * - otherwise the environment: YASAD_API_KEY with YASAD_API_URL, else the legacy FRESH_* pair.
277
+ */
278
+ constructor(options?: {
279
+ apiKey?: string;
280
+ baseUrl?: string;
281
+ envFile?: string;
282
+ });
283
+ pageBusinessRecords: (input: {
284
+ entity: "customers" | "resources" | "reservations" | "orders" | "payments";
285
+ ids?: string[];
286
+ after?: string;
287
+ limit?: number;
288
+ }) => Promise<{
289
+ records: (Customer | Resource | Reservation | Order | Payment)[];
290
+ next: string | null;
291
+ }>;
292
+ summarizeRecords: (input: {
293
+ collection: string;
294
+ field?: string;
295
+ filter?: Record<string, unknown>;
296
+ }) => Promise<{
297
+ count: string;
298
+ sum: string | null;
299
+ min: string | null;
300
+ max: string | null;
301
+ }>;
302
+ deployments: () => Promise<{
303
+ id: string;
304
+ applicationId: string;
305
+ action: string;
306
+ revision: string;
307
+ status: string;
308
+ createdAt: string;
309
+ }[]>;
310
+ usage: () => Promise<Record<string, number>>;
311
+ capabilities: () => Promise<Capabilities>;
312
+ export: () => Promise<WorkspaceExport>;
313
+ customers: {
314
+ list: () => Promise<Customer[]>;
315
+ create: (input: Mutation<CustomerInput>) => Promise<Customer>;
316
+ };
317
+ resources: {
318
+ list: () => Promise<Resource[]>;
319
+ create: (input: Mutation<ResourceInput>) => Promise<Resource>;
320
+ update: (id: string, input: Mutation<ResourceInput & Version>) => Promise<Resource>;
321
+ };
322
+ reservations: {
323
+ list: () => Promise<Reservation[]>;
324
+ availability: (input: Demand) => Promise<Availability>;
325
+ hold: (input: Mutation<Demand & {
326
+ customerLabel: string;
327
+ holdMinutes: number;
328
+ }>) => Promise<Reservation>;
329
+ confirm: (id: string, input: Mutation<Version>) => Promise<Reservation>;
330
+ cancel: (id: string, input: Mutation<Version>) => Promise<Reservation>;
331
+ };
332
+ orders: {
333
+ list: () => Promise<Order[]>;
334
+ get: (id: string) => Promise<Order>;
335
+ create: (input: Mutation<OrderInput>) => Promise<Order>;
336
+ update: (id: string, input: Mutation<Version & {
337
+ status: OrderStatus;
338
+ }>) => Promise<Order>;
339
+ };
340
+ emails: {
341
+ send: (input: Mutation<{
342
+ to: string;
343
+ subject: string;
344
+ html?: string;
345
+ text?: string;
346
+ }>) => Promise<EmailMessage>;
347
+ list: () => Promise<(EmailMessage & {
348
+ history: {
349
+ type: string;
350
+ at: string;
351
+ }[];
352
+ })[]>;
353
+ sender: () => Promise<{
354
+ address: string;
355
+ mode: string;
356
+ custom: boolean;
357
+ }>;
358
+ setSender: (input: Mutation<{
359
+ address: string | null;
360
+ }>) => Promise<{
361
+ address: string;
362
+ custom: boolean;
363
+ }>;
364
+ };
365
+ files: {
366
+ list: () => Promise<WorkspaceFile[]>;
367
+ createUpload: (input: Mutation<{
368
+ name: string;
369
+ contentType: string;
370
+ sizeBytes: number;
371
+ sha256?: string;
372
+ }>) => Promise<{
373
+ uploadUrl: string;
374
+ id: string;
375
+ name: string;
376
+ contentType: string;
377
+ sizeBytes: number;
378
+ sha256: string | null;
379
+ status: string;
380
+ public: boolean;
381
+ entity: string | null;
382
+ entityId: string | null;
383
+ expiresAt: string;
384
+ method: "PUT";
385
+ }>;
386
+ finalize: (id: string, requestId?: string) => Promise<WorkspaceFile>;
387
+ download: (id: string) => Promise<{
388
+ url: string;
389
+ expiresIn: number;
390
+ }>;
391
+ attach: (id: string, input: Mutation<{
392
+ target: {
393
+ entity: string;
394
+ id: string;
395
+ } | null;
396
+ }>) => Promise<WorkspaceFile>;
397
+ visibility: (id: string, input: Mutation<{
398
+ public: boolean;
399
+ }>) => Promise<{
400
+ id: string;
401
+ public: boolean;
402
+ url: string | null;
403
+ }>;
404
+ delete: (id: string, requestId?: string) => Promise<{
405
+ id: string;
406
+ status: string;
407
+ }>;
408
+ };
409
+ payments: {
410
+ merchant: () => Promise<Merchant>;
411
+ connect: (input: Mutation<{
412
+ origins: string[];
413
+ returnUrl: string;
414
+ refreshUrl: string;
415
+ depositBps: number;
416
+ }>) => Promise<PaymentJob>;
417
+ refresh: (requestId?: string) => Promise<PaymentJob>;
418
+ checkout: (input: Mutation<{
419
+ orderId: string;
420
+ amount: "full" | "deposit" | "remaining";
421
+ successUrl: string;
422
+ cancelUrl: string;
423
+ }>) => Promise<PaymentJob>;
424
+ operation: (id: string) => Promise<PaymentJob>;
425
+ operations: () => Promise<PaymentJob[]>;
426
+ reconcile: (input: Mutation<{
427
+ checkoutId: string;
428
+ sessionId?: string;
429
+ }>) => Promise<PaymentJob>;
430
+ simulate: (input: Mutation<{
431
+ checkoutId: string;
432
+ status: "paid" | "expired";
433
+ }>) => Promise<PaymentJob>;
434
+ refund: (input: Mutation<{
435
+ checkoutId: string;
436
+ amountCents?: number;
437
+ }>) => Promise<PaymentJob>;
438
+ list: () => Promise<Payment[]>;
439
+ record: (input: Mutation<{
440
+ orderId: string;
441
+ amountCents: number;
442
+ }>) => Promise<Payment>;
443
+ };
444
+ events: {
445
+ list: () => Promise<BusinessEvent[]>;
446
+ };
447
+ webhooks: {
448
+ list: () => Promise<Subscription[]>;
449
+ create: (input: Mutation<{
450
+ url: string;
451
+ types: string[];
452
+ }>) => Promise<Subscription & {
453
+ publicKey: string;
454
+ }>;
455
+ disable: (id: string, requestId?: string) => Promise<{
456
+ id: string;
457
+ enabled: boolean;
458
+ }>;
459
+ deliveries: () => Promise<Delivery[]>;
460
+ retry: (id: string, requestId?: string) => Promise<{
461
+ id: string;
462
+ status: string;
463
+ }>;
464
+ };
465
+ collections: {
466
+ list: () => Promise<Collection[]>;
467
+ get: (collection: string) => Promise<Collection>;
468
+ create: (input: Mutation<CollectionInput>) => Promise<Collection>;
469
+ update: (input: Mutation<CollectionInput & {
470
+ version: number;
471
+ }>) => Promise<Collection>;
472
+ };
473
+ data: {
474
+ create: (collection: string, data: Record<string, unknown>, requestId?: string) => Promise<DataRecord>;
475
+ get: (id: string) => Promise<DataRecord>;
476
+ query: (collection: string, query?: RecordQuery) => Promise<{
477
+ records: DataRecord[];
478
+ nextOffset: number | null;
479
+ }>;
480
+ update: (id: string, input: Mutation<Version & {
481
+ data: Record<string, unknown>;
482
+ }>) => Promise<DataRecord>;
483
+ delete: (id: string, input: Mutation<Version>) => Promise<{
484
+ id: string;
485
+ collection: string;
486
+ }>;
487
+ };
488
+ customRecords: {
489
+ list: () => Promise<CustomRecord[]>;
490
+ create: (input: Mutation<Omit<CustomRecord, "id">>) => Promise<CustomRecord>;
491
+ };
492
+ }
493
+ /** Former names, kept so code written against the alpha SDK keeps working. */
494
+ export { Yasad as Fresh, YasadError as FreshError };
495
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAkB7C;AAQD,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAC5D,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AACtD,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,M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AY,EAAE,IAAI,CAAC,CAAC;MAElD;CACH;AAED,8EAA8E;AAC9E,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,UAAU,IAAI,UAAU,EAAE,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,247 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { readFileSync } from 'node:fs';
3
+ import { parseEnv } from 'node:util';
4
+ import { isIP } from 'node:net';
5
+ /**
6
+ * The API origin a key may be sent to. HTTPS is required except for loopback and private-network
7
+ * development addresses, matching the MCP bridge. Paths, queries and URL credentials are refused so a
8
+ * key is only ever sent to a bare origin.
9
+ */
10
+ export function apiOrigin(raw) {
11
+ let u;
12
+ try {
13
+ u = new URL(raw);
14
+ }
15
+ catch {
16
+ throw new Error('YASAD_API_URL must be a full address such as https://api.example.com.');
17
+ }
18
+ if (u.username || u.password || u.search || u.hash || (u.pathname !== '/' && u.pathname !== ''))
19
+ throw new Error('YASAD_API_URL must be an origin only, with no path, query or credentials.');
20
+ const h = u.hostname;
21
+ const local = h === 'localhost' ||
22
+ h === '[::1]' ||
23
+ (isIP(h) === 4 &&
24
+ (/^127\./.test(h) || /^10\./.test(h) || /^192\.168\./.test(h) || /^172\.(1[6-9]|2[0-9]|3[01])\./.test(h)));
25
+ if (u.protocol !== 'https:' && !(u.protocol === 'http:' && local))
26
+ throw new Error('YASAD_API_URL must use https:// outside local development, so your key is never sent unencrypted.');
27
+ return u.origin;
28
+ }
29
+ /** YASAD_* is current; FRESH_* is read for env files made before the rename. Never mixed. */
30
+ function pair(source, set) {
31
+ const family = set(source.YASAD_API_KEY) ? 'YASAD' : set(source.FRESH_API_KEY) ? 'FRESH' : null;
32
+ return family ? { apiKey: set(source[`${family}_API_KEY`]), envUrl: set(source[`${family}_API_URL`]) } : { apiKey: undefined, envUrl: undefined };
33
+ }
34
+ export class YasadError extends Error {
35
+ details;
36
+ status;
37
+ code;
38
+ constructor(status, code, message, details) {
39
+ super(message);
40
+ this.name = 'YasadError';
41
+ this.details = details;
42
+ this.status = status;
43
+ this.code = code;
44
+ }
45
+ }
46
+ export class Yasad {
47
+ #baseUrl;
48
+ #apiKey;
49
+ /**
50
+ * Credentials come from exactly one place, and a key is only ever paired with its own origin:
51
+ * - `envFile`: the key and URL are read together from that file (inherited settings are ignored);
52
+ * - `apiKey`: pass `baseUrl` too; otherwise only the URL configured for that same key is used;
53
+ * - otherwise the environment: YASAD_API_KEY with YASAD_API_URL, else the legacy FRESH_* pair.
54
+ */
55
+ constructor(options = {}) {
56
+ const set = (value) => (value === undefined || value === '' ? undefined : value);
57
+ let apiKey, envUrl;
58
+ if (options.envFile !== undefined) {
59
+ if (options.apiKey !== undefined || options.baseUrl !== undefined) {
60
+ throw new Error('envFile supplies both the key and its origin; do not also pass apiKey or baseUrl.');
61
+ }
62
+ // Windows editors may save UTF-16 (PowerShell 5 `>`) or a UTF-8 byte-order mark; read both.
63
+ const raw = readFileSync(options.envFile);
64
+ const text = raw[0] === 0xff && raw[1] === 0xfe
65
+ ? raw.subarray(2).toString('utf16le')
66
+ : raw[0] === 0xfe && raw[1] === 0xff
67
+ ? Buffer.from(raw.subarray(2)).swap16().toString('utf16le')
68
+ : raw.toString('utf8').replace(/^\uFEFF/, '');
69
+ const values = parseEnv(text);
70
+ ({ apiKey, envUrl } = pair(values, set));
71
+ }
72
+ else if (options.apiKey !== undefined) {
73
+ apiKey = set(options.apiKey);
74
+ // Without baseUrl, only the origin configured for this same key may be used. An explicit key
75
+ // that matches neither configured key is never sent to an environment origin.
76
+ const env = process.env;
77
+ if (options.baseUrl === undefined && apiKey !== undefined) {
78
+ if (apiKey === set(env.YASAD_API_KEY))
79
+ envUrl = set(env.YASAD_API_URL);
80
+ else if (apiKey === set(env.FRESH_API_KEY))
81
+ envUrl = set(env.FRESH_API_URL);
82
+ else if (set(env.YASAD_API_URL) || set(env.FRESH_API_URL)) {
83
+ throw new Error('Pass baseUrl with apiKey: this key does not match YASAD_API_KEY or FRESH_API_KEY.');
84
+ }
85
+ }
86
+ }
87
+ else {
88
+ // An inherited key is only ever sent to the origin configured beside it.
89
+ if (options.baseUrl !== undefined)
90
+ throw new Error('Pass apiKey together with baseUrl, or use envFile.');
91
+ ({ apiKey, envUrl } = pair(process.env, set));
92
+ }
93
+ if (!apiKey)
94
+ throw new Error('YASAD_API_KEY is not set. Add YASAD_API_URL and YASAD_API_KEY to your server environment. ' +
95
+ 'Plain Node does not read .env files on its own: start it with `node --env-file=.env app.mjs`, ' +
96
+ "or pass new Yasad({ envFile: '.env' }). Frameworks such as Next.js load .env for server code.");
97
+ const url = options.baseUrl ?? envUrl;
98
+ // Never guess where to send a key: a missing URL used to fall back to a local default silently.
99
+ if (!url)
100
+ throw new Error('YASAD_API_URL is not set. Add it next to YASAD_API_KEY (copy both from Applications → your app → API keys), ' +
101
+ 'or pass baseUrl together with apiKey.');
102
+ this.#apiKey = apiKey;
103
+ this.#baseUrl = apiOrigin(url);
104
+ }
105
+ async #request(path, method = 'GET', input, mutationId) {
106
+ try {
107
+ const response = await fetch(this.#baseUrl + '/v1/' + path, {
108
+ method,
109
+ redirect: 'error',
110
+ headers: {
111
+ authorization: 'Bearer ' + this.#apiKey,
112
+ ...(input && { 'content-type': 'application/json' }),
113
+ },
114
+ ...(input && { body: JSON.stringify(input) }),
115
+ signal: AbortSignal.timeout(15000),
116
+ });
117
+ const text = await response.text();
118
+ let result;
119
+ try {
120
+ result = JSON.parse(text);
121
+ }
122
+ catch {
123
+ // An HTML page usually means YASAD_API_URL points at a website rather than the Yasad API.
124
+ // Keep the HTTP status so the cause is visible. A proxy error can arrive after a change was
125
+ // committed, so a mutation's outcome stays unconfirmed and its requestId is attached below.
126
+ const read = mutationId === undefined;
127
+ throw new YasadError(response.status, 'UNEXPECTED_RESPONSE', 'Expected JSON from ' + this.#baseUrl + ' but got HTTP ' + response.status + '. Check that YASAD_API_URL is your Yasad API address, not the website.', { outcome: read ? 'read_failed' : 'unconfirmed', retryable: read,
128
+ recovery: (read ? '' : 'Check the original request receipt before repeating this change. ') +
129
+ 'Copy YASAD_API_URL again from Applications → your app → API keys.' });
130
+ }
131
+ if (!response.ok)
132
+ throw new YasadError(response.status, result.error, result.message, result.details);
133
+ return result;
134
+ }
135
+ catch (error) {
136
+ if (error instanceof YasadError) {
137
+ if (mutationId === undefined || !error.details)
138
+ throw error;
139
+ throw new YasadError(error.status, error.code, error.message, { ...error.details, requestId: mutationId });
140
+ }
141
+ const read = mutationId === undefined;
142
+ const recovery = read ? 'Try loading this information again.' : 'Check the original request receipt before repeating this change.';
143
+ throw new YasadError(0, read ? 'READ_UNAVAILABLE' : 'OUTCOME_UNCONFIRMED', read ? 'The response could not be read.' : 'The outcome of the request could not be confirmed.', { outcome: read ? 'read_failed' : 'unconfirmed', retryable: read, recovery,
144
+ ...(mutationId !== undefined && { requestId: mutationId }) });
145
+ }
146
+ }
147
+ async #mutate(path, input, method = 'POST') {
148
+ const requestId = input.requestId ?? randomUUID();
149
+ const receipt = await this.#request(path, method, { ...input, requestId }, requestId);
150
+ return receipt.value;
151
+ }
152
+ pageBusinessRecords = (input) => this.#request('records/page', 'POST', input);
153
+ summarizeRecords = (input) => this.#request('data/summary', 'POST', input);
154
+ deployments = () => this.#request('deployments');
155
+ usage = () => this.#request('usage');
156
+ capabilities = () => this.#request('capabilities');
157
+ export = () => this.#request('export');
158
+ customers = {
159
+ list: () => this.#request('customers'),
160
+ create: (input) => this.#mutate('customers', input),
161
+ };
162
+ resources = {
163
+ list: () => this.#request('resources'),
164
+ create: (input) => this.#mutate('resources', input),
165
+ update: (id, input) => this.#mutate('resources/' + encodeURIComponent(id), input, 'PATCH'),
166
+ };
167
+ reservations = {
168
+ list: () => this.#request('reservations'),
169
+ availability: (input) => this.#request('availability', 'POST', input),
170
+ hold: (input) => this.#mutate('reservations/hold', input),
171
+ confirm: (id, input) => this.#mutate('reservations/' + encodeURIComponent(id) + '/confirm', input),
172
+ cancel: (id, input) => this.#mutate('reservations/' + encodeURIComponent(id) + '/cancel', input),
173
+ };
174
+ orders = {
175
+ list: () => this.#request('orders'),
176
+ get: (id) => this.#request('orders/' + encodeURIComponent(id)),
177
+ create: (input) => this.#mutate('orders', input),
178
+ update: (id, input) => this.#mutate('orders/' + encodeURIComponent(id), input, 'PATCH'),
179
+ };
180
+ emails = {
181
+ send: (input) => this.#mutate('emails', input),
182
+ list: () => this.#request('emails'),
183
+ sender: () => this.#request('emails/sender'),
184
+ setSender: (input) => this.#mutate('emails/sender', input),
185
+ };
186
+ files = {
187
+ list: () => this.#request('files'),
188
+ createUpload: async (input) => {
189
+ const f = await this.#mutate('files', input);
190
+ return { ...f, uploadUrl: new URL(f.uploadUrl, this.#baseUrl).href };
191
+ },
192
+ finalize: (id, requestId) => this.#mutate('files/' + encodeURIComponent(id) + '/finalize', { requestId }),
193
+ download: async (id) => {
194
+ const v = await this.#request('files/' + encodeURIComponent(id) + '/download');
195
+ return { ...v, url: new URL(v.url, this.#baseUrl).href };
196
+ },
197
+ attach: (id, input) => this.#mutate('files/' + encodeURIComponent(id) + '/attach', input),
198
+ visibility: (id, input) => this.#mutate('files/' + encodeURIComponent(id) + '/visibility', input),
199
+ delete: (id, requestId) => this.#mutate('files/' + encodeURIComponent(id), { requestId }, 'DELETE'),
200
+ };
201
+ payments = {
202
+ merchant: () => this.#request('payments/merchant'),
203
+ connect: (input) => this.#mutate('payments/merchant', input),
204
+ refresh: (requestId) => this.#mutate('payments/merchant/refresh', { requestId }),
205
+ checkout: (input) => this.#mutate('payments/checkout', input),
206
+ operation: (id) => this.#request('payments/operations/' + encodeURIComponent(id)),
207
+ operations: () => this.#request('payments/operations'),
208
+ reconcile: (input) => this.#mutate('payments/reconcile', input),
209
+ simulate: (input) => this.#mutate('payments/simulate', input),
210
+ refund: (input) => this.#mutate('payments/refund', input),
211
+ list: () => this.#request('payments'),
212
+ record: (input) => this.#mutate('payments', input),
213
+ };
214
+ events = { list: () => this.#request('events') };
215
+ webhooks = {
216
+ list: () => this.#request('webhooks'),
217
+ create: (input) => this.#mutate('webhooks', input),
218
+ disable: (id, requestId) => this.#mutate('webhooks/' + encodeURIComponent(id) + '/disable', {
219
+ requestId,
220
+ }),
221
+ deliveries: () => this.#request('webhooks/deliveries'),
222
+ retry: (id, requestId) => this.#mutate('webhooks/deliveries/' + encodeURIComponent(id) + '/retry', { requestId }),
223
+ };
224
+ collections = {
225
+ list: () => this.#request('collections'),
226
+ get: (collection) => this.#request('collections/schema', 'POST', { collection }),
227
+ create: (input) => this.#mutate('collections', input),
228
+ update: (input) => this.#mutate('collections', input, 'PATCH'),
229
+ };
230
+ data = {
231
+ create: (collection, data, requestId) => this.#mutate('data', Object.assign({ collection, data }, { requestId })),
232
+ get: (id) => this.#request('data/' + encodeURIComponent(id)),
233
+ query: (collection, query = {}) => this.#request('data/query', 'POST', {
234
+ ...query,
235
+ collection,
236
+ }),
237
+ update: (id, input) => this.#mutate('data/' + encodeURIComponent(id), input, 'PATCH'),
238
+ delete: (id, input) => this.#mutate('data/' + encodeURIComponent(id), input, 'DELETE'),
239
+ };
240
+ customRecords = {
241
+ list: () => this.#request('custom-records'),
242
+ create: (input) => this.#mutate('custom-records', input),
243
+ };
244
+ }
245
+ /** Former names, kept so code written against the alpha SDK keeps working. */
246
+ export { Yasad as Fresh, YasadError as FreshError };
247
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,IAAI,CAAM,CAAC;IACX,IAAI,CAAC;QACH,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;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AC,QAAQ,CAAa,OAAO,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;QAChF,KAAK,EAAE,CAAC,UAAkB,EAAE,QAAqB,EAAE,EAAE,EAAE,CACrD,IAAI,CAAC,QAAQ,CAAuD,YAAY,EAAE,MAAM,EAAE;YACxF,GAAG,KAAK;YACR,UAAU;SACX,CAAC;QACJ,MAAM,EAAE,CAAC,EAAU,EAAE,KAA4D,EAAE,EAAE,CACnF,IAAI,CAAC,OAAO,CAAa,OAAO,GAAG,kBAAkB,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC;QAC5E,MAAM,EAAE,CAAC,EAAU,EAAE,KAAwB,EAAE,EAAE,CAC/C,IAAI,CAAC,OAAO,CAAqC,OAAO,GAAG,kBAAkB,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC;KACtG,CAAC;IACF,aAAa,GAAG;QACd,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAiB,gBAAgB,CAAC;QAC3D,MAAM,EAAE,CAAC,KAAyC,EAAE,EAAE,CACpD,IAAI,CAAC,OAAO,CAAe,gBAAgB,EAAE,KAAK,CAAC;KACtD,CAAC;CACH;AAED,8EAA8E;AAC9E,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,UAAU,IAAI,UAAU,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
2
  "name": "@yasad/client",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "Server-side TypeScript client for the Yasad REST API.",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "yasadInfra": {
8
+ "layer": "integration",
9
+ "provides": "sdk"
10
+ },
11
+ "engines": {
12
+ "node": ">=24"
13
+ },
14
+ "keywords": [
15
+ "yasad",
16
+ "sdk",
17
+ "api-client"
18
+ ],
19
+ "files": [
20
+ "dist",
21
+ "README.md"
22
+ ],
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/index.js"
27
+ }
28
+ },
29
+ "scripts": {
30
+ "build": "tsc --project tsconfig.json",
31
+ "prepack": "tsc --project tsconfig.json"
32
+ },
33
+ "sideEffects": false,
34
+ "publishConfig": {
35
+ "access": "public"
36
+ }
37
+ }