@fonderie/client 0.17.0 → 0.18.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
@@ -61,6 +61,12 @@ var HttpClient = class {
61
61
  cache;
62
62
  defaultTtlMs;
63
63
  refresh;
64
+ // Absolute URL for a path on this client's origin — for endpoints a browser
65
+ // navigates to or embeds (e.g. a public `<img src>`) rather than fetches
66
+ // through request(). Mirrors the `${baseUrl}${path}` join request() uses.
67
+ absolute(path) {
68
+ return `${this.baseUrl}${path}`;
69
+ }
64
70
  // Drop all cached responses — sign-out must not leave one session's data
65
71
  // servable to the next.
66
72
  clearCache() {
@@ -418,7 +424,7 @@ var BillingClient = class {
418
424
  getPlan(planId, opts) {
419
425
  return this.http.request({
420
426
  method: "GET",
421
- path: `/plans/${planId}`,
427
+ path: `/plans/${encodeURIComponent(planId)}`,
422
428
  bust: opts?.bust
423
429
  });
424
430
  }
@@ -440,7 +446,7 @@ var BillingClient = class {
440
446
  updatePlan(planId, input) {
441
447
  return this.http.request({
442
448
  method: "PUT",
443
- path: `/plans/${planId}`,
449
+ path: `/plans/${encodeURIComponent(planId)}`,
444
450
  body: input,
445
451
  token: this.tokens.get()
446
452
  });
@@ -448,7 +454,7 @@ var BillingClient = class {
448
454
  deletePlan(planId) {
449
455
  return this.http.request({
450
456
  method: "DELETE",
451
- path: `/plans/${planId}`,
457
+ path: `/plans/${encodeURIComponent(planId)}`,
452
458
  token: this.tokens.get()
453
459
  });
454
460
  }
@@ -515,7 +521,7 @@ var BillingClient = class {
515
521
  getUsage(metric, opts) {
516
522
  return this.http.request({
517
523
  method: "GET",
518
- path: `/billing/usage/${metric}`,
524
+ path: `/billing/usage/${encodeURIComponent(metric)}`,
519
525
  token: this.tokens.get(),
520
526
  workspaceId: this.workspaceId,
521
527
  bust: opts?.bust
@@ -685,7 +691,7 @@ var CustomersClient = class {
685
691
  const qs = input.depth === 1 ? "?depth=1" : "";
686
692
  return this.http.request({
687
693
  method: "GET",
688
- path: `/customers/${customerId}${qs}`,
694
+ path: `/customers/${encodeURIComponent(customerId)}${qs}`,
689
695
  token: this.tokens.get(),
690
696
  workspaceId: this.workspaceId,
691
697
  bust: opts?.bust
@@ -694,7 +700,7 @@ var CustomersClient = class {
694
700
  updateCustomer(customerId, input) {
695
701
  return this.http.request({
696
702
  method: "PUT",
697
- path: `/customers/${customerId}`,
703
+ path: `/customers/${encodeURIComponent(customerId)}`,
698
704
  body: input,
699
705
  token: this.tokens.get(),
700
706
  workspaceId: this.workspaceId
@@ -703,7 +709,7 @@ var CustomersClient = class {
703
709
  deleteCustomer(customerId) {
704
710
  return this.http.request({
705
711
  method: "DELETE",
706
- path: `/customers/${customerId}`,
712
+ path: `/customers/${encodeURIComponent(customerId)}`,
707
713
  token: this.tokens.get(),
708
714
  workspaceId: this.workspaceId
709
715
  });
@@ -711,7 +717,7 @@ var CustomersClient = class {
711
717
  blacklistCustomer(customerId, input = {}) {
712
718
  return this.http.request({
713
719
  method: "POST",
714
- path: `/customers/${customerId}/blacklist`,
720
+ path: `/customers/${encodeURIComponent(customerId)}/blacklist`,
715
721
  body: input,
716
722
  token: this.tokens.get(),
717
723
  workspaceId: this.workspaceId
@@ -720,7 +726,7 @@ var CustomersClient = class {
720
726
  unblacklistCustomer(customerId) {
721
727
  return this.http.request({
722
728
  method: "POST",
723
- path: `/customers/${customerId}/unblacklist`,
729
+ path: `/customers/${encodeURIComponent(customerId)}/unblacklist`,
724
730
  token: this.tokens.get(),
725
731
  workspaceId: this.workspaceId
726
732
  });
@@ -729,7 +735,7 @@ var CustomersClient = class {
729
735
  listEmails(customerId, opts) {
730
736
  return this.http.request({
731
737
  method: "GET",
732
- path: `/customers/${customerId}/emails`,
738
+ path: `/customers/${encodeURIComponent(customerId)}/emails`,
733
739
  token: this.tokens.get(),
734
740
  workspaceId: this.workspaceId,
735
741
  bust: opts?.bust
@@ -738,7 +744,7 @@ var CustomersClient = class {
738
744
  addEmail(customerId, input) {
739
745
  return this.http.request({
740
746
  method: "POST",
741
- path: `/customers/${customerId}/emails`,
747
+ path: `/customers/${encodeURIComponent(customerId)}/emails`,
742
748
  body: input,
743
749
  token: this.tokens.get(),
744
750
  workspaceId: this.workspaceId
@@ -749,7 +755,7 @@ var CustomersClient = class {
749
755
  updateEmailLabel(customerId, emailId, label) {
750
756
  return this.http.request({
751
757
  method: "PATCH",
752
- path: `/customers/${customerId}/emails/${emailId}`,
758
+ path: `/customers/${encodeURIComponent(customerId)}/emails/${encodeURIComponent(emailId)}`,
753
759
  body: { label },
754
760
  token: this.tokens.get(),
755
761
  workspaceId: this.workspaceId
@@ -758,7 +764,7 @@ var CustomersClient = class {
758
764
  setPrimaryEmail(customerId, emailId) {
759
765
  return this.http.request({
760
766
  method: "PUT",
761
- path: `/customers/${customerId}/emails/${emailId}/primary`,
767
+ path: `/customers/${encodeURIComponent(customerId)}/emails/${encodeURIComponent(emailId)}/primary`,
762
768
  token: this.tokens.get(),
763
769
  workspaceId: this.workspaceId
764
770
  });
@@ -766,7 +772,7 @@ var CustomersClient = class {
766
772
  removeEmail(customerId, emailId) {
767
773
  return this.http.request({
768
774
  method: "DELETE",
769
- path: `/customers/${customerId}/emails/${emailId}`,
775
+ path: `/customers/${encodeURIComponent(customerId)}/emails/${encodeURIComponent(emailId)}`,
770
776
  token: this.tokens.get(),
771
777
  workspaceId: this.workspaceId
772
778
  });
@@ -775,7 +781,7 @@ var CustomersClient = class {
775
781
  listPhones(customerId, opts) {
776
782
  return this.http.request({
777
783
  method: "GET",
778
- path: `/customers/${customerId}/phones`,
784
+ path: `/customers/${encodeURIComponent(customerId)}/phones`,
779
785
  token: this.tokens.get(),
780
786
  workspaceId: this.workspaceId,
781
787
  bust: opts?.bust
@@ -784,7 +790,7 @@ var CustomersClient = class {
784
790
  addPhone(customerId, input) {
785
791
  return this.http.request({
786
792
  method: "POST",
787
- path: `/customers/${customerId}/phones`,
793
+ path: `/customers/${encodeURIComponent(customerId)}/phones`,
788
794
  body: input,
789
795
  token: this.tokens.get(),
790
796
  workspaceId: this.workspaceId
@@ -794,7 +800,7 @@ var CustomersClient = class {
794
800
  updatePhoneLabel(customerId, phoneId, label) {
795
801
  return this.http.request({
796
802
  method: "PATCH",
797
- path: `/customers/${customerId}/phones/${phoneId}`,
803
+ path: `/customers/${encodeURIComponent(customerId)}/phones/${encodeURIComponent(phoneId)}`,
798
804
  body: { label },
799
805
  token: this.tokens.get(),
800
806
  workspaceId: this.workspaceId
@@ -803,7 +809,7 @@ var CustomersClient = class {
803
809
  setPrimaryPhone(customerId, phoneId) {
804
810
  return this.http.request({
805
811
  method: "PUT",
806
- path: `/customers/${customerId}/phones/${phoneId}/primary`,
812
+ path: `/customers/${encodeURIComponent(customerId)}/phones/${encodeURIComponent(phoneId)}/primary`,
807
813
  token: this.tokens.get(),
808
814
  workspaceId: this.workspaceId
809
815
  });
@@ -811,7 +817,7 @@ var CustomersClient = class {
811
817
  removePhone(customerId, phoneId) {
812
818
  return this.http.request({
813
819
  method: "DELETE",
814
- path: `/customers/${customerId}/phones/${phoneId}`,
820
+ path: `/customers/${encodeURIComponent(customerId)}/phones/${encodeURIComponent(phoneId)}`,
815
821
  token: this.tokens.get(),
816
822
  workspaceId: this.workspaceId
817
823
  });
@@ -820,7 +826,7 @@ var CustomersClient = class {
820
826
  listAddresses(customerId, opts) {
821
827
  return this.http.request({
822
828
  method: "GET",
823
- path: `/customers/${customerId}/addresses`,
829
+ path: `/customers/${encodeURIComponent(customerId)}/addresses`,
824
830
  token: this.tokens.get(),
825
831
  workspaceId: this.workspaceId,
826
832
  bust: opts?.bust
@@ -829,7 +835,7 @@ var CustomersClient = class {
829
835
  addAddress(customerId, input) {
830
836
  return this.http.request({
831
837
  method: "POST",
832
- path: `/customers/${customerId}/addresses`,
838
+ path: `/customers/${encodeURIComponent(customerId)}/addresses`,
833
839
  body: input,
834
840
  token: this.tokens.get(),
835
841
  workspaceId: this.workspaceId
@@ -839,7 +845,7 @@ var CustomersClient = class {
839
845
  updateAddressLabel(customerId, addrId, label) {
840
846
  return this.http.request({
841
847
  method: "PATCH",
842
- path: `/customers/${customerId}/addresses/${addrId}`,
848
+ path: `/customers/${encodeURIComponent(customerId)}/addresses/${encodeURIComponent(addrId)}`,
843
849
  body: { label },
844
850
  token: this.tokens.get(),
845
851
  workspaceId: this.workspaceId
@@ -848,7 +854,7 @@ var CustomersClient = class {
848
854
  setPrimaryAddress(customerId, addrId) {
849
855
  return this.http.request({
850
856
  method: "PUT",
851
- path: `/customers/${customerId}/addresses/${addrId}/primary`,
857
+ path: `/customers/${encodeURIComponent(customerId)}/addresses/${encodeURIComponent(addrId)}/primary`,
852
858
  token: this.tokens.get(),
853
859
  workspaceId: this.workspaceId
854
860
  });
@@ -856,7 +862,7 @@ var CustomersClient = class {
856
862
  removeAddress(customerId, addrId) {
857
863
  return this.http.request({
858
864
  method: "DELETE",
859
- path: `/customers/${customerId}/addresses/${addrId}`,
865
+ path: `/customers/${encodeURIComponent(customerId)}/addresses/${encodeURIComponent(addrId)}`,
860
866
  token: this.tokens.get(),
861
867
  workspaceId: this.workspaceId
862
868
  });
@@ -865,7 +871,7 @@ var CustomersClient = class {
865
871
  listNotes(customerId, opts) {
866
872
  return this.http.request({
867
873
  method: "GET",
868
- path: `/customers/${customerId}/notes`,
874
+ path: `/customers/${encodeURIComponent(customerId)}/notes`,
869
875
  token: this.tokens.get(),
870
876
  workspaceId: this.workspaceId,
871
877
  bust: opts?.bust
@@ -874,7 +880,7 @@ var CustomersClient = class {
874
880
  createNote(customerId, body) {
875
881
  return this.http.request({
876
882
  method: "POST",
877
- path: `/customers/${customerId}/notes`,
883
+ path: `/customers/${encodeURIComponent(customerId)}/notes`,
878
884
  body: { body },
879
885
  token: this.tokens.get(),
880
886
  workspaceId: this.workspaceId
@@ -883,7 +889,7 @@ var CustomersClient = class {
883
889
  updateNote(customerId, noteId, body) {
884
890
  return this.http.request({
885
891
  method: "PUT",
886
- path: `/customers/${customerId}/notes/${noteId}`,
892
+ path: `/customers/${encodeURIComponent(customerId)}/notes/${encodeURIComponent(noteId)}`,
887
893
  body: { body },
888
894
  token: this.tokens.get(),
889
895
  workspaceId: this.workspaceId
@@ -892,7 +898,7 @@ var CustomersClient = class {
892
898
  deleteNote(customerId, noteId) {
893
899
  return this.http.request({
894
900
  method: "DELETE",
895
- path: `/customers/${customerId}/notes/${noteId}`,
901
+ path: `/customers/${encodeURIComponent(customerId)}/notes/${encodeURIComponent(noteId)}`,
896
902
  token: this.tokens.get(),
897
903
  workspaceId: this.workspaceId
898
904
  });
@@ -901,7 +907,7 @@ var CustomersClient = class {
901
907
  listTags(customerId, opts) {
902
908
  return this.http.request({
903
909
  method: "GET",
904
- path: `/customers/${customerId}/tags`,
910
+ path: `/customers/${encodeURIComponent(customerId)}/tags`,
905
911
  token: this.tokens.get(),
906
912
  workspaceId: this.workspaceId,
907
913
  bust: opts?.bust
@@ -910,7 +916,7 @@ var CustomersClient = class {
910
916
  addTag(customerId, tag) {
911
917
  return this.http.request({
912
918
  method: "POST",
913
- path: `/customers/${customerId}/tags`,
919
+ path: `/customers/${encodeURIComponent(customerId)}/tags`,
914
920
  body: { tag },
915
921
  token: this.tokens.get(),
916
922
  workspaceId: this.workspaceId
@@ -928,7 +934,7 @@ var CustomersClient = class {
928
934
  listRelationships(customerId, opts) {
929
935
  return this.http.request({
930
936
  method: "GET",
931
- path: `/customers/${customerId}/relationships`,
937
+ path: `/customers/${encodeURIComponent(customerId)}/relationships`,
932
938
  token: this.tokens.get(),
933
939
  workspaceId: this.workspaceId,
934
940
  bust: opts?.bust
@@ -937,7 +943,7 @@ var CustomersClient = class {
937
943
  addRelationship(customerId, input) {
938
944
  return this.http.request({
939
945
  method: "POST",
940
- path: `/customers/${customerId}/relationships`,
946
+ path: `/customers/${encodeURIComponent(customerId)}/relationships`,
941
947
  body: input,
942
948
  token: this.tokens.get(),
943
949
  workspaceId: this.workspaceId
@@ -946,7 +952,7 @@ var CustomersClient = class {
946
952
  setPrimaryRelationship(customerId, relatedId) {
947
953
  return this.http.request({
948
954
  method: "PUT",
949
- path: `/customers/${customerId}/relationships/${relatedId}/primary`,
955
+ path: `/customers/${encodeURIComponent(customerId)}/relationships/${encodeURIComponent(relatedId)}/primary`,
950
956
  token: this.tokens.get(),
951
957
  workspaceId: this.workspaceId
952
958
  });
@@ -954,7 +960,7 @@ var CustomersClient = class {
954
960
  removeRelationship(customerId, relatedId) {
955
961
  return this.http.request({
956
962
  method: "DELETE",
957
- path: `/customers/${customerId}/relationships/${relatedId}`,
963
+ path: `/customers/${encodeURIComponent(customerId)}/relationships/${encodeURIComponent(relatedId)}`,
958
964
  token: this.tokens.get(),
959
965
  workspaceId: this.workspaceId
960
966
  });
@@ -967,7 +973,7 @@ var CustomersClient = class {
967
973
  listLabels(type, opts) {
968
974
  return this.http.request({
969
975
  method: "GET",
970
- path: `/customers/labels?type=${type}`,
976
+ path: `/customers/labels?type=${encodeURIComponent(type)}`,
971
977
  token: this.tokens.get(),
972
978
  workspaceId: this.workspaceId,
973
979
  bust: opts?.bust
@@ -976,13 +982,62 @@ var CustomersClient = class {
976
982
  removeLabel(labelId) {
977
983
  return this.http.request({
978
984
  method: "DELETE",
979
- path: `/customers/labels/${labelId}`,
985
+ path: `/customers/labels/${encodeURIComponent(labelId)}`,
980
986
  token: this.tokens.get(),
981
987
  workspaceId: this.workspaceId
982
988
  });
983
989
  }
984
990
  };
985
991
 
992
+ // src/modules/media.ts
993
+ var MediaClient = class {
994
+ constructor(http, tokens) {
995
+ this.http = http;
996
+ this.tokens = tokens;
997
+ }
998
+ http;
999
+ tokens;
1000
+ setAccessToken(token) {
1001
+ this.tokens.set(token);
1002
+ }
1003
+ // POST /media — store an image; returns the asset with its monomorphic
1004
+ // /media/:id url. requireAuth server-side.
1005
+ upload(input) {
1006
+ return this.http.request({
1007
+ method: "POST",
1008
+ path: "/media",
1009
+ body: input,
1010
+ token: this.tokens.get()
1011
+ });
1012
+ }
1013
+ // DELETE /media/:id — uploader-only (403 for anyone else).
1014
+ delete(id) {
1015
+ return this.http.request({
1016
+ method: "DELETE",
1017
+ path: `/media/${encodeURIComponent(id)}`,
1018
+ token: this.tokens.get()
1019
+ });
1020
+ }
1021
+ // Absolute URL for a stored asset — an `<img src>` target. The GET /media/:id
1022
+ // route is public and cached (it can't carry a Bearer token), so turn an
1023
+ // upload's `asset.id` into a browser-loadable URL with this, and use it as
1024
+ // the avatarUrl handed to auth's updateProfile.
1025
+ assetUrl(id) {
1026
+ return this.http.absolute(`/media/${encodeURIComponent(id)}`);
1027
+ }
1028
+ // Inverse of assetUrl: pull the asset id out of one of THIS brick's
1029
+ // /media/:id URLs (absolute or relative); null for empty/external URLs. Lets
1030
+ // avatar cleanup delete only assets we minted (matched as a UUID), never a
1031
+ // placeholder or third-party avatar URL.
1032
+ assetIdFromUrl(url) {
1033
+ if (!url) return null;
1034
+ const m = url.match(
1035
+ /\/media\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:[/?#]|$)/i
1036
+ );
1037
+ return m ? m[1] : null;
1038
+ }
1039
+ };
1040
+
986
1041
  // src/modules/webhooks.ts
987
1042
  var WebhooksClient = class {
988
1043
  constructor(http, tokens) {
@@ -1023,7 +1078,7 @@ var WebhooksClient = class {
1023
1078
  getEndpoint(endpointId, opts) {
1024
1079
  return this.http.request({
1025
1080
  method: "GET",
1026
- path: `/webhooks/${endpointId}`,
1081
+ path: `/webhooks/${encodeURIComponent(endpointId)}`,
1027
1082
  token: this.tokens.get(),
1028
1083
  workspaceId: this.workspaceId,
1029
1084
  bust: opts?.bust
@@ -1032,7 +1087,7 @@ var WebhooksClient = class {
1032
1087
  updateEndpoint(endpointId, input) {
1033
1088
  return this.http.request({
1034
1089
  method: "PATCH",
1035
- path: `/webhooks/${endpointId}`,
1090
+ path: `/webhooks/${encodeURIComponent(endpointId)}`,
1036
1091
  body: input,
1037
1092
  token: this.tokens.get(),
1038
1093
  workspaceId: this.workspaceId
@@ -1041,7 +1096,7 @@ var WebhooksClient = class {
1041
1096
  deleteEndpoint(endpointId) {
1042
1097
  return this.http.request({
1043
1098
  method: "DELETE",
1044
- path: `/webhooks/${endpointId}`,
1099
+ path: `/webhooks/${encodeURIComponent(endpointId)}`,
1045
1100
  token: this.tokens.get(),
1046
1101
  workspaceId: this.workspaceId
1047
1102
  });
@@ -1049,7 +1104,7 @@ var WebhooksClient = class {
1049
1104
  listDeliveries(endpointId, opts) {
1050
1105
  return this.http.request({
1051
1106
  method: "GET",
1052
- path: `/webhooks/${endpointId}/deliveries`,
1107
+ path: `/webhooks/${encodeURIComponent(endpointId)}/deliveries`,
1053
1108
  token: this.tokens.get(),
1054
1109
  workspaceId: this.workspaceId,
1055
1110
  bust: opts?.bust
@@ -1058,7 +1113,7 @@ var WebhooksClient = class {
1058
1113
  testEndpoint(endpointId) {
1059
1114
  return this.http.request({
1060
1115
  method: "POST",
1061
- path: `/webhooks/${endpointId}/test`,
1116
+ path: `/webhooks/${encodeURIComponent(endpointId)}/test`,
1062
1117
  token: this.tokens.get(),
1063
1118
  workspaceId: this.workspaceId
1064
1119
  });
@@ -1102,7 +1157,7 @@ var WorkspacesClient = class {
1102
1157
  getWorkspace(id, opts) {
1103
1158
  return this.http.request({
1104
1159
  method: "GET",
1105
- path: `/workspaces/${id}`,
1160
+ path: `/workspaces/${encodeURIComponent(id)}`,
1106
1161
  token: this.tokens.get(),
1107
1162
  bust: opts?.bust
1108
1163
  });
@@ -1155,7 +1210,7 @@ var WorkspacesClient = class {
1155
1210
  getRole(roleId, opts) {
1156
1211
  return this.http.request({
1157
1212
  method: "GET",
1158
- path: `/workspaces/roles/${roleId}`,
1213
+ path: `/workspaces/roles/${encodeURIComponent(roleId)}`,
1159
1214
  token: this.tokens.get(),
1160
1215
  workspaceId: this.workspaceId,
1161
1216
  bust: opts?.bust
@@ -1164,7 +1219,7 @@ var WorkspacesClient = class {
1164
1219
  updateRole(roleId, input) {
1165
1220
  return this.http.request({
1166
1221
  method: "PUT",
1167
- path: `/workspaces/roles/${roleId}`,
1222
+ path: `/workspaces/roles/${encodeURIComponent(roleId)}`,
1168
1223
  body: input,
1169
1224
  token: this.tokens.get(),
1170
1225
  workspaceId: this.workspaceId
@@ -1173,7 +1228,7 @@ var WorkspacesClient = class {
1173
1228
  removeRole(roleId) {
1174
1229
  return this.http.request({
1175
1230
  method: "DELETE",
1176
- path: `/workspaces/roles/${roleId}`,
1231
+ path: `/workspaces/roles/${encodeURIComponent(roleId)}`,
1177
1232
  token: this.tokens.get(),
1178
1233
  workspaceId: this.workspaceId
1179
1234
  });
@@ -1181,7 +1236,7 @@ var WorkspacesClient = class {
1181
1236
  getRolePermissions(roleId, opts) {
1182
1237
  return this.http.request({
1183
1238
  method: "GET",
1184
- path: `/workspaces/roles/${roleId}/permissions`,
1239
+ path: `/workspaces/roles/${encodeURIComponent(roleId)}/permissions`,
1185
1240
  token: this.tokens.get(),
1186
1241
  workspaceId: this.workspaceId,
1187
1242
  bust: opts?.bust
@@ -1190,7 +1245,7 @@ var WorkspacesClient = class {
1190
1245
  setRolePermissions(roleId, permissions) {
1191
1246
  return this.http.request({
1192
1247
  method: "POST",
1193
- path: `/workspaces/roles/${roleId}/permissions`,
1248
+ path: `/workspaces/roles/${encodeURIComponent(roleId)}/permissions`,
1194
1249
  body: { permissions },
1195
1250
  token: this.tokens.get(),
1196
1251
  workspaceId: this.workspaceId
@@ -1209,7 +1264,7 @@ var WorkspacesClient = class {
1209
1264
  removeMember(userId) {
1210
1265
  return this.http.request({
1211
1266
  method: "DELETE",
1212
- path: `/workspaces/members/${userId}`,
1267
+ path: `/workspaces/members/${encodeURIComponent(userId)}`,
1213
1268
  token: this.tokens.get(),
1214
1269
  workspaceId: this.workspaceId
1215
1270
  });
@@ -1217,7 +1272,7 @@ var WorkspacesClient = class {
1217
1272
  getMemberRoles(userId, opts) {
1218
1273
  return this.http.request({
1219
1274
  method: "GET",
1220
- path: `/workspaces/members/${userId}/roles`,
1275
+ path: `/workspaces/members/${encodeURIComponent(userId)}/roles`,
1221
1276
  token: this.tokens.get(),
1222
1277
  workspaceId: this.workspaceId,
1223
1278
  bust: opts?.bust
@@ -1226,7 +1281,7 @@ var WorkspacesClient = class {
1226
1281
  addMemberRole(userId, roleId) {
1227
1282
  return this.http.request({
1228
1283
  method: "POST",
1229
- path: `/workspaces/members/${userId}/roles`,
1284
+ path: `/workspaces/members/${encodeURIComponent(userId)}/roles`,
1230
1285
  body: { roleId },
1231
1286
  token: this.tokens.get(),
1232
1287
  workspaceId: this.workspaceId
@@ -1235,7 +1290,7 @@ var WorkspacesClient = class {
1235
1290
  removeMemberRole(userId, roleId) {
1236
1291
  return this.http.request({
1237
1292
  method: "DELETE",
1238
- path: `/workspaces/members/${userId}/roles/${roleId}`,
1293
+ path: `/workspaces/members/${encodeURIComponent(userId)}/roles/${encodeURIComponent(roleId)}`,
1239
1294
  token: this.tokens.get(),
1240
1295
  workspaceId: this.workspaceId
1241
1296
  });
@@ -1262,7 +1317,7 @@ var WorkspacesClient = class {
1262
1317
  cancelInvitation(inviteId) {
1263
1318
  return this.http.request({
1264
1319
  method: "DELETE",
1265
- path: `/workspaces/invitations/${inviteId}`,
1320
+ path: `/workspaces/invitations/${encodeURIComponent(inviteId)}`,
1266
1321
  token: this.tokens.get(),
1267
1322
  workspaceId: this.workspaceId
1268
1323
  });
@@ -1318,6 +1373,7 @@ var FonderieClient = class {
1318
1373
  audit;
1319
1374
  webhooks;
1320
1375
  customers;
1376
+ media;
1321
1377
  http;
1322
1378
  tokens;
1323
1379
  workspaceId;
@@ -1340,6 +1396,7 @@ var FonderieClient = class {
1340
1396
  this.audit = new AuditClient(this.http, this.tokens);
1341
1397
  this.webhooks = new WebhooksClient(this.http, this.tokens);
1342
1398
  this.customers = new CustomersClient(this.http, this.tokens);
1399
+ this.media = new MediaClient(this.http, this.tokens);
1343
1400
  if (opts.workspaceId !== void 0) this.setWorkspaceId(opts.workspaceId);
1344
1401
  }
1345
1402
  // Single-flight refresh: POST /auth/refresh with the app-supplied refresh
@@ -1454,14 +1511,14 @@ var ConfigAdminClient = class {
1454
1511
  getConfig(key, environment) {
1455
1512
  return this.http.request({
1456
1513
  method: "GET",
1457
- path: `/admin/config/${key}${envQuery(environment)}`,
1514
+ path: `/admin/config/${encodeURIComponent(key)}${envQuery(environment)}`,
1458
1515
  token: this.adminToken
1459
1516
  });
1460
1517
  }
1461
1518
  setConfig(key, input, environment) {
1462
1519
  return this.http.request({
1463
1520
  method: "PUT",
1464
- path: `/admin/config/${key}${envQuery(environment)}`,
1521
+ path: `/admin/config/${encodeURIComponent(key)}${envQuery(environment)}`,
1465
1522
  body: input,
1466
1523
  token: this.adminToken,
1467
1524
  headers: this.actorHeaders
@@ -1470,7 +1527,7 @@ var ConfigAdminClient = class {
1470
1527
  deleteConfig(key, environment) {
1471
1528
  return this.http.request({
1472
1529
  method: "DELETE",
1473
- path: `/admin/config/${key}${envQuery(environment)}`,
1530
+ path: `/admin/config/${encodeURIComponent(key)}${envQuery(environment)}`,
1474
1531
  token: this.adminToken,
1475
1532
  headers: this.actorHeaders
1476
1533
  });
@@ -1478,14 +1535,14 @@ var ConfigAdminClient = class {
1478
1535
  listConfigRevisions(key, environment) {
1479
1536
  return this.http.request({
1480
1537
  method: "GET",
1481
- path: `/admin/config/${key}/revisions${envQuery(environment)}`,
1538
+ path: `/admin/config/${encodeURIComponent(key)}/revisions${envQuery(environment)}`,
1482
1539
  token: this.adminToken
1483
1540
  });
1484
1541
  }
1485
1542
  rollbackConfig(key, input, environment) {
1486
1543
  return this.http.request({
1487
1544
  method: "POST",
1488
- path: `/admin/config/${key}/rollback${envQuery(environment)}`,
1545
+ path: `/admin/config/${encodeURIComponent(key)}/rollback${envQuery(environment)}`,
1489
1546
  body: input,
1490
1547
  token: this.adminToken,
1491
1548
  headers: this.actorHeaders
@@ -1502,14 +1559,14 @@ var ConfigAdminClient = class {
1502
1559
  getSecret(key, environment) {
1503
1560
  return this.http.request({
1504
1561
  method: "GET",
1505
- path: `/admin/secrets/${key}${envQuery(environment)}`,
1562
+ path: `/admin/secrets/${encodeURIComponent(key)}${envQuery(environment)}`,
1506
1563
  token: this.adminToken
1507
1564
  });
1508
1565
  }
1509
1566
  setSecret(key, input, environment) {
1510
1567
  return this.http.request({
1511
1568
  method: "PUT",
1512
- path: `/admin/secrets/${key}${envQuery(environment)}`,
1569
+ path: `/admin/secrets/${encodeURIComponent(key)}${envQuery(environment)}`,
1513
1570
  body: input,
1514
1571
  token: this.adminToken,
1515
1572
  headers: this.actorHeaders
@@ -1518,7 +1575,7 @@ var ConfigAdminClient = class {
1518
1575
  deleteSecret(key, environment) {
1519
1576
  return this.http.request({
1520
1577
  method: "DELETE",
1521
- path: `/admin/secrets/${key}${envQuery(environment)}`,
1578
+ path: `/admin/secrets/${encodeURIComponent(key)}${envQuery(environment)}`,
1522
1579
  token: this.adminToken,
1523
1580
  headers: this.actorHeaders
1524
1581
  });
@@ -1526,14 +1583,14 @@ var ConfigAdminClient = class {
1526
1583
  listSecretRevisions(key, environment) {
1527
1584
  return this.http.request({
1528
1585
  method: "GET",
1529
- path: `/admin/secrets/${key}/revisions${envQuery(environment)}`,
1586
+ path: `/admin/secrets/${encodeURIComponent(key)}/revisions${envQuery(environment)}`,
1530
1587
  token: this.adminToken
1531
1588
  });
1532
1589
  }
1533
1590
  rollbackSecret(key, input, environment) {
1534
1591
  return this.http.request({
1535
1592
  method: "POST",
1536
- path: `/admin/secrets/${key}/rollback${envQuery(environment)}`,
1593
+ path: `/admin/secrets/${encodeURIComponent(key)}/rollback${envQuery(environment)}`,
1537
1594
  body: input,
1538
1595
  token: this.adminToken,
1539
1596
  headers: this.actorHeaders
@@ -1543,7 +1600,7 @@ var ConfigAdminClient = class {
1543
1600
  revealSecret(key, environment) {
1544
1601
  return this.http.request({
1545
1602
  method: "POST",
1546
- path: `/admin/secrets/${key}/reveal${envQuery(environment)}`,
1603
+ path: `/admin/secrets/${encodeURIComponent(key)}/reveal${envQuery(environment)}`,
1547
1604
  token: this.adminToken,
1548
1605
  headers: this.actorHeaders
1549
1606
  });
@@ -1571,7 +1628,7 @@ var CourierAdminClient = class {
1571
1628
  const q = locale ? `?locale=${encodeURIComponent(locale)}` : "";
1572
1629
  return this.http.request({
1573
1630
  method: "GET",
1574
- path: `/admin/templates/${type}${q}`,
1631
+ path: `/admin/templates/${encodeURIComponent(type)}${q}`,
1575
1632
  token: this.adminToken
1576
1633
  });
1577
1634
  }
@@ -1579,7 +1636,7 @@ var CourierAdminClient = class {
1579
1636
  const q = locale ? `?locale=${encodeURIComponent(locale)}` : "";
1580
1637
  return this.http.request({
1581
1638
  method: "PUT",
1582
- path: `/admin/templates/${type}${q}`,
1639
+ path: `/admin/templates/${encodeURIComponent(type)}${q}`,
1583
1640
  body: input,
1584
1641
  token: this.adminToken,
1585
1642
  headers: this.actorHeaders
@@ -1589,7 +1646,7 @@ var CourierAdminClient = class {
1589
1646
  const q = locale ? `?locale=${encodeURIComponent(locale)}` : "";
1590
1647
  return this.http.request({
1591
1648
  method: "DELETE",
1592
- path: `/admin/templates/${type}${q}`,
1649
+ path: `/admin/templates/${encodeURIComponent(type)}${q}`,
1593
1650
  token: this.adminToken,
1594
1651
  headers: this.actorHeaders
1595
1652
  });
@@ -1598,7 +1655,7 @@ var CourierAdminClient = class {
1598
1655
  const q = locale ? `?locale=${encodeURIComponent(locale)}` : "";
1599
1656
  return this.http.request({
1600
1657
  method: "GET",
1601
- path: `/admin/templates/${type}/revisions${q}`,
1658
+ path: `/admin/templates/${encodeURIComponent(type)}/revisions${q}`,
1602
1659
  token: this.adminToken
1603
1660
  });
1604
1661
  }
@@ -1606,7 +1663,7 @@ var CourierAdminClient = class {
1606
1663
  const q = locale ? `?locale=${encodeURIComponent(locale)}` : "";
1607
1664
  return this.http.request({
1608
1665
  method: "POST",
1609
- path: `/admin/templates/${type}/rollback${q}`,
1666
+ path: `/admin/templates/${encodeURIComponent(type)}/rollback${q}`,
1610
1667
  body: input,
1611
1668
  token: this.adminToken,
1612
1669
  headers: this.actorHeaders
@@ -1627,6 +1684,7 @@ export {
1627
1684
  CustomersClient,
1628
1685
  FonderieApiError,
1629
1686
  FonderieClient,
1687
+ MediaClient,
1630
1688
  WebhooksClient,
1631
1689
  WorkspacesClient,
1632
1690
  createMemoryCache,