@uipath/common 1.200.0-preview.120 → 1.201.0-preview.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,3 +33,17 @@ export declare function parseBoundedInt(raw: string, optionName: string, bounds:
33
33
  }): number;
34
34
  export declare function parsePositiveInteger(raw: string): number | undefined;
35
35
  export declare function parseNonNegativeInteger(raw: string): number | undefined;
36
+ /**
37
+ * Split an OAuth scope list into individual scope names.
38
+ *
39
+ * Accepts both separators the CLI has historically used: the OAuth2
40
+ * space-separated form (`uip login --scope`) and the comma-separated form
41
+ * (`uip admin external-apps --user-scope`). Space is safe to split on
42
+ * because RFC 6749 uses it as the scope delimiter. Comma is not reserved by
43
+ * the RFC — a `scope-token` may legally contain one — but no UiPath scope
44
+ * name does, and the server validates every name it is sent, so a
45
+ * wrongly-split name fails as unknown rather than granting anything extra.
46
+ *
47
+ * Returns an empty array for undefined, empty, or separator-only input.
48
+ */
49
+ export declare function splitScopeList(raw: string | undefined): string[];
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Lazy loaders for the two output codecs that only some invocations need.
3
+ *
4
+ * `formatter.ts` is imported by every command in every tool, so anything it
5
+ * imports statically is parsed on every `uip` invocation — including
6
+ * `uip <tool> -h`. `js-yaml` (101 KB) is only reached by `--output yaml` and
7
+ * `@jmespath-community/jmespath` (68 KB) only by `--output-filter`, so both
8
+ * live behind `await import` here instead.
9
+ *
10
+ * The API is split in two on purpose:
11
+ *
12
+ * - `loadOutputCodecsAsync` is awaited from the async paths that already know
13
+ * what the user asked for — the CLI host right after it resolves `--output`
14
+ * and `--output-filter`, and `trackedAction` before it runs a handler.
15
+ * - `getYamlCodec` / `getJmespathCodec` are the synchronous accessors
16
+ * `OutputFormatter` uses, because the formatter API is synchronous.
17
+ *
18
+ * Loaded modules live in cross-bundle singleton slots: each tool bundles its
19
+ * own copy of `@uipath/common`, so a module-level variable would be loaded by
20
+ * the host and then missing in the tool. See `singleton.ts`.
21
+ */
22
+ /** The slice of `js-yaml` the formatter uses. */
23
+ export interface YamlCodec {
24
+ dump: (data: unknown) => string;
25
+ }
26
+ /** The slice of `@jmespath-community/jmespath` the formatter uses. */
27
+ export interface JmespathCodec {
28
+ compile: (expression: string) => unknown;
29
+ search: (data: never, expression: string) => unknown;
30
+ }
31
+ /** Which codecs an invocation needs, derived from the resolved CLI options. */
32
+ export interface OutputCodecsNeeded {
33
+ /** True when the resolved output format is `yaml`. */
34
+ yaml?: boolean;
35
+ /** True when an `--output-filter` expression is present. */
36
+ filter?: boolean;
37
+ }
38
+ /**
39
+ * Load the codecs this invocation needs, if they are not loaded already.
40
+ *
41
+ * Safe to call repeatedly — a codec already in its slot is not re-imported.
42
+ * Call before any `OutputFormatter` output that could use them.
43
+ */
44
+ export declare function loadOutputCodecsAsync(needed: OutputCodecsNeeded): Promise<void>;
45
+ /**
46
+ * The loaded YAML codec, or `undefined` when nothing preloaded it.
47
+ *
48
+ * `undefined` means a code path produced `--output yaml` output without
49
+ * passing through the CLI host or `trackedAction` — a bug in that path, not a
50
+ * user error, so callers should throw rather than silently emit JSON.
51
+ */
52
+ export declare function getYamlCodec(): YamlCodec | undefined;
53
+ /** The loaded JMESPath codec, or `undefined` when nothing preloaded it. */
54
+ export declare function getJmespathCodec(): JmespathCodec | undefined;
55
+ /** Test seam — drops both codecs so a spec can assert the unloaded path. */
56
+ export declare function resetOutputCodecs(): void;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Guidance for a project type a solution cannot contain, or `null` when allowed.
3
+ * Lives in `@uipath/common` so `solution-tool`'s packager resolver can ask
4
+ * without importing the `@uipath/solution-sdk` barrel (which drags
5
+ * `@uipath/studioweb-sdk` in).
6
+ *
7
+ * A library registered as a project does not fail late, it deploys *wrong*: the
8
+ * resource builder has no library template, falls through to the default, and
9
+ * mints `kind: process`. Deploy then creates an Orchestrator process backed by a
10
+ * library package, which has no entry point. The SDK metadata agrees a library
11
+ * is not project-shaped: `kind: library` is `scope: Tenant`,
12
+ * `supportsInLineCreation: false`.
13
+ *
14
+ * Case-insensitive — `.uipx` writes PascalCase `Type`, `project.json` uses
15
+ * `designOptions.outputType`.
16
+ *
17
+ * Takes `unknown` because one caller (`ensurePackagerTools`) reads `Type`
18
+ * straight out of `.uipx` JSON, where it can be absent or not a string. Only a
19
+ * type positively known to be unsupported is rejected, so anything else is
20
+ * allowed through to the resolvers, which warn on their own.
21
+ */
22
+ export declare function unsupportedSolutionProjectType(projectType: unknown): string | null;
@@ -0,0 +1,2 @@
1
+ export declare function setProxyAuthHttpsAgent(agent: unknown): void;
2
+ export declare function getProxyAuthHttpsAgent(): unknown;
@@ -1,28 +1,8 @@
1
1
  /**
2
- * Cross-module bridge for packager factory and tool-module resolution.
2
+ * Cross-module bridge for packager factory resolution.
3
3
  */
4
4
  export type PackagerFactoryProvider = (verb: string) => Promise<void>;
5
5
  export declare function setPackagerFactoryProvider(provider: PackagerFactoryProvider): void;
6
- export type ToolModuleProvider = (verb: string, moduleName: string) => Promise<unknown>;
7
- export declare function setToolModuleProvider(provider: ToolModuleProvider): void;
8
- /**
9
- * Resolve another tool's library entry point (its `dist/<module>.js` subpath
10
- * export) at runtime and return the module namespace.
11
- *
12
- * Prefers the registered provider (installed by the CLI — it can install the
13
- * tool on demand and imports the entry by absolute path). With no provider —
14
- * a library caller — falls back to importing `<packageName>/<moduleName>`,
15
- * which resolves when the tool package is installed next to the caller.
16
- *
17
- * This is how one tool uses another tool's code without bundling it: the
18
- * multi-megabyte implementation ships once, in the tool that owns it.
19
- *
20
- * @param verb - CLI tool verb that owns the module (e.g. `"solution"`).
21
- * @param packageName - npm package behind that verb, used for the fallback
22
- * import (e.g. `"@uipath/solution-tool"`).
23
- * @param moduleName - subpath entry to load (e.g. `"init"`, `"resource"`).
24
- */
25
- export declare function ensureToolModule(verb: string, packageName: string, moduleName: string): Promise<unknown>;
26
6
  /**
27
7
  * Resolve the packager factory for a tool verb.
28
8
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/common",
3
3
  "license": "MIT",
4
- "version": "1.200.0-preview.120",
4
+ "version": "1.201.0-preview.121",
5
5
  "description": "Common infrastructure needed by uip tools.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -71,5 +71,5 @@
71
71
  "mihaigirleanu",
72
72
  "vlad-uipath"
73
73
  ],
74
- "gitHead": "173ad4b4930bd3e17a493b32e9f1c3c616ea1c10"
74
+ "gitHead": "c70ccfc0b12e637441d67df1d212b71d7784b5f8"
75
75
  }
@@ -1,43 +0,0 @@
1
- /**
2
- * Shared `ensureProjectArtifacts` used by every `*-tool init` path (agent,
3
- * case, codedapp, flow, maestro). Lives here so the five tools don't each
4
- * carry a copy; each tool re-exports it from its own
5
- * `src/services/project-artifacts.ts` shim (the browser-build
6
- * `excludedImports` stub mechanism resolves only relative paths under each
7
- * tool's own src tree).
8
- */
9
- /** Options forwarded to solution-tool's `addProjectArtifactsToSolutionAsync`. */
10
- export interface EnsureProjectArtifactsArgs {
11
- /** Absolute path to the solution directory (containing the `.uipx`). */
12
- solutionDir: string;
13
- /** Stable project key — must match the `Id` in `.uipx` `Projects[]`. */
14
- projectId: string;
15
- /** Display name for the project; typically the project folder name. */
16
- projectName: string;
17
- /** Project type as written to `project.uiproj` (e.g. `Flow`, `Agent`). */
18
- projectType: string;
19
- /** Optional SDK subType (AppV2: `"Coded"` / `"CodedAction"`). */
20
- projectSubType?: string;
21
- }
22
- /**
23
- * Result envelope. Structurally identical to `ProjectArtifactsResult` in
24
- * `@uipath/solution-sdk/resources` — declared here too because this
25
- * package sits below `solution-sdk` in the dependency graph and cannot import
26
- * from it.
27
- */
28
- export interface ProjectArtifactsResult {
29
- /** True when artifact resources were generated. */
30
- Created: boolean;
31
- /** Error message when `Created` is `false`. */
32
- Error?: string;
33
- }
34
- /**
35
- * Generate the `resources/solution_folder/...` artifact-resource entries for
36
- * a project that has just been registered in its parent solution's `.uipx`.
37
- *
38
- * The implementation is resolved at runtime from the installed
39
- * `@uipath/solution-tool` (through the CLI host's tool-module provider, which
40
- * installs it on demand), so the multi-megabyte resource-builder chain is
41
- * never bundled into the calling tool.
42
- */
43
- export declare function ensureProjectArtifacts(args: EnsureProjectArtifactsArgs): Promise<ProjectArtifactsResult>;
@@ -1,9 +0,0 @@
1
- /**
2
- * Dynamic import of another tool's library entry point (e.g.
3
- * `@uipath/solution-tool/init`).
4
- *
5
- * Its own module so tests can stand in for it, and so the specifier stays a
6
- * plain variable — bundlers then leave the `import()` to run at runtime
7
- * instead of inlining the multi-megabyte target bundle into the caller.
8
- */
9
- export declare function importToolModule(specifier: string): Promise<unknown>;