/** Pattern for valid extension names. */
export const EXTENSION_NAME_VALID_PATTERN = '^[a-zA-Z0-9](?:[a-zA-Z0-9]|[_.-](?=[a-zA-Z0-9]))*$';
/** Maximum allowed length for an extension name. */
export const EXTENSION_NAME_MAX_LENGTH = 128;
/** Returns the extension ID prefix (excluding the ".") for a registry extension's publisher. */
export function extensionIDPrefix(p) {
    return `${p.extensionIDPrefix ? `${p.extensionIDPrefix}/` : ''}${publisherName(p)}`;
}
export function publisherName(p) {
    switch (p.__typename) {
        case 'User':
            return p.username;
        case 'Org':
            return p.name;
    }
}
/** Returns the extension ID (in "publisher/name" format). */
export function toExtensionID(publisher, name) {
    return `${typeof publisher === 'string' ? publisher : extensionIDPrefix(publisher)}/${name}`;
}
//# sourceMappingURL=extension.js.map