Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ jobs:
working-directory: packages/${{ matrix.package }}
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '20'
cache: 'npm'
Expand All @@ -70,3 +70,27 @@ jobs:
- name: Run tests
run: npm test

jsdoc-validation:
# Fails when public API methods/parameters lack JSDoc. Uses TypeDoc's
# built-in notDocumented validation (typedoc.validation.json) - no custom
# parsing. Expected to fail until existing gaps are documented or tagged
# @internal.
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Validate JSDoc completeness
run: npm run docs:validate

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
"docs:api": "typedoc && npm run docs:post-process && npm run docs:coded-action-app",
"docs:coded-action-app": "npm run docs --prefix packages/coded-action-app",
"docs:post-process": "node scripts/docs-post-process.mjs",
"docs:validate": "typedoc --options typedoc.validation.json",
"lint": "oxlint",
"typecheck": "tsc --noEmit",
"test": "vitest",
Expand Down
1 change: 1 addition & 0 deletions src/core/errors/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ErrorParams } from './types';
* - Missing authentication
*/
export class AuthenticationError extends UiPathError {
/** @internal */
constructor(params: Partial<ErrorParams> = {}) {
super(ErrorType.AUTHENTICATION, {
message: params.message || ErrorMessages.AUTHENTICATION_FAILED,
Expand Down
1 change: 1 addition & 0 deletions src/core/errors/authorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ErrorParams } from './types';
* - Invalid scope
*/
export class AuthorizationError extends UiPathError {
/** @internal */
constructor(params: Partial<ErrorParams> = {}) {
super(ErrorType.AUTHORIZATION, {
message: params.message || ErrorMessages.ACCESS_DENIED,
Expand Down
27 changes: 27 additions & 0 deletions src/core/errors/guards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,62 +9,89 @@ import { NetworkError } from './network';

/**
* Type guard to check if an error is a UiPathError
*
* @param error - The value to check
* @returns True if the value is a UiPathError
*/
export function isUiPathError(error: unknown): error is UiPathError {
return error instanceof UiPathError;
}

/**
* Type guard to check if an error is an AuthenticationError
*
* @param error - The value to check
* @returns True if the value is an AuthenticationError
*/
export function isAuthenticationError(error: unknown): error is AuthenticationError {
return error instanceof AuthenticationError;
}

/**
* Type guard to check if an error is an AuthorizationError
*
* @param error - The value to check
* @returns True if the value is an AuthorizationError
*/
export function isAuthorizationError(error: unknown): error is AuthorizationError {
return error instanceof AuthorizationError;
}

/**
* Type guard to check if an error is a ValidationError
*
* @param error - The value to check
* @returns True if the value is a ValidationError
*/
export function isValidationError(error: unknown): error is ValidationError {
return error instanceof ValidationError;
}

/**
* Type guard to check if an error is a NotFoundError
*
* @param error - The value to check
* @returns True if the value is a NotFoundError
*/
export function isNotFoundError(error: unknown): error is NotFoundError {
return error instanceof NotFoundError;
}

/**
* Type guard to check if an error is a RateLimitError
*
* @param error - The value to check
* @returns True if the value is a RateLimitError
*/
export function isRateLimitError(error: unknown): error is RateLimitError {
return error instanceof RateLimitError;
}

/**
* Type guard to check if an error is a ServerError
*
* @param error - The value to check
* @returns True if the value is a ServerError
*/
export function isServerError(error: unknown): error is ServerError {
return error instanceof ServerError;
}

/**
* Type guard to check if an error is a NetworkError
*
* @param error - The value to check
* @returns True if the value is a NetworkError
*/
export function isNetworkError(error: unknown): error is NetworkError {
return error instanceof NetworkError;
}

/**
* Helper to get error details in a safe way
*
* @param error - The error to extract details from
* @returns The error message and, when available, the HTTP status code
*/
export function getErrorDetails(error: unknown): { message: string; statusCode?: number } {
if (isUiPathError(error)) {
Expand Down
1 change: 1 addition & 0 deletions src/core/errors/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ErrorParams } from './types';
* - Request aborted
*/
export class NetworkError extends UiPathError {
/** @internal */
constructor(params: Partial<ErrorParams> = {}) {
super(ErrorType.NETWORK, {
message: params.message || ErrorMessages.NETWORK_ERROR,
Expand Down
1 change: 1 addition & 0 deletions src/core/errors/not-found.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ErrorParams } from './types';
* - Resource deleted
*/
export class NotFoundError extends UiPathError {
/** @internal */
constructor(params: Partial<ErrorParams> = {}) {
super(ErrorType.NOT_FOUND, {
message: params.message || ErrorMessages.RESOURCE_NOT_FOUND,
Expand Down
1 change: 1 addition & 0 deletions src/core/errors/rate-limit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ErrorParams } from './types';
* - API throttling
*/
export class RateLimitError extends UiPathError {
/** @internal */
constructor(params: Partial<ErrorParams> = {}) {
super(ErrorType.RATE_LIMIT, {
message: params.message || ErrorMessages.RATE_LIMIT_EXCEEDED,
Expand Down
1 change: 1 addition & 0 deletions src/core/errors/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ErrorParams } from './types';
* - Gateway timeout
*/
export class ServerError extends UiPathError {
/** @internal */
constructor(params: Partial<ErrorParams> = {}) {
super(ErrorType.SERVER, {
message: params.message || ErrorMessages.INTERNAL_SERVER_ERROR,
Expand Down
1 change: 1 addition & 0 deletions src/core/errors/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ErrorParams } from './types';
* - Invalid data format
*/
export class ValidationError extends UiPathError {
/** @internal */
constructor(params: Partial<ErrorParams> = {}) {
super(ErrorType.VALIDATION, {
message: params.message || ErrorMessages.VALIDATION_FAILED,
Expand Down
3 changes: 3 additions & 0 deletions src/core/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ import {
// across every subpath bundle (`assets`, `feedback`, `tasks`, …).
const sdkClient = getOrCreateClient(CLOUD_ROLE_NAME);

/** @internal */
export const track = createTrack(sdkClient);
/** @internal */
export const trackEvent = createTrackEvent(sdkClient);

/** @internal */
export const telemetryClient = {
initialize(context?: TelemetryContext): void {
sdkClient.initialize({
Expand Down
5 changes: 5 additions & 0 deletions src/core/uipath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ export class UiPath implements IUiPath {
/** Read-only config for user convenience */
public readonly config!: Readonly<BaseConfig>;

/**
* Creates a UiPath SDK instance.
*
* @param config - Optional SDK configuration; when omitted, configuration is loaded from meta tags
*/
constructor(config?: PartialUiPathConfig) {
// Load configuration from meta tags
const configFromMetaTags = loadFromMetaTags();
Expand Down
7 changes: 7 additions & 0 deletions src/models/conversational-agent/agents/agents.models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ function createAgentMethods(
};
}

/**
* Combines raw agent data with bound methods.
*
* @param agentData - The raw agent data from API
* @param conversationService - The conversation service instance
* @returns An agent object with added methods
*/
export function createAgentWithMethods<T extends RawAgentGetResponse>(
agentData: T,
conversationService: ConversationServiceModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,23 @@ import type { SessionStream } from './types/events/session.types';
export interface ConversationSessionMethods {
/**
* Starts a real-time chat session for a conversation
*
* @param conversationId - The conversation ID
* @param options - Optional session options
*/
startSession(conversationId: string, options?: ConversationSessionOptions): SessionStream;

/**
* Gets an active session for a conversation
*
* @param conversationId - The conversation ID
*/
getSession(conversationId: string): SessionStream | undefined;

/**
* Ends an active session for a conversation
*
* @param conversationId - The conversation ID
*/
endSession(conversationId: string): void;
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/data-fabric/entities.models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ function createEntityMethods(entityData: RawEntityGetResponse, service: EntitySe
/**
* Creates an actionable entity by combining entity metadata with data and management methods
*
* @param entityMetadata - Entity metadata
* @param entityData - The raw entity data from API
* @param service - The entity service instance
* @returns Entity metadata with added methods
*/
Expand Down
4 changes: 2 additions & 2 deletions src/models/orchestrator/queues.models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import { PaginatedResponse, NonPaginatedResponse, HasPaginationOptions } from '.
export interface QueueServiceModel {
/**
* Gets all queues across folders with optional filtering and folder scoping
*
* @signature getAll(options?) → Promise&lt;QueueGetResponse[]&gt;
*
* @param options Query options including optional folderId and pagination options
* @returns Promise resolving to either an array of queues NonPaginatedResponse<QueueGetResponse> or a PaginatedResponse<QueueGetResponse> when pagination options are used.
* {@link QueueGetResponse}
Expand Down Expand Up @@ -66,6 +65,7 @@ export interface QueueServiceModel {
*
* @param id - Queue ID
* @param folderId - Required folder ID
* @param options - Optional query options
* @returns Promise resolving to a queue definition
* @example
* ```typescript
Expand Down
3 changes: 2 additions & 1 deletion src/services/orchestrator/queues/queues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ export class QueueService extends FolderScopedService implements QueueServiceMod
*
* @param id - Queue ID
* @param folderId - Required folder ID
* @param options - Optional query options
* @returns Promise resolving to a queue definition
*
*
* @example
* ```typescript
* import { Queues } from '@uipath/uipath-typescript/queues';
Expand Down
12 changes: 12 additions & 0 deletions typedoc.validation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://typedoc.org/schema.json",
"extends": "./typedoc.json",
"emit": "none",
Comment thread
Raina451 marked this conversation as resolved.
"validation": {
"notDocumented": true,
"notExported": false,
"invalidLink": false
},
"requiredToBeDocumented": ["Method", "CallSignature", "Parameter"],
"treatValidationWarningsAsErrors": true
}
Loading