fn scaffold(path: string, id: string, name: string, developer: string)
Create a new Appspace card project at the given path with manifest.json, schema.json, model.json, index.html, and a placeholder thumbnail. Defaults to a plain HTML/JS template (zero build step) — extend with React/Angular as needed.
| Argument | Type | Required | Description |
|---|
| path | string | yes | Destination directory (created if missing). Should be empty. |
| id | string | yes | Reverse-DNS card identifier (e.g., 'com.example.lobby.welcome') |
| name | string | yes | Human-readable card name |
| developer | string | yes | Developer/author name for the manifest (your company or org) |
fn validate(path: string)
Validate a card project's Big Three (manifest.json, schema.json, model.json) for required fields and consistency. Returns warnings without modifying files.
| Argument | Type | Required | Description |
|---|
| path | string | yes | Path to card project directory |
fn build(path: string, command: string, args: array)
Run a build command in the card project directory (e.g., 'npm run build'). Skip for plain-HTML cards that need no build.
| Argument | Type | Required | Description |
|---|
| path | string | yes | Path to card project directory |
| command | string | yes | Build executable |
| args | array | yes | Build command arguments |
fn package(sourceDir: string, outputZip: string, excludeGlobs: array)
Package a card project into a .zip ready for upload to Appspace. Handles the 'zip contents not folder' gotcha by archiving entries with paths relative to the source dir. Run validate first.
| Argument | Type | Required | Description |
|---|
| sourceDir | string | yes | Directory whose contents to package (typically build/ or the project root for plain cards) |
| outputZip | string | yes | Path where the .zip should be written (e.g., 'dist/my-card.zip') |
| excludeGlobs | array | yes | Entries to skip at ANY depth (matched against the entry name). Appspace rejects .db files, so swamp's nested .swamp/ catalogs must never be bundled. |
fn verifyPackage(zipPath: string)
Gate a built card .zip before upload: fail if it contains swamp/vcs/OS internals or DB-type files (Appspace rejects .db with a 500), or is missing the files the manifest references (Schema/Model/Startup/Thumbnail) at the zip root. Throws on any violation so a build workflow stops before a bad upload. Run after `package`.
| Argument | Type | Required | Description |
|---|
| zipPath | string | yes | Path to the built card .zip to verify |
fn listTemplateTypes()
List all card template types installed on the Appspace tenant. Use the returned 'id' as cardTemplateTypeId when creating new template instances.
fn listTemplates(maxItems?: number)
List configured card template instances in the Appspace library.
| Argument | Type | Required | Description |
|---|
| maxItems? | number | no | |
fn getTemplate(id: string)
Get a single card template by ID.
| Argument | Type | Required | Description |
|---|
| id | string | yes | Card template ID |
fn createTemplate(cardTemplateTypeId: string, name: string, model?: record, schema?: record, permissions?: array, theme?: record)
Create a new configured card template instance from a registered template type. The 'model' and 'schema' fields override the template type's defaults for this instance.
| Argument | Type | Required | Description |
|---|
| cardTemplateTypeId | string | yes | ID of the template type to instantiate (from listTemplateTypes) |
| name | string | yes | Display name for the instance |
| model? | record | no | Per-instance model.json overrides |
| schema? | record | no | Per-instance schema.json overrides |
| permissions? | array | no | |
| theme? | record | no | |
fn pullCard(templateId: string, destDir: string, includeAssets: boolean)
Download a card's source files from its templateUrl on the Appspace tenant. Fetches manifest/schema/model/index.html plus every script and stylesheet referenced from index.html (preserving the relative directory structure). NOTE: dynamically-loaded files (translations under console/lang/*, fonts/, console/react/*, SVG assets) are not statically referenced so they won't be picked up — if pulling a customer-customized card to re-base, the bundle may be stripped. Warns when fewer than 50 files are
| Argument | Type | Required | Description |
|---|
| templateId | string | yes | Card template instance ID (UUID). Find via listTemplates. |
| destDir | string | yes | Destination directory. Created if missing; existing files are overwritten. |
| includeAssets | boolean | yes | When true (default), follow JS/CSS references from index.html and download those too. When false, only fetches root files (manifest, schema, model, index.html, thumbnail.svg). |
fn inspectChannel(channelId: string, includeContentModels: boolean)
Probe an Appspace channel and return its metadata, every playlist item, and (when the item is a card) the deployed model.json with the live per-instance input values. Useful for debugging why a card configured in the Appspace console isn't behaving as expected — channel-level card content has its own model.json overrides separate from the library template's defaults, and the only authoritative way to see what a kiosk is actually running with is to fetch that deployed model.
| Argument | Type | Required | Description |
|---|
| channelId | string | yes | Appspace channel UUID (find via the channel's URL in the console, e.g. /channels/<UUID>). |
| includeContentModels | boolean | yes | When true (default), fetches the deployed model.json for each card item in the playlist. Set false to skip and just return playlist metadata. |
fn getContentModel(contentId: string)
Fetch the deployed model.json for an Appspace content item — the live per-instance input values, NOT the library template defaults. Looks up the content via libraries/contents to resolve its current contentURL, then fetches the matching model.json. Use this to verify what configuration a kiosk is actually running with when you only have a contentId.
| Argument | Type | Required | Description |
|---|
| contentId | string | yes | Appspace content UUID |
fn updateTemplate(id: string, cardTemplateTypeId?: string, name?: string, model?: record, schema?: record, theme?: record)
Update a configured card template instance (name, model overrides, schema overrides, theme).
| Argument | Type | Required | Description |
|---|
| id | string | yes | Card template instance ID |
| cardTemplateTypeId? | string | no | ID of the underlying template type. Required by the PUT endpoint (full-replace); if omitted it is recovered from the existing instance's cardTemplateType.id. |
| name? | string | no | |
| model? | record | no | |
| schema? | record | no | |
| theme? | record | no | |
Resources
cardTemplateType(infinite)— Registered card template type — the developer-uploaded card 'class' that instances are created from
cardTemplate(infinite)— Configured card template instance — references a cardTemplateType and stores the per-instance schema/model overrides
cardProject(infinite)— Local card project on disk — directory containing manifest.json, schema.json, model.json, and the card's web app
cardPackage(infinite)— Built and zipped card ready to upload to Appspace
cardPackageVerification(infinite)— Upload-safety verdict for a built card .zip — confirms no swamp/vcs/OS internals or DB-type files (which Appspace rejects with a 500) and that the manifest-referenced files are present at the zip root.
cardPull(infinite)— Source files pulled from a card's templateUrl on the Appspace tenant — manifest, schema, model, index.html, and all referenced JS/CSS/asset bundles
channel(infinite)— Appspace channel — top-level container that publishes content to one or more devices. Has an associated playlist (1:1) of cards/articles.
channelPlaylistItem(infinite)— Single item (card content, article, or media) in a channel's playlist. References a contentId whose deployed model.json holds the per-instance configured input values.
contentModel(infinite)— Deployed model.json for a content item — the live per-instance input values as the kiosk runtime sees them. Distinct from the library template's model.json defaults; this captures whatever a user (or the console editor) saved on the content.