---
title: Packages
description: Import content-pinned functions and JSON shapes from the standard library, connector shapes, or your data repo.
species: reference
---
# Packages

A typesql package is a versioned namespace of functions, model signatures, and JSON shapes. Resolution is content-pinned: the same `typesql.lock` bytes always select the same package artifact.

```typesql
import type shapes from 'connector/stripe';
import finance from 'skycrane/finance';
```

## Package names

A reference is exactly `stdlib` or a lowercase `namespace/name`. Segments start with `a-z` and then contain `a-z`, `0-9`, `_`, or `-`.

Organization packages live at `packages/<namespace>/<name>/typesql.pkg`. `connector/*` is reserved for connector-shape packages. Absolute paths, `.` and `..`, repeated separators, uppercase aliases, and a third path segment are refused.

## Imports

`import type` brings in shapes and signatures, then erases completely. Bare `import` also brings function bodies and belongs to the full typesql layer.

Packages do not read the filesystem themselves. The caller validates that the canonical artifact path stays inside the repository `packages/` directory and supplies the bytes.

## The lockfile

`typesql.lock` uses one sorted line per exact artifact hash:

```text
typesql-lock-v1
package skycrane/finance sha256:813c25d0f81d8963fd60345cf6be0a8d3e40f52612f491d6d97e06c77b16f9d0
```

Missing pins use `TS0601`; missing artifacts use `TS0602`; a hash mismatch uses `TS0603`. Format, export, cycle, shadow, resource-limit, and unused-import failures use `TS0604` through `TS0609`.
