/** * URL normalization utilities * Handles trailing slashes and path joining to prevent double slashes in URLs */ /** * Normalize a base URL by removing trailing slashes * @param args - Normalization arguments * @param args.baseUrl - The base URL to normalize (e.g., "https://example.com/") * @param args.path - Optional path to append (e.g., "/api/endpoint") * * @returns Normalized URL with no double slashes * * @example * normalizeUrl({ baseUrl: "https://example.com/", path: "/api/test" }) * // Returns: "https://example.com/api/test" * @example * normalizeUrl({ baseUrl: "https://example.com", path: "api/test" }) * // Returns: "https://example.com/api/test" */ export declare const normalizeUrl: (args: { baseUrl: string; path?: string | null; }) => string; /** * Validate organization ID format * Must be lowercase alphanumeric with hyphens, not starting or ending with hyphen * @param args - Validation arguments * @param args.orgId - The organization ID to validate * * @returns True if valid, false otherwise * * @example * isValidOrgId({ orgId: "my-company" }) // Returns: true * isValidOrgId({ orgId: "MyCompany" }) // Returns: false (uppercase) * isValidOrgId({ orgId: "-company" }) // Returns: false (starts with hyphen) */ export declare const isValidOrgId: (args: { orgId: string; }) => boolean; /** * Build Watchtower URL from organization ID * @param args - Build arguments * @param args.orgId - The organization ID * * @returns The full Watchtower URL * * @example * buildWatchtowerUrl({ orgId: "tilework" }) * // Returns: "https://tilework.tilework.tech" */ export declare const buildWatchtowerUrl: (args: { orgId: string; }) => string; /** * Build Organization Registry URL from organization ID * Uses noriskillsets.dev domain. "public" org maps to apex domain. * @param args - Build arguments * @param args.orgId - The organization ID ("public" for public registry) * * @returns The full Registry URL * * @example * buildOrganizationRegistryUrl({ orgId: "public" }) * // Returns: "https://noriskillsets.dev" * @example * buildOrganizationRegistryUrl({ orgId: "myorg" }) * // Returns: "https://myorg.noriskillsets.dev" */ export declare const buildOrganizationRegistryUrl: (args: { orgId: string; }) => string; /** * Check if a string is a valid URL * @param args - Validation arguments * @param args.input - The string to check * * @returns True if valid URL, false otherwise * * @example * isValidUrl({ input: "https://example.com" }) // Returns: true * isValidUrl({ input: "not-a-url" }) // Returns: false */ export declare const isValidUrl: (args: { input: string; }) => boolean; /** * Extract organization ID from a Nori service URL * Supports both Watchtower (*.tilework.tech) and Registry (*.noriskillsets.dev) URLs * @param args - Extraction arguments * @param args.url - The service URL to extract org ID from * * @returns The organization ID, or null if not a valid Nori service URL * * @example * extractOrgId({ url: "https://tilework.tilework.tech" }) * // Returns: "tilework" * @example * extractOrgId({ url: "https://myorg.noriskillsets.dev" }) * // Returns: "myorg" * @example * extractOrgId({ url: "http://localhost:3000" }) * // Returns: null (not a Nori service URL) */ export declare const extractOrgId: (args: { url: string; }) => string | null; /** * Result of parsing a namespaced package specification */ export type ParsedNamespacedPackage = { orgId: string; packageName: string; version: string | null; }; /** * Parse a namespaced package specification into org, name, and version * Supports formats: "package-name", "package-name@1.0.0", "org/package-name", "org/package-name@1.0.0" * A bare (non-namespaced) name resolves to `defaultOrg` when provided, otherwise * to the "public" org. An explicit `org/` (or `public/`) prefix is never * overridden by `defaultOrg`. * * @param args - Parsing arguments * @param args.packageSpec - The package specification string * @param args.defaultOrg - Org to resolve a bare name to instead of "public" * * @returns Parsed package info, or null if invalid format * * @example * parseNamespacedPackage({ packageSpec: "my-profile" }) * // Returns: { orgId: "public", packageName: "my-profile", version: null } * @example * parseNamespacedPackage({ packageSpec: "my-profile", defaultOrg: "myorg" }) * // Returns: { orgId: "myorg", packageName: "my-profile", version: null } * @example * parseNamespacedPackage({ packageSpec: "myorg/my-profile@1.0.0" }) * // Returns: { orgId: "myorg", packageName: "my-profile", version: "1.0.0" } */ export declare const parseNamespacedPackage: (args: { packageSpec: string; defaultOrg?: string | null; }) => ParsedNamespacedPackage | null; /** * Build a one-line notice when a bare package name was routed to a non-public * organization via a configured default org. Returns null when no notice is * warranted — an explicit namespace was given, or the name resolved to public. * * @param args - Notice arguments * @param args.packageSpec - The raw package spec as typed by the caller * @param args.orgId - The resolved org ID * @param args.packageName - The resolved package name * * @returns The notice string, or null when none is warranted */ export declare const formatDefaultOrgNotice: (args: { packageSpec: string; orgId: string; packageName: string; }) => string | null; /** * Build the fully-qualified `/` name for a parsed package * reference. This is the single namespaced form used everywhere below the CLI * edge — user-facing display, the on-disk directory (relative to `profiles/`), * and the stored identity. The public registrar is a normal namespace here, so a * public package is `public/`, never a bare ``. * * @param args - Naming arguments * @param args.orgId - The organization ID ("public" for the public registry) * @param args.packageName - The package name * * @returns The qualified name ("public/my-profile" for public, "myorg/my-profile" for an org) * * @example * namespacedName({ orgId: "public", packageName: "my-profile" }) * // Returns: "public/my-profile" * @example * namespacedName({ orgId: "myorg", packageName: "my-profile" }) * // Returns: "myorg/my-profile" */ export declare const namespacedName: (args: { orgId: string; packageName: string; }) => string; /** * Determine whether a registry URL refers to the public registrar. * * @param args - Arguments * @param args.url - The registry URL to classify * * @returns True if the URL is the public registry (noriskillsets.dev apex) */ export declare const isPublicRegistryUrl: (args: { url: string; }) => boolean; //# sourceMappingURL=url.d.ts.map