Skip to content

@lastshotlabs/slingshot-emoji

npm install @lastshotlabs/slingshot-emoji

Create the emoji package: custom emoji metadata management with org-scoped shortcode uniqueness, permission-guarded CRUD, and event-driven notifications.

Emoji assets are managed by the framework upload system — this package stores only the uploadKey reference. The update route is intentionally disabled (emojis are immutable; delete and re-upload to change).

Permissions resolve through the slingshot-permissions package, which must be registered before this one. Shortcodes must match /^[a-z0-9_]{2,32}$/; the shortcodeGuard middleware enforces this on the create route and returns 400 with a clear error when violated.

When the framework upload system is configured (ctx.upload.adapter is set), the package subscribes to emoji:emoji.deleted and removes the uploaded file via storageAdapter.delete(uploadKey). When no storage adapter is configured, a warning is logged and the cascade is skipped.

function createEmojiPackage(rawConfig: unknown): SlingshotPackageDefinition

Source: packages/slingshot-emoji/src/plugin.ts

Validates the shortcode field on emoji create requests.

Returns 400 when the body’s shortcode is present and fails the format check. Passes the request through otherwise — non-POST methods and bodies without a shortcode field are not the responsibility of this guard.

Source: packages/slingshot-emoji/src/middleware/shortcodeGuard.ts

Provider-owned package contract for slingshot-emoji.

Source: packages/slingshot-emoji/src/public.ts

Custom emoji entity.

Shortcode uniqueness is enforced by the [orgId, shortcode] unique index. The uploadKey field references a file managed by the framework upload system. Clients presign, upload to storage, then POST emoji metadata with the key. Emojis are immutable once created — the update route is intentionally disabled.

Source: packages/slingshot-emoji/src/entities/emoji.ts

Source: packages/slingshot-emoji/src/entities/emoji.ts

Source: packages/slingshot-emoji/src/entities/emoji.ts

Zod validation schema for EmojiPackageConfig.

Used by createEmojiPackage() to validate the raw config at construction time.

Source: packages/slingshot-emoji/src/types.ts

Shape of an emoji record as returned by the API.

Matches the entity fields defined in src/entities/emoji.ts. The uploadKey references a file managed by the framework upload system — the emoji package does not handle file uploads directly.

Shortcodes must match /^[a-z0-9_]{2,32}$/ (e.g. party_parrot). Validated by the shortcodeGuard middleware on the create route. Uniqueness is enforced by the [orgId, shortcode] unique index.

Source: packages/slingshot-emoji/src/types.ts

Fully-typed configuration for the emoji package.

Pass a value of this type to createEmojiPackage(). All fields are optional.

Permissions resolve through the slingshot-permissions package, which must be registered before this one. Apps that need a custom permissions adapter should configure it on the permissions package, not here.

Source: packages/slingshot-emoji/src/types.ts

Canonical plugin configuration name.

Source: packages/slingshot-emoji/src/types.ts