/** * 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 Registry URL from organization ID * @param args - Build arguments * @param args.orgId - The organization ID * * @returns The full Registry URL * * @example * buildRegistryUrl({ orgId: "myorg" }) * // Returns: "https://myorg.nori-registry.ai" */ export declare const buildRegistryUrl: (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 (*.nori-registry.ai) 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.nori-registry.ai" }) * // 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" * Non-namespaced packages are treated as belonging to "public" org * * @param args - Parsing arguments * @param args.packageSpec - The package specification string * * @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: "myorg/my-profile@1.0.0" }) * // Returns: { orgId: "myorg", packageName: "my-profile", version: "1.0.0" } */ export declare const parseNamespacedPackage: (args: { packageSpec: string; }) => ParsedNamespacedPackage | null; //# sourceMappingURL=url.d.ts.map