@futdevpro/nts-dynamo 1.15.145 → 1.15.151

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 (56) hide show
  1. package/.dynamo/logs/cicd-pipeline/output.log +1806 -1957
  2. package/.dynamo/logs/cicd-pipeline/status.json +33 -33
  3. package/README.md +16 -0
  4. package/__documentations/2026-08-21-distributed-rate-limit-bfr-ctm-010.md +59 -0
  5. package/__documentations/2026-08-22-npm-token-state-classifier.md +92 -0
  6. package/build/_collections/npm-token-check.util.d.ts +139 -0
  7. package/build/_collections/npm-token-check.util.d.ts.map +1 -0
  8. package/build/_collections/npm-token-check.util.js +302 -0
  9. package/build/_collections/npm-token-check.util.js.map +1 -0
  10. package/build/_modules/rate-limit/_enums/rate-limit-store-kind.type-enum.d.ts +6 -0
  11. package/build/_modules/rate-limit/_enums/rate-limit-store-kind.type-enum.d.ts.map +1 -0
  12. package/build/_modules/rate-limit/_enums/rate-limit-store-kind.type-enum.js +10 -0
  13. package/build/_modules/rate-limit/_enums/rate-limit-store-kind.type-enum.js.map +1 -0
  14. package/build/_modules/rate-limit/_models/rate-limit-config.interface.d.ts +15 -6
  15. package/build/_modules/rate-limit/_models/rate-limit-config.interface.d.ts.map +1 -1
  16. package/build/_modules/rate-limit/_models/rate-limit-consume-request.interface.d.ts +9 -0
  17. package/build/_modules/rate-limit/_models/rate-limit-consume-request.interface.d.ts.map +1 -0
  18. package/build/_modules/rate-limit/_models/rate-limit-consume-request.interface.js +3 -0
  19. package/build/_modules/rate-limit/_models/rate-limit-consume-request.interface.js.map +1 -0
  20. package/build/_modules/rate-limit/_models/rate-limit-consume-result.interface.d.ts +7 -0
  21. package/build/_modules/rate-limit/_models/rate-limit-consume-result.interface.d.ts.map +1 -0
  22. package/build/_modules/rate-limit/_models/rate-limit-consume-result.interface.js +3 -0
  23. package/build/_modules/rate-limit/_models/rate-limit-consume-result.interface.js.map +1 -0
  24. package/build/_modules/rate-limit/_models/rate-limit-store.interface.d.ts +9 -0
  25. package/build/_modules/rate-limit/_models/rate-limit-store.interface.d.ts.map +1 -0
  26. package/build/_modules/rate-limit/_models/rate-limit-store.interface.js +3 -0
  27. package/build/_modules/rate-limit/_models/rate-limit-store.interface.js.map +1 -0
  28. package/build/_modules/rate-limit/index.d.ts +5 -0
  29. package/build/_modules/rate-limit/index.d.ts.map +1 -1
  30. package/build/_modules/rate-limit/index.js +5 -1
  31. package/build/_modules/rate-limit/index.js.map +1 -1
  32. package/build/_modules/rate-limit/rate-limit-in-memory.store.d.ts +19 -0
  33. package/build/_modules/rate-limit/rate-limit-in-memory.store.d.ts.map +1 -0
  34. package/build/_modules/rate-limit/rate-limit-in-memory.store.js +71 -0
  35. package/build/_modules/rate-limit/rate-limit-in-memory.store.js.map +1 -0
  36. package/build/_modules/rate-limit/rate-limit.middleware.d.ts +39 -103
  37. package/build/_modules/rate-limit/rate-limit.middleware.d.ts.map +1 -1
  38. package/build/_modules/rate-limit/rate-limit.middleware.js +325 -236
  39. package/build/_modules/rate-limit/rate-limit.middleware.js.map +1 -1
  40. package/build/index.d.ts +1 -0
  41. package/build/index.d.ts.map +1 -1
  42. package/build/index.js +1 -0
  43. package/build/index.js.map +1 -1
  44. package/package.json +2 -2
  45. package/src/_collections/npm-token-check.util.spec.ts +218 -0
  46. package/src/_collections/npm-token-check.util.ts +327 -0
  47. package/src/_modules/rate-limit/_enums/rate-limit-store-kind.type-enum.ts +5 -0
  48. package/src/_modules/rate-limit/_models/rate-limit-config.interface.ts +19 -6
  49. package/src/_modules/rate-limit/_models/rate-limit-consume-request.interface.ts +9 -0
  50. package/src/_modules/rate-limit/_models/rate-limit-consume-result.interface.ts +6 -0
  51. package/src/_modules/rate-limit/_models/rate-limit-store.interface.ts +9 -0
  52. package/src/_modules/rate-limit/index.ts +5 -0
  53. package/src/_modules/rate-limit/rate-limit-in-memory.store.ts +91 -0
  54. package/src/_modules/rate-limit/rate-limit.middleware.spec.ts +424 -200
  55. package/src/_modules/rate-limit/rate-limit.middleware.ts +436 -275
  56. package/src/index.ts +1 -0
@@ -1,7 +1,7 @@
1
1
  {
2
- "pid": 29359,
3
- "startedAt": "2026-08-19T10:50:54.256Z",
4
- "startedAtMs": 1787136654256,
2
+ "pid": 3434,
3
+ "startedAt": "2026-08-22T10:06:08.665Z",
4
+ "startedAtMs": 1787393168665,
5
5
  "phase": "npm-publish",
6
6
  "pipelineComplete": false,
7
7
  "serverRunning": false,
@@ -10,63 +10,63 @@
10
10
  "steps": {
11
11
  "validate-secrets": {
12
12
  "status": "ok",
13
- "startedAt": "2026-08-19T10:50:54.295Z",
13
+ "startedAt": "2026-08-22T10:06:08.682Z",
14
14
  "logLineStart": 2,
15
15
  "logLineEnd": 8,
16
- "durationSec": 3.1
16
+ "durationSec": 2.3
17
17
  },
18
18
  "discord-start": {
19
19
  "status": "ok",
20
- "startedAt": "2026-08-19T10:50:59.121Z",
20
+ "startedAt": "2026-08-22T10:06:11.955Z",
21
21
  "logLineStart": 9,
22
- "logLineEnd": 14,
23
- "durationSec": 5.8
22
+ "logLineEnd": 16,
23
+ "durationSec": 5
24
24
  },
25
25
  "pre-flight": {
26
26
  "status": "ok",
27
- "startedAt": "2026-08-19T10:51:05.892Z",
28
- "logLineStart": 15,
29
- "logLineEnd": 17,
30
- "durationSec": 2.3
27
+ "startedAt": "2026-08-22T10:06:17.944Z",
28
+ "logLineStart": 17,
29
+ "logLineEnd": 19,
30
+ "durationSec": 2.2
31
31
  },
32
32
  "install": {
33
33
  "status": "ok",
34
- "startedAt": "2026-08-19T10:51:09.166Z",
35
- "logLineStart": 18,
36
- "logLineEnd": 191,
37
- "durationSec": 148.5
34
+ "startedAt": "2026-08-22T10:06:21.154Z",
35
+ "logLineStart": 20,
36
+ "logLineEnd": 102,
37
+ "durationSec": 27.9
38
38
  },
39
39
  "check-dev-leftovers": {
40
40
  "status": "ok",
41
- "startedAt": "2026-08-19T10:53:38.920Z",
42
- "logLineStart": 192,
43
- "logLineEnd": 199,
44
- "durationSec": 7.4
41
+ "startedAt": "2026-08-22T10:06:50.006Z",
42
+ "logLineStart": 103,
43
+ "logLineEnd": 112,
44
+ "durationSec": 6.6
45
45
  },
46
46
  "build": {
47
47
  "status": "ok",
48
- "startedAt": "2026-08-19T10:53:47.356Z",
49
- "logLineStart": 200,
50
- "logLineEnd": 201,
51
- "durationSec": 35.5
48
+ "startedAt": "2026-08-22T10:06:57.613Z",
49
+ "logLineStart": 113,
50
+ "logLineEnd": 114,
51
+ "durationSec": 43.9
52
52
  },
53
53
  "test": {
54
54
  "status": "ok",
55
- "startedAt": "2026-08-19T10:54:23.822Z",
56
- "logLineStart": 202,
57
- "logLineEnd": 3028,
58
- "durationSec": 64.3,
55
+ "startedAt": "2026-08-22T10:07:42.487Z",
56
+ "logLineStart": 115,
57
+ "logLineEnd": 2877,
58
+ "durationSec": 67.1,
59
59
  "testSummary": {
60
- "totalSpecs": 1699,
60
+ "totalSpecs": 1728,
61
61
  "failures": 0,
62
- "passed": 1699,
63
- "testDurationSec": 11.275
62
+ "passed": 1728,
63
+ "testDurationSec": 9.435
64
64
  }
65
65
  },
66
66
  "npm-publish": {
67
67
  "status": "running",
68
- "startedAt": "2026-08-19T10:55:29.162Z",
69
- "logLineStart": 3029,
68
+ "startedAt": "2026-08-22T10:08:50.633Z",
69
+ "logLineStart": 2878,
70
70
  "logLineEnd": null,
71
71
  "durationSec": null
72
72
  }
package/README.md CHANGED
@@ -313,6 +313,22 @@ Persistence remains application-owned through explicit atomic adapters. Transpor
313
313
  credentials in URLs, logs, analytics or durable client storage. A consuming application must also apply its
314
314
  rate-limit, authorization, cookie/storage and audit-redaction policy at the API boundary.
315
315
 
316
+ ### Distributed rate limiting
317
+
318
+ The `@futdevpro/nts-dynamo/rate-limit` entry point provides an atomic rate-limit boundary for HTTP services:
319
+
320
+ - an exact sliding-window in-memory store for deterministic tests and explicitly single-instance development;
321
+ - an application-owned shared-store contract for production deployments;
322
+ - a production configuration gate that requires both shared persistence and explicit opaque subject/endpoint
323
+ extractors;
324
+ - validated positive limits, windows and weighted request costs with stable, content-free failures;
325
+ - trusted `req.ip` as the safe local default instead of reading caller-controlled forwarding headers directly;
326
+ - explicit opportunistic local cleanup with no timer, polling loop or hidden background task.
327
+
328
+ Production consumers must implement the shared store with one atomic permit decision across every application
329
+ instance. They must derive non-sensitive, purpose-scoped bucket identifiers and must not persist or log raw IP
330
+ addresses, credentials, email addresses or other request content as rate-limit keys.
331
+
316
332
  ### Privacy lifecycle
317
333
 
318
334
  The optional `@futdevpro/nts-dynamo/privacy-lifecycle` entry point provides the shared machinery for standalone
@@ -0,0 +1,59 @@
1
+ # Dynamo NTS distributed rate-limit boundary
2
+
3
+ **Contract:** `dynts-rate-limit/2`
4
+
5
+ **Release candidate:** `@futdevpro/nts-dynamo@1.15.147`
6
+
7
+ **Consumer trace:** `BFR-CTM-010`
8
+
9
+ ## Purpose
10
+
11
+ This Bedrock boundary makes one rate-limit decision atomic across application processes while keeping persistence
12
+ application-owned. It replaces the former process-local-only middleware behavior without adding a replaceable
13
+ framework abstraction: consumers use the published `@futdevpro/nts-dynamo/rate-limit` types and middleware
14
+ directly and provide the storage adapter required by their deployment.
15
+
16
+ ## Contract
17
+
18
+ `DyNTS_RateLimit_Store_Interface.consume(...)` receives one opaque bucket key, the active limit and window, the
19
+ positive request cost and a caller-supplied millisecond timestamp. It resolves one committed decision containing
20
+ `allowed`, `remaining` and `resetAt`. A production host enables `requireSharedStore` and supplies:
21
+
22
+ - a store advertising `storeKind: shared`;
23
+ - an explicit opaque subject extractor;
24
+ - an explicit stable endpoint-group extractor.
25
+
26
+ Configuration fails closed when any of these requirements is absent. Runtime store exceptions and malformed
27
+ store results become stable 503 errors without reflecting the bucket, the adapter exception or request content.
28
+ Policy rejection remains a stable 429 and includes the committed reset interval in response headers.
29
+
30
+ ## Security and privacy properties
31
+
32
+ - The middleware never reads `x-forwarded-for` directly. Its local default uses Express `req.ip`, whose proxy
33
+ trust policy belongs to the host; production still requires an explicit extractor.
34
+ - Extractor exceptions, invalid callbacks, invalid clocks and malformed bucket components are converted to
35
+ content-free errors.
36
+ - Limits, windows, costs, timestamps, bucket component lengths and store results have hard numeric/structural
37
+ bounds.
38
+ - No raw storage key or adapter exception is placed in the generated error.
39
+ - The shared-store interface carries opaque identifiers only. The consuming application is responsible for
40
+ purpose-scoped pseudonymization and retention.
41
+ - The module starts no timer, cleanup loop, polling process or background task. Local cleanup is caller-triggered.
42
+
43
+ ## Semantics
44
+
45
+ The provided in-memory implementation uses exact sliding-window timestamps. It exists for deterministic tests and
46
+ explicitly single-instance development, not production. A shared implementation may use exact sliding-window
47
+ semantics or a conservatively safe equivalent, but its read/prune/admit/write decision must be atomic. Concurrent
48
+ requests for the final permit may produce exactly one successful decision.
49
+
50
+ Weighted requests consume multiple permit units. An unsuccessful weighted request does not mutate the committed
51
+ usage, so `remaining` can be positive but lower than the attempted cost.
52
+
53
+ ## Verification
54
+
55
+ The focused Bedrock suite covers singleton behavior, forwarding-header spoof resistance, deterministic window
56
+ reset, weighted cost, subject/endpoint isolation, headers, policy precedence, invalid configuration atomicity,
57
+ the production shared-store gate, cross-instance state, concurrent final-permit behavior, non-reflective store
58
+ failure, malformed store results and explicit timer-free cleanup. Full-package compilation, tests, lint, import and
59
+ naming validation are release gates for the candidate.
@@ -0,0 +1,92 @@
1
+ # NPM-token állapot-osztályozó (FR-320)
2
+
3
+ **Dátum:** 2026-08-22 · **Csomag:** `@futdevpro/nts-dynamo` ≥ `01.15.150` ·
4
+ **Belépési pont:** `checkNpmToken()` + `classifyNpmTokenShape()` / `classifyNpmTokenProbe()`
5
+
6
+ ## 1. Miért kellett — a hibaosztály
7
+
8
+ 2026-08-20-án a flotta npm-tokenje **lejárt**, majd a pótlására beállított token **nem kapott
9
+ írási / 2FA-bypass jogot**. A diagnózis **több napot és több kört** vitt el, mert az npm
10
+ **létezés-elrejtést** alkalmaz privát csomagnál: a jogosulatlan kérésre **404**-et ad, nem 401-et.
11
+
12
+ **Három külön képesség — mind ugyanazzal a hibakóddal bukik:**
13
+
14
+ | képesség | hibás tokennel | amit az operator lát |
15
+ |---|---|---|
16
+ | olvasás (`GET /@scope%2fpkg`) | **404** | „nincs ilyen csomag" |
17
+ | publikálás (`PUT /@scope%2fpkg`) | **404** | „nincs ilyen csomag" |
18
+ | hitelesítés (`GET /-/whoami`) | **401** | ← az **egyetlen** egyértelmű jel |
19
+
20
+ Emiatt a *„nincs ilyen csomag"*, a *„lejárt kulcs"* és a *„rossz jogú kulcs"* megkülönböztethetetlen
21
+ volt. Élesben ez így nézett ki: `ERR_PNPM_FETCH_404` négy projektben, `npm-publish` némán bukva, és
22
+ egy `PUT … 404`, **miközben ugyanaz a token olvasni tudta a csomagot**.
23
+
24
+ ## 2. A kulcs-diszkriminátor
25
+
26
+ **Mindig a `/-/whoami`-val kell kezdeni.** Az **csomag-független**, ezért nem esik a 404-csapdába:
27
+
28
+ - rossz / hiányzó token → **401**
29
+ - érvényes token → **200** + `username`
30
+
31
+ Csak ha ez 200, akkor értelmezhető bármilyen csomag-szintű 404 — és élő token mellett az **mindig
32
+ jogosultság**, sosem hiányzó csomag.
33
+
34
+ ## 3. Megkülönböztetett állapotok
35
+
36
+ | állapot | mit jelent | mérés |
37
+ |---|---|---|
38
+ | `missing` | nincs beállítva (env **és** `~/.npmrc`) | helyi, hálózat nélkül |
39
+ | `malformed` | van érték, de nem token-alakú (idézőjel, whitespace, bemásolt `.npmrc`-sor) | helyi |
40
+ | `invalid` | a registry elutasítja | whoami **401** |
41
+ | `no-scope-access` | a token él, de a csomagra nincs joga | whoami 200 + csomag 404/403 |
42
+ | `missing-publish-right` | olvas, de **publikálni nem tud** | whoami 200 + `EOTP`/`E403`/**`E404`** publish-hiba |
43
+ | `ok` | érvényes és a vizsgált csomagot is eléri | whoami 200 + csomag 200 |
44
+ | `unknown` | a próba el sem jutott a registryig | **nem** bizonyíték a token ellen |
45
+
46
+ ## 4. Amit szándékosan NEM ígér
47
+
48
+ - A **2FA-bypass hiánya read-only próbával nem állapítható meg** — csak egy már elbukott publish
49
+ hibakódjából (`EOTP`). Ezért van opcionális `publishErrorCode` bemenet.
50
+ - A **lejárt** és a **visszavont** token kívülről egyforma 401.
51
+ - A token **élettartama** nem kérdezhető le.
52
+ - **Granular** tokennél az npm a `readonly`/`automation` mezőket sem teszi közzé
53
+ (`GET /-/npm/v1/tokens` → 200, de a jogok nélkül) — mérve.
54
+
55
+ ## 5. Biztonság
56
+
57
+ A **token értéke sosem kerül a kimenetbe** — sem logba, sem eredménybe. A helyi alak-ellenőrzés
58
+ kizárólag minta-illesztés; külön teszt állítja, hogy nincs `cat /root/.npmrc` és nincs
59
+ `echo $NPM_TOKEN`. A `.npmrc`-t **csak olvassuk** — létrehozni flotta-szintű hard rule tiltja.
60
+
61
+ ## 6. Használat
62
+
63
+ ```ts
64
+ import { checkNpmToken, DyNTS_NpmTokenState } from '@futdevpro/nts-dynamo';
65
+
66
+ const result = await checkNpmToken({ scopedPackage: '@futdevpro/cli-dynamo' });
67
+ if (result.state !== DyNTS_NpmTokenState.ok) {
68
+ // result.detail = ember-olvasható magyarázat + a KÖVETKEZŐ LÉPÉS
69
+ }
70
+ ```
71
+
72
+ Token-feloldás prioritása: explicit paraméter → `NPM_TOKEN` env → `~/.npmrc`.
73
+
74
+ ## 7. Teszt
75
+
76
+ 27 spec. Élesben igazolva mindhárom ág: jó token → `ok` (whoami 200 + csomag 200), érvénytelen →
77
+ `invalid` (401), rossz alak → `malformed`.
78
+
79
+ **Két saját hibát a tesztek/mérés fogtak meg — mindkettő hamis negatív lett volna:**
80
+
81
+ 1. Az első változat **csak a `process.env.NPM_TOKEN`-t** nézte → a workstationon `missing`-et adott,
82
+ holott az npm ott működött (a token a `~/.npmrc`-ben áll). Épp a legfontosabb helyeken
83
+ (runner-konténer, hosztok) sült volna el, ahol a token szintén fájlban van.
84
+ 2. A host-összehasonlításnál csak az **egyik oldalt** normalizáltam, a `.npmrc` viszont **záró
85
+ perjellel** írja a hostot (`//registry.npmjs.org/`) → sosem illeszkedett.
86
+
87
+ ## 8. Kapcsolódó
88
+
89
+ A lánc, ami emiatt állt: `install` (404) → `npm-publish` (💤/❌) → `trigger-runner-cli-hot-update`
90
+ (💤) → **a runnereken befagyott a CLI**. Az automatizmus nem volt hibás, csak **blokkolt** — egyetlen
91
+ ponton. Runner-oldali próba: `fdp-devops` FR-318/FR-319 (`POST /diag/runner/registry-auth` +
92
+ a `fdp diag-all` `2b. RUNNER REGISTRY-AUTH` szekciója).
@@ -0,0 +1,139 @@
1
+ /**
2
+ * FR-320 — NPM-TOKEN ALLAPOT-OSZTALYOZO (bedrock).
3
+ *
4
+ * MIERT KELLETT (2026-08-20..22, valos incidens): a flotta npm-tokenje lejart, majd egy olyan
5
+ * pot-token kerult be, aminek NEM volt 2FA-bypass joga. A kovetkezmeny NAPOKIG tartott es
6
+ * MINDENHOL `E404`-kent jelentkezett — privat csomagnal ugyanis az npm a jogosulatlan kerest
7
+ * 404-gyel utasitja el, NEM 401-gyel. Emiatt a "nincs ilyen csomag", a "lejart kulcs" es a
8
+ * "rossz jogu kulcs" MEGKULONBOZTETHETETLEN volt, es a diagnozis tobb kort vitt el.
9
+ *
10
+ * A KULCS-DISZKRIMINATOR: a `/-/whoami` vegpont NEM csomag-fuggo, ezert nem esik bele a privat-404
11
+ * elrejtesbe:
12
+ * - token NELKUL / ROSSZ tokennel -> **401**
13
+ * - ERVENYES tokennel -> **200** + a felhasznalonev
14
+ * Innen a csomag-szintu proba mar ertelmezheto: ha a whoami OK, de a scope-olt csomag 404, akkor a
15
+ * token EL, csak nincs joga hozza.
16
+ *
17
+ * ⚠️ AMIT EZ NEM TUD MEGALLAPITANI (szandekosan kimondva, hogy ne igerjunk tobbet a valosagnal):
18
+ * - a **2FA-bypass** hianya CSAK publikalaskor derul ki (`EOTP` hibakod) — read-only probaval nem;
19
+ * - a **lejart** es a **visszavont** token kivulrol egyforman 401;
20
+ * - a token **elettartama** nem kerdezheto le.
21
+ * Ezert a `publishErrorCode` opcionalis bemenet: ha egy publish mar elbukott, az `EOTP` alapjan
22
+ * ERRE is tudunk hatarozott allapotot mondani.
23
+ *
24
+ * A TOKEN ERTEKE SOSEM KERUL A KIMENETBE — sem logba, sem eredmenybe.
25
+ */
26
+ /** Az npm-token megallapithato allapotai. */
27
+ export declare enum DyNTS_NpmTokenState {
28
+ /** Nincs beallitva token (se env, se .npmrc). */
29
+ missing = "missing",
30
+ /** Van ertek, de nem npm-token alaku — jellemzoen elgepeles / rossz valtozo. */
31
+ malformed = "malformed",
32
+ /** A registry elutasitja (401): lejart, visszavont vagy egyszeruen rossz. */
33
+ invalid = "invalid",
34
+ /** A token EL (whoami OK), de a vizsgalt scope-hoz/csomaghoz NINCS joga. */
35
+ noScopeAccess = "no-scope-access",
36
+ /** A token el es olvas, de publikalasra nincs joga (2FA-bypass hianya — `EOTP`). */
37
+ missingPublishRight = "missing-publish-right",
38
+ /** Minden vizsgalt kepesseg rendben. */
39
+ ok = "ok",
40
+ /** A proba maga nem futott le (halozat/timeout) — NEM azonos azzal, hogy a token rossz. */
41
+ unknown = "unknown"
42
+ }
43
+ /** A helyi (halozat NELKULI) alak-ellenorzes eredmenye. */
44
+ export declare enum DyNTS_NpmTokenShape {
45
+ missing = "missing",
46
+ malformed = "malformed",
47
+ plausible = "plausible"
48
+ }
49
+ /**
50
+ * PURE — a token ALAKJANAK ellenorzese, halozat nelkul.
51
+ *
52
+ * MIERT KULON LEPES: a "nincs beallitva" es a "rosszul beallitva" eseteket halozat nelkul, azonnal
53
+ * es egyertelmuen el lehet donteni — ezek a leggyakoribb operatori hibak (ures env-var, idezojelek
54
+ * bennragadtak, a `//registry…/:_authToken=` PREFIX is bemasolodott).
55
+ *
56
+ * Az npm mai token-alakjai `npm_`-mel kezdodnek (classic automation + granular). A regi, prefix
57
+ * nelkuli UUID-alaku tokenek MEG ervenyesek lehetnek, ezert azokat is `plausible`-nek vesszuk —
58
+ * inkabb engedunk at egy kesobb 401-et kapo tokent, mint hogy egy jot elutasitsunk.
59
+ */
60
+ export declare function classifyNpmTokenShape(rawToken: string | undefined | null): DyNTS_NpmTokenShape;
61
+ /**
62
+ * Publish-oldali npm-hibakodok, amik ELO token mellett JOGOSULTSAG-hianyt jelentenek.
63
+ *
64
+ * A lista SZANDEKOSAN tartalmazza az `E404`-et: az npm a `PUT` (publish) kerest is 404-gyel
65
+ * utasitja el, ha a tokennek nincs irasi joga a csomagra. Elo token mellett ez SOSEM jelentheti,
66
+ * hogy a csomag hianyzik — hiszen olvasni tudtuk.
67
+ */
68
+ export declare const PUBLISH_RIGHT_ERROR_CODES: string[];
69
+ /** A halozati proba nyers bemenete (a `classifyNpmTokenProbe` szamara). */
70
+ export interface DyNTS_NpmTokenProbe_Input {
71
+ /** A `/-/whoami` HTTP-statusza. `null`, ha a hivas el sem jutott a szerverig. */
72
+ whoamiStatus: number | null;
73
+ /** Egy SCOPE-olt (jellemzoen privat) csomag metaadat-lekeresenek statusza; `undefined` = nem mertuk. */
74
+ scopedPackageStatus?: number;
75
+ /** Ha egy publish MAR elbukott, annak npm-hibakodja (pl. `EOTP`, `E403`); `undefined` = nem mertuk. */
76
+ publishErrorCode?: string;
77
+ }
78
+ /**
79
+ * PURE — a halozati valaszokbol allapot.
80
+ *
81
+ * A sorrend SZANDEKOS: a `whoami` az egyetlen csomag-fuggetlen jel, ezert az dont eloszor. Csak
82
+ * utana ertelmezheto a csomag-szintu 404 — kulonben ugyanaz a 404 jelentene "nincs ilyen csomag"-ot
83
+ * es "rossz kulcs"-ot is, ami epp a 2026-08-i incidens diagnozisat huzta el.
84
+ */
85
+ export declare function classifyNpmTokenProbe(input: DyNTS_NpmTokenProbe_Input): DyNTS_NpmTokenState;
86
+ /**
87
+ * PURE — ember-olvashato magyarazat + a KOVETKEZO LEPES. A puszta allapot-cimke keves: az operator
88
+ * azt akarja tudni, mit tegyen.
89
+ */
90
+ export declare function describeNpmTokenState(state: DyNTS_NpmTokenState): string;
91
+ /** A teljes ellenorzes eredmenye. A token ERTEKE sosem szerepel benne. */
92
+ export interface DyNTS_NpmTokenCheck_Result {
93
+ state: DyNTS_NpmTokenState;
94
+ /** A `/-/whoami` altal visszaadott felhasznalonev, ha a token ervenyes. */
95
+ username: string | null;
96
+ /** Ember-olvashato magyarazat + kovetkezo lepes. */
97
+ detail: string;
98
+ /** Amit tenylegesen mertunk (diagnosztikahoz). */
99
+ probe: DyNTS_NpmTokenProbe_Input;
100
+ }
101
+ /** A `checkNpmToken` bemenete. */
102
+ export interface DyNTS_NpmTokenCheck_Options {
103
+ /** A vizsgalando token. Ha nincs megadva, a `process.env.NPM_TOKEN`-t hasznaljuk. */
104
+ token?: string;
105
+ /** Registry-alap. Default: a publikus npm. */
106
+ registry?: string;
107
+ /**
108
+ * Egy SCOPE-olt csomag, amin a jogosultsagot merjuk (pl. `@futdevpro/cli-dynamo`).
109
+ * Ha nincs megadva, csak a whoami fut le.
110
+ */
111
+ scopedPackage?: string;
112
+ /** Ha egy publish mar elbukott, annak npm-hibakodja — igy a 2FA-bypass hianya is besorolhato. */
113
+ publishErrorCode?: string;
114
+ /** Halozati timeout (ms). Default: 10000. */
115
+ timeoutMs?: number;
116
+ }
117
+ /**
118
+ * PURE — token kinyerese egy `.npmrc` TARTALMABOL.
119
+ *
120
+ * MIERT KELL: az elso valtozat CSAK a `process.env.NPM_TOKEN`-t nezte, es ezert a sajat
121
+ * workstationomon `missing`-et adott — HOLOTT az npm ott tokeletesen mukodott, mert a token a
122
+ * `~/.npmrc`-ben all. Ez HAMIS NEGATIV, es epp a legfontosabb helyeken (runner-kontener, hosztok)
123
+ * sulna el, ahol a token szinten FAJLBAN van.
124
+ *
125
+ * A `.npmrc`-t csak OLVASSUK — letrehozni tilos (flotta-szintu hard rule).
126
+ */
127
+ export declare function extractTokenFromNpmrc(content: string, registry?: string): string | null;
128
+ /**
129
+ * A token feloldasa a szokasos helyekrol, PRIORITAS szerint:
130
+ * 1. explicit parameter, 2. `NPM_TOKEN` env, 3. a felhasznaloi `~/.npmrc`.
131
+ * Sose dob; ha egyik sincs, ures stringet ad.
132
+ */
133
+ export declare function resolveNpmToken(explicit: string | undefined, registry: string): string;
134
+ /**
135
+ * A tenyleges ellenorzes. SOSE dob — a hibat allapotkent adja vissza (a token-ellenorzes nem
136
+ * buktathat meg semmit, amibe beepitjuk).
137
+ */
138
+ export declare function checkNpmToken(options?: DyNTS_NpmTokenCheck_Options): Promise<DyNTS_NpmTokenCheck_Result>;
139
+ //# sourceMappingURL=npm-token-check.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npm-token-check.util.d.ts","sourceRoot":"","sources":["../../src/_collections/npm-token-check.util.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,6CAA6C;AAC7C,oBAAY,mBAAmB;IAC7B,iDAAiD;IACjD,OAAO,YAAY;IACnB,gFAAgF;IAChF,SAAS,cAAc;IACvB,6EAA6E;IAC7E,OAAO,YAAY;IACnB,4EAA4E;IAC5E,aAAa,oBAAoB;IACjC,oFAAoF;IACpF,mBAAmB,0BAA0B;IAC7C,wCAAwC;IACxC,EAAE,OAAO;IACT,2FAA2F;IAC3F,OAAO,YAAY;CACpB;AAED,2DAA2D;AAC3D,oBAAY,mBAAmB;IAC7B,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,mBAAmB,CAc9F;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,EAA6B,CAAC;AAE5E,2EAA2E;AAC3E,MAAM,WAAW,yBAAyB;IACxC,iFAAiF;IACjF,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,wGAAwG;IACxG,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uGAAuG;IACvG,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,yBAAyB,GAAG,mBAAmB,CAgC3F;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAsBxE;AAED,0EAA0E;AAC1E,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,KAAK,EAAE,yBAAyB,CAAC;CAClC;AAED,kCAAkC;AAClC,MAAM,WAAW,2BAA2B;IAC1C,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iGAAiG;IACjG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAyB,GAAG,MAAM,GAAG,IAAI,CAiBzG;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CActF;AAsBD;;;GAGG;AACH,wBAAsB,aAAa,CACjC,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,0BAA0B,CAAC,CAkDrC"}