UNPKG

@swell/cli

Version:

Swell's command line interface/utility

30 lines (29 loc) 1.23 kB
/** * Compute an app's display slug. * * Mirrors the server-canonical priority in * schema-api-server/api/admin/features/apps/installer.js:213 — private_id * (with the leading underscore stripped) wins over public_id. The orders * agree for the typical case where `private_id === '_' + public_id`, but * diverge for theme-collision suffixes (`_my_theme_1`) and any app where * `public_id` was set independently of `private_id`. Following the server * keeps CLI labels in sync with what the admin UI shows for the same row. * * No id fallback: an app with neither slug returns `undefined`. Callers * that want a "show something" guarantee (e.g. the push-app picker) should * append `?? app.id` themselves; the slug map deliberately filters such * records out so downstream code can flag them as `<not resolved>`. */ export interface SlugSource { privateId?: string; publicId?: string; } export declare function appSlug(source: SlugSource): string | undefined; export declare function slugFromApp(app: { private_id?: string; public_id?: string; }): string | undefined; export declare function slugFromInstalledApp(rec: { app_private_id?: string; app_public_id?: string; }): string | undefined;