import type { IResourceBuilderServices } from "@uipath/resource-builder-sdk"; import type { ISolutionBuilder, ResourceDefinition } from "@uipath/resource-builder-sdk/solution"; interface RequiredPropertyDefault { property: string; /** Empty placeholder value matching the property's declared type. */ placeholder: unknown; } export interface ResolvedKindMetadata { /** Subtype to pass to createVirtualResourceAsync (e.g. "StringAsset"). */ type?: string; /** SDK's `supportsInLineCreation` — whether a virtual stub can be created. */ virtualizable: boolean; /** * Required spec properties that have no default in SDK metadata. Deploy * validation rejects virtualized resources missing these (e.g. Asset.value). * We fill them in-memory after `createVirtualResourceAsync` with a * type-appropriate placeholder. */ requiredDefaults: RequiredPropertyDefault[]; /** * Lowercased spec property names the kind declares, unioned across every * metadata version of the kind. Callers use this to ask what a kind * carries without hardcoding a table — e.g. whether it has a `version` * (`app`, `appVersion`, `package`, `process` do; `queue`, `asset` do not). * Unioned rather than read off `versions[0]` so a property added in a * newer metadata version still counts. */ specProperties: Set; subtypes: string[]; typeMatched: boolean; } export { findMatchingLocalResource, findMatchingMemberResource, findMemberCloneResources, normalizeFolderPath, } from "./local-resource-matcher"; export declare function formatResourceSubtypes(subtypes: string[]): string; export declare function sameResourceSubtype(a: string | undefined, b: string | undefined): boolean; interface SyncResult { created: number; imported: number; skipped: number; /** Stale `name_` clones of member projects removed this run (UV-15817). */ pruned: number; warnings: string[]; } /** * Reads bindings_v2.json from project paths and creates/imports matching * resources in the solution using the resource-builder-sdk. * * @param solutionDir - Path to the solution directory * @param projectPaths - Specific project paths to scan (if omitted, scans all projects in .uipx) */ export declare function syncResourcesFromBindings(solutionDir: string, projectPaths?: string[], projectSubTypes?: ReadonlyMap): Promise; /** * Mirror of SDK's private `addResourceWithUniqueName` * (resource-builder-sdk index.js:673): if any other resource of the same * kind already carries `name` (or a `name_` suffix variant), return * `name_`. Otherwise return `name` unchanged. Excludes `excludeKey` * so the resource we just created doesn't collide with itself. */ export declare function uniqueNameForResource(name: string, kind: string, excludeKey: string, solution: { resources: Array<{ key: string; kind?: string; name?: string; }>; }): string; export interface RcsMatch { key: string; name: string; /** Subtype in its solution name (e.g. `stringAsset` for a Text asset). * `undefined` for kinds without a subtype (Queue). Callers may need to * forward this to `addOrUpdateResourceToSolutionAsync`, which rejects * type-less imports for kinds that SDK metadata indexes by (kind, type). */ type?: string; folder?: { fullyQualifiedName: string; folderKey: string; path?: string; }; } /** * Find a resource in RCS by key (UUID). RCS's `SearchFolderEntities` endpoint * has no key-based filter — only `name`/`entityTypes`/`entitySubTypes`. We * paginate all resources of this kind and filter locally by key, exiting * early on the match. Used for connections, whose binding carries the UUID * directly via `bindingKey`. */ export declare function findResourceByKeyInRcs(builder: ISolutionBuilder, kind: string, expectedKey: string, folderPath?: string, propagateErrors?: boolean): Promise; /** * Page through RCS for a given (kind, name) and collect every match. Returns * an empty array on lookup error (logged as a warning). Callers decide what * to do with 0/1/many matches. Callers that must tell "nothing matched" * from "the catalog could not be searched" use {@link searchRcsResourcesStrict}. */ export declare function searchRcsResources(builder: ISolutionBuilder, kind: string, name: string): Promise; /** * Same search as {@link searchRcsResources}, but a failed catalog call is * thrown instead of swallowed into an empty result. Use it where an empty * answer leads to a user-facing "not found" that would be wrong after an * auth or network failure. */ export declare function searchRcsResourcesStrict(builder: ISolutionBuilder, kind: string, name: string): Promise; export declare function findResourceInRcs(builder: ISolutionBuilder, kind: string, name: string, folderPath?: string): Promise; /** * Build a resolver that answers kind-metadata questions for many (kind, type) * pairs off one `getOrderedAsync` fetch, caching per pair. Prefer this over * calling `resolveResourceKindMetadata` in a loop — that re-reads SDK metadata * on every call. */ export declare function createResourceKindMetadataResolver(services: IResourceBuilderServices): Promise<(kind: string, type?: string) => Promise>; /** * Resolve a resource kind's metadata via the SDK (`kind`, optional `type`) so * callers outside the bindings sync can fill required spec defaults the same * way `createVirtualForBinding` does. Returns undefined if the kind isn't * indexed by SDK metadata. */ export declare function resolveResourceKindMetadata(services: IResourceBuilderServices, kind: string, type?: string): Promise; export interface CreateLocalResourceParams { builder: ISolutionBuilder; services: IResourceBuilderServices; kind: string; type?: string; name: string; folderPath?: string; } export interface CreateLocalResourceResult { resource: ResourceDefinition; /** Final name on the resource — may differ from input if SDK conflict suffix kicked in. */ finalName: string; } /** * Create a virtual (local-only) resource via the SDK and rename it to `name`, * mirroring the rename + spec-default flow `createVirtualForBinding` runs * during refresh. Returns the freshly created `SolutionResource` after the * mutation, or undefined if the SDK failed to allocate a key. * * Callers must: * - Persist the change (e.g. `builder.disposeAsync()` or * `context.saveAsync()`); this helper only mutates in-memory state. * - Have already done an idempotency check — this helper *always* creates, * and SDK's `addResourceWithUniqueName` will suffix the name on conflict. */ export declare function createLocalResource(params: CreateLocalResourceParams): Promise; export interface UipxProject { /** Project type as written in `.uipx` (e.g. "Agent", "Process"). */ type: string; /** Design-time UUID used as `projectKey` in reconcile. */ id: string; /** Path to the project directory (parent of `project.uiproj`). */ path: string; /** Project name read from `project.uiproj` (`Name` field). */ name: string; } /** * Read solution's `.uipx` and each project's `project.uiproj` to assemble the * data needed for `reconcileProjectsAsync`. Without this, sync would only see * resource bindings (Queue/Asset/etc.) and miss the project artefacts * (process/, package, app/, appVersion) the SDK generates from * project templates. */ export declare function readUipxProjects(solutionDir: string): Promise; /** * Sync resources from bindings with logging. Non-fatal — logs warnings * on failure and continues. Used by pack and upload before packaging. */ export declare function syncAndLog(solutionDir: string, projectSubTypes?: ReadonlyMap): Promise;