@stacksjs/registry 0.10.35 → 0.10.40

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 (3) hide show
  1. package/README.md +5 -1
  2. package/dist/index.js +13 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Pantry package registry backend. A simple, fast package registry that works with the Pantry CLI.
4
4
 
5
+ The authoritative route, authentication, integrity, storage, failure, operations,
6
+ and test contract is [docs/registry.md](../../docs/registry.md). CI verifies its
7
+ critical claims directly against the route handlers.
8
+
5
9
  ## Features
6
10
 
7
11
  - **npm-compatible API** - Works with the Pantry CLI out of the box
@@ -9,7 +13,7 @@ Pantry package registry backend. A simple, fast package registry that works with
9
13
  - **Zig package support** - Host Zig packages with content-addressed hashing
10
14
  - **S3 storage** - Tarball storage via S3 (or local filesystem for development)
11
15
  - **Analytics** - Track download counts and package statistics
12
- - **Simple metadata** - JSON file or DynamoDB for package metadata
16
+ - **Portable metadata** - Local/in-memory stores for development and an object-storage snapshot for production
13
17
  - **Zero config** - Works out of the box for local development
14
18
 
15
19
  ## Quick Start
package/dist/index.js CHANGED
@@ -41014,22 +41014,25 @@ async function handleZigRoutes(path, req, url, storage, baseUrl, corsHeaders, an
41014
41014
  }
41015
41015
  return null;
41016
41016
  }
41017
- var REGISTRY_TOKEN = process.env.PANTRY_REGISTRY_TOKEN || process.env.PANTRY_TOKEN;
41017
+ function getRegistryToken() {
41018
+ return process.env.PANTRY_REGISTRY_TOKEN || process.env.PANTRY_TOKEN;
41019
+ }
41018
41020
  function validateToken(authHeader) {
41019
- if (!REGISTRY_TOKEN) {
41021
+ const registryToken = getRegistryToken();
41022
+ if (!registryToken) {
41020
41023
  return { valid: false, error: "Server misconfigured \u2014 no registry token set" };
41021
41024
  }
41022
41025
  if (!authHeader) {
41023
41026
  return { valid: false, error: "Authorization required" };
41024
41027
  }
41025
41028
  const token = authHeader.startsWith("Bearer ") ? authHeader.slice(7) : authHeader;
41026
- const maxLen = Math.max(token.length, REGISTRY_TOKEN.length);
41029
+ const maxLen = Math.max(token.length, registryToken.length);
41027
41030
  const tokenBuf = Buffer.alloc(maxLen);
41028
41031
  const legacyBuf = Buffer.alloc(maxLen);
41029
41032
  Buffer.from(token).copy(tokenBuf);
41030
- Buffer.from(REGISTRY_TOKEN).copy(legacyBuf);
41033
+ Buffer.from(registryToken).copy(legacyBuf);
41031
41034
  const crypto5 = __require("crypto");
41032
- if (!crypto5.timingSafeEqual(tokenBuf, legacyBuf) || token.length !== REGISTRY_TOKEN.length) {
41035
+ if (!crypto5.timingSafeEqual(tokenBuf, legacyBuf) || token.length !== registryToken.length) {
41033
41036
  return { valid: false, error: "Invalid token" };
41034
41037
  }
41035
41038
  return { valid: true };
@@ -41627,11 +41630,11 @@ async function handlePhpRoutes(path, req, url, storage, baseUrl, corsHeaders, an
41627
41630
  }
41628
41631
  return null;
41629
41632
  }
41630
- function getRegistryToken() {
41633
+ function getRegistryToken2() {
41631
41634
  return process.env.PANTRY_REGISTRY_TOKEN || process.env.PANTRY_TOKEN;
41632
41635
  }
41633
41636
  function validateToken2(authHeader) {
41634
- const registryToken = getRegistryToken();
41637
+ const registryToken = getRegistryToken2();
41635
41638
  if (!registryToken) {
41636
41639
  return { valid: false, error: "Server misconfigured \u2014 no registry token set" };
41637
41640
  }
@@ -101896,10 +101899,10 @@ async function handleAnalyticsEvent(req, analytics, corsHeaders) {
101896
101899
  return Response.json({ error: "Invalid JSON body" }, { status: 400, headers: corsHeaders });
101897
101900
  }
101898
101901
  }
101899
- function getRegistryToken2() {
101902
+ function getRegistryToken3() {
101900
101903
  return process.env.PANTRY_REGISTRY_TOKEN || process.env.PANTRY_TOKEN;
101901
101904
  }
101902
- if (!getRegistryToken2()) {
101905
+ if (!getRegistryToken3()) {
101903
101906
  console.warn("WARNING: PANTRY_REGISTRY_TOKEN or PANTRY_TOKEN must be set \u2014 publish/admin endpoints will reject all requests");
101904
101907
  }
101905
101908
  var _authService;
@@ -101913,7 +101916,7 @@ async function validateToken3(authHeader) {
101913
101916
  return { valid: false, error: "Authorization required" };
101914
101917
  }
101915
101918
  const token = authHeader.startsWith("Bearer ") ? authHeader.slice(7) : authHeader;
101916
- const registryToken = getRegistryToken2();
101919
+ const registryToken = getRegistryToken3();
101917
101920
  if (_authService && isUserApiToken(token)) {
101918
101921
  const result = await _authService.validatePublishToken(token, registryToken ?? "");
101919
101922
  return result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stacksjs/registry",
3
- "version": "0.10.35",
3
+ "version": "0.10.40",
4
4
  "type": "module",
5
5
  "description": "Pantry package registry backend - S3 storage with DynamoDB metadata",
6
6
  "author": "Stacks.js",