@yasad/client 0.0.0-stage → 0.1.0

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,107 @@
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
+ ```sh
6
+ npm install @yasad/client
7
+ npx yasad init https://YOUR-API-ORIGIN # makes a private ~/.yasad/workspace.env key file; approve its code in Yasad
8
+ ```
9
+
10
+ ```ts
11
+ import { randomUUID } from 'node:crypto';
12
+ import { homedir } from 'node:os';
13
+ import { Yasad } from '@yasad/client';
14
+
15
+ const yasad = new Yasad({ envFile: `${homedir()}/.yasad/workspace.env` }); // key and API origin, read together
16
+ const requestId = randomUUID(); // keep this and reuse it if you retry the same create
17
+ const customer = await yasad.customers.create({ requestId, name: 'Jane Smith', email: 'jane@example.com' });
18
+ ```
19
+
20
+ The raw key stays in that private file, which lives outside your repository; only its digest is approved in the dashboard. Use the API origin shown on the dashboard's Connect page.
21
+
22
+ Credentials always come from one place, and a key is only ever sent to its own origin:
23
+
24
+ - `new Yasad({ envFile })` reads the key and URL together from the file and ignores inherited settings.
25
+ - `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.
26
+ - `new Yasad({ apiKey, baseUrl })` uses exactly what you pass. `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.
27
+
28
+ 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 and message. Find the current contract at `/openapi.json` and the operations your key may use with `await yasad.capabilities()`.
29
+
30
+ 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.
31
+
32
+ | Interface | Operations |
33
+ | --- | --- |
34
+ | `yasad.capabilities()`, `yasad.export()` | Discover permitted operations and retrieve a workspace snapshot |
35
+ | `yasad.customers`, `yasad.customRecords` | List and create |
36
+ | `yasad.resources` | List, create and update capacity, price and buffers |
37
+ | `yasad.reservations` | List, check availability, hold, confirm and cancel |
38
+ | `yasad.orders` | List, get, create and update |
39
+ | `yasad.payments` | List and record manual USD-cent payments |
40
+
41
+ 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.
42
+
43
+ ```js
44
+ // Store this intent durably before the first call and reload it for every retry.
45
+ const intent = {requestId: crypto.randomUUID(), name: 'Avery Lee', email: 'avery@example.test'};
46
+ const customer = await yasad.customers.create(intent);
47
+ ```
48
+
49
+ 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.
50
+
51
+ ## Collections
52
+
53
+ `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.
54
+
55
+ ```ts
56
+ await yasad.collections.create({name:'recipes', fields:{
57
+ name:{type:'string',required:true}, flourGrams:{type:'number',default:500}
58
+ }});
59
+ const loaf = await yasad.data.create('recipes',{name:'Country sourdough'},crypto.randomUUID());
60
+ const {records,nextOffset} = await yasad.data.query('recipes',{
61
+ filter:{flourGrams:500},sort:'name',limit:50,offset:0
62
+ });
63
+ await yasad.data.update(loaf.id,{revision:loaf.revision,data:{...loaf.data,flourGrams:510}});
64
+ ```
65
+
66
+ 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.
67
+
68
+ ## Checkout and refunds
69
+
70
+ 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.
71
+
72
+ ```ts
73
+ const intent=await yasad.payments.checkout({orderId:order.id,amount:'deposit',
74
+ successUrl:'https://shop.example.test/done',cancelUrl:'https://shop.example.test/cart',requestId});
75
+ const current=await yasad.payments.operation(intent.id);
76
+ ```
77
+
78
+ 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.
79
+
80
+ ## Files, email and events
81
+
82
+ ```ts
83
+ const upload=await yasad.files.createUpload({name:'service.jpg',contentType:'image/jpeg',sizeBytes:bytes.length});
84
+ const response=await fetch(upload.uploadUrl,{method:'PUT',headers:{'content-type':'image/jpeg'},body:bytes});
85
+ if(!response.ok) throw Error('Upload failed');
86
+ await yasad.files.finalize(upload.id);
87
+ await yasad.files.attach(upload.id,{target:{entity:'record',id:equipment.id}});
88
+ const link=await yasad.files.download(upload.id);
89
+ ```
90
+
91
+ 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.
92
+
93
+ 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.
94
+
95
+ 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.
96
+
97
+ `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. Fresh API keys and provider configuration belong on the server. The provider setup guide is available from the running API at `/providers/guide`.
98
+
99
+ 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.
100
+
101
+ ### Extensions and hosting history
102
+
103
+ `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.
104
+
105
+ `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.
106
+
107
+ 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,489 @@
1
+ export type CustomerInput = {
2
+ name: string;
3
+ email: string;
4
+ };
5
+ export type Customer = CustomerInput & {
6
+ id: string;
7
+ };
8
+ export type ResourceInput = {
9
+ name: string;
10
+ kind: string;
11
+ capacity: number;
12
+ unitCents?: number | null;
13
+ archived?: boolean;
14
+ bufferBeforeMinutes?: number;
15
+ bufferAfterMinutes?: number;
16
+ };
17
+ export type Resource = Required<ResourceInput> & {
18
+ id: string;
19
+ tenantId: string;
20
+ revision: number;
21
+ };
22
+ export type Allocation = {
23
+ resourceId: string;
24
+ quantity: number;
25
+ };
26
+ export type ReservationWindow = {
27
+ startsAt: string;
28
+ endsAt: string;
29
+ };
30
+ export type Demand = ReservationWindow & {
31
+ allocations: Allocation[];
32
+ };
33
+ export type AllocatedWindow = Allocation & ReservationWindow & {
34
+ resourceName: string;
35
+ resourceKind: string;
36
+ };
37
+ export type Availability = ReservationWindow & {
38
+ allocations: AllocatedWindow[];
39
+ };
40
+ export type Reservation = Availability & {
41
+ id: string;
42
+ revision: number;
43
+ tenantId: string;
44
+ customerLabel: string;
45
+ expiresAt: string;
46
+ status: 'held' | 'confirmed' | 'cancelled' | 'expired' | 'requested' | 'pending' | 'completed';
47
+ };
48
+ export type OrderStatus = 'awaiting_payment' | 'payment_expired' | 'payment_review' | 'placed' | 'ready' | 'fulfilled' | 'cancelled';
49
+ export type OrderInput = ReservationWindow & {
50
+ customer: CustomerInput;
51
+ lines: (Allocation & {
52
+ expectedUnitCents: number;
53
+ })[];
54
+ };
55
+ export type Order = ReservationWindow & {
56
+ id: string;
57
+ customerId: string;
58
+ reservationId: string;
59
+ status: OrderStatus;
60
+ requiredCents?: number;
61
+ holdExpiresAt?: string;
62
+ revision: number;
63
+ createdAt: string;
64
+ lines: (Allocation & {
65
+ name: string;
66
+ unitCents: number;
67
+ })[];
68
+ totalCents: number;
69
+ currency: 'USD';
70
+ };
71
+ export type Payment = {
72
+ id: string;
73
+ orderId: string;
74
+ amountCents: number;
75
+ currency: 'USD';
76
+ method: 'manual' | 'stripe';
77
+ checkoutId?: string;
78
+ recordedAt: string;
79
+ };
80
+ export type CustomRecord = {
81
+ id: string;
82
+ collection: string;
83
+ data: Record<string, unknown>;
84
+ };
85
+ export type WorkspaceFile = {
86
+ id: string;
87
+ name: string;
88
+ contentType: string;
89
+ sizeBytes: number;
90
+ sha256: string | null;
91
+ status: string;
92
+ public: boolean;
93
+ entity: string | null;
94
+ entityId: string | null;
95
+ expiresAt: string;
96
+ };
97
+ export type EmailMessage = {
98
+ id: string;
99
+ to: string;
100
+ from: string;
101
+ createdAt: string;
102
+ status: string;
103
+ attempts: number;
104
+ providerId: string | null;
105
+ error: string | null;
106
+ };
107
+ export type PaymentJob = {
108
+ id: string;
109
+ kind: string;
110
+ orderId: string | null;
111
+ amountCents: number;
112
+ status: string;
113
+ url?: string | null;
114
+ error?: string | null;
115
+ refundedCents?: number;
116
+ };
117
+ export type Merchant = {
118
+ mode: string;
119
+ ready: boolean;
120
+ reason: string;
121
+ capabilities?: Record<string, string>;
122
+ depositBps?: number;
123
+ origins?: string[];
124
+ };
125
+ export type BusinessEvent = {
126
+ id: string;
127
+ type: string;
128
+ entityId: string;
129
+ at: string;
130
+ };
131
+ export type Subscription = {
132
+ id: string;
133
+ url: string;
134
+ types: string[];
135
+ enabled: boolean;
136
+ };
137
+ export type Delivery = {
138
+ id: string;
139
+ subscriptionId: string;
140
+ eventId: string;
141
+ status: string;
142
+ attempts: number;
143
+ nextAt: string;
144
+ history: {
145
+ at: string;
146
+ attempt: number;
147
+ outcome: string;
148
+ }[];
149
+ };
150
+ export type Field = {
151
+ type: 'string' | 'text' | 'integer' | 'number' | 'boolean' | 'date' | 'datetime' | 'enum' | 'json' | 'record' | 'native';
152
+ required?: boolean;
153
+ default?: unknown;
154
+ values?: string[];
155
+ target?: string;
156
+ unique?: boolean;
157
+ };
158
+ export type CollectionInput = {
159
+ name: string;
160
+ fields: Record<string, Field>;
161
+ };
162
+ export type Collection = CollectionInput & {
163
+ version: number;
164
+ legacy: boolean;
165
+ };
166
+ export type DataRecord = CustomRecord & {
167
+ revision: number;
168
+ schemaVersion: number;
169
+ };
170
+ export type RecordQuery = {
171
+ filter?: Record<string, unknown>;
172
+ sort?: string;
173
+ descending?: boolean;
174
+ limit?: number;
175
+ offset?: number;
176
+ };
177
+ export type WorkspaceExport = {
178
+ version: 1;
179
+ workspace: {
180
+ id: string;
181
+ name: string;
182
+ };
183
+ customers: Customer[];
184
+ resources: Resource[];
185
+ reservations: Reservation[];
186
+ orders: Order[];
187
+ payments: Payment[];
188
+ customRecords: CustomRecord[];
189
+ collections: Collection[];
190
+ collectionVersions: Collection[];
191
+ records: DataRecord[];
192
+ relationships?: {
193
+ source: string;
194
+ field: string;
195
+ target: string;
196
+ kind: string;
197
+ }[];
198
+ files?: {
199
+ id: string;
200
+ name: string;
201
+ content_type: string;
202
+ size_bytes: number;
203
+ sha256: string | null;
204
+ entity: string | null;
205
+ entity_id: string | null;
206
+ record_id: string | null;
207
+ }[];
208
+ applications?: {
209
+ id: string;
210
+ name: string;
211
+ app_type: string;
212
+ revision: number;
213
+ }[];
214
+ };
215
+ export type Capabilities = {
216
+ /** Older servers may omit workspace context. A null caller denotes a standalone grant. */
217
+ context?: {
218
+ workspaceName: string;
219
+ environment: 'sandbox';
220
+ caller: {
221
+ id: string;
222
+ kind: 'application' | 'assistant';
223
+ name: string;
224
+ } | null;
225
+ businessDescription?: string;
226
+ documentation: {
227
+ guide: string;
228
+ sdk: string;
229
+ contract: string;
230
+ };
231
+ };
232
+ version: number;
233
+ workspaceId: string;
234
+ role: 'reader' | 'operator' | 'storefront' | 'integrations' | 'mailer';
235
+ capabilities: string[];
236
+ payments: boolean;
237
+ operations: string[];
238
+ openapi: string;
239
+ currency: 'USD';
240
+ paymentMethods: string[];
241
+ maxRequestBytes: number;
242
+ };
243
+ type Mutation<T> = T & {
244
+ requestId?: string;
245
+ };
246
+ type Version = {
247
+ revision: number;
248
+ };
249
+ export type RecoveryDetails = {
250
+ reference?: string;
251
+ outcome: 'unconfirmed' | 'read_failed' | 'rejected';
252
+ recovery: string;
253
+ retryable: boolean;
254
+ retryAfterSeconds?: number;
255
+ field?: string;
256
+ requestId?: string;
257
+ };
258
+ export declare class YasadError extends Error {
259
+ readonly details?: RecoveryDetails;
260
+ readonly status: number;
261
+ readonly code: string;
262
+ constructor(status: number, code: string, message: string, details?: RecoveryDetails);
263
+ }
264
+ export declare class Yasad {
265
+ #private;
266
+ /**
267
+ * Credentials come from exactly one place, and a key is only ever paired with its own origin:
268
+ * - `envFile`: the key and URL are read together from that file (inherited settings are ignored);
269
+ * - `apiKey`: pass `baseUrl` too; otherwise only the URL configured for that same key is used;
270
+ * - otherwise the environment: YASAD_API_KEY with YASAD_API_URL, else the legacy FRESH_* pair.
271
+ */
272
+ constructor(options?: {
273
+ apiKey?: string;
274
+ baseUrl?: string;
275
+ envFile?: string;
276
+ });
277
+ pageBusinessRecords: (input: {
278
+ entity: "customers" | "resources" | "reservations" | "orders" | "payments";
279
+ ids?: string[];
280
+ after?: string;
281
+ limit?: number;
282
+ }) => Promise<{
283
+ records: (Customer | Resource | Reservation | Order | Payment)[];
284
+ next: string | null;
285
+ }>;
286
+ summarizeRecords: (input: {
287
+ collection: string;
288
+ field?: string;
289
+ filter?: Record<string, unknown>;
290
+ }) => Promise<{
291
+ count: string;
292
+ sum: string | null;
293
+ min: string | null;
294
+ max: string | null;
295
+ }>;
296
+ deployments: () => Promise<{
297
+ id: string;
298
+ applicationId: string;
299
+ action: string;
300
+ revision: string;
301
+ status: string;
302
+ createdAt: string;
303
+ }[]>;
304
+ usage: () => Promise<Record<string, number>>;
305
+ capabilities: () => Promise<Capabilities>;
306
+ export: () => Promise<WorkspaceExport>;
307
+ customers: {
308
+ list: () => Promise<Customer[]>;
309
+ create: (input: Mutation<CustomerInput>) => Promise<Customer>;
310
+ };
311
+ resources: {
312
+ list: () => Promise<Resource[]>;
313
+ create: (input: Mutation<ResourceInput>) => Promise<Resource>;
314
+ update: (id: string, input: Mutation<ResourceInput & Version>) => Promise<Resource>;
315
+ };
316
+ reservations: {
317
+ list: () => Promise<Reservation[]>;
318
+ availability: (input: Demand) => Promise<Availability>;
319
+ hold: (input: Mutation<Demand & {
320
+ customerLabel: string;
321
+ holdMinutes: number;
322
+ }>) => Promise<Reservation>;
323
+ confirm: (id: string, input: Mutation<Version>) => Promise<Reservation>;
324
+ cancel: (id: string, input: Mutation<Version>) => Promise<Reservation>;
325
+ };
326
+ orders: {
327
+ list: () => Promise<Order[]>;
328
+ get: (id: string) => Promise<Order>;
329
+ create: (input: Mutation<OrderInput>) => Promise<Order>;
330
+ update: (id: string, input: Mutation<Version & {
331
+ status: OrderStatus;
332
+ }>) => Promise<Order>;
333
+ };
334
+ emails: {
335
+ send: (input: Mutation<{
336
+ to: string;
337
+ subject: string;
338
+ html?: string;
339
+ text?: string;
340
+ }>) => Promise<EmailMessage>;
341
+ list: () => Promise<(EmailMessage & {
342
+ history: {
343
+ type: string;
344
+ at: string;
345
+ }[];
346
+ })[]>;
347
+ sender: () => Promise<{
348
+ address: string;
349
+ mode: string;
350
+ custom: boolean;
351
+ }>;
352
+ setSender: (input: Mutation<{
353
+ address: string | null;
354
+ }>) => Promise<{
355
+ address: string;
356
+ custom: boolean;
357
+ }>;
358
+ };
359
+ files: {
360
+ list: () => Promise<WorkspaceFile[]>;
361
+ createUpload: (input: Mutation<{
362
+ name: string;
363
+ contentType: string;
364
+ sizeBytes: number;
365
+ sha256?: string;
366
+ }>) => Promise<{
367
+ uploadUrl: string;
368
+ id: string;
369
+ name: string;
370
+ contentType: string;
371
+ sizeBytes: number;
372
+ sha256: string | null;
373
+ status: string;
374
+ public: boolean;
375
+ entity: string | null;
376
+ entityId: string | null;
377
+ expiresAt: string;
378
+ method: "PUT";
379
+ }>;
380
+ finalize: (id: string, requestId?: string) => Promise<WorkspaceFile>;
381
+ download: (id: string) => Promise<{
382
+ url: string;
383
+ expiresIn: number;
384
+ }>;
385
+ attach: (id: string, input: Mutation<{
386
+ target: {
387
+ entity: string;
388
+ id: string;
389
+ } | null;
390
+ }>) => Promise<WorkspaceFile>;
391
+ visibility: (id: string, input: Mutation<{
392
+ public: boolean;
393
+ }>) => Promise<{
394
+ id: string;
395
+ public: boolean;
396
+ url: string | null;
397
+ }>;
398
+ delete: (id: string, requestId?: string) => Promise<{
399
+ id: string;
400
+ status: string;
401
+ }>;
402
+ };
403
+ payments: {
404
+ merchant: () => Promise<Merchant>;
405
+ connect: (input: Mutation<{
406
+ origins: string[];
407
+ returnUrl: string;
408
+ refreshUrl: string;
409
+ depositBps: number;
410
+ }>) => Promise<PaymentJob>;
411
+ refresh: (requestId?: string) => Promise<PaymentJob>;
412
+ checkout: (input: Mutation<{
413
+ orderId: string;
414
+ amount: "full" | "deposit" | "remaining";
415
+ successUrl: string;
416
+ cancelUrl: string;
417
+ }>) => Promise<PaymentJob>;
418
+ operation: (id: string) => Promise<PaymentJob>;
419
+ operations: () => Promise<PaymentJob[]>;
420
+ reconcile: (input: Mutation<{
421
+ checkoutId: string;
422
+ sessionId?: string;
423
+ }>) => Promise<PaymentJob>;
424
+ simulate: (input: Mutation<{
425
+ checkoutId: string;
426
+ status: "paid" | "expired";
427
+ }>) => Promise<PaymentJob>;
428
+ refund: (input: Mutation<{
429
+ checkoutId: string;
430
+ amountCents?: number;
431
+ }>) => Promise<PaymentJob>;
432
+ list: () => Promise<Payment[]>;
433
+ record: (input: Mutation<{
434
+ orderId: string;
435
+ amountCents: number;
436
+ }>) => Promise<Payment>;
437
+ };
438
+ events: {
439
+ list: () => Promise<BusinessEvent[]>;
440
+ };
441
+ webhooks: {
442
+ list: () => Promise<Subscription[]>;
443
+ create: (input: Mutation<{
444
+ url: string;
445
+ types: string[];
446
+ }>) => Promise<Subscription & {
447
+ publicKey: string;
448
+ }>;
449
+ disable: (id: string, requestId?: string) => Promise<{
450
+ id: string;
451
+ enabled: boolean;
452
+ }>;
453
+ deliveries: () => Promise<Delivery[]>;
454
+ retry: (id: string, requestId?: string) => Promise<{
455
+ id: string;
456
+ status: string;
457
+ }>;
458
+ };
459
+ collections: {
460
+ list: () => Promise<Collection[]>;
461
+ get: (collection: string) => Promise<Collection>;
462
+ create: (input: Mutation<CollectionInput>) => Promise<Collection>;
463
+ update: (input: Mutation<CollectionInput & {
464
+ version: number;
465
+ }>) => Promise<Collection>;
466
+ };
467
+ data: {
468
+ create: (collection: string, data: Record<string, unknown>, requestId?: string) => Promise<DataRecord>;
469
+ get: (id: string) => Promise<DataRecord>;
470
+ query: (collection: string, query?: RecordQuery) => Promise<{
471
+ records: DataRecord[];
472
+ nextOffset: number | null;
473
+ }>;
474
+ update: (id: string, input: Mutation<Version & {
475
+ data: Record<string, unknown>;
476
+ }>) => Promise<DataRecord>;
477
+ delete: (id: string, input: Mutation<Version>) => Promise<{
478
+ id: string;
479
+ collection: string;
480
+ }>;
481
+ };
482
+ customRecords: {
483
+ list: () => Promise<CustomRecord[]>;
484
+ create: (input: Mutation<Omit<CustomRecord, "id">>) => Promise<CustomRecord>;
485
+ };
486
+ }
487
+ /** Former names, kept so code written against the alpha SDK keeps working. */
488
+ export { Yasad as Fresh, YasadError as FreshError };
489
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAC5D,MAAM,MAAM,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,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SAAE,CAAC;qBAEpE,MAAM,SAAS,QAAQ,CAAC,OAAO,CAAC;gBACxB,MAAM;wBAAc,MAAM;;MAC/C;IACF,aAAa;;wBAEK,QAAQ,CAAC,IAAI,CAAC,YAAY,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,195 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { readFileSync } from 'node:fs';
3
+ import { parseEnv } from 'node:util';
4
+ /** YASAD_* is current; FRESH_* is read for env files made before the rename. Never mixed. */
5
+ function pair(source, set) {
6
+ const family = set(source.YASAD_API_KEY) ? 'YASAD' : set(source.FRESH_API_KEY) ? 'FRESH' : null;
7
+ return family ? { apiKey: set(source[`${family}_API_KEY`]), envUrl: set(source[`${family}_API_URL`]) } : { apiKey: undefined, envUrl: undefined };
8
+ }
9
+ export class YasadError extends Error {
10
+ details;
11
+ status;
12
+ code;
13
+ constructor(status, code, message, details) {
14
+ super(message);
15
+ this.name = 'YasadError';
16
+ this.details = details;
17
+ this.status = status;
18
+ this.code = code;
19
+ }
20
+ }
21
+ export class Yasad {
22
+ #baseUrl;
23
+ #apiKey;
24
+ /**
25
+ * Credentials come from exactly one place, and a key is only ever paired with its own origin:
26
+ * - `envFile`: the key and URL are read together from that file (inherited settings are ignored);
27
+ * - `apiKey`: pass `baseUrl` too; otherwise only the URL configured for that same key is used;
28
+ * - otherwise the environment: YASAD_API_KEY with YASAD_API_URL, else the legacy FRESH_* pair.
29
+ */
30
+ constructor(options = {}) {
31
+ const set = (value) => (value === undefined || value === '' ? undefined : value);
32
+ let apiKey, envUrl;
33
+ if (options.envFile !== undefined) {
34
+ if (options.apiKey !== undefined || options.baseUrl !== undefined) {
35
+ throw new Error('envFile supplies both the key and its origin; do not also pass apiKey or baseUrl.');
36
+ }
37
+ const values = parseEnv(readFileSync(options.envFile, 'utf8'));
38
+ ({ apiKey, envUrl } = pair(values, set));
39
+ }
40
+ else if (options.apiKey !== undefined) {
41
+ apiKey = set(options.apiKey);
42
+ // Without baseUrl, only the origin configured for this same key may be used. An explicit key
43
+ // that matches neither configured key is never sent to an environment origin.
44
+ const env = process.env;
45
+ if (options.baseUrl === undefined && apiKey !== undefined) {
46
+ if (apiKey === set(env.YASAD_API_KEY))
47
+ envUrl = set(env.YASAD_API_URL);
48
+ else if (apiKey === set(env.FRESH_API_KEY))
49
+ envUrl = set(env.FRESH_API_URL);
50
+ else if (set(env.YASAD_API_URL) || set(env.FRESH_API_URL)) {
51
+ throw new Error('Pass baseUrl with apiKey: this key does not match YASAD_API_KEY or FRESH_API_KEY.');
52
+ }
53
+ }
54
+ }
55
+ else {
56
+ // An inherited key is only ever sent to the origin configured beside it.
57
+ if (options.baseUrl !== undefined)
58
+ throw new Error('Pass apiKey together with baseUrl, or use envFile.');
59
+ ({ apiKey, envUrl } = pair(process.env, set));
60
+ }
61
+ if (!apiKey)
62
+ throw new Error('Set a server-side YASAD_API_KEY, pass envFile, or pass apiKey.');
63
+ this.#apiKey = apiKey;
64
+ this.#baseUrl = (options.baseUrl ?? envUrl ?? 'http://127.0.0.1:4310').replace(/\/$/, '');
65
+ }
66
+ async #request(path, method = 'GET', input, mutationId) {
67
+ try {
68
+ const response = await fetch(this.#baseUrl + '/v1/' + path, {
69
+ method,
70
+ redirect: 'error',
71
+ headers: {
72
+ authorization: 'Bearer ' + this.#apiKey,
73
+ ...(input && { 'content-type': 'application/json' }),
74
+ },
75
+ ...(input && { body: JSON.stringify(input) }),
76
+ signal: AbortSignal.timeout(15000),
77
+ });
78
+ const result = await response.json();
79
+ if (!response.ok)
80
+ throw new YasadError(response.status, result.error, result.message, result.details);
81
+ return result;
82
+ }
83
+ catch (error) {
84
+ if (error instanceof YasadError) {
85
+ if (mutationId === undefined || !error.details)
86
+ throw error;
87
+ throw new YasadError(error.status, error.code, error.message, { ...error.details, requestId: mutationId });
88
+ }
89
+ const read = mutationId === undefined;
90
+ const recovery = read ? 'Try loading this information again.' : 'Check the original request receipt before repeating this change.';
91
+ 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,
92
+ ...(mutationId !== undefined && { requestId: mutationId }) });
93
+ }
94
+ }
95
+ async #mutate(path, input, method = 'POST') {
96
+ const requestId = input.requestId ?? randomUUID();
97
+ const receipt = await this.#request(path, method, { ...input, requestId }, requestId);
98
+ return receipt.value;
99
+ }
100
+ pageBusinessRecords = (input) => this.#request('records/page', 'POST', input);
101
+ summarizeRecords = (input) => this.#request('data/summary', 'POST', input);
102
+ deployments = () => this.#request('deployments');
103
+ usage = () => this.#request('usage');
104
+ capabilities = () => this.#request('capabilities');
105
+ export = () => this.#request('export');
106
+ customers = {
107
+ list: () => this.#request('customers'),
108
+ create: (input) => this.#mutate('customers', input),
109
+ };
110
+ resources = {
111
+ list: () => this.#request('resources'),
112
+ create: (input) => this.#mutate('resources', input),
113
+ update: (id, input) => this.#mutate('resources/' + encodeURIComponent(id), input, 'PATCH'),
114
+ };
115
+ reservations = {
116
+ list: () => this.#request('reservations'),
117
+ availability: (input) => this.#request('availability', 'POST', input),
118
+ hold: (input) => this.#mutate('reservations/hold', input),
119
+ confirm: (id, input) => this.#mutate('reservations/' + encodeURIComponent(id) + '/confirm', input),
120
+ cancel: (id, input) => this.#mutate('reservations/' + encodeURIComponent(id) + '/cancel', input),
121
+ };
122
+ orders = {
123
+ list: () => this.#request('orders'),
124
+ get: (id) => this.#request('orders/' + encodeURIComponent(id)),
125
+ create: (input) => this.#mutate('orders', input),
126
+ update: (id, input) => this.#mutate('orders/' + encodeURIComponent(id), input, 'PATCH'),
127
+ };
128
+ emails = {
129
+ send: (input) => this.#mutate('emails', input),
130
+ list: () => this.#request('emails'),
131
+ sender: () => this.#request('emails/sender'),
132
+ setSender: (input) => this.#mutate('emails/sender', input),
133
+ };
134
+ files = {
135
+ list: () => this.#request('files'),
136
+ createUpload: async (input) => {
137
+ const f = await this.#mutate('files', input);
138
+ return { ...f, uploadUrl: new URL(f.uploadUrl, this.#baseUrl).href };
139
+ },
140
+ finalize: (id, requestId) => this.#mutate('files/' + encodeURIComponent(id) + '/finalize', { requestId }),
141
+ download: async (id) => {
142
+ const v = await this.#request('files/' + encodeURIComponent(id) + '/download');
143
+ return { ...v, url: new URL(v.url, this.#baseUrl).href };
144
+ },
145
+ attach: (id, input) => this.#mutate('files/' + encodeURIComponent(id) + '/attach', input),
146
+ visibility: (id, input) => this.#mutate('files/' + encodeURIComponent(id) + '/visibility', input),
147
+ delete: (id, requestId) => this.#mutate('files/' + encodeURIComponent(id), { requestId }, 'DELETE'),
148
+ };
149
+ payments = {
150
+ merchant: () => this.#request('payments/merchant'),
151
+ connect: (input) => this.#mutate('payments/merchant', input),
152
+ refresh: (requestId) => this.#mutate('payments/merchant/refresh', { requestId }),
153
+ checkout: (input) => this.#mutate('payments/checkout', input),
154
+ operation: (id) => this.#request('payments/operations/' + encodeURIComponent(id)),
155
+ operations: () => this.#request('payments/operations'),
156
+ reconcile: (input) => this.#mutate('payments/reconcile', input),
157
+ simulate: (input) => this.#mutate('payments/simulate', input),
158
+ refund: (input) => this.#mutate('payments/refund', input),
159
+ list: () => this.#request('payments'),
160
+ record: (input) => this.#mutate('payments', input),
161
+ };
162
+ events = { list: () => this.#request('events') };
163
+ webhooks = {
164
+ list: () => this.#request('webhooks'),
165
+ create: (input) => this.#mutate('webhooks', input),
166
+ disable: (id, requestId) => this.#mutate('webhooks/' + encodeURIComponent(id) + '/disable', {
167
+ requestId,
168
+ }),
169
+ deliveries: () => this.#request('webhooks/deliveries'),
170
+ retry: (id, requestId) => this.#mutate('webhooks/deliveries/' + encodeURIComponent(id) + '/retry', { requestId }),
171
+ };
172
+ collections = {
173
+ list: () => this.#request('collections'),
174
+ get: (collection) => this.#request('collections/schema', 'POST', { collection }),
175
+ create: (input) => this.#mutate('collections', input),
176
+ update: (input) => this.#mutate('collections', input, 'PATCH'),
177
+ };
178
+ data = {
179
+ create: (collection, data, requestId) => this.#mutate('data', Object.assign({ collection, data }, { requestId })),
180
+ get: (id) => this.#request('data/' + encodeURIComponent(id)),
181
+ query: (collection, query = {}) => this.#request('data/query', 'POST', {
182
+ ...query,
183
+ collection,
184
+ }),
185
+ update: (id, input) => this.#mutate('data/' + encodeURIComponent(id), input, 'PATCH'),
186
+ delete: (id, input) => this.#mutate('data/' + encodeURIComponent(id), input, 'DELETE'),
187
+ };
188
+ customRecords = {
189
+ list: () => this.#request('custom-records'),
190
+ create: (input) => this.#mutate('custom-records', input),
191
+ };
192
+ }
193
+ /** Former names, kept so code written against the alpha SDK keeps working. */
194
+ export { Yasad as Fresh, YasadError as FreshError };
195
+ //# 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;AAErC,6FAA6F;AAC7F,SAAS,IAAI,CAAC,MAA0C,EAAE,GAAsD;IAC9G,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IAChG,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG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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.0",
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
+ }