@hyperscale0/sdk 4.0.1 → 4.0.2

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/client.d.ts CHANGED
@@ -14,10 +14,10 @@ import type {
14
14
  export interface ClientOptions {
15
15
  apiKey?: string;
16
16
  sessionToken?: string;
17
- staffTenantId?: string;
18
17
  productId: string;
19
18
  baseUrl?: string;
20
19
  environment?: "sandbox" | "live";
20
+ turnstileToken?: string;
21
21
  }
22
22
  export interface ActionInput {
23
23
  instanceId?: string;
@@ -37,7 +37,11 @@ export interface Client {
37
37
  call<Name extends keyof Operations>(
38
38
  name: Name,
39
39
  input: Operations[Name]["input"],
40
- options?: { idempotencyKey?: string },
40
+ options?: {
41
+ idempotencyKey?: string;
42
+ turnstileToken?: string;
43
+ headers?: Record<string, string>;
44
+ },
41
45
  ): Promise<Operations[Name]["output"]>;
42
46
  instruments(): Promise<product_instruments_listOutput>;
43
47
  actions(instrument?: string): Promise<product_actions_listOutput>;
package/client.js CHANGED
@@ -1,19 +1,701 @@
1
+ // Generated from core/contracts operation descriptors. Do not edit.
2
+ const routes = {
3
+ "account.balance.retrieve": {
4
+ "method": "GET",
5
+ "path": "/v1/accounts/{accountId}/balance",
6
+ "pathParams": [
7
+ "accountId"
8
+ ],
9
+ "idempotency": "not_required"
10
+ },
11
+ "account.close": {
12
+ "method": "POST",
13
+ "path": "/v1/accounts/{accountId}/close",
14
+ "pathParams": [
15
+ "accountId"
16
+ ],
17
+ "idempotency": "required"
18
+ },
19
+ "account.create": {
20
+ "method": "POST",
21
+ "path": "/v1/accounts",
22
+ "pathParams": [],
23
+ "idempotency": "required"
24
+ },
25
+ "account.freeze": {
26
+ "method": "POST",
27
+ "path": "/v1/accounts/{accountId}/freeze",
28
+ "pathParams": [
29
+ "accountId"
30
+ ],
31
+ "idempotency": "required"
32
+ },
33
+ "account.hold.list": {
34
+ "method": "GET",
35
+ "path": "/v1/accounts/{accountId}/holds",
36
+ "pathParams": [
37
+ "accountId"
38
+ ],
39
+ "idempotency": "not_required"
40
+ },
41
+ "account.hold.retrieve": {
42
+ "method": "GET",
43
+ "path": "/v1/accounts/{accountId}/holds/{transferId}",
44
+ "pathParams": [
45
+ "accountId",
46
+ "transferId"
47
+ ],
48
+ "idempotency": "not_required"
49
+ },
50
+ "account.list": {
51
+ "method": "GET",
52
+ "path": "/v1/accounts",
53
+ "pathParams": [],
54
+ "idempotency": "not_required"
55
+ },
56
+ "account.retrieve": {
57
+ "method": "GET",
58
+ "path": "/v1/accounts/{accountId}",
59
+ "pathParams": [
60
+ "accountId"
61
+ ],
62
+ "idempotency": "not_required"
63
+ },
64
+ "account.statement.export": {
65
+ "method": "GET",
66
+ "path": "/v1/accounts/{accountId}/statements/{period}/export",
67
+ "pathParams": [
68
+ "accountId",
69
+ "period"
70
+ ],
71
+ "idempotency": "not_required"
72
+ },
73
+ "account.statement.retrieve": {
74
+ "method": "GET",
75
+ "path": "/v1/accounts/{accountId}/statements/{period}",
76
+ "pathParams": [
77
+ "accountId",
78
+ "period"
79
+ ],
80
+ "idempotency": "not_required"
81
+ },
82
+ "account.unfreeze": {
83
+ "method": "POST",
84
+ "path": "/v1/accounts/{accountId}/unfreeze",
85
+ "pathParams": [
86
+ "accountId"
87
+ ],
88
+ "idempotency": "required"
89
+ },
90
+ "activity.list": {
91
+ "method": "GET",
92
+ "path": "/v1/activity",
93
+ "pathParams": [],
94
+ "idempotency": "not_required"
95
+ },
96
+ "audit_event.list": {
97
+ "method": "GET",
98
+ "path": "/v1/audit-events",
99
+ "pathParams": [],
100
+ "idempotency": "not_required"
101
+ },
102
+ "audit_event.retrieve": {
103
+ "method": "GET",
104
+ "path": "/v1/audit-events/{auditEventId}",
105
+ "pathParams": [
106
+ "auditEventId"
107
+ ],
108
+ "idempotency": "not_required"
109
+ },
110
+ "consent.list": {
111
+ "method": "GET",
112
+ "path": "/v1/consents",
113
+ "pathParams": [],
114
+ "idempotency": "not_required"
115
+ },
116
+ "consent.retrieve": {
117
+ "method": "GET",
118
+ "path": "/v1/consents/{consentId}",
119
+ "pathParams": [
120
+ "consentId"
121
+ ],
122
+ "idempotency": "not_required"
123
+ },
124
+ "consent.revoke": {
125
+ "method": "POST",
126
+ "path": "/v1/consents/{consentId}/revoke",
127
+ "pathParams": [
128
+ "consentId"
129
+ ],
130
+ "idempotency": "required"
131
+ },
132
+ "customer_access.close": {
133
+ "method": "POST",
134
+ "path": "/v1/customer-access/{customerAccessId}/close",
135
+ "pathParams": [
136
+ "customerAccessId"
137
+ ],
138
+ "idempotency": "required"
139
+ },
140
+ "customer_access.list": {
141
+ "method": "GET",
142
+ "path": "/v1/customer-access",
143
+ "pathParams": [],
144
+ "idempotency": "not_required"
145
+ },
146
+ "customer_access.reactivate": {
147
+ "method": "POST",
148
+ "path": "/v1/customer-access/{customerAccessId}/reactivate",
149
+ "pathParams": [
150
+ "customerAccessId"
151
+ ],
152
+ "idempotency": "required"
153
+ },
154
+ "customer_access.retrieve": {
155
+ "method": "GET",
156
+ "path": "/v1/customer-access/{customerAccessId}",
157
+ "pathParams": [
158
+ "customerAccessId"
159
+ ],
160
+ "idempotency": "not_required"
161
+ },
162
+ "customer_access.suspend": {
163
+ "method": "POST",
164
+ "path": "/v1/customer-access/{customerAccessId}/suspend",
165
+ "pathParams": [
166
+ "customerAccessId"
167
+ ],
168
+ "idempotency": "required"
169
+ },
170
+ "customer.create": {
171
+ "method": "POST",
172
+ "path": "/v1/customers",
173
+ "pathParams": [],
174
+ "idempotency": "required"
175
+ },
176
+ "customer.list": {
177
+ "method": "GET",
178
+ "path": "/v1/customers",
179
+ "pathParams": [],
180
+ "idempotency": "not_required"
181
+ },
182
+ "customer.login": {
183
+ "method": "POST",
184
+ "path": "/v1/customer-identity/login",
185
+ "pathParams": [],
186
+ "idempotency": "required"
187
+ },
188
+ "customer.logout": {
189
+ "method": "POST",
190
+ "path": "/v1/customer-identity/logout",
191
+ "pathParams": [],
192
+ "idempotency": "required"
193
+ },
194
+ "customer.retrieve": {
195
+ "method": "GET",
196
+ "path": "/v1/customers/{customerId}",
197
+ "pathParams": [
198
+ "customerId"
199
+ ],
200
+ "idempotency": "not_required"
201
+ },
202
+ "customer.session.revoke": {
203
+ "method": "POST",
204
+ "path": "/v1/customer-identity/sessions/{customerSessionId}/revoke",
205
+ "pathParams": [
206
+ "customerSessionId"
207
+ ],
208
+ "idempotency": "required"
209
+ },
210
+ "customer.signup": {
211
+ "method": "POST",
212
+ "path": "/v1/customer-identity/signup",
213
+ "pathParams": [],
214
+ "idempotency": "required"
215
+ },
216
+ "developer.log.list": {
217
+ "method": "GET",
218
+ "path": "/v1/developer-logs",
219
+ "pathParams": [],
220
+ "idempotency": "not_required"
221
+ },
222
+ "developer.log.retrieve": {
223
+ "method": "GET",
224
+ "path": "/v1/developer-logs/{operationId}",
225
+ "pathParams": [
226
+ "operationId"
227
+ ],
228
+ "idempotency": "not_required"
229
+ },
230
+ "event.list": {
231
+ "method": "GET",
232
+ "path": "/v1/events",
233
+ "pathParams": [],
234
+ "idempotency": "not_required"
235
+ },
236
+ "event.retrieve": {
237
+ "method": "GET",
238
+ "path": "/v1/events/{eventId}",
239
+ "pathParams": [
240
+ "eventId"
241
+ ],
242
+ "idempotency": "not_required"
243
+ },
244
+ "extension.list": {
245
+ "method": "GET",
246
+ "path": "/v1/extensions",
247
+ "pathParams": [],
248
+ "idempotency": "not_required"
249
+ },
250
+ "internal_transfer.list": {
251
+ "method": "GET",
252
+ "path": "/v1/internal-transfers",
253
+ "pathParams": [],
254
+ "idempotency": "not_required"
255
+ },
256
+ "internal_transfer.retrieve": {
257
+ "method": "GET",
258
+ "path": "/v1/internal-transfers/{transferId}",
259
+ "pathParams": [
260
+ "transferId"
261
+ ],
262
+ "idempotency": "not_required"
263
+ },
264
+ "operation.list": {
265
+ "method": "GET",
266
+ "path": "/v1/operations",
267
+ "pathParams": [],
268
+ "idempotency": "not_required"
269
+ },
270
+ "operation.retrieve": {
271
+ "method": "GET",
272
+ "path": "/v1/operations/{operationId}",
273
+ "pathParams": [
274
+ "operationId"
275
+ ],
276
+ "idempotency": "not_required"
277
+ },
278
+ "payment_reminder.delivery.retrieve": {
279
+ "method": "GET",
280
+ "path": "/v1/products/{productId}/payment-reminders/{operationId}",
281
+ "pathParams": [
282
+ "productId",
283
+ "operationId"
284
+ ],
285
+ "idempotency": "not_required"
286
+ },
287
+ "product.actions.list": {
288
+ "method": "GET",
289
+ "path": "/v1/products/{productId}/actions",
290
+ "pathParams": [
291
+ "productId"
292
+ ],
293
+ "idempotency": "not_required"
294
+ },
295
+ "product.activation.retrieve": {
296
+ "method": "GET",
297
+ "path": "/v1/products/{productId}/activation",
298
+ "pathParams": [
299
+ "productId"
300
+ ],
301
+ "idempotency": "not_required"
302
+ },
303
+ "product.balance_sheet.retrieve": {
304
+ "method": "GET",
305
+ "path": "/v1/products/{productId}/balance-sheet",
306
+ "pathParams": [
307
+ "productId"
308
+ ],
309
+ "idempotency": "not_required"
310
+ },
311
+ "product.blocks.summary": {
312
+ "method": "GET",
313
+ "path": "/v1/products/{productId}/blocks/summary",
314
+ "pathParams": [
315
+ "productId"
316
+ ],
317
+ "idempotency": "not_required"
318
+ },
319
+ "product.connections.retrieve": {
320
+ "method": "GET",
321
+ "path": "/v1/products/{productId}/connections",
322
+ "pathParams": [
323
+ "productId"
324
+ ],
325
+ "idempotency": "not_required"
326
+ },
327
+ "product.earn.rate.list": {
328
+ "method": "GET",
329
+ "path": "/v1/products/{productId}/earn-rates",
330
+ "pathParams": [
331
+ "productId"
332
+ ],
333
+ "idempotency": "not_required"
334
+ },
335
+ "product.earnings.settle": {
336
+ "method": "POST",
337
+ "path": "/v1/products/{productId}/earnings/settlements",
338
+ "pathParams": [
339
+ "productId"
340
+ ],
341
+ "idempotency": "required"
342
+ },
343
+ "product.economic_snapshot.retrieve": {
344
+ "method": "GET",
345
+ "path": "/v1/products/{productId}/economic-snapshot",
346
+ "pathParams": [
347
+ "productId"
348
+ ],
349
+ "idempotency": "not_required"
350
+ },
351
+ "product.guidance.retrieve": {
352
+ "method": "GET",
353
+ "path": "/v1/products/{productId}/guidance",
354
+ "pathParams": [
355
+ "productId"
356
+ ],
357
+ "idempotency": "not_required"
358
+ },
359
+ "product.instruments.list": {
360
+ "method": "GET",
361
+ "path": "/v1/products/{productId}/instruments",
362
+ "pathParams": [
363
+ "productId"
364
+ ],
365
+ "idempotency": "not_required"
366
+ },
367
+ "product.list": {
368
+ "method": "GET",
369
+ "path": "/v1/products",
370
+ "pathParams": [],
371
+ "idempotency": "not_required"
372
+ },
373
+ "product.margin.retrieve": {
374
+ "method": "GET",
375
+ "path": "/v1/products/{productId}/margin",
376
+ "pathParams": [
377
+ "productId"
378
+ ],
379
+ "idempotency": "not_required"
380
+ },
381
+ "product.objects.actions": {
382
+ "method": "GET",
383
+ "path": "/v1/products/{productId}/objects/{kind}/{objectId}/actions",
384
+ "pathParams": [
385
+ "productId",
386
+ "kind",
387
+ "objectId"
388
+ ],
389
+ "idempotency": "not_required"
390
+ },
391
+ "product.objects.agreements.evidence.list": {
392
+ "method": "GET",
393
+ "path": "/v1/products/{productId}/objects/{kind}/{objectId}/agreements/{instanceId}/evidence",
394
+ "pathParams": [
395
+ "productId",
396
+ "kind",
397
+ "objectId",
398
+ "instanceId"
399
+ ],
400
+ "idempotency": "not_required"
401
+ },
402
+ "product.objects.agreements.list": {
403
+ "method": "GET",
404
+ "path": "/v1/products/{productId}/objects/{kind}/{objectId}/agreements",
405
+ "pathParams": [
406
+ "productId",
407
+ "kind",
408
+ "objectId"
409
+ ],
410
+ "idempotency": "not_required"
411
+ },
412
+ "product.objects.create": {
413
+ "method": "POST",
414
+ "path": "/v1/products/{productId}/objects/{kind}",
415
+ "pathParams": [
416
+ "productId",
417
+ "kind"
418
+ ],
419
+ "idempotency": "required"
420
+ },
421
+ "product.objects.discover": {
422
+ "method": "GET",
423
+ "path": "/v1/products/{productId}/objects",
424
+ "pathParams": [
425
+ "productId"
426
+ ],
427
+ "idempotency": "not_required"
428
+ },
429
+ "product.objects.execute": {
430
+ "method": "POST",
431
+ "path": "/v1/products/{productId}/objects/{kind}/{objectId}/actions/{action}",
432
+ "pathParams": [
433
+ "productId",
434
+ "kind",
435
+ "objectId",
436
+ "action"
437
+ ],
438
+ "idempotency": "required"
439
+ },
440
+ "product.objects.list": {
441
+ "method": "GET",
442
+ "path": "/v1/products/{productId}/objects/{kind}",
443
+ "pathParams": [
444
+ "productId",
445
+ "kind"
446
+ ],
447
+ "idempotency": "not_required"
448
+ },
449
+ "product.objects.preview": {
450
+ "method": "POST",
451
+ "path": "/v1/products/{productId}/objects/{kind}/{objectId}/actions/{action}/preview",
452
+ "pathParams": [
453
+ "productId",
454
+ "kind",
455
+ "objectId",
456
+ "action"
457
+ ],
458
+ "idempotency": "not_required"
459
+ },
460
+ "product.objects.retrieve": {
461
+ "method": "GET",
462
+ "path": "/v1/products/{productId}/objects/{kind}/{objectId}",
463
+ "pathParams": [
464
+ "productId",
465
+ "kind",
466
+ "objectId"
467
+ ],
468
+ "idempotency": "not_required"
469
+ },
470
+ "product.objects.timeline.list": {
471
+ "method": "GET",
472
+ "path": "/v1/products/{productId}/objects/{kind}/{objectId}/timeline",
473
+ "pathParams": [
474
+ "productId",
475
+ "kind",
476
+ "objectId"
477
+ ],
478
+ "idempotency": "not_required"
479
+ },
480
+ "product.operation_set.retrieve": {
481
+ "method": "GET",
482
+ "path": "/v1/products/{productId}/operation-set",
483
+ "pathParams": [
484
+ "productId"
485
+ ],
486
+ "idempotency": "not_required"
487
+ },
488
+ "product.retrieve": {
489
+ "method": "GET",
490
+ "path": "/v1/products/{productId}",
491
+ "pathParams": [
492
+ "productId"
493
+ ],
494
+ "idempotency": "not_required"
495
+ },
496
+ "product.schedule.list": {
497
+ "method": "GET",
498
+ "path": "/v1/products/{productId}/schedule",
499
+ "pathParams": [
500
+ "productId"
501
+ ],
502
+ "idempotency": "not_required"
503
+ },
504
+ "product.treasury.retrieve": {
505
+ "method": "GET",
506
+ "path": "/v1/products/{productId}/treasury",
507
+ "pathParams": [
508
+ "productId"
509
+ ],
510
+ "idempotency": "not_required"
511
+ },
512
+ "product.work.list": {
513
+ "method": "GET",
514
+ "path": "/v1/products/{productId}/work",
515
+ "pathParams": [
516
+ "productId"
517
+ ],
518
+ "idempotency": "not_required"
519
+ },
520
+ "receipt.list": {
521
+ "method": "GET",
522
+ "path": "/v1/receipts",
523
+ "pathParams": [],
524
+ "idempotency": "not_required"
525
+ },
526
+ "receipt.retrieve": {
527
+ "method": "GET",
528
+ "path": "/v1/receipts/{receiptId}",
529
+ "pathParams": [
530
+ "receiptId"
531
+ ],
532
+ "idempotency": "not_required"
533
+ },
534
+ "sandbox.account.fund": {
535
+ "method": "POST",
536
+ "path": "/v1/sandbox/account-funding",
537
+ "pathParams": [],
538
+ "idempotency": "required"
539
+ },
540
+ "sandbox.clock.advance": {
541
+ "method": "POST",
542
+ "path": "/v1/sandbox/clock/advance",
543
+ "pathParams": [],
544
+ "idempotency": "required"
545
+ },
546
+ "sandbox.clock.retrieve": {
547
+ "method": "GET",
548
+ "path": "/v1/products/{productId}/sandbox-clock",
549
+ "pathParams": [
550
+ "productId"
551
+ ],
552
+ "idempotency": "not_required"
553
+ },
554
+ "sandbox.customer_access.activate": {
555
+ "method": "POST",
556
+ "path": "/v1/sandbox/customer-access/{customerAccessId}/activate",
557
+ "pathParams": [
558
+ "customerAccessId"
559
+ ],
560
+ "idempotency": "required"
561
+ },
562
+ "sandbox.platform.fire": {
563
+ "method": "POST",
564
+ "path": "/v1/sandbox/platform/fire",
565
+ "pathParams": [],
566
+ "idempotency": "required"
567
+ },
568
+ "transfer_return.create": {
569
+ "method": "POST",
570
+ "path": "/v1/transfer-returns",
571
+ "pathParams": [],
572
+ "idempotency": "required"
573
+ },
574
+ "usage_record.list": {
575
+ "method": "GET",
576
+ "path": "/v1/usage-records",
577
+ "pathParams": [],
578
+ "idempotency": "not_required"
579
+ },
580
+ "usage_record.retrieve": {
581
+ "method": "GET",
582
+ "path": "/v1/usage-records/{usageRecordId}",
583
+ "pathParams": [
584
+ "usageRecordId"
585
+ ],
586
+ "idempotency": "not_required"
587
+ },
588
+ "usage.statement": {
589
+ "method": "GET",
590
+ "path": "/v1/usage/statement",
591
+ "pathParams": [],
592
+ "idempotency": "not_required"
593
+ },
594
+ "webhook.delivery.list": {
595
+ "method": "GET",
596
+ "path": "/v1/webhook-endpoints/{webhookEndpointId}/deliveries",
597
+ "pathParams": [
598
+ "webhookEndpointId"
599
+ ],
600
+ "idempotency": "not_required"
601
+ },
602
+ "webhook.delivery.resend": {
603
+ "method": "POST",
604
+ "path": "/v1/webhook-endpoints/{webhookEndpointId}/deliveries/{webhookDeliveryId}/resend",
605
+ "pathParams": [
606
+ "webhookEndpointId",
607
+ "webhookDeliveryId"
608
+ ],
609
+ "idempotency": "required"
610
+ },
611
+ "webhook.endpoint.create": {
612
+ "method": "POST",
613
+ "path": "/v1/webhook-endpoints",
614
+ "pathParams": [],
615
+ "idempotency": "required"
616
+ },
617
+ "webhook.endpoint.delete": {
618
+ "method": "POST",
619
+ "path": "/v1/webhook-endpoints/{webhookEndpointId}/delete",
620
+ "pathParams": [
621
+ "webhookEndpointId"
622
+ ],
623
+ "idempotency": "required"
624
+ },
625
+ "webhook.endpoint.disable": {
626
+ "method": "POST",
627
+ "path": "/v1/webhook-endpoints/{webhookEndpointId}/disable",
628
+ "pathParams": [
629
+ "webhookEndpointId"
630
+ ],
631
+ "idempotency": "required"
632
+ },
633
+ "webhook.endpoint.enable": {
634
+ "method": "POST",
635
+ "path": "/v1/webhook-endpoints/{webhookEndpointId}/enable",
636
+ "pathParams": [
637
+ "webhookEndpointId"
638
+ ],
639
+ "idempotency": "required"
640
+ },
641
+ "webhook.endpoint.list": {
642
+ "method": "GET",
643
+ "path": "/v1/webhook-endpoints",
644
+ "pathParams": [],
645
+ "idempotency": "not_required"
646
+ },
647
+ "webhook.endpoint.recover": {
648
+ "method": "POST",
649
+ "path": "/v1/webhook-endpoints/{webhookEndpointId}/recover",
650
+ "pathParams": [
651
+ "webhookEndpointId"
652
+ ],
653
+ "idempotency": "required"
654
+ },
655
+ "webhook.endpoint.retrieve": {
656
+ "method": "GET",
657
+ "path": "/v1/webhook-endpoints/{webhookEndpointId}",
658
+ "pathParams": [
659
+ "webhookEndpointId"
660
+ ],
661
+ "idempotency": "not_required"
662
+ },
663
+ "webhook.endpoint.secret.rotate": {
664
+ "method": "POST",
665
+ "path": "/v1/webhook-endpoints/{webhookEndpointId}/secret/rotate",
666
+ "pathParams": [
667
+ "webhookEndpointId"
668
+ ],
669
+ "idempotency": "required"
670
+ },
671
+ "webhook.endpoint.update": {
672
+ "method": "PATCH",
673
+ "path": "/v1/webhook-endpoints/{webhookEndpointId}",
674
+ "pathParams": [
675
+ "webhookEndpointId"
676
+ ],
677
+ "idempotency": "required"
678
+ },
679
+ "webhook.event.catalog": {
680
+ "method": "GET",
681
+ "path": "/v1/products/{productId}/webhook-event-catalog",
682
+ "pathParams": [
683
+ "productId"
684
+ ],
685
+ "idempotency": "not_required"
686
+ }
687
+ };
688
+
1
689
  export function createClient({
2
690
  apiKey,
3
691
  sessionToken,
4
- staffTenantId,
5
692
  productId,
6
693
  baseUrl = "https://hyperscale0.ai",
7
694
  environment = "sandbox",
695
+ turnstileToken,
8
696
  }) {
9
- if (
10
- !apiKey === !sessionToken ||
11
- !productId ||
12
- (staffTenantId && !sessionToken)
13
- )
14
- throw new Error(
15
- "Choose one API key or session token and a Product; staff requires a session",
16
- );
697
+ if (!apiKey === !sessionToken || !productId)
698
+ throw new Error("Choose one API key or session token and a Product");
17
699
  const credential = sessionToken ?? apiKey;
18
700
  const origin = new URL(baseUrl);
19
701
  if (
@@ -27,14 +709,16 @@ export function createClient({
27
709
  }
28
710
  if (!["sandbox", "live"].includes(environment))
29
711
  throw new Error("environment must be sandbox or live");
30
- async function request(path, input, idempotencyKey) {
712
+ async function request(path, input, idempotencyKey, method, extraHeaders) {
713
+ const httpMethod = method ?? (input === undefined ? "GET" : "POST");
31
714
  const response = await fetch(new URL(path, origin), {
32
- method: input === undefined ? "GET" : "POST",
715
+ method: httpMethod,
33
716
  headers: {
34
717
  authorization: `Bearer ${credential}`,
35
718
  "x-hyperscale-environment": environment,
36
719
  ...(input === undefined ? {} : { "content-type": "application/json" }),
37
720
  ...(idempotencyKey ? { "idempotency-key": idempotencyKey } : {}),
721
+ ...extraHeaders,
38
722
  },
39
723
  ...(input === undefined ? {} : { body: JSON.stringify(input) }),
40
724
  redirect: "error",
@@ -54,14 +738,12 @@ export function createClient({
54
738
  return result;
55
739
  }
56
740
  const productPath = `/v1/products/${encodeURIComponent(productId)}`;
57
- const actionPath = staffTenantId
58
- ? `/v1/admin/tenants/${encodeURIComponent(staffTenantId)}/products/${encodeURIComponent(productId)}/operations`
59
- : sessionToken
60
- ? `${productPath}/operations`
61
- : "/v1/operations";
741
+ const actionPath = sessionToken
742
+ ? `${productPath}/operations`
743
+ : "/v1/operations";
62
744
  return {
63
745
  rehearse: (name, { idempotencyKey } = {}) => {
64
- if (!sessionToken || staffTenantId || !idempotencyKey)
746
+ if (!sessionToken || !idempotencyKey)
65
747
  throw new Error(
66
748
  "rehearse requires a tenant session and idempotency key",
67
749
  );
@@ -76,12 +758,53 @@ export function createClient({
76
758
  `${productPath}/payment-reminders/${encodeURIComponent(operationId)}`,
77
759
  ),
78
760
  discover: () => request(`${productPath}/objects`),
79
- call: (name, input, { idempotencyKey } = {}) =>
80
- request(
81
- `/v1/operations/${encodeURIComponent(name)}`,
82
- input,
83
- idempotencyKey,
84
- ),
761
+ call: (name, input = {}, options = {}) => {
762
+ const route = routes[name];
763
+ if (!route) throw new Error(`Unknown operation: ${name}`);
764
+ const remaining = { ...input };
765
+ const path = route.path.replace(/\{([^}]+)\}/g, (_, param) => {
766
+ let value = remaining[param];
767
+ if (value === undefined && param === "productId") {
768
+ value = productId;
769
+ }
770
+ if (value === undefined || value === null) {
771
+ throw new Error(`${name} requires ${param} in input`);
772
+ }
773
+ delete remaining[param];
774
+ return encodeURIComponent(String(value));
775
+ });
776
+ const extraHeaders = { ...(options.headers ?? {}) };
777
+ const turnstile = options.turnstileToken ?? turnstileToken;
778
+ if (turnstile) {
779
+ extraHeaders["x-turnstile-token"] ??= turnstile;
780
+ }
781
+ if (route.method === "GET") {
782
+ const params = new URLSearchParams();
783
+ for (const [key, value] of Object.entries(remaining)) {
784
+ if (value === undefined || value === null) continue;
785
+ params.set(
786
+ key,
787
+ typeof value === "string" ? value : JSON.stringify(value),
788
+ );
789
+ }
790
+ const query = params.toString();
791
+ const targetPath = query ? `${path}?${query}` : path;
792
+ return request(
793
+ targetPath,
794
+ undefined,
795
+ options.idempotencyKey,
796
+ route.method,
797
+ extraHeaders,
798
+ );
799
+ }
800
+ return request(
801
+ path,
802
+ remaining,
803
+ options.idempotencyKey,
804
+ route.method,
805
+ extraHeaders,
806
+ );
807
+ },
85
808
  instruments: () => request(`${productPath}/instruments`),
86
809
  actions: (instrument) =>
87
810
  request(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperscale0/sdk",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "LicenseRef-Hyperscale-Proprietary",
@@ -22,5 +22,5 @@
22
22
  "publishConfig": {
23
23
  "access": "public"
24
24
  },
25
- "gitHead": "8e13de507f47ba25ac23662235302e643fa2267c"
25
+ "gitHead": "827eec4deda84826190720ee40c3f3316216c1a6"
26
26
  }
package/platform.d.ts CHANGED
@@ -32,7 +32,7 @@ export type account_retrieveOutput = { readonly "item": { readonly "accountId":
32
32
  export type account_statement_exportInput = { readonly "accountId": string; readonly "productId"?: string; readonly "period": string; };
33
33
  export type account_statement_exportOutput = { readonly "accountId": string; readonly "closingBalance": string; readonly "currency": string; readonly "environment": "sandbox" | "live"; readonly "finalized": boolean; readonly "openingBalance": string; readonly "period": string; readonly "periodEndExclusive": string; readonly "periodStart": string; readonly "tenantId": string; readonly "productId"?: string; readonly "contentType": "text/csv"; readonly "csv": string; readonly "filename": string; readonly "sha256": string; readonly "sizeBytes": number; };
34
34
  export type account_statement_retrieveInput = { readonly "accountId": string; readonly "productId"?: string; readonly "period": string; readonly "cutoff"?: string; readonly "cursor"?: string; readonly "limit"?: number; };
35
- export type account_statement_retrieveOutput = { readonly "accountId": string; readonly "closingBalance": string; readonly "currency": string; readonly "environment": "sandbox" | "live"; readonly "finalized": boolean; readonly "openingBalance": string; readonly "period": string; readonly "periodEndExclusive": string; readonly "periodStart": string; readonly "tenantId": string; readonly "productId"?: string; readonly "asOf": string; readonly "cutoff": string; readonly "totalLines": number; readonly "nextCursor": string | null; readonly "lines": ReadonlyArray<{ readonly "amount": string; readonly "balanceDelta": string; readonly "counterpartyAccountId": string; readonly "counterpartyDisplayName": string; readonly "currency": string; readonly "direction": "debit" | "credit"; readonly "entryId": string; readonly "ledgerTransferId": string; readonly "memo": string; readonly "occurredAt": string; readonly "operationId": string; readonly "operationName": string; readonly "origin"?: { readonly "instrumentId": string; readonly "instrumentInstanceId": string; readonly "action": string; }; readonly "runningBalance": string; readonly "status": "pending" | "posted" | "voided"; readonly "transferId": string; }>; };
35
+ export type account_statement_retrieveOutput = { readonly "accountId": string; readonly "closingBalance": string; readonly "currency": string; readonly "environment": "sandbox" | "live"; readonly "finalized": boolean; readonly "openingBalance": string; readonly "period": string; readonly "periodEndExclusive": string; readonly "periodStart": string; readonly "tenantId": string; readonly "productId"?: string; readonly "asOf": string; readonly "cutoff": string; readonly "totalLines": number; readonly "nextCursor": string | null; readonly "lines": ReadonlyArray<{ readonly "amount": string; readonly "balanceDelta": string; readonly "counterpartyAccountId": string; readonly "counterpartyDisplayName": string; readonly "currency": string; readonly "direction": "debit" | "credit"; readonly "entryId": string; readonly "ledgerTransferId": string; readonly "memo": string; readonly "occurredAt": string; readonly "operationId": string; readonly "operationName": string; readonly "origin"?: { readonly "instrumentId": string; readonly "instrumentInstanceId": string; readonly "action": string; }; readonly "runningBalance": string; readonly "status": "pending" | "posted" | "voided"; readonly "title"?: string; readonly "transferId": string; }>; };
36
36
  export type account_unfreezeInput = { readonly "accountId": string; readonly "reason": string; };
37
37
  export type account_unfreezeOutput = { readonly "tenantId": string; readonly "accountId": string; readonly "productId"?: string; readonly "updatedAt": string; readonly "reason": string; readonly "previousStatus": "frozen"; readonly "status": "open"; };
38
38
  export type activity_listInput = { readonly "productId"?: string; readonly "operation"?: string; readonly "status"?: "accepted" | "pending" | "succeeded" | "failed"; readonly "resourceKind"?: "account" | "activity" | "api_key" | "audit" | "product_capability" | "consent" | "customer" | "entity" | "instrument_instance" | "business_object" | "operation" | "product" | "customer_access" | "customer_session" | "external_confirmation" | "provider_cost_event" | "provider_webhook_event" | "webhook_endpoint" | "webhook_delivery" | "receipt" | "tenant" | "tenant_catalog_revision" | "reporting_artifact" | "wedged_money_repair" | "user_session" | "internal_transfer" | "usage" | "platform_alert" | "team" | "team_membership" | "user"; readonly "resourceId"?: string; readonly "createdFrom"?: string; readonly "createdTo"?: string; readonly "limit"?: number; readonly "cursor"?: string; readonly "type"?: "object" | "money_move" | "company_access"; };
package/portal.d.ts CHANGED
@@ -32,7 +32,7 @@ export type account_retrieveOutput = { readonly "item": { readonly "accountId":
32
32
  export type account_statement_exportInput = { readonly "tenantId": string; readonly "accountId": string; readonly "productId"?: string; readonly "period": string; };
33
33
  export type account_statement_exportOutput = { readonly "accountId": string; readonly "closingBalance": string; readonly "currency": string; readonly "environment": "sandbox" | "live"; readonly "finalized": boolean; readonly "openingBalance": string; readonly "period": string; readonly "periodEndExclusive": string; readonly "periodStart": string; readonly "tenantId": string; readonly "productId"?: string; readonly "contentType": "text/csv"; readonly "csv": string; readonly "filename": string; readonly "sha256": string; readonly "sizeBytes": number; };
34
34
  export type account_statement_retrieveInput = { readonly "tenantId": string; readonly "accountId": string; readonly "productId"?: string; readonly "period": string; readonly "cutoff"?: string; readonly "cursor"?: string; readonly "limit"?: number; };
35
- export type account_statement_retrieveOutput = { readonly "accountId": string; readonly "closingBalance": string; readonly "currency": string; readonly "environment": "sandbox" | "live"; readonly "finalized": boolean; readonly "openingBalance": string; readonly "period": string; readonly "periodEndExclusive": string; readonly "periodStart": string; readonly "tenantId": string; readonly "productId"?: string; readonly "asOf": string; readonly "cutoff": string; readonly "totalLines": number; readonly "nextCursor": string | null; readonly "lines": ReadonlyArray<{ readonly "amount": string; readonly "balanceDelta": string; readonly "counterpartyAccountId": string; readonly "counterpartyDisplayName": string; readonly "currency": string; readonly "direction": "debit" | "credit"; readonly "entryId": string; readonly "ledgerTransferId": string; readonly "memo": string; readonly "occurredAt": string; readonly "operationId": string; readonly "operationName": string; readonly "origin"?: { readonly "instrumentId": string; readonly "instrumentInstanceId": string; readonly "action": string; }; readonly "runningBalance": string; readonly "status": "pending" | "posted" | "voided"; readonly "transferId": string; }>; };
35
+ export type account_statement_retrieveOutput = { readonly "accountId": string; readonly "closingBalance": string; readonly "currency": string; readonly "environment": "sandbox" | "live"; readonly "finalized": boolean; readonly "openingBalance": string; readonly "period": string; readonly "periodEndExclusive": string; readonly "periodStart": string; readonly "tenantId": string; readonly "productId"?: string; readonly "asOf": string; readonly "cutoff": string; readonly "totalLines": number; readonly "nextCursor": string | null; readonly "lines": ReadonlyArray<{ readonly "amount": string; readonly "balanceDelta": string; readonly "counterpartyAccountId": string; readonly "counterpartyDisplayName": string; readonly "currency": string; readonly "direction": "debit" | "credit"; readonly "entryId": string; readonly "ledgerTransferId": string; readonly "memo": string; readonly "occurredAt": string; readonly "operationId": string; readonly "operationName": string; readonly "origin"?: { readonly "instrumentId": string; readonly "instrumentInstanceId": string; readonly "action": string; }; readonly "runningBalance": string; readonly "status": "pending" | "posted" | "voided"; readonly "title"?: string; readonly "transferId": string; }>; };
36
36
  export type account_unfreezeInput = { readonly "tenantId": string; readonly "accountId": string; readonly "reason": string; };
37
37
  export type account_unfreezeOutput = { readonly "tenantId": string; readonly "accountId": string; readonly "productId"?: string; readonly "updatedAt": string; readonly "reason": string; readonly "previousStatus": "frozen"; readonly "status": "open"; };
38
38
  export type activity_listInput = { readonly "tenantId": string; readonly "productId"?: string; readonly "operation"?: string; readonly "status"?: "accepted" | "pending" | "succeeded" | "failed"; readonly "resourceKind"?: "account" | "activity" | "api_key" | "audit" | "product_capability" | "consent" | "customer" | "entity" | "instrument_instance" | "business_object" | "operation" | "product" | "customer_access" | "customer_session" | "external_confirmation" | "provider_cost_event" | "provider_webhook_event" | "webhook_endpoint" | "webhook_delivery" | "receipt" | "tenant" | "tenant_catalog_revision" | "reporting_artifact" | "wedged_money_repair" | "user_session" | "internal_transfer" | "usage" | "platform_alert" | "team" | "team_membership" | "user"; readonly "resourceId"?: string; readonly "createdFrom"?: string; readonly "createdTo"?: string; readonly "limit"?: number; readonly "cursor"?: string; readonly "type"?: "object" | "money_move" | "company_access"; };
@@ -361,7 +361,7 @@ type tenant_statement_export_retrieveOutput___schema0 = (string | number | boole
361
361
  export type tenant_treasury_retrieveInput = { readonly "tenantId": string; };
362
362
  export type tenant_treasury_retrieveOutput = { readonly "environment": "sandbox" | "live"; readonly "tenantId": string; readonly "asOf": string; readonly "credit": { readonly "accountId": string; readonly "available": string; readonly "pending": string; readonly "settled": string; readonly "currency": string; }; readonly "withdrawals": { readonly "accountId": string; readonly "available": string; readonly "pending": string; readonly "settled": string; readonly "currency": string; readonly "settlementDestination": ({ readonly "state": "configured"; readonly "maskedIban": string; readonly "accountName": string | null; } | { readonly "state": "missing"; }); readonly "autoSettleEnabled": boolean; }; readonly "products": ReadonlyArray<{ readonly "productId": string; readonly "displayName": string; readonly "revenue": { readonly "accountId": string; readonly "available": string; readonly "pending": string; readonly "settled": string; readonly "currency": string; }; }>; readonly "billingAccount": { readonly "accountId": string; readonly "available": string; readonly "pending": string; readonly "settled": string; readonly "currency": string; }; };
363
363
  export type tenant_treasury_statements_retrieveInput = { readonly "tenantId": string; readonly "fromPeriod": string; readonly "toPeriod": string; };
364
- export type tenant_treasury_statements_retrieveOutput = { readonly "environment": "sandbox" | "live"; readonly "tenantId": string; readonly "asOf": string; readonly "fromPeriod": string; readonly "toPeriod": string; readonly "periods": ReadonlyArray<string>; readonly "accounts": ReadonlyArray<{ readonly "accountId": string; readonly "role": "tenant_credit" | "tenant_settlement" | "product_revenue"; readonly "displayName": string; readonly "currency": string; readonly "productId"?: string; readonly "months": ReadonlyArray<{ readonly "period": string; readonly "periodStart": string; readonly "periodEndExclusive": string; readonly "finalized": boolean; readonly "openingBalance"?: string; readonly "closingBalance"?: string; readonly "lines": ReadonlyArray<{ readonly "amount": string; readonly "balanceDelta": string; readonly "counterpartyAccountId": string; readonly "counterpartyDisplayName": string; readonly "currency": string; readonly "direction": "debit" | "credit"; readonly "entryId": string; readonly "ledgerTransferId": string; readonly "memo": string; readonly "occurredAt": string; readonly "operationId": string; readonly "operationName": string; readonly "origin"?: { readonly "instrumentId": string; readonly "instrumentInstanceId": string; readonly "action": string; }; readonly "runningBalance": string; readonly "status": "pending" | "posted" | "voided"; readonly "transferId": string; }>; readonly "unavailable"?: { readonly "code": string; readonly "message": string; }; }>; }>; };
364
+ export type tenant_treasury_statements_retrieveOutput = { readonly "environment": "sandbox" | "live"; readonly "tenantId": string; readonly "asOf": string; readonly "fromPeriod": string; readonly "toPeriod": string; readonly "periods": ReadonlyArray<string>; readonly "accounts": ReadonlyArray<{ readonly "accountId": string; readonly "role": "tenant_credit" | "tenant_settlement" | "product_revenue"; readonly "displayName": string; readonly "currency": string; readonly "productId"?: string; readonly "months": ReadonlyArray<{ readonly "period": string; readonly "periodStart": string; readonly "periodEndExclusive": string; readonly "finalized": boolean; readonly "openingBalance"?: string; readonly "closingBalance"?: string; readonly "lines": ReadonlyArray<{ readonly "amount": string; readonly "balanceDelta": string; readonly "counterpartyAccountId": string; readonly "counterpartyDisplayName": string; readonly "currency": string; readonly "direction": "debit" | "credit"; readonly "entryId": string; readonly "ledgerTransferId": string; readonly "memo": string; readonly "occurredAt": string; readonly "operationId": string; readonly "operationName": string; readonly "origin"?: { readonly "instrumentId": string; readonly "instrumentInstanceId": string; readonly "action": string; }; readonly "runningBalance": string; readonly "status": "pending" | "posted" | "voided"; readonly "title"?: string; readonly "transferId": string; }>; readonly "unavailable"?: { readonly "code": string; readonly "message": string; }; }>; }>; };
365
365
  export type tenant_updateInput = { readonly "tenantId": string; readonly "legalName": string; readonly "reason": string; };
366
366
  export type tenant_updateOutput = { readonly "tenantId": string; readonly "legalName": string; readonly "updatedAt": string; readonly "reason": string; };
367
367
  export type tenant_work_listInput = { readonly "tenantId": string; readonly "productId"?: string; readonly "lane"?: "needs_human" | "waiting_customer" | "waiting_provider" | "waiting_clock"; readonly "dueFrom"?: string; readonly "dueTo"?: string; readonly "cursor"?: string; readonly "limit"?: number; };