@needle-tools/gltf-build-pipeline 3.0.0-next.3fbb1fc → 3.0.0-next.73f1606

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +11 -14
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -1190,7 +1190,7 @@ function registerExtensions(node) {
1190
1190
  import { createTransform } from "@gltf-transform/functions";
1191
1191
 
1192
1192
  // src/utils/version.gen.ts
1193
- var version = "3.0.0-next.3fbb1fc";
1193
+ var version = "3.0.0-next.73f1606";
1194
1194
 
1195
1195
  // src/utils/version.ts
1196
1196
  function getVersion(_marklocal = !0) {
@@ -3926,10 +3926,10 @@ var AuthError = class extends Error {
3926
3926
  constructor(message) {
3927
3927
  super(message), this.name = "AuthError";
3928
3928
  }
3929
- }, LOCAL_LICENSE_URL = "http://localhost:8424/api/license", LOCAL_FETCH_TIMEOUT_MS = 2e3;
3929
+ }, LOCAL_FETCH_TIMEOUT_MS = 2e3;
3930
3930
  async function tryFetchLocalToken(org) {
3931
3931
  try {
3932
- let url = new URL(LOCAL_LICENSE_URL);
3932
+ let baseUrl = process.env.NEEDLE_LICENSE_SERVER_URL || "http://localhost:8424/api/license", url = new URL(baseUrl);
3933
3933
  org && url.searchParams.set("org", org);
3934
3934
  let res = await fetch(url, {
3935
3935
  signal: AbortSignal.timeout(LOCAL_FETCH_TIMEOUT_MS)
@@ -3941,10 +3941,10 @@ async function tryFetchLocalToken(org) {
3941
3941
  return null;
3942
3942
  }
3943
3943
  }
3944
- async function verifyWithKey(token, key, opts) {
3944
+ async function verifyWithKey(token, key) {
3945
3945
  if (!key.alg) throw new AuthError(`trusted key '${key.kid ?? "?"}' is missing 'alg'`);
3946
3946
  let keyObj = await importJWK(key, key.alg);
3947
- await jwtVerify(token, keyObj, opts?.requireExp ? { requiredClaims: ["exp"] } : void 0);
3947
+ await jwtVerify(token, keyObj);
3948
3948
  }
3949
3949
  async function verifyAuthToken(token) {
3950
3950
  if (!token)
@@ -3957,7 +3957,7 @@ async function verifyAuthToken(token) {
3957
3957
  let match = TRUSTED_KEYS.find((k) => k.kid === header.kid);
3958
3958
  if (!match)
3959
3959
  throw new AuthError(`token signed by unknown key '${header.kid}'`);
3960
- await verifyWithKey(token, match, { requireExp: !0 });
3960
+ await verifyWithKey(token, match);
3961
3961
  } else {
3962
3962
  let lastError = null;
3963
3963
  for (let key of TRUSTED_KEYS)
@@ -3973,13 +3973,8 @@ async function verifyAuthToken(token) {
3973
3973
  }
3974
3974
  } catch (err) {
3975
3975
  if (err instanceof AuthError) throw err;
3976
- if (err && typeof err == "object" && "code" in err) {
3977
- let code = err.code;
3978
- if (code === "ERR_JWT_EXPIRED")
3979
- throw new AuthError("token expired");
3980
- if (code === "ERR_JWT_CLAIM_VALIDATION_FAILED" && "claim" in err && err.claim === "exp")
3981
- throw new AuthError("token missing 'exp' claim");
3982
- }
3976
+ if (err && typeof err == "object" && "code" in err && err.code === "ERR_JWT_EXPIRED")
3977
+ throw new AuthError("token expired");
3983
3978
  let message = err instanceof Error ? err.message : String(err);
3984
3979
  throw new AuthError(message);
3985
3980
  }
@@ -3987,7 +3982,9 @@ async function verifyAuthToken(token) {
3987
3982
  async function requireAuth(cliToken, org) {
3988
3983
  let token = typeof cliToken == "string" && cliToken.length > 0 ? cliToken : process.env.NEEDLE_CLOUD_TOKEN;
3989
3984
  if ((!token || typeof token == "string" && token.length === 0) && (token = await tryFetchLocalToken(org ?? process.env.NEEDLE_CLOUD_ORG)), !token)
3990
- throw new AuthError("pass --auth-token or set NEEDLE_CLOUD_TOKEN (or log in to the needle-cloud CLI)");
3985
+ throw new AuthError(
3986
+ "No valid auth token found. Provide one via --auth-token, NEEDLE_CLOUD_TOKEN env, or log in to the needle-cloud CLI (npx needle-cloud@version-1 start --restart). If you are logged in but still see this error, try updating: npx needle-cloud@version-1 start --restart"
3987
+ );
3991
3988
  await verifyAuthToken(token);
3992
3989
  }
3993
3990
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/gltf-build-pipeline",
3
- "version": "3.0.0-next.3fbb1fc",
3
+ "version": "3.0.0-next.73f1606",
4
4
  "description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
5
5
  "type": "module",
6
6
  "exports": {