@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/dist/index.js CHANGED
@@ -95,6 +95,7 @@ var HttpClient = class {
95
95
  if (opts.token) headers["Authorization"] = `Bearer ${opts.token}`;
96
96
  if (opts.cookie) headers["Cookie"] = opts.cookie;
97
97
  if (opts.workspaceId) headers["X-Workspace-ID"] = opts.workspaceId;
98
+ Object.assign(headers, opts.headers ?? {});
98
99
  const fetchInit = { method: opts.method, headers, credentials: "include" };
99
100
  if (opts.body !== void 0) fetchInit.body = JSON.stringify(opts.body);
100
101
  const res = await fetch(`${this.baseUrl}${opts.path}`, fetchInit);
@@ -455,6 +456,25 @@ var BillingClient = class {
455
456
  bust: opts?.bust
456
457
  });
457
458
  }
459
+ // ── Wallet ─────────────────────────────────────────────────────────────────────
460
+ getWallet(opts) {
461
+ return this.http.request({
462
+ method: "GET",
463
+ path: "/billing/wallet",
464
+ token: this.tokens.get(),
465
+ workspaceId: this.workspaceId,
466
+ bust: opts?.bust
467
+ });
468
+ }
469
+ setWalletPreferences(input) {
470
+ return this.http.request({
471
+ method: "POST",
472
+ path: "/billing/wallet/preferences",
473
+ body: input,
474
+ token: this.tokens.get(),
475
+ workspaceId: this.workspaceId
476
+ });
477
+ }
458
478
  };
459
479
 
460
480
  // src/modules/customers.ts
@@ -1257,9 +1277,11 @@ function envQuery(environment) {
1257
1277
  var ConfigAdminClient = class {
1258
1278
  http;
1259
1279
  adminToken;
1280
+ actorHeaders;
1260
1281
  constructor(opts) {
1261
1282
  this.http = new HttpClient(opts.baseUrl);
1262
1283
  this.adminToken = opts.adminToken;
1284
+ this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
1263
1285
  }
1264
1286
  // ── Config ───────────────────────────────────────────────────────────────
1265
1287
  listConfig(environment) {
@@ -1281,14 +1303,16 @@ var ConfigAdminClient = class {
1281
1303
  method: "PUT",
1282
1304
  path: `/admin/config/${key}${envQuery(environment)}`,
1283
1305
  body: input,
1284
- token: this.adminToken
1306
+ token: this.adminToken,
1307
+ headers: this.actorHeaders
1285
1308
  });
1286
1309
  }
1287
1310
  deleteConfig(key, environment) {
1288
1311
  return this.http.request({
1289
1312
  method: "DELETE",
1290
1313
  path: `/admin/config/${key}${envQuery(environment)}`,
1291
- token: this.adminToken
1314
+ token: this.adminToken,
1315
+ headers: this.actorHeaders
1292
1316
  });
1293
1317
  }
1294
1318
  listConfigRevisions(key, environment) {
@@ -1303,7 +1327,8 @@ var ConfigAdminClient = class {
1303
1327
  method: "POST",
1304
1328
  path: `/admin/config/${key}/rollback${envQuery(environment)}`,
1305
1329
  body: input,
1306
- token: this.adminToken
1330
+ token: this.adminToken,
1331
+ headers: this.actorHeaders
1307
1332
  });
1308
1333
  }
1309
1334
  // ── Secrets (masked) ─────────────────────────────────────────────────────
@@ -1326,14 +1351,16 @@ var ConfigAdminClient = class {
1326
1351
  method: "PUT",
1327
1352
  path: `/admin/secrets/${key}${envQuery(environment)}`,
1328
1353
  body: input,
1329
- token: this.adminToken
1354
+ token: this.adminToken,
1355
+ headers: this.actorHeaders
1330
1356
  });
1331
1357
  }
1332
1358
  deleteSecret(key, environment) {
1333
1359
  return this.http.request({
1334
1360
  method: "DELETE",
1335
1361
  path: `/admin/secrets/${key}${envQuery(environment)}`,
1336
- token: this.adminToken
1362
+ token: this.adminToken,
1363
+ headers: this.actorHeaders
1337
1364
  });
1338
1365
  }
1339
1366
  listSecretRevisions(key, environment) {
@@ -1348,7 +1375,8 @@ var ConfigAdminClient = class {
1348
1375
  method: "POST",
1349
1376
  path: `/admin/secrets/${key}/rollback${envQuery(environment)}`,
1350
1377
  body: input,
1351
- token: this.adminToken
1378
+ token: this.adminToken,
1379
+ headers: this.actorHeaders
1352
1380
  });
1353
1381
  }
1354
1382
  // POST (not GET) so the decrypted value never lands in a URL or access log.
@@ -1356,7 +1384,8 @@ var ConfigAdminClient = class {
1356
1384
  return this.http.request({
1357
1385
  method: "POST",
1358
1386
  path: `/admin/secrets/${key}/reveal${envQuery(environment)}`,
1359
- token: this.adminToken
1387
+ token: this.adminToken,
1388
+ headers: this.actorHeaders
1360
1389
  });
1361
1390
  }
1362
1391
  };
@@ -1365,9 +1394,11 @@ var ConfigAdminClient = class {
1365
1394
  var CourierAdminClient = class {
1366
1395
  http;
1367
1396
  adminToken;
1397
+ actorHeaders;
1368
1398
  constructor(opts) {
1369
1399
  this.http = new HttpClient(opts.baseUrl);
1370
1400
  this.adminToken = opts.adminToken;
1401
+ this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
1371
1402
  }
1372
1403
  listTemplates() {
1373
1404
  return this.http.request({
@@ -1390,7 +1421,8 @@ var CourierAdminClient = class {
1390
1421
  method: "PUT",
1391
1422
  path: `/admin/templates/${type}${q}`,
1392
1423
  body: input,
1393
- token: this.adminToken
1424
+ token: this.adminToken,
1425
+ headers: this.actorHeaders
1394
1426
  });
1395
1427
  }
1396
1428
  deleteTemplate(type, locale) {
@@ -1398,7 +1430,8 @@ var CourierAdminClient = class {
1398
1430
  return this.http.request({
1399
1431
  method: "DELETE",
1400
1432
  path: `/admin/templates/${type}${q}`,
1401
- token: this.adminToken
1433
+ token: this.adminToken,
1434
+ headers: this.actorHeaders
1402
1435
  });
1403
1436
  }
1404
1437
  listRevisions(type, locale) {
@@ -1415,7 +1448,8 @@ var CourierAdminClient = class {
1415
1448
  method: "POST",
1416
1449
  path: `/admin/templates/${type}/rollback${q}`,
1417
1450
  body: input,
1418
- token: this.adminToken
1451
+ token: this.adminToken,
1452
+ headers: this.actorHeaders
1419
1453
  });
1420
1454
  }
1421
1455
  };