Skip to content

Commit 2aa68d2

Browse files
Sarath1018claude
andauthored
docs: add SETUP.md for Agentic Inner Loop KPI [PLT-103741] (#507)
* docs: add SETUP.md for Agentic Inner Loop KPI [PLT-103741] Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs: cap Node heap in SETUP.md build command to avoid CI OOM [PLT-103741] Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 96062a5 commit 2aa68d2

1 file changed

Lines changed: 137 additions & 0 deletions

File tree

SETUP.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# SETUP.md
2+
3+
Machine-executable setup, build, and test instructions for the UiPath TypeScript SDK.
4+
5+
## Prerequisites
6+
7+
- Node.js 20+ (npm 10+ is bundled)
8+
- git
9+
10+
### Supported platforms
11+
12+
- [x] Linux
13+
- [x] macOS
14+
- [ ] Windows
15+
16+
## Environment Variables
17+
18+
### Standard (injected by pipeline)
19+
20+
| Variable | Description |
21+
|----------|-------------|
22+
| `GITHUB_TOKEN` | Referenced by this repo's `.npmrc` (`//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}`). All dependencies resolve from the public npm registry via `package-lock.json`, so the token value is never validated during install — it only needs to be set so npm can interpolate the `.npmrc`. Any non-empty value works for local dev. |
23+
24+
### Project-specific
25+
26+
None. Unit tests are fully mocked and need no credentials or external infrastructure. (Integration tests against a live UiPath tenant exist under `tests/integration/` but are not part of this loop.)
27+
28+
## Setup
29+
30+
```bash
31+
# .npmrc interpolates ${GITHUB_TOKEN}; default it for local dev (pipeline injects the real one).
32+
export GITHUB_TOKEN="${GITHUB_TOKEN:-local-dev-placeholder}"
33+
34+
# Install exact locked dependencies.
35+
npm ci --no-audit --no-fund
36+
```
37+
38+
## Verify Setup
39+
40+
```bash
41+
node --version
42+
npm ls rollup vitest typescript --depth=0
43+
```
44+
45+
`node --version` confirms Node 20+ is on PATH; `npm ls` exits non-zero if the build/test toolchain failed to install.
46+
47+
## Build
48+
49+
```bash
50+
# The .d.ts bundling across ~20 subpath modules peaks above Node's default heap
51+
# cap on 7GB CI agents — grant 4GB explicitly to avoid an OOM abort.
52+
NODE_OPTIONS="--max-old-space-size=4096" npm run build
53+
```
54+
55+
Runs rollup and emits ESM, CJS, UMD bundles and `.d.ts` files per module into `dist/`.
56+
57+
## Test
58+
59+
```bash
60+
npm run test:unit
61+
```
62+
63+
Runs the full vitest unit suite (no network, no credentials required).
64+
65+
## Sample Code Change
66+
67+
### The change
68+
69+
Add a new exported function `filterNullish` to `src/utils/object.ts` — the symmetric complement of the existing `filterUndefined` (which removes only `undefined` values), removing both `null` and `undefined`. Append at the end of the file:
70+
71+
```typescript
72+
/**
73+
* Filters out null and undefined values from an object
74+
* @param obj The source object
75+
* @returns A new object without null or undefined values
76+
*/
77+
export function filterNullish<T extends Record<string, any>>(obj: T): Partial<T> {
78+
const result: Partial<T> = {};
79+
80+
for (const [key, value] of Object.entries(obj)) {
81+
if (value !== null && value !== undefined) {
82+
result[key as keyof T] = value;
83+
}
84+
}
85+
86+
return result;
87+
}
88+
```
89+
90+
Then create a new test file `tests/unit/utils/object.test.ts` with exactly this content:
91+
92+
```typescript
93+
import { describe, it, expect } from 'vitest';
94+
import { filterNullish } from '@/utils/object';
95+
96+
describe('filterNullish', () => {
97+
it('removes null and undefined values', () => {
98+
expect(filterNullish({ a: 1, b: undefined, c: null, d: 'x' })).toEqual({ a: 1, d: 'x' });
99+
});
100+
101+
it('returns an equal object when no nullish values are present', () => {
102+
expect(filterNullish({ a: 1, b: 'x', c: false, d: 0 })).toEqual({ a: 1, b: 'x', c: false, d: 0 });
103+
});
104+
});
105+
```
106+
107+
Do not modify any existing function, export, or test.
108+
109+
### Verification
110+
111+
```bash
112+
npx vitest run tests/unit/utils/object.test.ts
113+
npm run typecheck
114+
```
115+
116+
## Troubleshooting
117+
118+
### `npm error Failed to replace env in config: ${GITHUB_TOKEN}`
119+
120+
Older npm versions fail hard when `.npmrc` references an unset variable. Set it to any non-empty value: `export GITHUB_TOKEN=local-dev-placeholder`.
121+
122+
### Build aborts with `FatalProcessOutOfMemory` / `JavaScript heap out of memory`
123+
124+
Node's default heap cap is below the build's peak memory on machines with ~7GB RAM (typical hosted CI agents). Re-run with an explicit 4GB heap: `NODE_OPTIONS="--max-old-space-size=4096" npm run build`.
125+
126+
### `vitest: command not found` / `rollup: command not found`
127+
128+
Dependencies are not installed — run `npm ci` from the repo root and invoke tools through npm scripts (`npm run build`, `npm run test:unit`) or `npx`.
129+
130+
## Architecture
131+
132+
- `src/core/` — UiPath client, auth (OAuth + secret-based), config, errors, HTTP client, telemetry
133+
- `src/services/` — typed service clients per platform area (Action Center, Conversational Agent, Data Fabric, Maestro, Orchestrator)
134+
- `src/models/` — TypeScript interfaces/types per service domain
135+
- `src/utils/` — constants, pagination, encoding, HTTP helpers
136+
- `tests/unit/` — vitest unit tests (mocked, no network); `tests/integration/` — live-API tests, excluded from this loop
137+
- Build is rollup-based (`rollup.config.js`); each service is published as a separate subpath export

0 commit comments

Comments
 (0)