@fonderie/client 0.9.0 → 0.10.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/dist/index.js CHANGED
@@ -132,7 +132,7 @@ var AuditClient = class {
132
132
  setWorkspaceId(workspaceId) {
133
133
  this.workspaceId = workspaceId;
134
134
  }
135
- listEvents(input = {}) {
135
+ listEvents(input = {}, opts) {
136
136
  const params = new URLSearchParams();
137
137
  if (input.limit !== void 0) params.set("limit", String(input.limit));
138
138
  if (input.type) params.set("type", input.type);
@@ -145,7 +145,8 @@ var AuditClient = class {
145
145
  method: "GET",
146
146
  path: `/audit${qs ? `?${qs}` : ""}`,
147
147
  token: this.tokens.get(),
148
- workspaceId: this.workspaceId
148
+ workspaceId: this.workspaceId,
149
+ bust: opts?.bust
149
150
  });
150
151
  }
151
152
  };
@@ -272,15 +273,19 @@ var AuthClient = class {
272
273
  return this.http.request({
273
274
  method: "GET",
274
275
  path: "/auth/send-verification",
275
- token: this.tokens.get()
276
+ token: this.tokens.get(),
277
+ // A send-action on a GET route: never serve it from the cache, or a
278
+ // resend inside the TTL would silently no-op.
279
+ cache: false
276
280
  });
277
281
  }
278
282
  // ── Protected + Verified ───────────────────────────────────────────────────
279
- getUser() {
283
+ getUser(opts) {
280
284
  return this.http.request({
281
285
  method: "GET",
282
286
  path: "/users",
283
- token: this.tokens.get()
287
+ token: this.tokens.get(),
288
+ bust: opts?.bust
284
289
  });
285
290
  }
286
291
  updateProfile(input) {
@@ -359,16 +364,18 @@ var BillingClient = class {
359
364
  this.workspaceId = workspaceId;
360
365
  }
361
366
  // ── Plans — public read-only ────────────────────────────────────────────────
362
- listPlans() {
367
+ listPlans(opts) {
363
368
  return this.http.request({
364
369
  method: "GET",
365
- path: "/plans"
370
+ path: "/plans",
371
+ bust: opts?.bust
366
372
  });
367
373
  }
368
- getPlan(planId) {
374
+ getPlan(planId, opts) {
369
375
  return this.http.request({
370
376
  method: "GET",
371
- path: `/plans/${planId}`
377
+ path: `/plans/${planId}`,
378
+ bust: opts?.bust
372
379
  });
373
380
  }
374
381
  // ── Plans — admin write ──────────────────────────────────────────────────────
@@ -402,12 +409,13 @@ var BillingClient = class {
402
409
  });
403
410
  }
404
411
  // ── Subscription ─────────────────────────────────────────────────────────────
405
- getSubscription() {
412
+ getSubscription(opts) {
406
413
  return this.http.request({
407
414
  method: "GET",
408
415
  path: "/billing/subscription",
409
416
  token: this.tokens.get(),
410
- workspaceId: this.workspaceId
417
+ workspaceId: this.workspaceId,
418
+ bust: opts?.bust
411
419
  });
412
420
  }
413
421
  // ── Checkout / portal ────────────────────────────────────────────────────────
@@ -438,12 +446,13 @@ var BillingClient = class {
438
446
  workspaceId: this.workspaceId
439
447
  });
440
448
  }
441
- getUsage(metric) {
449
+ getUsage(metric, opts) {
442
450
  return this.http.request({
443
451
  method: "GET",
444
452
  path: `/billing/usage/${metric}`,
445
453
  token: this.tokens.get(),
446
- workspaceId: this.workspaceId
454
+ workspaceId: this.workspaceId,
455
+ bust: opts?.bust
447
456
  });
448
457
  }
449
458
  };
@@ -466,7 +475,7 @@ var CustomersClient = class {
466
475
  this.workspaceId = workspaceId;
467
476
  }
468
477
  // ── Core customer CRUD ───────────────────────────────────────────────────────
469
- listCustomers(input = {}) {
478
+ listCustomers(input = {}, opts) {
470
479
  const params = new URLSearchParams();
471
480
  if (input.search !== void 0) params.set("search", input.search);
472
481
  if (input.blacklisted !== void 0) params.set("blacklisted", String(input.blacklisted));
@@ -477,7 +486,8 @@ var CustomersClient = class {
477
486
  method: "GET",
478
487
  path: qs ? `/customers?${qs}` : "/customers",
479
488
  token: this.tokens.get(),
480
- workspaceId: this.workspaceId
489
+ workspaceId: this.workspaceId,
490
+ bust: opts?.bust
481
491
  });
482
492
  }
483
493
  createCustomer(input = {}) {
@@ -491,13 +501,14 @@ var CustomersClient = class {
491
501
  }
492
502
  // depth defaults to 2 server-side; pass { depth: 1 } for one level of
493
503
  // relationship expansion instead of the D2 (nested-relationships) shape.
494
- getCustomer(customerId, input = {}) {
504
+ getCustomer(customerId, input = {}, opts) {
495
505
  const qs = input.depth === 1 ? "?depth=1" : "";
496
506
  return this.http.request({
497
507
  method: "GET",
498
508
  path: `/customers/${customerId}${qs}`,
499
509
  token: this.tokens.get(),
500
- workspaceId: this.workspaceId
510
+ workspaceId: this.workspaceId,
511
+ bust: opts?.bust
501
512
  });
502
513
  }
503
514
  updateCustomer(customerId, input) {
@@ -535,12 +546,13 @@ var CustomersClient = class {
535
546
  });
536
547
  }
537
548
  // ── Emails ───────────────────────────────────────────────────────────────────
538
- listEmails(customerId) {
549
+ listEmails(customerId, opts) {
539
550
  return this.http.request({
540
551
  method: "GET",
541
552
  path: `/customers/${customerId}/emails`,
542
553
  token: this.tokens.get(),
543
- workspaceId: this.workspaceId
554
+ workspaceId: this.workspaceId,
555
+ bust: opts?.bust
544
556
  });
545
557
  }
546
558
  addEmail(customerId, input) {
@@ -580,12 +592,13 @@ var CustomersClient = class {
580
592
  });
581
593
  }
582
594
  // ── Phones ───────────────────────────────────────────────────────────────────
583
- listPhones(customerId) {
595
+ listPhones(customerId, opts) {
584
596
  return this.http.request({
585
597
  method: "GET",
586
598
  path: `/customers/${customerId}/phones`,
587
599
  token: this.tokens.get(),
588
- workspaceId: this.workspaceId
600
+ workspaceId: this.workspaceId,
601
+ bust: opts?.bust
589
602
  });
590
603
  }
591
604
  addPhone(customerId, input) {
@@ -624,12 +637,13 @@ var CustomersClient = class {
624
637
  });
625
638
  }
626
639
  // ── Addresses ────────────────────────────────────────────────────────────────
627
- listAddresses(customerId) {
640
+ listAddresses(customerId, opts) {
628
641
  return this.http.request({
629
642
  method: "GET",
630
643
  path: `/customers/${customerId}/addresses`,
631
644
  token: this.tokens.get(),
632
- workspaceId: this.workspaceId
645
+ workspaceId: this.workspaceId,
646
+ bust: opts?.bust
633
647
  });
634
648
  }
635
649
  addAddress(customerId, input) {
@@ -668,12 +682,13 @@ var CustomersClient = class {
668
682
  });
669
683
  }
670
684
  // ── Notes ────────────────────────────────────────────────────────────────────
671
- listNotes(customerId) {
685
+ listNotes(customerId, opts) {
672
686
  return this.http.request({
673
687
  method: "GET",
674
688
  path: `/customers/${customerId}/notes`,
675
689
  token: this.tokens.get(),
676
- workspaceId: this.workspaceId
690
+ workspaceId: this.workspaceId,
691
+ bust: opts?.bust
677
692
  });
678
693
  }
679
694
  createNote(customerId, body) {
@@ -703,12 +718,13 @@ var CustomersClient = class {
703
718
  });
704
719
  }
705
720
  // ── Tags ─────────────────────────────────────────────────────────────────────
706
- listTags(customerId) {
721
+ listTags(customerId, opts) {
707
722
  return this.http.request({
708
723
  method: "GET",
709
724
  path: `/customers/${customerId}/tags`,
710
725
  token: this.tokens.get(),
711
- workspaceId: this.workspaceId
726
+ workspaceId: this.workspaceId,
727
+ bust: opts?.bust
712
728
  });
713
729
  }
714
730
  addTag(customerId, tag) {
@@ -729,12 +745,13 @@ var CustomersClient = class {
729
745
  });
730
746
  }
731
747
  // ── Relationships ────────────────────────────────────────────────────────────
732
- listRelationships(customerId) {
748
+ listRelationships(customerId, opts) {
733
749
  return this.http.request({
734
750
  method: "GET",
735
751
  path: `/customers/${customerId}/relationships`,
736
752
  token: this.tokens.get(),
737
- workspaceId: this.workspaceId
753
+ workspaceId: this.workspaceId,
754
+ bust: opts?.bust
738
755
  });
739
756
  }
740
757
  addRelationship(customerId, input) {
@@ -767,12 +784,13 @@ var CustomersClient = class {
767
784
  // looked up/created implicitly by addEmail/addPhone/addAddress's `label`
768
785
  // string; these two methods are for managing the vocabulary directly
769
786
  // (e.g. an admin screen listing/pruning unused labels).
770
- listLabels(type) {
787
+ listLabels(type, opts) {
771
788
  return this.http.request({
772
789
  method: "GET",
773
790
  path: `/customers/labels?type=${type}`,
774
791
  token: this.tokens.get(),
775
- workspaceId: this.workspaceId
792
+ workspaceId: this.workspaceId,
793
+ bust: opts?.bust
776
794
  });
777
795
  }
778
796
  removeLabel(labelId) {
@@ -802,12 +820,13 @@ var WebhooksClient = class {
802
820
  setWorkspaceId(workspaceId) {
803
821
  this.workspaceId = workspaceId;
804
822
  }
805
- listEndpoints() {
823
+ listEndpoints(opts) {
806
824
  return this.http.request({
807
825
  method: "GET",
808
826
  path: "/webhooks",
809
827
  token: this.tokens.get(),
810
- workspaceId: this.workspaceId
828
+ workspaceId: this.workspaceId,
829
+ bust: opts?.bust
811
830
  });
812
831
  }
813
832
  // The response includes `secret` — shown once, at creation. There is no
@@ -821,12 +840,13 @@ var WebhooksClient = class {
821
840
  workspaceId: this.workspaceId
822
841
  });
823
842
  }
824
- getEndpoint(endpointId) {
843
+ getEndpoint(endpointId, opts) {
825
844
  return this.http.request({
826
845
  method: "GET",
827
846
  path: `/webhooks/${endpointId}`,
828
847
  token: this.tokens.get(),
829
- workspaceId: this.workspaceId
848
+ workspaceId: this.workspaceId,
849
+ bust: opts?.bust
830
850
  });
831
851
  }
832
852
  updateEndpoint(endpointId, input) {
@@ -846,12 +866,13 @@ var WebhooksClient = class {
846
866
  workspaceId: this.workspaceId
847
867
  });
848
868
  }
849
- listDeliveries(endpointId) {
869
+ listDeliveries(endpointId, opts) {
850
870
  return this.http.request({
851
871
  method: "GET",
852
872
  path: `/webhooks/${endpointId}/deliveries`,
853
873
  token: this.tokens.get(),
854
- workspaceId: this.workspaceId
874
+ workspaceId: this.workspaceId,
875
+ bust: opts?.bust
855
876
  });
856
877
  }
857
878
  testEndpoint(endpointId) {
@@ -882,11 +903,12 @@ var WorkspacesClient = class {
882
903
  this.workspaceId = workspaceId;
883
904
  }
884
905
  // ── Workspace creation + listing ─────────────────────────────────────────────
885
- listWorkspaces() {
906
+ listWorkspaces(opts) {
886
907
  return this.http.request({
887
908
  method: "GET",
888
909
  path: "/workspaces",
889
- token: this.tokens.get()
910
+ token: this.tokens.get(),
911
+ bust: opts?.bust
890
912
  });
891
913
  }
892
914
  createWorkspace(input) {
@@ -897,11 +919,12 @@ var WorkspacesClient = class {
897
919
  token: this.tokens.get()
898
920
  });
899
921
  }
900
- getWorkspace(id) {
922
+ getWorkspace(id, opts) {
901
923
  return this.http.request({
902
924
  method: "GET",
903
925
  path: `/workspaces/${id}`,
904
- token: this.tokens.get()
926
+ token: this.tokens.get(),
927
+ bust: opts?.bust
905
928
  });
906
929
  }
907
930
  updateWorkspace(input) {
@@ -931,12 +954,13 @@ var WorkspacesClient = class {
931
954
  });
932
955
  }
933
956
  // ── Roles ────────────────────────────────────────────────────────────────────
934
- listRoles() {
957
+ listRoles(opts) {
935
958
  return this.http.request({
936
959
  method: "GET",
937
960
  path: "/workspaces/roles",
938
961
  token: this.tokens.get(),
939
- workspaceId: this.workspaceId
962
+ workspaceId: this.workspaceId,
963
+ bust: opts?.bust
940
964
  });
941
965
  }
942
966
  createRole(input) {
@@ -948,12 +972,13 @@ var WorkspacesClient = class {
948
972
  workspaceId: this.workspaceId
949
973
  });
950
974
  }
951
- getRole(roleId) {
975
+ getRole(roleId, opts) {
952
976
  return this.http.request({
953
977
  method: "GET",
954
978
  path: `/workspaces/roles/${roleId}`,
955
979
  token: this.tokens.get(),
956
- workspaceId: this.workspaceId
980
+ workspaceId: this.workspaceId,
981
+ bust: opts?.bust
957
982
  });
958
983
  }
959
984
  updateRole(roleId, input) {
@@ -973,12 +998,13 @@ var WorkspacesClient = class {
973
998
  workspaceId: this.workspaceId
974
999
  });
975
1000
  }
976
- getRolePermissions(roleId) {
1001
+ getRolePermissions(roleId, opts) {
977
1002
  return this.http.request({
978
1003
  method: "GET",
979
1004
  path: `/workspaces/roles/${roleId}/permissions`,
980
1005
  token: this.tokens.get(),
981
- workspaceId: this.workspaceId
1006
+ workspaceId: this.workspaceId,
1007
+ bust: opts?.bust
982
1008
  });
983
1009
  }
984
1010
  setRolePermissions(roleId, permissions) {
@@ -991,12 +1017,13 @@ var WorkspacesClient = class {
991
1017
  });
992
1018
  }
993
1019
  // ── Members ──────────────────────────────────────────────────────────────────
994
- listMembers() {
1020
+ listMembers(opts) {
995
1021
  return this.http.request({
996
1022
  method: "GET",
997
1023
  path: "/workspaces/members",
998
1024
  token: this.tokens.get(),
999
- workspaceId: this.workspaceId
1025
+ workspaceId: this.workspaceId,
1026
+ bust: opts?.bust
1000
1027
  });
1001
1028
  }
1002
1029
  removeMember(userId) {
@@ -1007,12 +1034,13 @@ var WorkspacesClient = class {
1007
1034
  workspaceId: this.workspaceId
1008
1035
  });
1009
1036
  }
1010
- getMemberRoles(userId) {
1037
+ getMemberRoles(userId, opts) {
1011
1038
  return this.http.request({
1012
1039
  method: "GET",
1013
1040
  path: `/workspaces/members/${userId}/roles`,
1014
1041
  token: this.tokens.get(),
1015
- workspaceId: this.workspaceId
1042
+ workspaceId: this.workspaceId,
1043
+ bust: opts?.bust
1016
1044
  });
1017
1045
  }
1018
1046
  addMemberRole(userId, roleId) {
@@ -1033,12 +1061,13 @@ var WorkspacesClient = class {
1033
1061
  });
1034
1062
  }
1035
1063
  // ── Invitations ──────────────────────────────────────────────────────────────
1036
- listInvitations() {
1064
+ listInvitations(opts) {
1037
1065
  return this.http.request({
1038
1066
  method: "GET",
1039
1067
  path: "/workspaces/invitations",
1040
1068
  token: this.tokens.get(),
1041
- workspaceId: this.workspaceId
1069
+ workspaceId: this.workspaceId,
1070
+ bust: opts?.bust
1042
1071
  });
1043
1072
  }
1044
1073
  invite(entries) {
@@ -1067,12 +1096,13 @@ var WorkspacesClient = class {
1067
1096
  });
1068
1097
  }
1069
1098
  // ── Settings ─────────────────────────────────────────────────────────────────
1070
- getSettings() {
1099
+ getSettings(opts) {
1071
1100
  return this.http.request({
1072
1101
  method: "GET",
1073
1102
  path: "/workspaces/settings",
1074
1103
  token: this.tokens.get(),
1075
- workspaceId: this.workspaceId
1104
+ workspaceId: this.workspaceId,
1105
+ bust: opts?.bust
1076
1106
  });
1077
1107
  }
1078
1108
  updateSettings(input) {