open-index/open-npm huggingface dataset:
npm package: @glorychain/s3
Description: S3-compatible connector for glorychain — supports AWS S3, Cloudflare R2, MinIO, Backblaze B2
Latest version: 0.1.2

# @glorychain/s3

> S3-compatible connector for glorychain. Store chains in AWS S3, Cloudflare R2, MinIO, or Backblaze B2.

```bash
npm install @glorychain/s3
# or
pnpm add @glorychain/s3
```

---

## Usage

```ts
import { appendBlock, createChain, generateKeypair } from "@glorychain/core"
import { S3Connector } from "@glorychain/s3"

const connector = new S3Connector({
  bucket: "my-chains-bucket",
  region: "us-east-1",
  credentials: {
    accessKeyId: process.env.AWS_ACCESS_KEY_ID,
    secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
  },
})

const { value: { privateKey, publicKey } } = generateKeypair()

const { value: chain } = createChain({
  content: "Board resolution register.",
  purpose: "governance",
  creatorId: "secretary@acme.org",
  identityType: "anonymous",
  publicKey,
}, privateKey)

await connector.write(chain)

const read = await connector.read(chain.metadata.chainId)
const ids  = await connector.list()
```

---

## Cloudflare R2

```ts
const connector = new S3Connector({
  bucket: "my-chains",
  region: "auto",
  endpoint: "https://<account-id>.r2.cloudflarestorage.com",
  credentials: {
    accessKeyId: process.env.R2_ACCESS_KEY_ID,
    secretAccessKey: process.env.R2_SECRET_ACCESS_KEY,
  },
})
```

## MinIO

```ts
const connector = new S3Connector({
  bucket: "chains",
  endpoint: "http://localhost:9000",
  region: "us-east-1",
  credentials: {
    accessKeyId: "minioadmin",
    secretAccessKey: "minioadmin",
  },
})
```

---

## Config

| Option | Type | Default | Description |
|---|---|---|---|
| `bucket` | `string` | required | S3 bucket name |
| `prefix` | `string` | `"chains"` | Key prefix for all chain objects |
| `region` | `string` | `"us-east-1"` | AWS region. Use `"auto"` for R2 |
| `endpoint` | `string` | — | Custom endpoint for R2, MinIO, Backblaze |
| `credentials` | `{ accessKeyId, secretAccessKey }` | — | Explicit credentials. Omit to use environment/IAM |

---

## Storage layout

Each chain is stored as a single JSON object:

```
{prefix}/{chainId}.json
```

Writes are atomic (`PutObject`). No partial state is possible.

---

## API

| Method | Description |
|---|---|
| `read(chainId)` | Read a chain |
| `write(chain)` | Write (upsert) a chain |
| `exists(chainId)` | Check if a chain exists |
| `list()` | List all chain IDs in the bucket prefix |
| `delete(chainId)` | Delete a chain |
| `verify(chainId)` | Read and verify chain integrity |
| `migrate(chainId, target)` | Migrate a chain to another connector |

`watch()` is not supported — use S3 event notifications or poll `verify()` instead.
npm package: @glorychain/shared
Description: Glory Chain shared Zod validators — consumed by apps/web server and client
Latest version: 0.1.0

# @glorychain/shared

> Zod validators and shared TypeScript types used across all glorychain packages and the web platform.

```bash
npm install @glorychain/shared
# or
pnpm add @glorychain/shared
```

This package is the single source of truth for input shapes. The same validators run in CLI commands, API route handlers, and tRPC procedures — so a chain created from the CLI and one created via the web API have identical validation semantics.

---

## Chain validators

```typescript
import { CreateChainSchema, AppendBlockSchema } from "@glorychain/shared";
import type { CreateChainInput, AppendBlockInput } from "@glorychain/shared";

// Validate input before creating a chain
const input = CreateChainSchema.parse({
  purpose:      "Tamper-evident public record of all governance decisions",
  identityType: "anonymous",  // "oauth" | "external" | "anonymous"
});

// Validate input before appending a block
const appendInput = AppendBlockSchema.parse({
  chainId:   "3e7c9f2a-...",
  content:   "Motion passed: Approve 2026 budget. Votes: 7 for, 0 against.",
  timestamp: new Date().toISOString(),
});
```

---

## Suggestion validators

The SaaS platform supports a suggestion workflow — anyone can propose a block for a chain; the chain owner approves or rejects it.

```typescript
import { SubmitSuggestionSchema } from "@glorychain/shared";
import type { SubmitSuggestionInput } from "@glorychain/shared";

// Submit a suggestion (public — no auth required)
const suggestion = SubmitSuggestionSchema.parse({
  chainSlug:     "acme-ngo-board-resolutions",
  content:       "Proposed board resolution: ...",
  submitterNote: "From the finance committee.",  // optional
});
```

---

## All exports

```typescript
// Schemas
export {
  CreateChainSchema,
  AppendBlockSchema,
  ContentSchemaDefinitionSchema,
  SubmitSuggestionSchema,
};

// Types (derived from schemas via z.infer)
export type {
  CreateChainInput,
  AppendBlockInput,
  ContentSchemaDefinition,
  SubmitSuggestionInput,
};
```

---

## Design

- **No runtime dependencies beyond `zod`** — installs cleanly in any environment
- **Validators are canonical** — the Zod schemas define the contract; TypeScript types are derived from them via `z.infer`, never written by hand
- **Used everywhere** — CLI flags → parsed through these validators. tRPC inputs → these schemas. API request bodies → these schemas. One source of truth.
- **Pure ESM** — tree-shakeable, no CJS interop issues