# dev.nibling.npm.getClosure

> Every abbreviated npm packument an install of the given specs reaches, streamed as NDJSON while the gateway walks the graph, so a client resolves level N while the gateway walks level N+1. The client still picks every version: a `spec` line says the versions sent so far for its name hold every candidate for that raw spec. Any service may answer it; a client names a gateway by its hostname, as a tangled repo names its knot.

- Kind: query
- Authority: npm.nibling.dev
- Lexicon: 1
- Published by [nibling.dev](https://lexicon.garden/identity/did:plc:qgte7qw4zeutobb5h7joxoyt), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:qgte7qw4zeutobb5h7joxoyt/dev.nibling.npm.getClosure)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:qgte7qw4zeutobb5h7joxoyt/dev.nibling.npm.getClosure/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:qgte7qw4zeutobb5h7joxoyt/dev.nibling.npm.getClosure/analytics)

## Query (`dev.nibling.npm.getClosure`)

Type: query · GET

### Parameters (query string)

- `alias` (array): `<package>:<substitute>`: when the walk picks <package>@<v>, it also walks <substitute>@<v>, which the client may install in its place.
  - Constraints: maxLength: 50
  - `items` (string)
    - Constraints: maxLength: 512
- `binding` (array): A napi-rs binding suffix such as `wasm32-wasi`: when a picked version lists two or more `<prefix>-<platform>` optional bindings at one exact version but not `<prefix>-<suffix>`, the walk also walks `<prefix>-<suffix>` at that version.
  - Constraints: maxLength: 10
  - `items` (string)
    - Constraints: maxLength: 64
- `spec` (array, required): Root specs, `<name>@<raw spec>`, as a dependent wrote them.
  - Constraints: minLength: 1, maxLength: 50
  - `items` (string)
    - Constraints: maxLength: 512

### Output (application/x-ndjson)


### Errors

- `InvalidRequest`: No description in schema.

## #absent (`dev.nibling.npm.getClosure#absent`)

Type: object

### Properties

- `name` (string, required): A name the registry answered 404 for.
- `t` (string, required)
  - Constraints: const: "absent"

## #end (`dev.nibling.npm.getClosure#end`)

Type: object

### Properties

- `t` (string, required)
  - Constraints: const: "end"

## #header (`dev.nibling.npm.getClosure#header`)

Type: object

### Properties

- `registry` (string · uri, required): The registry the packuments come from. A client only uses a stream from the registry it installs from.
- `t` (string, required)
  - Constraints: const: "closure"
- `v` (integer, required)
  - Constraints: const: 1

## #meta (`dev.nibling.npm.getClosure#meta`)

Type: object

### Properties

- `funding` (unknown)
- `id` (string, required): `<name>@<version>`, a version the walk picked.
- `libc` (unknown)
- `license` (unknown)
- `t` (string, required)
  - Constraints: const: "meta"

## #missing (`dev.nibling.npm.getClosure#missing`)

Type: object

### Properties

- `name` (string, required): A name the gateway could not load; the client fetches it itself.
- `t` (string, required)
  - Constraints: const: "missing"

## #spec (`dev.nibling.npm.getClosure#spec`)

Type: object

### Properties

- `distTags` (unknown): The packument's `dist-tags`, on a name's first line only.
- `name` (string, required)
- `raw` (string, required): The spec as a dependent wrote it.
- `t` (string, required)
  - Constraints: const: "spec"
- `versions` (unknown, required): Abbreviated packument version entries this name's earlier lines did not send. With those, they hold every candidate version for `raw`, and every dist-tag's version.

## #wait (`dev.nibling.npm.getClosure#wait`)

Type: object

The gateway is still walking while its upstream is slow. It carries nothing, and comes at least every 2 seconds while no other line does, so a client can tell a slow registry from a gateway that is gone. A cached stream replays without it.

### Properties

- `t` (string, required)
  - Constraints: const: "wait"

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "absent": {
      "properties": {
        "name": {
          "description": "A name the registry answered 404 for.",
          "type": "string"
        },
        "t": {
          "const": "absent",
          "type": "string"
        }
      },
      "required": [
        "t",
        "name"
      ],
      "type": "object"
    },
    "end": {
      "properties": {
        "t": {
          "const": "end",
          "type": "string"
        }
      },
      "required": [
        "t"
      ],
      "type": "object"
    },
    "header": {
      "properties": {
        "registry": {
          "description": "The registry the packuments come from. A client only uses a stream from the registry it installs from.",
          "format": "uri",
          "type": "string"
        },
        "t": {
          "const": "closure",
          "type": "string"
        },
        "v": {
          "const": 1,
          "type": "integer"
        }
      },
      "required": [
        "t",
        "v",
        "registry"
      ],
      "type": "object"
    },
    "main": {
      "errors": [
        {
          "name": "InvalidRequest"
        }
      ],
      "output": {
        "description": "One JSON object per line: `#header` first, then `#spec`, `#meta`, `#absent` and `#missing` lines in the order the walk finds them, `#wait` at least every 2 seconds while nothing else comes, then `#end`. A stream without `#end` was cut short; only what arrived holds.",
        "encoding": "application/x-ndjson"
      },
      "parameters": {
        "properties": {
          "alias": {
            "description": "`<package>:<substitute>`: when the walk picks <package>@<v>, it also walks <substitute>@<v>, which the client may install in its place.",
            "items": {
              "maxLength": 512,
              "type": "string"
            },
            "maxLength": 50,
            "type": "array"
          },
          "binding": {
            "description": "A napi-rs binding suffix such as `wasm32-wasi`: when a picked version lists two or more `<prefix>-<platform>` optional bindings at one exact version but not `<prefix>-<suffix>`, the walk also walks `<prefix>-<suffix>` at that version.",
            "items": {
              "maxLength": 64,
              "type": "string"
            },
            "maxLength": 10,
            "type": "array"
          },
          "spec": {
            "description": "Root specs, `<name>@<raw spec>`, as a dependent wrote them.",
            "items": {
              "maxLength": 512,
              "type": "string"
            },
            "maxLength": 50,
            "minLength": 1,
            "type": "array"
          }
        },
        "required": [
          "spec"
        ],
        "type": "params"
      },
      "type": "query"
    },
    "meta": {
      "properties": {
        "funding": {
          "type": "unknown"
        },
        "id": {
          "description": "`<name>@<version>`, a version the walk picked.",
          "type": "string"
        },
        "libc": {
          "type": "unknown"
        },
        "license": {
          "type": "unknown"
        },
        "t": {
          "const": "meta",
          "type": "string"
        }
      },
      "required": [
        "t",
        "id"
      ],
      "type": "object"
    },
    "missing": {
      "properties": {
        "name": {
          "description": "A name the gateway could not load; the client fetches it itself.",
          "type": "string"
        },
        "t": {
          "const": "missing",
          "type": "string"
        }
      },
      "required": [
        "t",
        "name"
      ],
      "type": "object"
    },
    "spec": {
      "properties": {
        "distTags": {
          "description": "The packument's `dist-tags`, on a name's first line only.",
          "type": "unknown"
        },
        "name": {
          "type": "string"
        },
        "raw": {
          "description": "The spec as a dependent wrote it.",
          "type": "string"
        },
        "t": {
          "const": "spec",
          "type": "string"
        },
        "versions": {
          "description": "Abbreviated packument version entries this name's earlier lines did not send. With those, they hold every candidate version for `raw`, and every dist-tag's version.",
          "type": "unknown"
        }
      },
      "required": [
        "t",
        "name",
        "raw",
        "versions"
      ],
      "type": "object"
    },
    "wait": {
      "description": "The gateway is still walking while its upstream is slow. It carries nothing, and comes at least every 2 seconds while no other line does, so a client can tell a slow registry from a gateway that is gone. A cached stream replays without it.",
      "properties": {
        "t": {
          "const": "wait",
          "type": "string"
        }
      },
      "required": [
        "t"
      ],
      "type": "object"
    }
  },
  "description": "Every abbreviated npm packument an install of the given specs reaches, streamed as NDJSON while the gateway walks the graph, so a client resolves level N while the gateway walks level N+1. The client still picks every version: a `spec` line says the versions sent so far for its name hold every candidate for that raw spec. Any service may answer it; a client names a gateway by its hostname, as a tangled repo names its knot.",
  "id": "dev.nibling.npm.getClosure",
  "lexicon": 1
}
```
