feat(samples): add SDK Playground — version-aware method explorer coded app - #625
feat(samples): add SDK Playground — version-aware method explorer coded app#625Sarath1018 wants to merge 2 commits into
Conversation
Swagger-style explorer for the SDK: pick any published SDK version (1.0.0-1.5.5, latest patch per minor line), browse every service and method that version exposes via manifests generated from its published .d.ts files, fill parameters in a generated form, and run calls live. Connection modes: platform-injected (coded-app deployment), PAT (memory-only secret), and OAuth PKCE via external application App ID. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
| if (t.isString()) return { kind: 'string' }; | ||
| if (t.isNumber()) return { kind: 'number' }; | ||
| if (t.isBoolean()) return { kind: 'boolean' }; | ||
| if (t.isString() || t.isStringLiteral()) return { kind: 'string' }; |
There was a problem hiding this comment.
Dead code / latent bug: t.isString() was already checked on line 73, so this branch can never execute. The t.isStringLiteral() case is silently dropped, meaning a parameter whose type is a single string literal (e.g. "ascending") falls through to return { kind: 'json' } and gets a JSON textarea instead of a plain text input.
Fix: merge the isStringLiteral() test into the line 73 check and delete this line.
| if (t.isString() || t.isStringLiteral()) return { kind: 'string' }; | |
| if (t.isString() || t.isStringLiteral()) return { kind: 'string' }; |
And delete the duplicate on line 76 (the current if (t.isString() || t.isStringLiteral()) line shown here).
| `import { UiPath } from '@uipath/uipath-typescript@${version}/core';`, | ||
| `import { ${service.name} } from '@uipath/uipath-typescript@${version}/${service.subpath}';`, |
There was a problem hiding this comment.
@uipath/uipath-typescript@${version}/core is not valid Node.js/TypeScript module syntax — you can't embed a version in a subpath specifier. Pasting this snippet into a project will fail at module resolution (Cannot find module '@uipath/uipath-typescript@1.5.5/core').
The version should be conveyed as a comment, with the import path being the bare package name as the user would have it installed:
| `import { UiPath } from '@uipath/uipath-typescript@${version}/core';`, | |
| `import { ${service.name} } from '@uipath/uipath-typescript@${version}/${service.subpath}';`, | |
| `// SDK version used: ${version}`, | |
| `import { UiPath } from '@uipath/uipath-typescript/core';`, | |
| `import { ${service.name} } from '@uipath/uipath-typescript/${service.subpath}';`, |
| { "id": "action-app-with-image", "title": "Action App — Image", "description": "Coded Action App for loan-application review. Reviewers assess applicant details, view a bundled loan-application image, and complete the task with an Approve or Reject decision.", "category": "action-apps", "framework": "React", "tags": ["Action Center","Coded Action App","Images"], "path": "samples/coded-action-apps/action-app-with-image", "preview": null }, | ||
| { "id": "action-app-with-storage-bucket-document", "title": "Action App — Storage Bucket Document", "description": "Coded Action App for loan-application review that loads its document from a Storage Bucket by bucket name and file path, as opposed to receiving a direct file attachment.", "category": "action-apps", "framework": "React", "tags": ["Action Center","Coded Action App","Storage Buckets","Documents"], "path": "samples/coded-action-apps/action-app-with-storage-bucket-document", "preview": null } | ||
| { "id": "action-app-with-storage-bucket-document", "title": "Action App — Storage Bucket Document", "description": "Coded Action App for loan-application review that loads its document from a Storage Bucket by bucket name and file path, as opposed to receiving a direct file attachment.", "category": "action-apps", "framework": "React", "tags": ["Action Center","Coded Action App","Storage Buckets","Documents"], "path": "samples/coded-action-apps/action-app-with-storage-bucket-document", "preview": null }, | ||
| { "id": "sdk-playground", "title": "SDK Playground", "description": "Swagger-style explorer for the SDK. Pick any published SDK version, browse every service and method it exposes via auto-generated manifests, fill parameters in a generated form, and run calls live with platform-injected or custom credentials.", "category": "dev-tools", "framework": "React", "tags": ["Playground","API Explorer","Versioning","Coded App"], "path": "samples/sdk-playground", "preview": null } |
There was a problem hiding this comment.
CLAUDE.md requirement (samples & Template Gallery section): every app under samples/ must ship a preview GIF at samples/<app>/screenshots/preview.gif before merging. "preview": null leaves an empty poster tile in the gallery. This is a hard gate — the PR cannot leave DRAFT status without it.
The PR TODO already tracks this, but flagging here so it doesn't get missed at review time.
Review summaryThree issues found, all actionable: 1. Bug — dead code / misclassified param types (generate-manifests.mjs line 76) 2. Bug — generated snippets have invalid import paths (MethodPanel.tsx lines 69-70) 3. Missing preview GIF (docs/samples/index.md line 143) |
- replace as-unknown-as cast in disposeClient with intersection cast - guard connect/version-switch/OAuth-resume against stale in-flight client resolutions (epoch counter; superseded clients are disposed) - snippet builder: keep interior omitted optionals as explicit undefined and use valid import specifiers (version in npm install comment) - manifest generator: skip Array.prototype members, well-known symbols, and method signatures in object shape hints; manifests regenerated - add screenshots/preview.gif and point the gallery entry at it Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
✅ No issues found. Checked for bugs and CLAUDE.md compliance. |
What
A new sample under
samples/sdk-playground— a Swagger-style explorer for the SDK, deployable as a UiPath coded app. Pick any published SDK version, browse every service and method that version exposes, fill in parameters through a generated form, and execute the call live against a tenant.No SDK source is changed — this PR adds a sample app and its Template Gallery entry only.
How it works
Version-aware method catalog
Six SDK versions (latest patch of every published minor line) are installed side by side via npm aliases:
scripts/generate-manifests.mjs(ts-morph) parses each installed version's published.d.tsfiles, extracts every{Entity}ServiceModelinterface (methods, parameters, enum values, object shapes, JSDoc descriptions and@exampleblocks), and emits one manifest JSON per version plus a statically-analyzable lazy-import registry. The catalog can never drift from what a version actually ships, and each version is its own Vite chunk — the browser downloads only the selected one.Adding a future version = one alias line in
package.json+npm run manifests.Connection modes
new UiPath()reading meta tags injected by UiPath AppsGenerated forms & execution
Date→ datetime pickers, booleans → selects, object params → JSON editor with a shape hint from the manifest@exampleJSDoc renders inline per methodtask.assign()) as badgesSecurity notes
Example usage
Then: pick a version → Connect (PAT or OAuth) → choose a method in the tree → fill params → Run.
Verification
npm run buildclean (typecheck + Vite production build, ~3.8 MB dist, per-version code splitting confirmed)Files
samples/sdk-playground/(Vite + React, TypeScript strict)samples/sdk-playground/scripts/generate-manifests.mjssamples/sdk-playground/src/manifests/*.json(6 versions)samples/sdk-playground/src/sdk/registry.gen.tssamples/sdk-playground/src/sdk/client.tssamples/sdk-playground/src/components/*samples/sdk-playground/screenshots/preview.gifdocs/samples/index.md(Template Gallery: new "Developer Tools" category + entry)Review
sdk-reviewran for 2 iterations — 6 findings fixed in the second commit (banned cast, in-flight connect race on version switching, snippet argument alignment + import specifiers, manifest shape-hint garbage from array types, missing preview GIF). Regenerated manifests verified byte-identical to generator output; no Array.prototype leakage remains.TODO before marking ready
🤖 Generated with Claude Code