apiblaze 0.17.23 → 0.18.1

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
@@ -703,7 +703,7 @@ var import_commander = require("commander");
703
703
  var import_chalk39 = __toESM(require("chalk"));
704
704
 
705
705
  // package.json
706
- var version = "0.17.23";
706
+ var version = "0.18.1";
707
707
 
708
708
  // src/index.ts
709
709
  init_types();
@@ -54,7 +54,6 @@ function createPlaneCore(cfg) {
54
54
  function planeFetch(base, method, path, user, opts = {}) {
55
55
  const params = new URLSearchParams({ product: "apiblaze", ...opts.query ?? {} });
56
56
  const headers = { "X-API-Key": cfg.cpKey, "X-End-User-Id": user.userId };
57
- if (user.email) headers["X-End-User-Email"] = String(user.email);
58
57
  let body;
59
58
  if (opts.body !== void 0) {
60
59
  headers["Content-Type"] = "application/json";
@@ -206,6 +205,7 @@ function createApiblazeKeys(cfg) {
206
205
  const expiresIn = cfg.keyExpiresInSeconds;
207
206
  const planeFetch = (method, path, user, opts = {}) => core.planeFetch(base, method, path, user, opts);
208
207
  const resolveTenant = (user) => core.resolveTenant(user);
208
+ const ensureEndUser = (user, tenant) => core.ensureEndUser(user, tenant);
209
209
  async function allowedTypesFor(user) {
210
210
  const raw = cfg.resolveKeyTypes ? await cfg.resolveKeyTypes(user) : user.keyTypes;
211
211
  if (raw === false) return false;
@@ -242,6 +242,7 @@ function createApiblazeKeys(cfg) {
242
242
  return { status: 403, data: { error: "You are not allowed to create that key type." } };
243
243
  }
244
244
  const chosen = op.keyType ?? (eligible.includes("call-only") ? "call-only" : eligible[0]);
245
+ await ensureEndUser(user, tenant2);
245
246
  const body = { tenant: tenant2, key_type_ids: [chosen], environment: "prod" };
246
247
  if (typeof expiresIn === "number" && expiresIn > 0) body.expires_in_seconds = expiresIn;
247
248
  const r = await planeFetch("POST", "/apikeys", user, { body });
@@ -26,7 +26,6 @@ function createPlaneCore(cfg) {
26
26
  function planeFetch(base, method, path, user, opts = {}) {
27
27
  const params = new URLSearchParams({ product: "apiblaze", ...opts.query ?? {} });
28
28
  const headers = { "X-API-Key": cfg.cpKey, "X-End-User-Id": user.userId };
29
- if (user.email) headers["X-End-User-Email"] = String(user.email);
30
29
  let body;
31
30
  if (opts.body !== void 0) {
32
31
  headers["Content-Type"] = "application/json";
@@ -178,6 +177,7 @@ function createApiblazeKeys(cfg) {
178
177
  const expiresIn = cfg.keyExpiresInSeconds;
179
178
  const planeFetch = (method, path, user, opts = {}) => core.planeFetch(base, method, path, user, opts);
180
179
  const resolveTenant = (user) => core.resolveTenant(user);
180
+ const ensureEndUser = (user, tenant) => core.ensureEndUser(user, tenant);
181
181
  async function allowedTypesFor(user) {
182
182
  const raw = cfg.resolveKeyTypes ? await cfg.resolveKeyTypes(user) : user.keyTypes;
183
183
  if (raw === false) return false;
@@ -214,6 +214,7 @@ function createApiblazeKeys(cfg) {
214
214
  return { status: 403, data: { error: "You are not allowed to create that key type." } };
215
215
  }
216
216
  const chosen = op.keyType ?? (eligible.includes("call-only") ? "call-only" : eligible[0]);
217
+ await ensureEndUser(user, tenant2);
217
218
  const body = { tenant: tenant2, key_type_ids: [chosen], environment: "prod" };
218
219
  if (typeof expiresIn === "number" && expiresIn > 0) body.expires_in_seconds = expiresIn;
219
220
  const r = await planeFetch("POST", "/apikeys", user, { body });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apiblaze",
3
- "version": "0.17.23",
3
+ "version": "0.18.1",
4
4
  "description": "APIblaze CLI — Chat with your APIs, Manage your API keys, users and groups with the APIblaze serverless proxy",
5
5
  "keywords": [
6
6
  "apiblaze",