@jolly-pixel/asset-server
v5.0.0
Published
Back-end asset orchestration: event-sourced projection, reconciliation and catalog delivery
Readme
💃 Getting Started
Install the package with pnpm:
$ pnpm add @jolly-pixel/asset-server👀 Usage example
import * as EventStore from "@jolly-pixel/event-store";
import { FilesystemAssetSource } from "@jolly-pixel/asset-source/node";
import { Server } from "@jolly-pixel/network";
import {
createAssetBackend,
textureAssetKind
} from "@jolly-pixel/asset-server";
using eventStore = await EventStore.persistence.sqlite(
"./assets/.jollypixel/events.db"
);
await using backend = await createAssetBackend({
source: new FilesystemAssetSource("./assets"),
eventStore,
handlers: [textureAssetKind()]
});
await using server = new Server();
backend.attach(server);On startup, the backend catalogs files already present in ./assets. Changes
made through backend.writer are appended to the event store and written to
the asset source. Changes made by external tools are detected and appended as
system events.
📚 API
Architecture: visual map of event flow, projections, live state and reconciliationAssetBackend: setup, options and lifecycleAssetWriter: create, update, rename and remove assetsAsset kinds: custom state, serialization and editing roomsCatalog: catalog projection, network messages and HTTP accessArchive: ZIP export and import of an asset with its dependenciesRooms: dynamic editing rooms and evictionSync: lifecycle events, snapshots and reconciliation
✨ Contributors guide
Read the contributing guide before submitting a change.
Run these commands from the monorepo root:
$ pnpm --filter @jolly-pixel/asset-server test
$ pnpm run lint[!CAUTION] Include tests when adding a feature or fixing a bug.
📃 License
MIT
