@fonderie/client 0.10.0 → 0.12.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/brain/signatures.md +58 -25
- package/dist/index.cjs +44 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -24
- package/dist/index.d.ts +61 -24
- package/dist/index.js +44 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/brain/signatures.md
CHANGED
|
@@ -107,16 +107,21 @@ interface IResetPasswordInput {
|
|
|
107
107
|
interface IUpdatePreferencesInput {
|
|
108
108
|
locale?: string;
|
|
109
109
|
timezone?: string;
|
|
110
|
-
notifications?:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
notifications?: {
|
|
111
|
+
email?: boolean;
|
|
112
|
+
inApp?: boolean;
|
|
113
|
+
sms?: boolean;
|
|
114
|
+
push?: boolean;
|
|
115
|
+
};
|
|
116
|
+
emailDigest?: string;
|
|
117
|
+
dateFormat?: string;
|
|
118
|
+
timeFormat?: string;
|
|
114
119
|
}
|
|
115
120
|
|
|
116
121
|
interface IUpdateProfileInput {
|
|
117
|
-
firstName?: string;
|
|
118
|
-
lastName?: string;
|
|
119
|
-
avatarUrl?: string;
|
|
122
|
+
firstName?: string | null;
|
|
123
|
+
lastName?: string | null;
|
|
124
|
+
avatarUrl?: string | null;
|
|
120
125
|
}
|
|
121
126
|
|
|
122
127
|
new AuthClient(http: HttpClient, tokens: TokenStore): AuthClient
|
|
@@ -165,6 +170,10 @@ interface IRecordUsageInput {
|
|
|
165
170
|
|
|
166
171
|
type IUpdatePlanInput = Partial<ICreatePlanInput>;
|
|
167
172
|
|
|
173
|
+
interface IWalletPreferencesInput {
|
|
174
|
+
spendPurchased: boolean;
|
|
175
|
+
}
|
|
176
|
+
|
|
168
177
|
new BillingClient(http: HttpClient, tokens: TokenStore): BillingClient
|
|
169
178
|
.setAccessToken(token: string | undefined): void
|
|
170
179
|
.setWorkspaceId(workspaceId: string | undefined): void
|
|
@@ -178,10 +187,13 @@ new BillingClient(http: HttpClient, tokens: TokenStore): BillingClient
|
|
|
178
187
|
.createPortalSession(): Promise<IApiResponse<IPortalUrlResult>>
|
|
179
188
|
.recordUsage(input: IRecordUsageInput): Promise<IApiResponse<undefined>>
|
|
180
189
|
.getUsage(metric: string, opts?: IReadOptions | undefined): Promise<IApiResponse<IUsageResult>>
|
|
190
|
+
.getWallet(opts?: IReadOptions | undefined): Promise<IApiResponse<IWalletResult>>
|
|
191
|
+
.setWalletPreferences(input: IWalletPreferencesInput): Promise<IApiResponse<IWalletResult>>
|
|
181
192
|
|
|
182
193
|
interface IConfigAdminClientOptions {
|
|
183
194
|
baseUrl: string;
|
|
184
195
|
adminToken: string;
|
|
196
|
+
actor?: string;
|
|
185
197
|
}
|
|
186
198
|
|
|
187
199
|
interface IRollbackInput {
|
|
@@ -191,12 +203,14 @@ interface IRollbackInput {
|
|
|
191
203
|
interface ISetConfigInput {
|
|
192
204
|
value: unknown;
|
|
193
205
|
description?: string;
|
|
206
|
+
active?: boolean;
|
|
194
207
|
ifVersion?: number;
|
|
195
208
|
}
|
|
196
209
|
|
|
197
210
|
interface ISetSecretInput {
|
|
198
211
|
value: string;
|
|
199
212
|
description?: string;
|
|
213
|
+
active?: boolean;
|
|
200
214
|
ifVersion?: number;
|
|
201
215
|
}
|
|
202
216
|
|
|
@@ -218,6 +232,7 @@ new ConfigAdminClient(opts: IConfigAdminClientOptions): ConfigAdminClient
|
|
|
218
232
|
interface ICourierAdminClientOptions {
|
|
219
233
|
baseUrl: string;
|
|
220
234
|
adminToken: string;
|
|
235
|
+
actor?: string;
|
|
221
236
|
}
|
|
222
237
|
|
|
223
238
|
interface IRollbackTemplateInput {
|
|
@@ -266,7 +281,7 @@ interface IAddPhoneInput {
|
|
|
266
281
|
|
|
267
282
|
interface IAddRelationshipInput {
|
|
268
283
|
relatedId: string;
|
|
269
|
-
relationship
|
|
284
|
+
relationship: string;
|
|
270
285
|
isPrimary?: boolean;
|
|
271
286
|
}
|
|
272
287
|
|
|
@@ -298,7 +313,7 @@ interface IListCustomersInput {
|
|
|
298
313
|
offset?: number;
|
|
299
314
|
}
|
|
300
315
|
|
|
301
|
-
type IUpdateCustomerInput = ICreateCustomerInput
|
|
316
|
+
type IUpdateCustomerInput = Omit<ICreateCustomerInput, 'referralCode' | 'referredByCode'>;
|
|
302
317
|
|
|
303
318
|
new CustomersClient(http: HttpClient, tokens: TokenStore): CustomersClient
|
|
304
319
|
.setAccessToken(token: string | undefined): void
|
|
@@ -306,7 +321,7 @@ new CustomersClient(http: HttpClient, tokens: TokenStore): CustomersClient
|
|
|
306
321
|
.listCustomers(input?: IListCustomersInput, opts?: IReadOptions | undefined): Promise<IApiResponse<ICustomerListResult>>
|
|
307
322
|
.createCustomer(input?: ICreateCustomerInput): Promise<IApiResponse<ICustomerResult>>
|
|
308
323
|
.getCustomer(customerId: string, input?: IGetCustomerInput, opts?: IReadOptions | undefined): Promise<IApiResponse<ICustomerDetailDTO | ICustomerDetailD2DTO>>
|
|
309
|
-
.updateCustomer(customerId: string, input:
|
|
324
|
+
.updateCustomer(customerId: string, input: IUpdateCustomerInput): Promise<IApiResponse<ICustomerResult>>
|
|
310
325
|
.deleteCustomer(customerId: string): Promise<IApiResponse<undefined>>
|
|
311
326
|
.blacklistCustomer(customerId: string, input?: IBlacklistCustomerInput): Promise<IApiResponse<undefined>>
|
|
312
327
|
.unblacklistCustomer(customerId: string): Promise<IApiResponse<undefined>>
|
|
@@ -528,6 +543,7 @@ interface IConfigRevision {
|
|
|
528
543
|
interface ICustomerAddressDTO {
|
|
529
544
|
id: string;
|
|
530
545
|
label: string;
|
|
546
|
+
labelId: string | null;
|
|
531
547
|
isPrimary: boolean;
|
|
532
548
|
address: IAddressDTO;
|
|
533
549
|
}
|
|
@@ -578,6 +594,7 @@ interface ICustomerEmailDTO {
|
|
|
578
594
|
id: string;
|
|
579
595
|
email: string;
|
|
580
596
|
label: string;
|
|
597
|
+
labelId: string | null;
|
|
581
598
|
isPrimary: boolean;
|
|
582
599
|
createdAt: string;
|
|
583
600
|
}
|
|
@@ -626,6 +643,7 @@ interface ICustomerPhoneDTO {
|
|
|
626
643
|
id: string;
|
|
627
644
|
phone: string;
|
|
628
645
|
label: string;
|
|
646
|
+
labelId: string | null;
|
|
629
647
|
isPrimary: boolean;
|
|
630
648
|
createdAt: string;
|
|
631
649
|
}
|
|
@@ -655,6 +673,7 @@ type ICustomerRelationshipExpandedDTO = Omit<ICustomerShallowDTO, 'id'> & {
|
|
|
655
673
|
customerId: string;
|
|
656
674
|
relationship: string;
|
|
657
675
|
isPrimary: boolean;
|
|
676
|
+
relationshipCreatedAt: string;
|
|
658
677
|
};
|
|
659
678
|
|
|
660
679
|
interface ICustomerRelationshipListResult {
|
|
@@ -706,6 +725,7 @@ interface IInviteResult {
|
|
|
706
725
|
interface ILoginResult {
|
|
707
726
|
tokens: ITokens;
|
|
708
727
|
user: IUserDTO;
|
|
728
|
+
requiresVerification?: boolean;
|
|
709
729
|
}
|
|
710
730
|
|
|
711
731
|
interface IMemberDTO {
|
|
@@ -715,6 +735,10 @@ interface IMemberDTO {
|
|
|
715
735
|
roleName: string;
|
|
716
736
|
confirmed: boolean;
|
|
717
737
|
createdAt: string;
|
|
738
|
+
email: string;
|
|
739
|
+
firstName: string;
|
|
740
|
+
lastName: string;
|
|
741
|
+
profileImageUrl: string;
|
|
718
742
|
}
|
|
719
743
|
|
|
720
744
|
interface IMemberListResult {
|
|
@@ -726,8 +750,7 @@ interface IMeResult {
|
|
|
726
750
|
}
|
|
727
751
|
|
|
728
752
|
interface IMfaEnabledResult {
|
|
729
|
-
|
|
730
|
-
user: IUserDTO;
|
|
753
|
+
mfaEnabled: boolean;
|
|
731
754
|
}
|
|
732
755
|
|
|
733
756
|
interface IMfaRequiredResult {
|
|
@@ -752,6 +775,7 @@ interface IPlanDTO {
|
|
|
752
775
|
yearly: number;
|
|
753
776
|
currency: string;
|
|
754
777
|
};
|
|
778
|
+
pricingStale?: boolean;
|
|
755
779
|
features: IPlanFeature[];
|
|
756
780
|
metadata: Record<string, unknown>;
|
|
757
781
|
}
|
|
@@ -786,16 +810,12 @@ interface IReadOptions {
|
|
|
786
810
|
interface IRegisterResult {
|
|
787
811
|
tokens: ITokens;
|
|
788
812
|
user: IUserDTO;
|
|
813
|
+
requiresVerification?: boolean;
|
|
789
814
|
}
|
|
790
815
|
|
|
791
816
|
interface IResendVerificationResult {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
data: {
|
|
795
|
-
token: string;
|
|
796
|
-
expiresAt: string;
|
|
797
|
-
email: string;
|
|
798
|
-
};
|
|
817
|
+
email?: string;
|
|
818
|
+
verified?: boolean;
|
|
799
819
|
}
|
|
800
820
|
|
|
801
821
|
interface IRevealSecretResult {
|
|
@@ -904,9 +924,9 @@ interface IUserDTO {
|
|
|
904
924
|
profileImageUrl: string;
|
|
905
925
|
isActive: boolean;
|
|
906
926
|
lastLogin: string;
|
|
907
|
-
skills: IUserSkill[];
|
|
908
927
|
preferences: IUserPreferences;
|
|
909
928
|
isEmailVerified: boolean;
|
|
929
|
+
isPhoneVerified: boolean;
|
|
910
930
|
mfaEnabled: boolean;
|
|
911
931
|
suspended: boolean;
|
|
912
932
|
whitelist: boolean;
|
|
@@ -929,23 +949,35 @@ interface IUserPreferences {
|
|
|
929
949
|
timeFormat: string;
|
|
930
950
|
}
|
|
931
951
|
|
|
932
|
-
interface IUserSkill {
|
|
933
|
-
name: string;
|
|
934
|
-
level: string;
|
|
935
|
-
}
|
|
936
|
-
|
|
937
952
|
interface IVerifyEmailResult {
|
|
938
953
|
verified: boolean;
|
|
939
954
|
email: string;
|
|
940
955
|
}
|
|
941
956
|
|
|
957
|
+
interface IWalletDTO {
|
|
958
|
+
balance: string;
|
|
959
|
+
currency: string;
|
|
960
|
+
precision: number;
|
|
961
|
+
granted?: string;
|
|
962
|
+
purchased?: string;
|
|
963
|
+
spendPurchased?: boolean;
|
|
964
|
+
grantedExpiresAt?: string | null;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
interface IWalletResult {
|
|
968
|
+
wallet: IWalletDTO;
|
|
969
|
+
}
|
|
970
|
+
|
|
942
971
|
interface IWebhookDeliveryDTO {
|
|
943
972
|
id: string;
|
|
944
973
|
eventId: string;
|
|
945
974
|
eventType: string;
|
|
946
975
|
status: string;
|
|
947
976
|
attempts: number;
|
|
977
|
+
payload: Record<string, unknown>;
|
|
948
978
|
responseStatus: number | null;
|
|
979
|
+
responseBody: string | null;
|
|
980
|
+
nextAttemptAt: string | null;
|
|
949
981
|
deliveredAt: string | null;
|
|
950
982
|
createdAt: string;
|
|
951
983
|
}
|
|
@@ -994,6 +1026,7 @@ interface IWorkspaceDTO {
|
|
|
994
1026
|
isPersonal: boolean;
|
|
995
1027
|
isArchived: boolean;
|
|
996
1028
|
archivedAt: string;
|
|
1029
|
+
archivedBy: string;
|
|
997
1030
|
createdAt: string;
|
|
998
1031
|
updatedAt: string;
|
|
999
1032
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -132,6 +132,7 @@ var HttpClient = class {
|
|
|
132
132
|
if (opts.token) headers["Authorization"] = `Bearer ${opts.token}`;
|
|
133
133
|
if (opts.cookie) headers["Cookie"] = opts.cookie;
|
|
134
134
|
if (opts.workspaceId) headers["X-Workspace-ID"] = opts.workspaceId;
|
|
135
|
+
Object.assign(headers, opts.headers ?? {});
|
|
135
136
|
const fetchInit = { method: opts.method, headers, credentials: "include" };
|
|
136
137
|
if (opts.body !== void 0) fetchInit.body = JSON.stringify(opts.body);
|
|
137
138
|
const res = await fetch(`${this.baseUrl}${opts.path}`, fetchInit);
|
|
@@ -492,6 +493,25 @@ var BillingClient = class {
|
|
|
492
493
|
bust: opts?.bust
|
|
493
494
|
});
|
|
494
495
|
}
|
|
496
|
+
// ── Wallet ─────────────────────────────────────────────────────────────────────
|
|
497
|
+
getWallet(opts) {
|
|
498
|
+
return this.http.request({
|
|
499
|
+
method: "GET",
|
|
500
|
+
path: "/billing/wallet",
|
|
501
|
+
token: this.tokens.get(),
|
|
502
|
+
workspaceId: this.workspaceId,
|
|
503
|
+
bust: opts?.bust
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
setWalletPreferences(input) {
|
|
507
|
+
return this.http.request({
|
|
508
|
+
method: "POST",
|
|
509
|
+
path: "/billing/wallet/preferences",
|
|
510
|
+
body: input,
|
|
511
|
+
token: this.tokens.get(),
|
|
512
|
+
workspaceId: this.workspaceId
|
|
513
|
+
});
|
|
514
|
+
}
|
|
495
515
|
};
|
|
496
516
|
|
|
497
517
|
// src/modules/customers.ts
|
|
@@ -1294,9 +1314,11 @@ function envQuery(environment) {
|
|
|
1294
1314
|
var ConfigAdminClient = class {
|
|
1295
1315
|
http;
|
|
1296
1316
|
adminToken;
|
|
1317
|
+
actorHeaders;
|
|
1297
1318
|
constructor(opts) {
|
|
1298
1319
|
this.http = new HttpClient(opts.baseUrl);
|
|
1299
1320
|
this.adminToken = opts.adminToken;
|
|
1321
|
+
this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
|
|
1300
1322
|
}
|
|
1301
1323
|
// ── Config ───────────────────────────────────────────────────────────────
|
|
1302
1324
|
listConfig(environment) {
|
|
@@ -1318,14 +1340,16 @@ var ConfigAdminClient = class {
|
|
|
1318
1340
|
method: "PUT",
|
|
1319
1341
|
path: `/admin/config/${key}${envQuery(environment)}`,
|
|
1320
1342
|
body: input,
|
|
1321
|
-
token: this.adminToken
|
|
1343
|
+
token: this.adminToken,
|
|
1344
|
+
headers: this.actorHeaders
|
|
1322
1345
|
});
|
|
1323
1346
|
}
|
|
1324
1347
|
deleteConfig(key, environment) {
|
|
1325
1348
|
return this.http.request({
|
|
1326
1349
|
method: "DELETE",
|
|
1327
1350
|
path: `/admin/config/${key}${envQuery(environment)}`,
|
|
1328
|
-
token: this.adminToken
|
|
1351
|
+
token: this.adminToken,
|
|
1352
|
+
headers: this.actorHeaders
|
|
1329
1353
|
});
|
|
1330
1354
|
}
|
|
1331
1355
|
listConfigRevisions(key, environment) {
|
|
@@ -1340,7 +1364,8 @@ var ConfigAdminClient = class {
|
|
|
1340
1364
|
method: "POST",
|
|
1341
1365
|
path: `/admin/config/${key}/rollback${envQuery(environment)}`,
|
|
1342
1366
|
body: input,
|
|
1343
|
-
token: this.adminToken
|
|
1367
|
+
token: this.adminToken,
|
|
1368
|
+
headers: this.actorHeaders
|
|
1344
1369
|
});
|
|
1345
1370
|
}
|
|
1346
1371
|
// ── Secrets (masked) ─────────────────────────────────────────────────────
|
|
@@ -1363,14 +1388,16 @@ var ConfigAdminClient = class {
|
|
|
1363
1388
|
method: "PUT",
|
|
1364
1389
|
path: `/admin/secrets/${key}${envQuery(environment)}`,
|
|
1365
1390
|
body: input,
|
|
1366
|
-
token: this.adminToken
|
|
1391
|
+
token: this.adminToken,
|
|
1392
|
+
headers: this.actorHeaders
|
|
1367
1393
|
});
|
|
1368
1394
|
}
|
|
1369
1395
|
deleteSecret(key, environment) {
|
|
1370
1396
|
return this.http.request({
|
|
1371
1397
|
method: "DELETE",
|
|
1372
1398
|
path: `/admin/secrets/${key}${envQuery(environment)}`,
|
|
1373
|
-
token: this.adminToken
|
|
1399
|
+
token: this.adminToken,
|
|
1400
|
+
headers: this.actorHeaders
|
|
1374
1401
|
});
|
|
1375
1402
|
}
|
|
1376
1403
|
listSecretRevisions(key, environment) {
|
|
@@ -1385,7 +1412,8 @@ var ConfigAdminClient = class {
|
|
|
1385
1412
|
method: "POST",
|
|
1386
1413
|
path: `/admin/secrets/${key}/rollback${envQuery(environment)}`,
|
|
1387
1414
|
body: input,
|
|
1388
|
-
token: this.adminToken
|
|
1415
|
+
token: this.adminToken,
|
|
1416
|
+
headers: this.actorHeaders
|
|
1389
1417
|
});
|
|
1390
1418
|
}
|
|
1391
1419
|
// POST (not GET) so the decrypted value never lands in a URL or access log.
|
|
@@ -1393,7 +1421,8 @@ var ConfigAdminClient = class {
|
|
|
1393
1421
|
return this.http.request({
|
|
1394
1422
|
method: "POST",
|
|
1395
1423
|
path: `/admin/secrets/${key}/reveal${envQuery(environment)}`,
|
|
1396
|
-
token: this.adminToken
|
|
1424
|
+
token: this.adminToken,
|
|
1425
|
+
headers: this.actorHeaders
|
|
1397
1426
|
});
|
|
1398
1427
|
}
|
|
1399
1428
|
};
|
|
@@ -1402,9 +1431,11 @@ var ConfigAdminClient = class {
|
|
|
1402
1431
|
var CourierAdminClient = class {
|
|
1403
1432
|
http;
|
|
1404
1433
|
adminToken;
|
|
1434
|
+
actorHeaders;
|
|
1405
1435
|
constructor(opts) {
|
|
1406
1436
|
this.http = new HttpClient(opts.baseUrl);
|
|
1407
1437
|
this.adminToken = opts.adminToken;
|
|
1438
|
+
this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
|
|
1408
1439
|
}
|
|
1409
1440
|
listTemplates() {
|
|
1410
1441
|
return this.http.request({
|
|
@@ -1427,7 +1458,8 @@ var CourierAdminClient = class {
|
|
|
1427
1458
|
method: "PUT",
|
|
1428
1459
|
path: `/admin/templates/${type}${q}`,
|
|
1429
1460
|
body: input,
|
|
1430
|
-
token: this.adminToken
|
|
1461
|
+
token: this.adminToken,
|
|
1462
|
+
headers: this.actorHeaders
|
|
1431
1463
|
});
|
|
1432
1464
|
}
|
|
1433
1465
|
deleteTemplate(type, locale) {
|
|
@@ -1435,7 +1467,8 @@ var CourierAdminClient = class {
|
|
|
1435
1467
|
return this.http.request({
|
|
1436
1468
|
method: "DELETE",
|
|
1437
1469
|
path: `/admin/templates/${type}${q}`,
|
|
1438
|
-
token: this.adminToken
|
|
1470
|
+
token: this.adminToken,
|
|
1471
|
+
headers: this.actorHeaders
|
|
1439
1472
|
});
|
|
1440
1473
|
}
|
|
1441
1474
|
listRevisions(type, locale) {
|
|
@@ -1452,7 +1485,8 @@ var CourierAdminClient = class {
|
|
|
1452
1485
|
method: "POST",
|
|
1453
1486
|
path: `/admin/templates/${type}/rollback${q}`,
|
|
1454
1487
|
body: input,
|
|
1455
|
-
token: this.adminToken
|
|
1488
|
+
token: this.adminToken,
|
|
1489
|
+
headers: this.actorHeaders
|
|
1456
1490
|
});
|
|
1457
1491
|
}
|
|
1458
1492
|
};
|