@fonderie/client 0.10.0 → 0.11.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.
@@ -107,16 +107,21 @@ interface IResetPasswordInput {
107
107
  interface IUpdatePreferencesInput {
108
108
  locale?: string;
109
109
  timezone?: string;
110
- notifications?: unknown;
111
- emailDigest?: unknown;
112
- dateFormat?: unknown;
113
- timeFormat?: unknown;
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
@@ -182,6 +187,7 @@ new BillingClient(http: HttpClient, tokens: TokenStore): BillingClient
182
187
  interface IConfigAdminClientOptions {
183
188
  baseUrl: string;
184
189
  adminToken: string;
190
+ actor?: string;
185
191
  }
186
192
 
187
193
  interface IRollbackInput {
@@ -191,12 +197,14 @@ interface IRollbackInput {
191
197
  interface ISetConfigInput {
192
198
  value: unknown;
193
199
  description?: string;
200
+ active?: boolean;
194
201
  ifVersion?: number;
195
202
  }
196
203
 
197
204
  interface ISetSecretInput {
198
205
  value: string;
199
206
  description?: string;
207
+ active?: boolean;
200
208
  ifVersion?: number;
201
209
  }
202
210
 
@@ -218,6 +226,7 @@ new ConfigAdminClient(opts: IConfigAdminClientOptions): ConfigAdminClient
218
226
  interface ICourierAdminClientOptions {
219
227
  baseUrl: string;
220
228
  adminToken: string;
229
+ actor?: string;
221
230
  }
222
231
 
223
232
  interface IRollbackTemplateInput {
@@ -266,7 +275,7 @@ interface IAddPhoneInput {
266
275
 
267
276
  interface IAddRelationshipInput {
268
277
  relatedId: string;
269
- relationship?: string;
278
+ relationship: string;
270
279
  isPrimary?: boolean;
271
280
  }
272
281
 
@@ -298,7 +307,7 @@ interface IListCustomersInput {
298
307
  offset?: number;
299
308
  }
300
309
 
301
- type IUpdateCustomerInput = ICreateCustomerInput;
310
+ type IUpdateCustomerInput = Omit<ICreateCustomerInput, 'referralCode' | 'referredByCode'>;
302
311
 
303
312
  new CustomersClient(http: HttpClient, tokens: TokenStore): CustomersClient
304
313
  .setAccessToken(token: string | undefined): void
@@ -306,7 +315,7 @@ new CustomersClient(http: HttpClient, tokens: TokenStore): CustomersClient
306
315
  .listCustomers(input?: IListCustomersInput, opts?: IReadOptions | undefined): Promise<IApiResponse<ICustomerListResult>>
307
316
  .createCustomer(input?: ICreateCustomerInput): Promise<IApiResponse<ICustomerResult>>
308
317
  .getCustomer(customerId: string, input?: IGetCustomerInput, opts?: IReadOptions | undefined): Promise<IApiResponse<ICustomerDetailDTO | ICustomerDetailD2DTO>>
309
- .updateCustomer(customerId: string, input: ICreateCustomerInput): Promise<IApiResponse<ICustomerResult>>
318
+ .updateCustomer(customerId: string, input: IUpdateCustomerInput): Promise<IApiResponse<ICustomerResult>>
310
319
  .deleteCustomer(customerId: string): Promise<IApiResponse<undefined>>
311
320
  .blacklistCustomer(customerId: string, input?: IBlacklistCustomerInput): Promise<IApiResponse<undefined>>
312
321
  .unblacklistCustomer(customerId: string): Promise<IApiResponse<undefined>>
@@ -528,6 +537,7 @@ interface IConfigRevision {
528
537
  interface ICustomerAddressDTO {
529
538
  id: string;
530
539
  label: string;
540
+ labelId: string | null;
531
541
  isPrimary: boolean;
532
542
  address: IAddressDTO;
533
543
  }
@@ -578,6 +588,7 @@ interface ICustomerEmailDTO {
578
588
  id: string;
579
589
  email: string;
580
590
  label: string;
591
+ labelId: string | null;
581
592
  isPrimary: boolean;
582
593
  createdAt: string;
583
594
  }
@@ -626,6 +637,7 @@ interface ICustomerPhoneDTO {
626
637
  id: string;
627
638
  phone: string;
628
639
  label: string;
640
+ labelId: string | null;
629
641
  isPrimary: boolean;
630
642
  createdAt: string;
631
643
  }
@@ -655,6 +667,7 @@ type ICustomerRelationshipExpandedDTO = Omit<ICustomerShallowDTO, 'id'> & {
655
667
  customerId: string;
656
668
  relationship: string;
657
669
  isPrimary: boolean;
670
+ relationshipCreatedAt: string;
658
671
  };
659
672
 
660
673
  interface ICustomerRelationshipListResult {
@@ -706,6 +719,7 @@ interface IInviteResult {
706
719
  interface ILoginResult {
707
720
  tokens: ITokens;
708
721
  user: IUserDTO;
722
+ requiresVerification?: boolean;
709
723
  }
710
724
 
711
725
  interface IMemberDTO {
@@ -715,6 +729,10 @@ interface IMemberDTO {
715
729
  roleName: string;
716
730
  confirmed: boolean;
717
731
  createdAt: string;
732
+ email: string;
733
+ firstName: string;
734
+ lastName: string;
735
+ profileImageUrl: string;
718
736
  }
719
737
 
720
738
  interface IMemberListResult {
@@ -726,8 +744,7 @@ interface IMeResult {
726
744
  }
727
745
 
728
746
  interface IMfaEnabledResult {
729
- tokens: ITokens;
730
- user: IUserDTO;
747
+ mfaEnabled: boolean;
731
748
  }
732
749
 
733
750
  interface IMfaRequiredResult {
@@ -752,6 +769,7 @@ interface IPlanDTO {
752
769
  yearly: number;
753
770
  currency: string;
754
771
  };
772
+ pricingStale?: boolean;
755
773
  features: IPlanFeature[];
756
774
  metadata: Record<string, unknown>;
757
775
  }
@@ -786,16 +804,12 @@ interface IReadOptions {
786
804
  interface IRegisterResult {
787
805
  tokens: ITokens;
788
806
  user: IUserDTO;
807
+ requiresVerification?: boolean;
789
808
  }
790
809
 
791
810
  interface IResendVerificationResult {
792
- stat: string;
793
- message: string;
794
- data: {
795
- token: string;
796
- expiresAt: string;
797
- email: string;
798
- };
811
+ email?: string;
812
+ verified?: boolean;
799
813
  }
800
814
 
801
815
  interface IRevealSecretResult {
@@ -904,9 +918,9 @@ interface IUserDTO {
904
918
  profileImageUrl: string;
905
919
  isActive: boolean;
906
920
  lastLogin: string;
907
- skills: IUserSkill[];
908
921
  preferences: IUserPreferences;
909
922
  isEmailVerified: boolean;
923
+ isPhoneVerified: boolean;
910
924
  mfaEnabled: boolean;
911
925
  suspended: boolean;
912
926
  whitelist: boolean;
@@ -929,11 +943,6 @@ interface IUserPreferences {
929
943
  timeFormat: string;
930
944
  }
931
945
 
932
- interface IUserSkill {
933
- name: string;
934
- level: string;
935
- }
936
-
937
946
  interface IVerifyEmailResult {
938
947
  verified: boolean;
939
948
  email: string;
@@ -945,7 +954,10 @@ interface IWebhookDeliveryDTO {
945
954
  eventType: string;
946
955
  status: string;
947
956
  attempts: number;
957
+ payload: Record<string, unknown>;
948
958
  responseStatus: number | null;
959
+ responseBody: string | null;
960
+ nextAttemptAt: string | null;
949
961
  deliveredAt: string | null;
950
962
  createdAt: string;
951
963
  }
@@ -994,6 +1006,7 @@ interface IWorkspaceDTO {
994
1006
  isPersonal: boolean;
995
1007
  isArchived: boolean;
996
1008
  archivedAt: string;
1009
+ archivedBy: string;
997
1010
  createdAt: string;
998
1011
  updatedAt: string;
999
1012
  }
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);
@@ -1294,9 +1295,11 @@ function envQuery(environment) {
1294
1295
  var ConfigAdminClient = class {
1295
1296
  http;
1296
1297
  adminToken;
1298
+ actorHeaders;
1297
1299
  constructor(opts) {
1298
1300
  this.http = new HttpClient(opts.baseUrl);
1299
1301
  this.adminToken = opts.adminToken;
1302
+ this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
1300
1303
  }
1301
1304
  // ── Config ───────────────────────────────────────────────────────────────
1302
1305
  listConfig(environment) {
@@ -1318,14 +1321,16 @@ var ConfigAdminClient = class {
1318
1321
  method: "PUT",
1319
1322
  path: `/admin/config/${key}${envQuery(environment)}`,
1320
1323
  body: input,
1321
- token: this.adminToken
1324
+ token: this.adminToken,
1325
+ headers: this.actorHeaders
1322
1326
  });
1323
1327
  }
1324
1328
  deleteConfig(key, environment) {
1325
1329
  return this.http.request({
1326
1330
  method: "DELETE",
1327
1331
  path: `/admin/config/${key}${envQuery(environment)}`,
1328
- token: this.adminToken
1332
+ token: this.adminToken,
1333
+ headers: this.actorHeaders
1329
1334
  });
1330
1335
  }
1331
1336
  listConfigRevisions(key, environment) {
@@ -1340,7 +1345,8 @@ var ConfigAdminClient = class {
1340
1345
  method: "POST",
1341
1346
  path: `/admin/config/${key}/rollback${envQuery(environment)}`,
1342
1347
  body: input,
1343
- token: this.adminToken
1348
+ token: this.adminToken,
1349
+ headers: this.actorHeaders
1344
1350
  });
1345
1351
  }
1346
1352
  // ── Secrets (masked) ─────────────────────────────────────────────────────
@@ -1363,14 +1369,16 @@ var ConfigAdminClient = class {
1363
1369
  method: "PUT",
1364
1370
  path: `/admin/secrets/${key}${envQuery(environment)}`,
1365
1371
  body: input,
1366
- token: this.adminToken
1372
+ token: this.adminToken,
1373
+ headers: this.actorHeaders
1367
1374
  });
1368
1375
  }
1369
1376
  deleteSecret(key, environment) {
1370
1377
  return this.http.request({
1371
1378
  method: "DELETE",
1372
1379
  path: `/admin/secrets/${key}${envQuery(environment)}`,
1373
- token: this.adminToken
1380
+ token: this.adminToken,
1381
+ headers: this.actorHeaders
1374
1382
  });
1375
1383
  }
1376
1384
  listSecretRevisions(key, environment) {
@@ -1385,7 +1393,8 @@ var ConfigAdminClient = class {
1385
1393
  method: "POST",
1386
1394
  path: `/admin/secrets/${key}/rollback${envQuery(environment)}`,
1387
1395
  body: input,
1388
- token: this.adminToken
1396
+ token: this.adminToken,
1397
+ headers: this.actorHeaders
1389
1398
  });
1390
1399
  }
1391
1400
  // POST (not GET) so the decrypted value never lands in a URL or access log.
@@ -1393,7 +1402,8 @@ var ConfigAdminClient = class {
1393
1402
  return this.http.request({
1394
1403
  method: "POST",
1395
1404
  path: `/admin/secrets/${key}/reveal${envQuery(environment)}`,
1396
- token: this.adminToken
1405
+ token: this.adminToken,
1406
+ headers: this.actorHeaders
1397
1407
  });
1398
1408
  }
1399
1409
  };
@@ -1402,9 +1412,11 @@ var ConfigAdminClient = class {
1402
1412
  var CourierAdminClient = class {
1403
1413
  http;
1404
1414
  adminToken;
1415
+ actorHeaders;
1405
1416
  constructor(opts) {
1406
1417
  this.http = new HttpClient(opts.baseUrl);
1407
1418
  this.adminToken = opts.adminToken;
1419
+ this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
1408
1420
  }
1409
1421
  listTemplates() {
1410
1422
  return this.http.request({
@@ -1427,7 +1439,8 @@ var CourierAdminClient = class {
1427
1439
  method: "PUT",
1428
1440
  path: `/admin/templates/${type}${q}`,
1429
1441
  body: input,
1430
- token: this.adminToken
1442
+ token: this.adminToken,
1443
+ headers: this.actorHeaders
1431
1444
  });
1432
1445
  }
1433
1446
  deleteTemplate(type, locale) {
@@ -1435,7 +1448,8 @@ var CourierAdminClient = class {
1435
1448
  return this.http.request({
1436
1449
  method: "DELETE",
1437
1450
  path: `/admin/templates/${type}${q}`,
1438
- token: this.adminToken
1451
+ token: this.adminToken,
1452
+ headers: this.actorHeaders
1439
1453
  });
1440
1454
  }
1441
1455
  listRevisions(type, locale) {
@@ -1452,7 +1466,8 @@ var CourierAdminClient = class {
1452
1466
  method: "POST",
1453
1467
  path: `/admin/templates/${type}/rollback${q}`,
1454
1468
  body: input,
1455
- token: this.adminToken
1469
+ token: this.adminToken,
1470
+ headers: this.actorHeaders
1456
1471
  });
1457
1472
  }
1458
1473
  };