npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cloud-space-api

v0.1.1

Published

Codemao Cloud Space API Library for Node.js

Readme

cloud-space-api

A Node.js SDK for Codemao Cloud Space (源码云空间), providing simple access to cloud databases and cloud dictionaries.

Installation

npm install cloud-space-api
# or
pnpm add cloud-space-api

Quick Start

import { CloudSpace } from 'cloud-space-api';

const cs = new CloudSpace('your-authorization-token');

// --- Cloud Database (Table) ---
const table = cs.table('your-table-id');

// List records
const { records, total } = await table.list(0, 100);

// Add a record
const recordId = await table.add([
  { column_id: 'col_xxx', value: 'hello' },
  { column_id: 'col_yyy', value: '42' },
]);

// Update a record
await table.edit(recordId, [
  { column_id: 'col_xxx', value: 'world' },
]);

// Delete a record
await table.delete(recordId);

// Get a record by id
const record = await table.get(recordId);

// Batch operations
await table.store({
  add_items: [{ values: [{ column_id: 'col_xxx', value: 'new' }] }],
  edit_items: [{ record_id: 'id_1', values: [{ column_id: 'col_xxx', value: 'updated' }] }],
  delete_items: ['id_2'],
});

// --- Cloud Dictionary (Dict) ---
const dict = cs.dict('your-dict-id');

// List all entries
const { items, total } = await dict.list();

// Add an entry
const entry = await dict.add('my_key', 'my_value');

// Edit an entry by id
await dict.edit(entry.id, 'my_key', 'new_value');

// Delete an entry by id
await dict.remove(entry.id);

// Look up an entry by key
const found = await dict.getByKey('my_key');

// Delete an entry by key
await dict.removeByKey('my_key');

// Batch operations
await dict.store({
  addItems: [{ key: 'k1', value: 'v1' }],
  editItems: [{ id: 123, key: 'k2', value: 'v2' }],
  deleteItems: [456],
});

API Reference

CloudSpace

class CloudSpace {
  constructor(authorization: string, options?: CloudSpaceOptions);
  table(tableId: string): Table;
  dict(dictId: string): Dict;
}
  • authorization — Your Codemao API authorization token.
  • options.baseUrl — Optional custom base URL (defaults to https://api-creation.codemao.cn).

Table

class Table {
  list(offset?: number, limit?: number): Promise<PaginatedList<TableRecord>>;
  store(body: TableStoreBody): Promise<void>;
  add(values: TableColumnValue[]): Promise<string>;
  edit(recordId: string, values: TableColumnValue[]): Promise<void>;
  delete(recordId: string): Promise<void>;
  get(recordId: string): Promise<TableRecord | undefined>;
}

Types

interface TableRecord {
  record_id: string;
  values: Record<string, string>;
}

interface TableColumnValue {
  column_id: string;
  value: string;
}

interface PaginatedList<T> {
  records: T[];
  offset: number;
  limit: number;
  total: number;
}

Dict

class Dict {
  list(offset?: number, limit?: number): Promise<DictListData>;
  store(req: DictStoreRequest): Promise<DictStoreData>;
  add(key: string, value: string, type?: string): Promise<DictEntry>;
  edit(id: number, key: string, value: string, type?: string): Promise<DictEntry>;
  remove(id: number): Promise<DictStoreData>;
  getByKey(key: string): Promise<DictEntry | undefined>;
  removeByKey(key: string): Promise<boolean>;
}

Types

interface DictEntry {
  id: number;
  key: string;
  value: string;
  type: string;
}

interface DictListData {
  items: DictEntry[];
  limit: number;
  offset: number;
  total: number;
}

interface DictStoreRequest {
  addItems?: Array<{ key: string; value: string; type?: string }>;
  editItems?: Array<{ id: number; key: string; value: string; type?: string }>;
  deleteItems?: number[];
}

interface DictStoreData {
  addItems: DictEntry[];
  editItems: DictEntry[];
  deleteItems: number[];
}

Development

pnpm build        # Compile TypeScript
pnpm test         # Run tests
pnpm lint         # Lint source code
pnpm format       # Format code with Prettier

License

MIT