From 9e2547256c07c3e6f798b926035ba5184e49d35d Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 17:51:36 +0000 Subject: [PATCH 01/16] Remove file-uploads example using deprecated file_path transformations --- examples/file-uploads.ts | 63 ---------------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 examples/file-uploads.ts diff --git a/examples/file-uploads.ts b/examples/file-uploads.ts deleted file mode 100644 index 5e9148f7..00000000 --- a/examples/file-uploads.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Example showing how to upload files using the StackOne SDK. - * - * This example demonstrates how to upload files using the simplified file_path parameter, - * which is the only parameter needed for file uploads. The SDK automatically derives - * the necessary file parameters (content, name, file_format) from the file_path. - * - * Run this example with: - * bun run examples/file-uploads.ts - */ - -import assert from 'node:assert'; -import * as fs from 'node:fs'; -import * as path from 'node:path'; -import { StackOneToolSet } from '../src'; - -const accountId = '45072196112816593343'; - -const fileUploads = async (): Promise => { - // Create a sample file for testing - const sampleFilePath = path.join(__dirname, 'sample-file.txt'); - fs.writeFileSync(sampleFilePath, 'This is a sample file for testing file uploads.'); - - try { - // Initialize the StackOne toolset - const toolset = new StackOneToolSet(); - - // Get tools for documents - const tools = toolset.getStackOneTools('hris_*', accountId); - - // Get the upload file tool - const uploadTool = tools.getTool('hris_upload_employee_document'); - - // Check if upload tool exists - assert(uploadTool !== undefined, 'Upload document tool not found'); - - /* - * Upload a file using the file_path parameter - * The SDK will automatically derive content, name, and file_format from the file_path - */ - // Use dry run to check parameter mapping - const dryRunResult = await uploadTool.execute( - { - file_path: sampleFilePath, - id: 'c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA', - category: { value: 'shared' }, - }, - { dryRun: true } - ); - - assert( - (dryRunResult.mappedParams as Record).file_format.value === 'txt', - 'File format was not mapped correctly' - ); - } finally { - // Clean up the sample file - if (fs.existsSync(sampleFilePath)) { - fs.unlinkSync(sampleFilePath); - } - } -}; - -fileUploads(); From 5387793467e5f940f32d5ffa668662e89a0169f5 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 17:51:41 +0000 Subject: [PATCH 02/16] Remove openapi-transformations example using deprecated transformation patterns --- examples/openapi-transformations.ts | 215 ---------------------------- 1 file changed, 215 deletions(-) delete mode 100644 examples/openapi-transformations.ts diff --git a/examples/openapi-transformations.ts b/examples/openapi-transformations.ts deleted file mode 100644 index 61ebda7e..00000000 --- a/examples/openapi-transformations.ts +++ /dev/null @@ -1,215 +0,0 @@ -/** - * OpenAPI with Parameter Transformations Example - * - * This example demonstrates how to: - * 1. Create custom parameter transformers - * 2. Use them with OpenAPI tools to derive additional parameters - * 3. Execute tools with minimal input, letting the transformers handle the rest - */ - -import assert from 'node:assert'; -import fs from 'node:fs'; -import path from 'node:path'; -import { OpenAPIToolSet } from '../src/toolsets/openapi'; -import type { ParameterTransformer } from '../src/types'; - -/** - * Create a mock OpenAPI specification for testing - */ -const createMockOpenAPISpec = (): string => { - // Create a simple OpenAPI spec with two operations - const spec = { - openapi: '3.0.0', - info: { - title: 'Parameter Transformation API', - version: '1.0.0', - }, - paths: { - '/upload': { - post: { - operationId: 'upload_file', - description: 'Upload a file', - requestBody: { - content: { - 'multipart/form-data': { - schema: { - type: 'object', - properties: { - file_content: { - type: 'string', - description: 'Base64-encoded file content', - }, - file_name: { - type: 'string', - description: 'Name of the file', - }, - file_format: { - type: 'string', - description: 'Format of the file', - }, - }, - required: ['file_content', 'file_name', 'file_format'], - }, - }, - }, - }, - responses: { - '200': { - description: 'File uploaded successfully', - }, - }, - }, - }, - '/users/{user_id}': { - put: { - operationId: 'update_user', - description: 'Update user details', - parameters: [ - { - name: 'user_id', - in: 'path', - required: true, - schema: { - type: 'string', - }, - }, - ], - requestBody: { - content: { - 'application/json': { - schema: { - type: 'object', - properties: { - user_name: { - type: 'string', - description: 'User name', - }, - user_email: { - type: 'string', - description: 'User email', - }, - user_role: { - type: 'string', - description: 'User role', - }, - }, - }, - }, - }, - }, - responses: { - '200': { - description: 'User updated successfully', - }, - }, - }, - }, - }, - }; - - // Write the spec to a temporary file - const tempFile = path.join( - process.env.TMPDIR || '/tmp', - `parameter-transformation-spec-${Date.now()}.json` - ); - fs.writeFileSync(tempFile, JSON.stringify(spec, null, 2)); - - return tempFile; -}; - -/** - * Create a file transformer - * This transformer extracts file_content, file_name, and file_format from file_path - */ -const createFileTransformer = (): ParameterTransformer => { - return { - transforms: { - // Extract file content as base64 - file_content: (filePath: unknown): string => { - if (typeof filePath !== 'string') { - throw new Error('file_path must be a string'); - } - - if (!fs.existsSync(filePath)) { - throw new Error(`File not found: ${filePath}`); - } - - return fs.readFileSync(filePath).toString('base64'); - }, - - // Extract file name - file_name: (filePath: unknown): string => { - if (typeof filePath !== 'string') { - throw new Error('file_path must be a string'); - } - - return path.basename(filePath); - }, - - // Extract file format (extension) - file_format: (filePath: unknown): string => { - if (typeof filePath !== 'string') { - throw new Error('file_path must be a string'); - } - - const extension = path.extname(filePath).slice(1); - return extension || ''; - }, - }, - }; -}; - -/** - * Example of using parameter transformations with OpenAPI - */ -async function main(): Promise { - const specFilePath = createMockOpenAPISpec(); - const fileTransformer = createFileTransformer(); - - // Create a transformers map for the toolset - const transformers = new Map(); - transformers.set('file_path', fileTransformer); - - // Create the toolset with transformers - const toolset = new OpenAPIToolSet({ - filePath: specFilePath, - transformers, - }); - - // Get the tools - const tools = toolset.getTools(); - const fileUploadTool = tools.getTool('upload_file'); - - assert(fileUploadTool, 'Expected to find upload_file tool'); - - const tempFilePath = path.join(__dirname, 'temp.txt'); - fs.writeFileSync(tempFilePath, 'Hello, world!'); - - try { - // Execute with just file_path - other parameters will be transformed - const fileUploadResult = await fileUploadTool.execute( - { file_path: tempFilePath }, - { dryRun: true } - ); - - const fileParams = fileUploadResult.mappedParams as Record; - - // Assertions to validate the transformations worked - assert(fileParams.file_name === 'temp.txt', 'Expected file_name to be transformed correctly'); - assert(fileParams.file_format === 'txt', 'Expected file_format to be transformed correctly'); - assert( - typeof fileParams.file_content === 'string' && fileParams.file_content.length > 0, - 'Expected file_content to be transformed correctly' - ); - } finally { - try { - fs.unlinkSync(tempFilePath); - fs.unlinkSync(specFilePath); - console.log('Cleaned up temporary files'); - } catch (error) { - console.error('Error cleaning up temporary files:', error); - } - } -} - -main(); From 60e4461a6884c28bc85661a58059043d01e5eb7e Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 17:51:49 +0000 Subject: [PATCH 03/16] Remove transformations test file using deprecated transformation patterns --- src/tests/transformations.spec.ts | 539 ------------------------------ 1 file changed, 539 deletions(-) delete mode 100644 src/tests/transformations.spec.ts diff --git a/src/tests/transformations.spec.ts b/src/tests/transformations.spec.ts deleted file mode 100644 index 1458c70a..00000000 --- a/src/tests/transformations.spec.ts +++ /dev/null @@ -1,539 +0,0 @@ -/** - * Tests for parameter transformation functions - */ - -import { - type Mock, - afterAll, - afterEach, - beforeAll, - beforeEach, - describe, - expect, - it, - mock, - spyOn, -} from 'bun:test'; -import fs from 'node:fs'; -import os from 'node:os'; -import path from 'node:path'; -import { transformParameter } from '../modules/parameterMapper'; -import type { Tools } from '../tool'; -import { OpenAPIToolSet } from '../toolsets'; -import type { ParameterTransformer } from '../types'; -import { mockFetch } from './utils/fetch-mock'; - -describe('Parameter Transformations', () => { - // Create a test file for derivation tests - const testFileContent = 'Test file content'; - const testFilePath = path.join(import.meta.dir, 'test-file.txt'); - - // Create the test file before tests - beforeAll(() => { - fs.writeFileSync(testFilePath, testFileContent); - }); - - // Remove the test file after tests - afterAll(() => { - fs.unlinkSync(testFilePath); - }); - - // Create a test derivation config - const testParameterTransformer: ParameterTransformer = { - transforms: { - derived_param1: (value: unknown): string => { - if (typeof value !== 'string') { - throw new Error('Value must be a string'); - } - return `derived_${value}`; - }, - derived_param2: (value: unknown): string => { - if (typeof value !== 'string') { - throw new Error('Value must be a string'); - } - return `${value}_derived`; - }, - }, - }; - - describe('transformParameter', () => { - it('should derive multiple parameters from a source parameter', () => { - // Test data - const sourceParam = 'source_param'; - const sourceValue = 'test_value'; - - // Transform parameters for derived_param1 - const result1 = transformParameter( - sourceValue, - 'derived_param1', - sourceParam, - testParameterTransformer - ); - - // Transform parameters for derived_param2 - const result2 = transformParameter( - sourceValue, - 'derived_param2', - sourceParam, - testParameterTransformer - ); - - // Verify derived parameters - expect(result1).toHaveProperty('derived_param1', 'derived_test_value'); - expect(result2).toHaveProperty('derived_param2', 'test_value_derived'); - }); - - it('should handle unknown parameters gracefully', () => { - // Test with a parameter that doesn't exist - const result = transformParameter( - 'test_value', - 'nonexistent_param', - 'source_param', - testParameterTransformer - ); - - // Verify no parameters were added - expect(Object.keys(result).length).toBe(0); - }); - - it('should handle errors in derivation functions', () => { - // Create a derivation config with a function that throws - const errorConfig: ParameterTransformer = { - transforms: { - error_param: (_value: unknown): string => { - throw new Error('Test error'); - }, - success_param: (value: unknown): string => { - if (typeof value !== 'string') { - throw new Error('Value must be a string'); - } - return `success_${value}`; - }, - }, - }; - - // Test data - const sourceValue = 'test_value'; - const sourceParam = 'source_param'; - - // Transform parameters for success_param - const successResult = transformParameter( - sourceValue, - 'success_param', - sourceParam, - errorConfig - ); - - // Verify success parameter is present - expect(successResult).toHaveProperty('success_param', 'success_test_value'); - - // Verify error parameter throws - expect(() => - transformParameter(sourceValue, 'error_param', sourceParam, errorConfig) - ).toThrow(); - }); - }); -}); - -describe('Parameter Transformation Edge Cases', () => { - // Create a temporary directory and file for tests - let tempDir: string; - let tempSpecFile: string; - let fetchMock: ReturnType; - let mockTool: { - execute: Mock< - ( - params: Record, - options?: unknown - ) => Promise<{ - mappedParams: Record; - url: string; - method: string; - headers: Record; - body: unknown; - originalParams: Record; - }> - >; - }; - - // Set up before each test - beforeEach(() => { - // Create a temporary directory - tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'openapi-test-')); - - // Create a temporary spec file - tempSpecFile = path.join(tempDir, 'test-spec.json'); - - // Write a minimal OpenAPI spec to the file - fs.writeFileSync( - tempSpecFile, - JSON.stringify({ - openapi: '3.0.0', - info: { - title: 'Test API', - version: '1.0.0', - }, - paths: { - '/test': { - post: { - operationId: 'test_derivation', - parameters: [ - { - name: 'source_param', - in: 'query', - schema: { - type: 'string', - }, - }, - ], - responses: { - '200': { - description: 'OK', - }, - }, - }, - }, - }, - }) - ); - - // Set up fetch mock - fetchMock = mockFetch({ - defaultResponse: { - ok: true, - json: async () => ({ success: true }), - }, - }); - - // Create a mock tool with an execute method - mockTool = { - execute: mock(async (params, _options) => { - return { - mappedParams: params, - url: 'https://example.com/api', - method: 'POST', - headers: {}, - body: null, - originalParams: params, - }; - }), - }; - - // Mock the OpenAPIToolSet.getTools method - spyOn(OpenAPIToolSet.prototype, 'getTools').mockImplementation(() => { - return { - getTool: mock(() => mockTool), - } as unknown as Tools; - }); - }); - - // Clean up after each test - afterEach(() => { - // Restore fetch mock - fetchMock.restore(); - - // Clean up temporary files - try { - fs.unlinkSync(tempSpecFile); - fs.rmdirSync(tempDir, { recursive: true }); - } catch (error) { - console.error('Error cleaning up temp files:', error); - } - }); - - describe('Empty derivation configs', () => { - it('should handle empty derivation configs map', async () => { - // Create OpenAPIToolSet with empty derivation configs - const toolset = new OpenAPIToolSet({ - filePath: tempSpecFile, - transformers: new Map(), - }); - - // Get test tool - const tools = toolset.getTools(); - const testTool = tools.getTool('test_derivation'); - - expect(testTool).toBeDefined(); - if (!testTool) return; - - // Execute tool with dry run - await testTool.execute({ source_param: 'test_value' }, { dryRun: true }); - - // Verify the execute method was called with the correct parameters - expect(mockTool.execute).toHaveBeenCalledWith( - { source_param: 'test_value' }, - { dryRun: true } - ); - }); - - it('should handle derivation config with no derivation functions', async () => { - // Create a transformation config with no transformation functions - const emptyConfig: ParameterTransformer = { - transforms: {}, - }; - - // Create a map of transformation configs - const transformers = new Map(); - transformers.set('source_param', emptyConfig); - - // Create OpenAPIToolSet with transformation configs - const toolset = new OpenAPIToolSet({ - filePath: tempSpecFile, - transformers, - }); - - // Get test tool - const tools = toolset.getTools(); - const testTool = tools.getTool('test_derivation'); - - expect(testTool).toBeDefined(); - if (!testTool) return; - - // Execute tool with dry run - await testTool.execute({ source_param: 'test_value' }, { dryRun: true }); - - // Verify the execute method was called with the correct parameters - expect(mockTool.execute).toHaveBeenCalledWith( - { source_param: 'test_value' }, - { dryRun: true } - ); - }); - }); - - describe('Invalid transformation configs', () => { - it('should handle transformation config with invalid source parameter', async () => { - // Create a transformation config with a non-existent source parameter - const invalidConfig: ParameterTransformer = { - transforms: { - derived_param1: (value: unknown): string => { - if (typeof value !== 'string') { - throw new Error('Value must be a string'); - } - return `derived_${value}`; - }, - }, - }; - - // Create a map of transformation configs - const transformers = new Map(); - transformers.set('non_existent_param', invalidConfig); - - // Create OpenAPIToolSet with transformation configs - const toolset = new OpenAPIToolSet({ - filePath: tempSpecFile, - transformers, - }); - - // Get test tool - const tools = toolset.getTools(); - const testTool = tools.getTool('test_derivation'); - - expect(testTool).toBeDefined(); - if (!testTool) return; - - // Execute tool with dry run - await testTool.execute({ source_param: 'test_value' }, { dryRun: true }); - - // Verify the execute method was called with the correct parameters - expect(mockTool.execute).toHaveBeenCalledWith( - { source_param: 'test_value' }, - { dryRun: true } - ); - }); - }); - - describe('Error handling in transformation functions', () => { - it('should handle one transformation function failing while others succeed', async () => { - // Create a transformation config with mixed success/failure - const mixedConfig: ParameterTransformer = { - transforms: { - derived_param1: (_value: unknown): string => { - throw new Error('Error in derived_param1'); - }, - derived_param2: (_value: unknown): string => { - return 'derived_value'; - }, - }, - }; - - // Create a map of transformation configs - const transformers = new Map(); - transformers.set('source_param', mixedConfig); - - // Create OpenAPIToolSet with transformation configs - const toolset = new OpenAPIToolSet({ - filePath: tempSpecFile, - transformers, - }); - - // Get test tool - const tools = toolset.getTools(); - const testTool = tools.getTool('test_derivation'); - - expect(testTool).toBeDefined(); - if (!testTool) return; - - // Execute tool with dry run - await testTool.execute({ source_param: 'test_value' }, { dryRun: true }); - - // Verify the execute method was called with the correct parameters - expect(mockTool.execute).toHaveBeenCalledWith( - { source_param: 'test_value' }, - { dryRun: true } - ); - }); - - it('should handle all transformation functions failing', async () => { - // Create a transformation config with all functions that throw - const errorConfig: ParameterTransformer = { - transforms: { - derived_param1: (_value: unknown): string => { - throw new Error('Error in derived_param1'); - }, - derived_param2: (_value: unknown): string => { - throw new Error('Error in derived_param2'); - }, - }, - }; - - // Create a map of transformation configs - const transformers = new Map(); - transformers.set('source_param', errorConfig); - - // Create OpenAPIToolSet with transformation configs - const toolset = new OpenAPIToolSet({ - filePath: tempSpecFile, - transformers, - }); - - // Get test tool - const tools = toolset.getTools(); - const testTool = tools.getTool('test_derivation'); - - expect(testTool).toBeDefined(); - if (!testTool) return; - - // Execute tool with dry run - await testTool.execute({ source_param: 'test_value' }, { dryRun: true }); - - // Verify the execute method was called with the correct parameters - expect(mockTool.execute).toHaveBeenCalledWith( - { source_param: 'test_value' }, - { dryRun: true } - ); - }); - }); - - describe('Nested derivations', () => { - it('should handle nested derivations', async () => { - // Create a first-level derivation config - const firstLevelConfig: ParameterTransformer = { - transforms: { - nested_source: (value: unknown): string => { - if (typeof value !== 'string') { - throw new Error('Value must be a string'); - } - return `nested_${value}`; - }, - }, - }; - - // Create a second-level derivation config - const secondLevelConfig: ParameterTransformer = { - transforms: { - nested_derived: (value: unknown): string => { - if (typeof value !== 'string') { - throw new Error('Value must be a string'); - } - return `derived_from_${value}`; - }, - }, - }; - - // Create a map of derivation configs - const transformers = new Map(); - transformers.set('source_param', firstLevelConfig); - transformers.set('nested_source', secondLevelConfig); - - // Create a mock OpenAPIToolSet with the transformers - const toolset = new OpenAPIToolSet({ - filePath: tempSpecFile, - transformers, - }); - - // Get test tool - const tools = toolset.getTools(); - const testTool = tools.getTool('test_derivation'); - - expect(testTool).toBeDefined(); - if (!testTool) return; - - // Execute tool with dry run - await testTool.execute({ source_param: 'test_value' }, { dryRun: true }); - - // Verify the execute method was called with the correct parameters - expect(mockTool.execute).toHaveBeenCalledWith( - { source_param: 'test_value' }, - { dryRun: true } - ); - }); - }); - - describe('Conflicting derivations', () => { - it('should handle conflicting derivation configs', async () => { - // Create a derivation config for the first parameter - const config1: ParameterTransformer = { - transforms: { - derived_param: (value: unknown): string => { - if (typeof value !== 'string') { - throw new Error('Value must be a string'); - } - return `derived_from_source_${value}`; - }, - }, - }; - - // Create a derivation config for the second parameter - const config2: ParameterTransformer = { - transforms: { - derived_param: (value: unknown): string => { - if (typeof value !== 'string') { - throw new Error('Value must be a string'); - } - return `derived_from_other_${value}`; - }, - }, - }; - - // Create a map of derivation configs - const transformers = new Map(); - transformers.set('source_param', config1); - transformers.set('other_param', config2); - - // Create a mock OpenAPIToolSet with the transformers - const toolset = new OpenAPIToolSet({ - filePath: tempSpecFile, - transformers, - }); - - // Get test tool - const tools = toolset.getTools(); - const testTool = tools.getTool('test_derivation'); - - expect(testTool).toBeDefined(); - if (!testTool) return; - - // Execute tool with dry run - await testTool.execute( - { source_param: 'test_value', other_param: 'other_value' }, - { dryRun: true } - ); - - // Verify the execute method was called with the correct parameters - expect(mockTool.execute).toHaveBeenCalledWith( - { source_param: 'test_value', other_param: 'other_value' }, - { dryRun: true } - ); - }); - }); -}); From 5a73090a0481a602e81c2d98265e9286a2f0fd7a Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 17:54:12 +0000 Subject: [PATCH 04/16] feat: remove backward compatibility transformers and add experimental preExecute functionality MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove default file_path transformers from StackOneToolSet - Remove addTransformationSourceParameters method - Add experimental preExecute function support for dynamic parameter processing - Add ExperimentalPreExecuteFunction type with "experimental" prefix - Create comprehensive experimental document handling example - Update exports to include experimental types - Update snapshots to reflect removed transformers - Maintain core parameter mapping infrastructure for experimental features This addresses security concerns while providing a flexible, developer-controlled approach to document handling through experimental preExecute functions. ๐Ÿค– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: mattzcarey --- examples/experimental-document-handling.ts | 214 ++++ examples/index.ts | 2 +- src/index.ts | 1 + .../__snapshots__/openapi-parser.spec.ts.snap | 14 +- src/tool.ts | 10 +- src/toolsets/stackone.ts | 80 +- .../tests/__snapshots__/stackone.spec.ts.snap | 1006 ++--------------- src/types.ts | 14 + 8 files changed, 307 insertions(+), 1034 deletions(-) create mode 100644 examples/experimental-document-handling.ts diff --git a/examples/experimental-document-handling.ts b/examples/experimental-document-handling.ts new file mode 100644 index 00000000..d1b40961 --- /dev/null +++ b/examples/experimental-document-handling.ts @@ -0,0 +1,214 @@ +/** + * EXPERIMENTAL: Document Handling with PreExecute Functions + * + * This example demonstrates the new experimental preExecute functionality + * for handling documents from various sources (local files, URLs, databases, etc.) + * + * This is an experimental feature and the API may change in future versions. + * + * Run this example with: + * bun run examples/experimental-document-handling.ts + */ + +import assert from 'node:assert'; +import * as fs from 'node:fs'; +import * as path from 'node:path'; +import { StackOneToolSet, type ExperimentalPreExecuteFunction } from '../src'; + +const accountId = '45072196112816593343'; + +/** + * EXPERIMENTAL: Create a document handler that fetches files from local storage + */ +const createLocalFileHandler = (allowedPaths: string[]): ExperimentalPreExecuteFunction => { + return async (params) => { + const { document_id, ...otherParams } = params; + + if (typeof document_id !== 'string') { + return params; // Pass through if not a string + } + + // Security check: only allow certain paths + const isAllowed = allowedPaths.some((allowedPath) => document_id.startsWith(allowedPath)); + + if (!isAllowed) { + throw new Error(`Document path not allowed: ${document_id}`); + } + + if (!fs.existsSync(document_id)) { + throw new Error(`Document not found: ${document_id}`); + } + + // Read file and convert to base64 + const fileContent = fs.readFileSync(document_id); + const base64Content = fileContent.toString('base64'); + const fileName = path.basename(document_id); + const extension = path.extname(document_id).slice(1); + + // Return modified parameters with document content + return { + ...otherParams, + content: base64Content, + name: fileName, + file_format: { value: extension }, + }; + }; +}; + +/** + * EXPERIMENTAL: Create a document handler for external sources (S3, databases, etc.) + */ +const createExternalDocumentHandler = (): ExperimentalPreExecuteFunction => { + return async (params) => { + const { document_reference, ...otherParams } = params; + + if (typeof document_reference !== 'string') { + return params; // Pass through if not a document reference + } + + // Simulate fetching from external source (S3, database, etc.) + console.log(`Fetching document from external source: ${document_reference}`); + + // In a real implementation, this would fetch from S3, database, etc. + const mockDocumentContent = 'This is a mock document fetched from external source'; + const base64Content = Buffer.from(mockDocumentContent).toString('base64'); + + return { + ...otherParams, + content: base64Content, + name: `external-doc-${document_reference}.txt`, + file_format: { value: 'txt' }, + }; + }; +}; + +/** + * EXPERIMENTAL: Create a multi-source document handler with fallback logic + */ +const createMultiSourceHandler = (localPaths: string[]): ExperimentalPreExecuteFunction => { + const localHandler = createLocalFileHandler(localPaths); + const externalHandler = createExternalDocumentHandler(); + + return async (params) => { + // Try local file handler first + if (params.document_id) { + try { + return await localHandler(params); + } catch (error) { + console.warn(`Local file handler failed: ${error}`); + } + } + + // Fallback to external handler + if (params.document_reference) { + return await externalHandler(params); + } + + // No document parameters, pass through + return params; + }; +}; + +const experimentalDocumentHandling = async (): Promise => { + // Create a sample file for testing + const sampleFilePath = path.join(__dirname, 'sample-document.txt'); + fs.writeFileSync(sampleFilePath, 'This is an experimental document handling test file.'); + + try { + // Initialize the StackOne toolset + const toolset = new StackOneToolSet(); + + // Get tools for documents + const tools = toolset.getStackOneTools('hris_*', accountId); + + // Get the upload file tool + const uploadTool = tools.getTool('hris_upload_employee_document'); + + // Check if upload tool exists + assert(uploadTool !== undefined, 'Upload document tool not found'); + + console.log('๐Ÿงช Testing EXPERIMENTAL local file document handling...'); + + // EXPERIMENTAL: Create a secure local file handler + const localFileHandler = createLocalFileHandler([__dirname]); + + // Use the experimental preExecute function for local file handling + const localFileResult = await uploadTool.execute( + { + document_id: sampleFilePath, // Use document_id instead of file_path + id: 'c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA', + category: { value: 'shared' }, + }, + { + dryRun: true, + experimentalPreExecute: localFileHandler, + } + ); + + console.log('โœ… Local file handling successful'); + assert( + (localFileResult.mappedParams as Record).file_format.value === + 'txt', + 'File format was not mapped correctly' + ); + + console.log('๐Ÿงช Testing EXPERIMENTAL external document handling...'); + + // EXPERIMENTAL: Test external document handler + const externalHandler = createExternalDocumentHandler(); + + const externalResult = await uploadTool.execute( + { + document_reference: 'external-doc-123', + id: 'c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA', + category: { value: 'shared' }, + }, + { + dryRun: true, + experimentalPreExecute: externalHandler, + } + ); + + console.log('โœ… External document handling successful'); + assert( + (externalResult.mappedParams as Record).name.includes('external-doc-123'), + 'External document name was not mapped correctly' + ); + + console.log('๐Ÿงช Testing EXPERIMENTAL multi-source handler...'); + + // EXPERIMENTAL: Test multi-source handler with fallback + const multiSourceHandler = createMultiSourceHandler([__dirname]); + + const multiSourceResult = await uploadTool.execute( + { + document_id: sampleFilePath, + id: 'c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA', + category: { value: 'shared' }, + }, + { + dryRun: true, + experimentalPreExecute: multiSourceHandler, + } + ); + + console.log('โœ… Multi-source handling successful'); + assert( + (multiSourceResult.mappedParams as Record).name === 'sample-document.txt', + 'Multi-source document name was not mapped correctly' + ); + + console.log('๐ŸŽ‰ All EXPERIMENTAL document handling tests passed!'); + console.log(''); + console.log('โš ๏ธ IMPORTANT: This is experimental functionality.'); + console.log(' The API may change in future versions.'); + console.log(' Use at your own risk in production environments.'); + } finally { + // Clean up the sample file + if (fs.existsSync(sampleFilePath)) { + fs.unlinkSync(sampleFilePath); + } + } +}; + +experimentalDocumentHandling(); diff --git a/examples/index.ts b/examples/index.ts index 6c1e464a..0f06a4e4 100644 --- a/examples/index.ts +++ b/examples/index.ts @@ -75,7 +75,7 @@ quickstart(); * - [OpenAI Integration](openai-integration.md) * - [AI SDK Integration](ai-sdk-integration.md) * - [Error Handling](error-handling.md) - * - [File Uploads](file-uploads.md) + * - [EXPERIMENTAL: Document Handling](experimental-document-handling.md) * - [Custom Base URL](custom-base-url.md) * - [Account ID Usage](account-id-usage.md) */ diff --git a/src/index.ts b/src/index.ts index 29e859d1..2e20905f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,6 +23,7 @@ export { export type { ExecuteConfig, ExecuteOptions, + ExperimentalPreExecuteFunction, JsonDict, ParameterLocation, ParameterTransformer, diff --git a/src/openapi/tests/__snapshots__/openapi-parser.spec.ts.snap b/src/openapi/tests/__snapshots__/openapi-parser.spec.ts.snap index 196b0bef..2fda2ac7 100644 --- a/src/openapi/tests/__snapshots__/openapi-parser.spec.ts.snap +++ b/src/openapi/tests/__snapshots__/openapi-parser.spec.ts.snap @@ -9359,14 +9359,9 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "child_care_leave", "maternity_leave", "jury_duty", + "bereavement_leave", "sabbatical", "accident", - "paid", - "unpaid", - "holiday", - "personal", - "in_lieu", - "bereavement", null, ], "type": "string", @@ -10375,14 +10370,9 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "child_care_leave", "maternity_leave", "jury_duty", + "bereavement_leave", "sabbatical", "accident", - "paid", - "unpaid", - "holiday", - "personal", - "in_lieu", - "bereavement", null, ], "type": "string", diff --git a/src/tool.ts b/src/tool.ts index 5c230e2b..225bf688 100644 --- a/src/tool.ts +++ b/src/tool.ts @@ -85,8 +85,16 @@ export class BaseTool { ); } + // Apply experimental preExecute function if provided + let processedParams = inputParams; + if (options?.experimentalPreExecute) { + processedParams = await options.experimentalPreExecute( + typeof inputParams === 'string' ? JSON.parse(inputParams) : inputParams || {} + ); + } + // Map parameters from user input to API parameters - const mappedParams = this.parameterMapper.mapParameters(inputParams); + const mappedParams = this.parameterMapper.mapParameters(processedParams); // Execute the request return await this.requestBuilder.execute(mappedParams, options); diff --git a/src/toolsets/stackone.ts b/src/toolsets/stackone.ts index 423f3b0d..66ff9ce5 100644 --- a/src/toolsets/stackone.ts +++ b/src/toolsets/stackone.ts @@ -1,9 +1,8 @@ import { loadStackOneSpecs } from '../openapi/loader'; import { StackOneTool, type Tools } from '../tool'; -import type { ParameterTransformer, ToolDefinition } from '../types'; -import { extractFileInfo, isValidFilePath, readFileAsBase64 } from '../utils/file'; +import type { ToolDefinition } from '../types'; import { removeJsonSchemaProperty } from '../utils/schema'; -import { type BaseToolSetConfig, ToolSet, ToolSetConfigError, ToolSetError } from './base'; +import { type BaseToolSetConfig, ToolSet, ToolSetConfigError } from './base'; /** * Configuration for StackOne toolset @@ -82,59 +81,10 @@ export class StackOneToolSet extends ToolSet { this.accountId = accountId; this._removedParams = ['source_value']; - // Add default parameter transformers - const defaultTransformers = StackOneToolSet.getDefaultParameterTransformers(); - for (const [sourceParam, config] of defaultTransformers.entries()) { - this.setParameterTransformer(sourceParam, config); - } - // Load tools this.loadTools(); } - /** - * Get the default derivation configurations for StackOne tools - */ - private static getDefaultParameterTransformers(): Map { - const transformers = new Map(); - - // File path derivation config - transformers.set('file_path', { - transforms: { - content: (filePath: unknown): string => { - if (typeof filePath !== 'string') { - throw new ToolSetError('file_path must be a string'); - } - - if (!isValidFilePath(filePath)) { - throw new ToolSetError(`Invalid file path or file not found: ${filePath}`); - } - - return readFileAsBase64(filePath); - }, - name: (filePath: unknown): string => { - if (typeof filePath !== 'string') { - throw new ToolSetError('file_path must be a string'); - } - - const { fileName } = extractFileInfo(filePath); - return fileName; - }, - file_format: (filePath: unknown): { value: string } => { - if (typeof filePath !== 'string') { - throw new ToolSetError('file_path must be a string'); - } - - // get the file extension - const { extension } = extractFileInfo(filePath); - return { value: extension || '' }; - }, - }, - }); - - return transformers; - } - /** * Get StackOne tools matching a filter pattern * @param filterPattern Optional glob pattern or array of patterns to filter tools @@ -181,9 +131,6 @@ export class StackOneToolSet extends ToolSet { this.removeAccountIdParameter(processedDef); } - // Add transformation source parameters to the tool's parameters schema - this.addTransformationSourceParameters(processedDef); - // Create tool const tool = new StackOneTool( toolName, @@ -217,27 +164,4 @@ export class StackOneToolSet extends ToolSet { ); } } - - /** - * Add transformation source parameters to the tool's parameters schema - * This ensures parameters like file_path are included in the schema for model consumption - * @param toolDef Tool definition to modify - */ - private addTransformationSourceParameters(toolDef: ToolDefinition): void { - // Skip if there are no transformers or no parameters - if (!this.transformers || !toolDef.parameters.properties) return; - - // Add each transformer source parameter to the schema - for (const [sourceParam, _] of this.transformers.entries()) { - // Skip if the parameter is already in the schema - if (sourceParam in toolDef.parameters.properties) continue; - - // Add the parameter to the schema - toolDef.parameters.properties[sourceParam] = { - type: 'string', - description: - 'Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.', - }; - } - } } diff --git a/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap b/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap index dd85573d..600148ec 100644 --- a/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap +++ b/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap @@ -49,17 +49,7 @@ Tools { }, "name": "hris_list_companies", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -68,10 +58,6 @@ Map { "example": "id,remote_id,name,full_name,display_name,created_at,updated_at", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -188,17 +174,7 @@ Map { }, "name": "hris_get_company", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -207,10 +183,6 @@ Map { "example": "id,remote_id,name,full_name,display_name,created_at,updated_at", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -312,17 +284,7 @@ Map { }, "name": "hris_list_employee_custom_field_definitions", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -331,10 +293,6 @@ Map { "example": "id,remote_id,name,description,type,options", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -466,17 +424,7 @@ Map { }, "name": "hris_get_employee_custom_field_definition", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -485,10 +433,6 @@ Map { "example": "id,remote_id,name,description,type,options", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -635,17 +579,7 @@ Map { }, "name": "hris_list_employees", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -659,10 +593,6 @@ Map { "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,benefits,employee_number,national_identity_number,national_identity_numbers,skills", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "HRIS Employees filters", "properties": { @@ -962,17 +892,7 @@ Map { }, "name": "hris_create_employee", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -1635,10 +1555,6 @@ Map { }, "type": "object", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "first_name": { "description": "The employee first name", "example": "Isaac", @@ -3218,17 +3134,7 @@ Map { }, "name": "hris_get_employee", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -3242,10 +3148,6 @@ Map { "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,benefits,employee_number,national_identity_number,national_identity_numbers,skills", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -3512,17 +3414,7 @@ Map { }, "name": "hris_update_employee", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -4163,10 +4055,6 @@ Map { }, "type": "object", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "first_name": { "description": "The employee first name", "example": "Isaac", @@ -5731,24 +5619,10 @@ Map { }, "name": "hris_invite_employee", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -5849,17 +5723,7 @@ Map { }, "name": "hris_list_employee_time_off_requests", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -5873,10 +5737,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "HRIS Time Off filters", "properties": { @@ -6045,17 +5905,7 @@ Map { }, "name": "hris_create_employee_time_off_request", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -6086,10 +5936,6 @@ Map { }, ], }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -6284,17 +6130,7 @@ Map { }, "name": "hris_get_employees_time_off_request", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -6308,10 +6144,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -6407,24 +6239,10 @@ Map { }, "name": "hris_cancel_employee_time_off_request", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -6536,17 +6354,7 @@ Map { }, "name": "hris_update_employee_time_off_request", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -6577,10 +6385,6 @@ Map { }, ], }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -6764,24 +6568,10 @@ Map { }, "name": "hris_batch_upload_employee_document", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -8189,17 +7979,7 @@ Map { }, "name": "hris_upload_employee_document", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -9498,10 +9278,6 @@ Map { }, "type": "object", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -9614,17 +9390,7 @@ Map { }, "name": "hris_download_employee_document", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -9633,10 +9399,6 @@ Map { "example": "text/plain", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "format": { "description": "The format to download the file in", "example": "base64", @@ -9743,17 +9505,7 @@ Map { }, "name": "hris_list_employee_documents", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -9762,10 +9514,6 @@ Map { "example": "id,remote_id,name,path,type,category,category_id,remote_category_id,contents,created_at,updated_at,remote_url,file_format", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -9897,17 +9645,7 @@ Map { }, "name": "hris_get_employee_document", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -9916,10 +9654,6 @@ Map { "example": "id,remote_id,name,path,type,category,category_id,remote_category_id,contents,created_at,updated_at,remote_url,file_format", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -10030,17 +9764,7 @@ Map { }, "name": "hris_list_employee_categories", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -10049,10 +9773,6 @@ Map { "example": "id,remote_id,name,active", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -10169,17 +9889,7 @@ Map { }, "name": "hris_get_employee_document_category", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -10188,10 +9898,6 @@ Map { "example": "id,remote_id,name,active", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -10298,17 +10004,7 @@ Map { }, "name": "hris_list_employee_work_eligibility", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -10317,10 +10013,6 @@ Map { "example": "id,remote_id,type,sub_type,document,valid_from,valid_to,issued_by,number", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -10472,17 +10164,7 @@ Map { }, "name": "hris_create_employee_work_eligibility_request", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -11769,10 +11451,6 @@ Map { }, "type": "object", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -12192,17 +11870,7 @@ Map { }, "name": "hris_get_employees_work_eligibility", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -12211,10 +11879,6 @@ Map { "example": "id,remote_id,type,sub_type,document,valid_from,valid_to,issued_by,number", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -12345,17 +12009,7 @@ Map { }, "name": "hris_update_employee_work_eligibility_request", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -13642,10 +13296,6 @@ Map { }, "type": "object", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -14089,17 +13739,7 @@ Map { }, "name": "hris_list_employee_time_off_balances", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -14113,10 +13753,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,policy_id,remote_policy_id,policy,current_balance,initial_balance,balance_unit,balance_start_date,balance_expiry_date,updated_at", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "HRIS Time Off Balance filters", "properties": { @@ -14266,17 +13902,7 @@ Map { }, "name": "hris_get_employee_time_off_balance", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -14290,10 +13916,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,policy_id,remote_policy_id,policy,current_balance,initial_balance,balance_unit,balance_start_date,balance_expiry_date,updated_at", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -14414,17 +14036,7 @@ Map { }, "name": "hris_list_employments", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -14438,10 +14050,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -14568,17 +14176,7 @@ Map { }, "name": "hris_get_employment", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -14592,10 +14190,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -14712,17 +14306,7 @@ Map { }, "name": "hris_list_employee_employments", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -14736,10 +14320,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -14921,17 +14501,7 @@ Map { }, "name": "hris_create_employee_employment", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -14947,10 +14517,6 @@ Map { "format": "date-time", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "grade": { "description": "Represents the employeeโ€™s position within the organizational hierarchy.", "properties": { @@ -15243,17 +14809,7 @@ Map { }, "name": "hris_get_employee_employment", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -15267,10 +14823,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -15426,17 +14978,7 @@ Map { }, "name": "hris_update_employee_employment", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -15452,10 +14994,6 @@ Map { "format": "date-time", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "grade": { "description": "Represents the employeeโ€™s position within the organizational hierarchy.", "properties": { @@ -15747,17 +15285,7 @@ Map { }, "name": "hris_list_locations", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -15766,10 +15294,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,name,phone_number,street_1,street_2,city,state,zip_code,country,location_type,created_at,updated_at", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -15886,17 +15410,7 @@ Map { }, "name": "hris_get_location", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -15905,10 +15419,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,name,phone_number,street_1,street_2,city,state,zip_code,country,location_type,created_at,updated_at", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -16015,17 +15525,7 @@ Map { }, "name": "hris_list_time_off_requests", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -16039,10 +15539,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "HRIS Time Off filters", "properties": { @@ -16176,17 +15672,7 @@ Map { }, "name": "hris_get_time_off_request", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -16200,10 +15686,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -16310,17 +15792,7 @@ Map { }, "name": "hris_list_time_off_types", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -16329,10 +15801,6 @@ Map { "example": "id,remote_id,name,active", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -16449,17 +15917,7 @@ Map { }, "name": "hris_get_time_off_type", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -16468,10 +15926,6 @@ Map { "example": "id,remote_id,name,active", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -16573,17 +16027,7 @@ Map { }, "name": "hris_list_time_entries", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -16592,10 +16036,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,start_time,end_time,hours_worked,break_duration,labor_type,location,status,created_at,updated_at", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "HRIS Time Entries filters", "properties": { @@ -16729,17 +16169,7 @@ Map { }, "name": "hris_get_time_entries", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -16748,10 +16178,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,start_time,end_time,hours_worked,break_duration,labor_type,location,status,created_at,updated_at", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -16853,17 +16279,7 @@ Map { }, "name": "hris_list_benefits", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -16872,10 +16288,6 @@ Map { "example": "id,remote_id,name,benefit_type,provider,description,created_at,updated_at", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -16992,17 +16404,7 @@ Map { }, "name": "hris_get_benefit", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -17011,10 +16413,6 @@ Map { "example": "id,remote_id,name,benefit_type,provider,description,created_at,updated_at", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -17116,17 +16514,7 @@ Map { }, "name": "hris_list_groups", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -17135,10 +16523,6 @@ Map { "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -17265,17 +16649,7 @@ Map { }, "name": "hris_list_department_groups", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -17284,10 +16658,6 @@ Map { "example": "id,remote_id,name", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -17414,17 +16784,7 @@ Map { }, "name": "hris_list_cost_center_groups", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -17433,10 +16793,6 @@ Map { "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -17563,17 +16919,7 @@ Map { }, "name": "hris_list_team_groups", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -17582,10 +16928,6 @@ Map { "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -17702,17 +17044,7 @@ Map { }, "name": "hris_get_group", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -17721,10 +17053,6 @@ Map { "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -17816,17 +17144,7 @@ Map { }, "name": "hris_get_department_group", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -17835,10 +17153,6 @@ Map { "example": "id,remote_id,name", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -17930,17 +17244,7 @@ Map { }, "name": "hris_get_cost_center_group", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -17949,10 +17253,6 @@ Map { "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -18044,17 +17344,7 @@ Map { }, "name": "hris_get_team_group", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -18063,10 +17353,6 @@ Map { "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -18168,17 +17454,7 @@ Map { }, "name": "hris_list_jobs", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -18187,10 +17463,6 @@ Map { "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -18307,17 +17579,7 @@ Map { }, "name": "hris_get_job", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -18326,10 +17588,6 @@ Map { "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -18436,17 +17694,7 @@ Map { }, "name": "hris_list_employee_skills", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -18455,10 +17703,6 @@ Map { "example": "id,remote_id,name,active,language,maximum_proficiency,minimum_proficiency", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -18585,24 +17829,10 @@ Map { }, "name": "hris_create_employee_skill", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "description": "The ID associated with this skill", "example": "16873-IT345", @@ -18763,17 +17993,7 @@ Map { }, "name": "hris_get_employee_skill", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -18782,10 +18002,6 @@ Map { "example": "id,remote_id,name,active,language,maximum_proficiency,minimum_proficiency", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -18896,17 +18112,7 @@ Map { }, "name": "hris_list_time_off_policies", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -18915,10 +18121,6 @@ Map { "example": "id,remote_id,name,description,type,duration_unit,reasons,updated_at,created_at", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "HRIS Time-Off Policies filters", "properties": { @@ -18939,14 +18141,9 @@ Map { "child_care_leave", "maternity_leave", "jury_duty", + "bereavement_leave", "sabbatical", "accident", - "paid", - "unpaid", - "holiday", - "personal", - "in_lieu", - "bereavement", null, ], "type": "string", @@ -19064,17 +18261,7 @@ Map { }, "name": "hris_get_time_off_policy", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -19083,10 +18270,6 @@ Map { "example": "id,remote_id,name,description,type,duration_unit,reasons,updated_at,created_at", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -19193,17 +18376,7 @@ Map { }, "name": "hris_list_employee_time_off_policies", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -19212,10 +18385,6 @@ Map { "example": "id,remote_id,name,description,type,duration_unit,reasons,updated_at,created_at", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "HRIS Time-Off Policies filters", "properties": { @@ -19236,14 +18405,9 @@ Map { "child_care_leave", "maternity_leave", "jury_duty", + "bereavement_leave", "sabbatical", "accident", - "paid", - "unpaid", - "holiday", - "personal", - "in_lieu", - "bereavement", null, ], "type": "string", @@ -19391,17 +18555,7 @@ Map { }, "name": "hris_list_employee_tasks", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -19415,10 +18569,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,name,description,type,status,due_date,completion_date,assigned_by_employee_id,remote_assigned_by_employee_id,assigned_by_employee_name,link_to_task,extracted_links,next_task_id,remote_next_task_id,parent_process_name,comments,attachments,created_at,updated_at", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "filter": { "description": "Filter parameters that allow greater customisation of the list response", "properties": { @@ -19560,17 +18710,7 @@ Map { }, "name": "hris_get_employee_task", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -19584,10 +18724,6 @@ Map { "example": "id,remote_id,employee_id,remote_employee_id,name,description,type,status,due_date,completion_date,assigned_by_employee_id,remote_assigned_by_employee_id,assigned_by_employee_name,link_to_task,extracted_links,next_task_id,remote_next_task_id,parent_process_name,comments,attachments,created_at,updated_at", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, @@ -19693,17 +18829,7 @@ Map { }, "name": "hris_complete_employee_task", "parameterMapper": ParameterMapper { - "transformers": -Map { - "file_path" => { - "transforms": { - "content": [Function], - "file_format": [Function], - "name": [Function], - }, - }, - } -, + "transformers": Map {}, }, "parameters": { "properties": { @@ -19712,10 +18838,6 @@ Map { "example": "All required documents have been submitted", "type": "string", }, - "file_path": { - "description": "Convenience parameter that will be transformed into other parameters. Try and use this parameter in your tool call.", - "type": "string", - }, "id": { "type": "string", }, diff --git a/src/types.ts b/src/types.ts index 54042af3..e5bd3a64 100644 --- a/src/types.ts +++ b/src/types.ts @@ -75,6 +75,14 @@ export interface ExecuteConfig { }[]; // this params are the full list of params used to execute. This should come straight from the OpenAPI spec. } +/** + * EXPERIMENTAL: Function to preprocess parameters before tool execution + * Can be used to transform parameters, fetch documents from external sources, etc. + * @param params - The input parameters + * @returns Modified parameters or Promise + */ +export type ExperimentalPreExecuteFunction = (params: JsonDict) => Promise | JsonDict; + /** * Options for executing a tool */ @@ -84,6 +92,12 @@ export interface ExecuteOptions { * Useful for debugging and testing transformed parameters */ dryRun?: boolean; + + /** + * EXPERIMENTAL: Function to preprocess parameters before execution + * Allows for document fetching, parameter override, etc. + */ + experimentalPreExecute?: ExperimentalPreExecuteFunction; } /** From 79c453b0eed2d890e738bd59c80e4222b8d27ee8 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 18:10:20 +0000 Subject: [PATCH 05/16] feat: update experimental naming to use underscore prefix - Rename ExperimentalPreExecuteFunction to Experimental_PreExecuteFunction - Rename experimentalPreExecute to experimental_PreExecute - Update all imports, exports, and usages across codebase Co-authored-by: mattzcarey --- examples/experimental-document-handling.ts | 14 +++++++------- src/index.ts | 2 +- src/tool.ts | 4 ++-- src/types.ts | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/experimental-document-handling.ts b/examples/experimental-document-handling.ts index d1b40961..aa060228 100644 --- a/examples/experimental-document-handling.ts +++ b/examples/experimental-document-handling.ts @@ -13,14 +13,14 @@ import assert from 'node:assert'; import * as fs from 'node:fs'; import * as path from 'node:path'; -import { StackOneToolSet, type ExperimentalPreExecuteFunction } from '../src'; +import { StackOneToolSet, type Experimental_PreExecuteFunction } from '../src'; const accountId = '45072196112816593343'; /** * EXPERIMENTAL: Create a document handler that fetches files from local storage */ -const createLocalFileHandler = (allowedPaths: string[]): ExperimentalPreExecuteFunction => { +const createLocalFileHandler = (allowedPaths: string[]): Experimental_PreExecuteFunction => { return async (params) => { const { document_id, ...otherParams } = params; @@ -58,7 +58,7 @@ const createLocalFileHandler = (allowedPaths: string[]): ExperimentalPreExecuteF /** * EXPERIMENTAL: Create a document handler for external sources (S3, databases, etc.) */ -const createExternalDocumentHandler = (): ExperimentalPreExecuteFunction => { +const createExternalDocumentHandler = (): Experimental_PreExecuteFunction => { return async (params) => { const { document_reference, ...otherParams } = params; @@ -85,7 +85,7 @@ const createExternalDocumentHandler = (): ExperimentalPreExecuteFunction => { /** * EXPERIMENTAL: Create a multi-source document handler with fallback logic */ -const createMultiSourceHandler = (localPaths: string[]): ExperimentalPreExecuteFunction => { +const createMultiSourceHandler = (localPaths: string[]): Experimental_PreExecuteFunction => { const localHandler = createLocalFileHandler(localPaths); const externalHandler = createExternalDocumentHandler(); @@ -141,7 +141,7 @@ const experimentalDocumentHandling = async (): Promise => { }, { dryRun: true, - experimentalPreExecute: localFileHandler, + experimental_PreExecute: localFileHandler, } ); @@ -165,7 +165,7 @@ const experimentalDocumentHandling = async (): Promise => { }, { dryRun: true, - experimentalPreExecute: externalHandler, + experimental_PreExecute: externalHandler, } ); @@ -188,7 +188,7 @@ const experimentalDocumentHandling = async (): Promise => { }, { dryRun: true, - experimentalPreExecute: multiSourceHandler, + experimental_PreExecute: multiSourceHandler, } ); diff --git a/src/index.ts b/src/index.ts index 2e20905f..fdf793fd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,7 +23,7 @@ export { export type { ExecuteConfig, ExecuteOptions, - ExperimentalPreExecuteFunction, + Experimental_PreExecuteFunction, JsonDict, ParameterLocation, ParameterTransformer, diff --git a/src/tool.ts b/src/tool.ts index 225bf688..ffcdb223 100644 --- a/src/tool.ts +++ b/src/tool.ts @@ -87,8 +87,8 @@ export class BaseTool { // Apply experimental preExecute function if provided let processedParams = inputParams; - if (options?.experimentalPreExecute) { - processedParams = await options.experimentalPreExecute( + if (options?.experimental_PreExecute) { + processedParams = await options.experimental_PreExecute( typeof inputParams === 'string' ? JSON.parse(inputParams) : inputParams || {} ); } diff --git a/src/types.ts b/src/types.ts index e5bd3a64..2af2ea53 100644 --- a/src/types.ts +++ b/src/types.ts @@ -81,7 +81,7 @@ export interface ExecuteConfig { * @param params - The input parameters * @returns Modified parameters or Promise */ -export type ExperimentalPreExecuteFunction = (params: JsonDict) => Promise | JsonDict; +export type Experimental_PreExecuteFunction = (params: JsonDict) => Promise | JsonDict; /** * Options for executing a tool @@ -97,7 +97,7 @@ export interface ExecuteOptions { * EXPERIMENTAL: Function to preprocess parameters before execution * Allows for document fetching, parameter override, etc. */ - experimentalPreExecute?: ExperimentalPreExecuteFunction; + experimental_PreExecute?: Experimental_PreExecuteFunction; } /** From b466194bbe7989f00fe3e85cf7fbbf458f8f5925 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 18:23:48 +0000 Subject: [PATCH 06/16] feat: add experimental_transformations example for UX comparison Add comprehensive example demonstrating experimental_ prefixed transformation API alongside existing ParameterMapper approach. Includes: - Experimental_ParameterMapper class with experimental_ naming - File, user data, and date transformation examples - Composite transformation handlers - Comprehensive test cases for UX comparison Co-authored-by: mattzcarey --- examples/experimental_transformations.ts | 397 +++++++++++++++++++++++ examples/index.ts | 1 + 2 files changed, 398 insertions(+) create mode 100644 examples/experimental_transformations.ts diff --git a/examples/experimental_transformations.ts b/examples/experimental_transformations.ts new file mode 100644 index 00000000..09428ca8 --- /dev/null +++ b/examples/experimental_transformations.ts @@ -0,0 +1,397 @@ +/** + * EXPERIMENTAL: Parameter Transformations + * + * This example demonstrates experimental parameter transformation functionality + * with experimental_ prefixed APIs for comparison with the current ParameterMapper approach. + * + * This is an experimental feature and the API may change in future versions. + * + * Run this example with: + * bun run examples/experimental_transformations.ts + */ + +import assert from 'node:assert'; +import * as fs from 'node:fs'; +import * as path from 'node:path'; +import { StackOneToolSet, type JsonDict } from '../src'; + +const accountId = '45072196112816593343'; + +/** + * EXPERIMENTAL: Type definition for a transformation function + */ +type Experimental_TransformFunction = (sourceValue: unknown) => unknown; + +/** + * EXPERIMENTAL: Type definition for a map of transformation functions + */ +type Experimental_TransformFunctions = Record; + +/** + * EXPERIMENTAL: Configuration for parameter transformations + */ +type Experimental_ParameterTransformer = { + transforms: Experimental_TransformFunctions; +}; + +/** + * EXPERIMENTAL: Type definition for a map of transformation configurations + */ +type Experimental_ParameterTransformerMap = Map; + +/** + * EXPERIMENTAL: Parameter transformation handler + */ +class Experimental_ParameterMapper { + private transformers: Experimental_ParameterTransformerMap; + + constructor(transformers?: Experimental_ParameterTransformerMap) { + this.transformers = transformers || new Map(); + } + + /** + * Add a transformer for a parameter + */ + addTransformer(sourceParam: string, transformer: Experimental_ParameterTransformer): void { + this.transformers.set(sourceParam, transformer); + } + + /** + * Get a transformer for a parameter + */ + getTransformer(sourceParam: string): Experimental_ParameterTransformer | undefined { + return this.transformers.get(sourceParam); + } + + /** + * Create a preExecute function that applies transformations + */ + createPreExecuteFunction() { + return async (params: JsonDict): Promise => { + // Create a copy of the parameters to avoid modifying the original + const mappedParams: JsonDict = { ...params }; + + // Process transformed parameters + for (const [sourceParam, config] of this.transformers.entries()) { + // Skip if source parameter is not present + if (!(sourceParam in params)) continue; + + // Get the source parameter value + const sourceValue = params[sourceParam]; + + // Process each transformation function + for (const targetParam of Object.keys(config.transforms)) { + try { + // Transform the parameter value + const derivedValue = config.transforms[targetParam](sourceValue); + if (derivedValue !== null) { + mappedParams[targetParam] = derivedValue; + } + } catch (error) { + throw new Error( + `Error transforming parameter ${targetParam} from ${sourceParam}: ${error instanceof Error ? error.message : 'Unknown error'}` + ); + } + } + + // Remove source parameter after transformation + delete mappedParams[sourceParam]; + } + + return mappedParams; + }; + } +} + +/** + * EXPERIMENTAL: File handling transformations + */ +const createExperimental_FileTransformations = (): Experimental_ParameterMapper => { + const mapper = new Experimental_ParameterMapper(); + + // Transform file_path to multiple parameters + mapper.addTransformer('file_path', { + transforms: { + // Extract file content as base64 + content: (filePath: unknown): string => { + if (typeof filePath !== 'string') { + throw new Error('file_path must be a string'); + } + + if (!fs.existsSync(filePath)) { + throw new Error(`File not found: ${filePath}`); + } + + const fileContent = fs.readFileSync(filePath); + return fileContent.toString('base64'); + }, + + // Extract filename + name: (filePath: unknown): string => { + if (typeof filePath !== 'string') { + throw new Error('file_path must be a string'); + } + return path.basename(filePath); + }, + + // Extract file format + file_format: (filePath: unknown): { value: string } => { + if (typeof filePath !== 'string') { + throw new Error('file_path must be a string'); + } + const extension = path.extname(filePath).slice(1); + return { value: extension || 'txt' }; + } + } + }); + + return mapper; +}; + +/** + * EXPERIMENTAL: User data transformations + */ +const createExperimental_UserDataTransformations = (): Experimental_ParameterMapper => { + const mapper = new Experimental_ParameterMapper(); + + // Transform full_name to first_name and last_name + mapper.addTransformer('full_name', { + transforms: { + first_name: (fullName: unknown): string => { + if (typeof fullName !== 'string') { + throw new Error('full_name must be a string'); + } + const parts = fullName.trim().split(/\s+/); + return parts[0] || ''; + }, + + last_name: (fullName: unknown): string => { + if (typeof fullName !== 'string') { + throw new Error('full_name must be a string'); + } + const parts = fullName.trim().split(/\s+/); + return parts.slice(1).join(' ') || ''; + } + } + }); + + // Transform email to username and domain + mapper.addTransformer('email', { + transforms: { + username: (email: unknown): string => { + if (typeof email !== 'string') { + throw new Error('email must be a string'); + } + const [username] = email.split('@'); + return username || ''; + }, + + email_domain: (email: unknown): string => { + if (typeof email !== 'string') { + throw new Error('email must be a string'); + } + const [, domain] = email.split('@'); + return domain || ''; + } + } + }); + + return mapper; +}; + +/** + * EXPERIMENTAL: Date formatting transformations + */ +const createExperimental_DateTransformations = (): Experimental_ParameterMapper => { + const mapper = new Experimental_ParameterMapper(); + + // Transform date_string to various formats + mapper.addTransformer('date_string', { + transforms: { + start_date: (dateString: unknown): string => { + if (typeof dateString !== 'string') { + throw new Error('date_string must be a string'); + } + const date = new Date(dateString); + if (isNaN(date.getTime())) { + throw new Error('Invalid date format'); + } + return date.toISOString().split('T')[0]; // YYYY-MM-DD format + }, + + formatted_date: (dateString: unknown): { value: string } => { + if (typeof dateString !== 'string') { + throw new Error('date_string must be a string'); + } + const date = new Date(dateString); + if (isNaN(date.getTime())) { + throw new Error('Invalid date format'); + } + return { value: date.toLocaleDateString('en-US') }; // MM/DD/YYYY format + } + } + }); + + return mapper; +}; + +const experimentalTransformationsExample = async (): Promise => { + // Create a sample file for testing + const sampleFilePath = path.join(__dirname, 'sample-transform-file.txt'); + fs.writeFileSync(sampleFilePath, 'This is a test file for experimental transformations.'); + + try { + // Initialize the StackOne toolset + const toolset = new StackOneToolSet(); + + // Get tools for testing + const tools = toolset.getStackOneTools('hris_*', accountId); + + console.log('๐Ÿงช Testing EXPERIMENTAL file transformations...'); + + // EXPERIMENTAL: Create file transformation mapper + const fileMapper = createExperimental_FileTransformations(); + const filePreExecute = fileMapper.createPreExecuteFunction(); + + // Get the upload file tool + const uploadTool = tools.getTool('hris_upload_employee_document'); + assert(uploadTool !== undefined, 'Upload document tool not found'); + + // Test file transformations + const fileResult = await uploadTool.execute( + { + file_path: sampleFilePath, // Will be transformed to content, name, file_format + id: 'c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA', + category: { value: 'shared' }, + }, + { + dryRun: true, + experimental_PreExecute: filePreExecute, + } + ); + + console.log('โœ… File transformations successful'); + const fileParams = fileResult.mappedParams as Record; + assert(typeof fileParams.content === 'string', 'Content should be base64 string'); + assert(fileParams.name === 'sample-transform-file.txt', 'Filename not extracted correctly'); + assert( + (fileParams.file_format as { value: string }).value === 'txt', + 'File format not extracted correctly' + ); + + console.log('๐Ÿงช Testing EXPERIMENTAL user data transformations...'); + + // EXPERIMENTAL: Create user data transformation mapper + const userMapper = createExperimental_UserDataTransformations(); + const userPreExecute = userMapper.createPreExecuteFunction(); + + // Get a tool that might use user data + const employeeTool = tools.getTool('hris_create_employee'); + assert(employeeTool !== undefined, 'Create employee tool not found'); + + // Test user data transformations + const userResult = await employeeTool.execute( + { + full_name: 'John William Smith', // Will be transformed to first_name, last_name + email: 'john.smith@company.com', // Will be transformed to username, email_domain + employment_status: { value: 'active' }, + }, + { + dryRun: true, + experimental_PreExecute: userPreExecute, + } + ); + + console.log('โœ… User data transformations successful'); + const userParams = userResult.mappedParams as Record; + assert(userParams.first_name === 'John', 'First name not extracted correctly'); + assert(userParams.last_name === 'William Smith', 'Last name not extracted correctly'); + assert(userParams.username === 'john.smith', 'Username not extracted correctly'); + assert(userParams.email_domain === 'company.com', 'Email domain not extracted correctly'); + + console.log('๐Ÿงช Testing EXPERIMENTAL date transformations...'); + + // EXPERIMENTAL: Create date transformation mapper + const dateMapper = createExperimental_DateTransformations(); + const datePreExecute = dateMapper.createPreExecuteFunction(); + + // Test date transformations + const testParams = { + date_string: '2024-01-15T10:30:00Z', // Will be transformed to start_date, formatted_date + other_param: 'unchanged', + }; + + const dateResult = await datePreExecute(testParams); + + console.log('โœ… Date transformations successful'); + assert(dateResult.start_date === '2024-01-15', 'Start date not formatted correctly'); + assert( + (dateResult.formatted_date as { value: string }).value === '1/15/2024', + 'Formatted date not created correctly' + ); + assert(dateResult.other_param === 'unchanged', 'Other parameters should remain unchanged'); + + console.log('๐Ÿงช Testing EXPERIMENTAL composite transformations...'); + + // EXPERIMENTAL: Combine multiple transformations + const compositePreExecute = async (params: JsonDict): Promise => { + let result = params; + + // Apply file transformations if file_path exists + if (result.file_path) { + const fileMapper = createExperimental_FileTransformations(); + const fileTransform = fileMapper.createPreExecuteFunction(); + result = await fileTransform(result); + } + + // Apply user transformations if full_name or email exists + if (result.full_name || result.email) { + const userMapper = createExperimental_UserDataTransformations(); + const userTransform = userMapper.createPreExecuteFunction(); + result = await userTransform(result); + } + + // Apply date transformations if date_string exists + if (result.date_string) { + const dateMapper = createExperimental_DateTransformations(); + const dateTransform = dateMapper.createPreExecuteFunction(); + result = await dateTransform(result); + } + + return result; + }; + + // Test composite transformations + const compositeResult = await compositePreExecute({ + file_path: sampleFilePath, + full_name: 'Jane Doe', + email: 'jane@example.com', + date_string: '2024-02-20T15:00:00Z', + unchanged_param: 'stays the same', + }); + + console.log('โœ… Composite transformations successful'); + assert(typeof compositeResult.content === 'string', 'File content should be transformed'); + assert(compositeResult.first_name === 'Jane', 'Name should be transformed'); + assert(compositeResult.username === 'jane', 'Email should be transformed'); + assert(compositeResult.start_date === '2024-02-20', 'Date should be transformed'); + assert(compositeResult.unchanged_param === 'stays the same', 'Other params should remain'); + + console.log('๐ŸŽ‰ All EXPERIMENTAL transformation tests passed!'); + console.log(''); + console.log('๐Ÿ”„ Transformation Comparison:'); + console.log(' Current API: ParameterMapper with static configuration'); + console.log(' Experimental API: Dynamic preExecute functions with async support'); + console.log(''); + console.log('โš ๏ธ IMPORTANT: This is experimental functionality.'); + console.log(' The API may change in future versions.'); + console.log(' Use at your own risk in production environments.'); + } finally { + // Clean up the sample file + if (fs.existsSync(sampleFilePath)) { + fs.unlinkSync(sampleFilePath); + } + } +}; + +experimentalTransformationsExample(); \ No newline at end of file diff --git a/examples/index.ts b/examples/index.ts index 0f06a4e4..51f3b9ac 100644 --- a/examples/index.ts +++ b/examples/index.ts @@ -76,6 +76,7 @@ quickstart(); * - [AI SDK Integration](ai-sdk-integration.md) * - [Error Handling](error-handling.md) * - [EXPERIMENTAL: Document Handling](experimental-document-handling.md) + * - [EXPERIMENTAL: Transformations](experimental_transformations.md) * - [Custom Base URL](custom-base-url.md) * - [Account ID Usage](account-id-usage.md) */ From 574417c5a56c0bdcd0019c588ed272d4305a9a9d Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 18:43:04 +0000 Subject: [PATCH 07/16] feat: remove parameter mapper and transformation infrastructure Remove old parameter transformation system in favor of new experimental schema override + preExecute API --- src/modules/parameterMapper.ts | 111 ------------ src/modules/tests/parameterMapper.spec.ts | 210 ---------------------- 2 files changed, 321 deletions(-) delete mode 100644 src/modules/parameterMapper.ts delete mode 100644 src/modules/tests/parameterMapper.spec.ts diff --git a/src/modules/parameterMapper.ts b/src/modules/parameterMapper.ts deleted file mode 100644 index 531bacb2..00000000 --- a/src/modules/parameterMapper.ts +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Parameter derivation functions for StackOne tools - * - * This file contains functions to transform parameter values from other parameters, - * particularly for file uploads where we want to extract multiple values from a file path. - */ - -import type { JsonDict, ParameterTransformer, ParameterTransformerMap } from '../types'; -import { StackOneError } from '../utils/errors'; - -/** - * Handles parameter mapping and transformation - */ -export class ParameterMapper { - private transformers: ParameterTransformerMap; - - constructor(transformers?: ParameterTransformerMap) { - this.transformers = transformers || new Map(); - } - - /** - * Add a transformer for a parameter - */ - addTransformer(sourceParam: string, transformer: ParameterTransformer): void { - this.transformers.set(sourceParam, transformer); - } - - /** - * Get a transformer for a parameter - */ - getTransformer(sourceParam: string): ParameterTransformer | undefined { - return this.transformers.get(sourceParam); - } - - /** - * Map parameters from user input to API parameters - */ - mapParameters(userParams: JsonDict | string | undefined): JsonDict { - // If no parameters provided, return empty object - if (!userParams) return {}; - - // If parameters are provided as a string, parse them as JSON - const params = typeof userParams === 'string' ? JSON.parse(userParams) : userParams; - - // Create a copy of the parameters to avoid modifying the original - const mappedParams: JsonDict = { ...params }; - - // Process transformed parameters - for (const [sourceParam, config] of this.transformers.entries()) { - // Skip if source parameter is not present - if (!(sourceParam in params)) continue; - - // Get the source parameter value - const sourceValue = params[sourceParam]; - - // Process each derivation function - for (const targetParam of Object.keys(config.transforms)) { - try { - // Derive the parameter value - const derivedValues = transformParameter(sourceValue, targetParam, sourceParam, config); - - // Add derived values to mapped parameters - Object.assign(mappedParams, derivedValues); - } catch (error) { - // Log error but continue processing other parameters - console.error(`Error deriving parameter ${targetParam}:`, error); - } - } - - // Always remove source parameters after transformation - delete mappedParams[sourceParam]; - } - - return mappedParams; - } -} - -/** - * Apply derivation functions to derive a parameter from a source parameter - * - * @param sourceValue Value of the source parameter - * @param targetParam Name of the parameter to derive - * @param sourceParam Name of the source parameter - * @param transformer The derivation configuration containing derivation functions - * @returns Object with the transformed parameter value - */ -export const transformParameter = ( - sourceValue: unknown, - targetParam: string, - sourceParam: string, - transformer: ParameterTransformer -): JsonDict => { - const result: JsonDict = {}; - - // Get the derivation function for the target parameter - const deriveFn = transformer.transforms[targetParam]; - if (!deriveFn) return result; - - try { - const derivedValue = deriveFn(sourceValue); - if (derivedValue !== null) { - result[targetParam] = derivedValue; - } - } catch (error) { - throw new StackOneError( - `Error deriving parameter ${targetParam} from ${sourceParam}: ${error instanceof Error ? error.message : 'Unknown error'}` - ); - } - - return result; -}; diff --git a/src/modules/tests/parameterMapper.spec.ts b/src/modules/tests/parameterMapper.spec.ts deleted file mode 100644 index 6a85c718..00000000 --- a/src/modules/tests/parameterMapper.spec.ts +++ /dev/null @@ -1,210 +0,0 @@ -import { describe, expect, it } from 'bun:test'; -import type { ParameterTransformer } from '../../types'; -import { StackOneError } from '../../utils/errors'; -import { ParameterMapper, transformParameter } from '../parameterMapper'; - -describe('ParameterMapper', () => { - it('should initialize with no transformers', () => { - const mapper = new ParameterMapper(); - expect(mapper).toBeDefined(); - }); - - it('should initialize with provided transformers', () => { - const transformers = new Map(); - transformers.set('sourceParam', { - transforms: { - targetParam: (value) => `transformed-${value}`, - }, - }); - - const mapper = new ParameterMapper(transformers); - expect(mapper).toBeDefined(); - expect(mapper.getTransformer('sourceParam')).toBeDefined(); - }); - - it('should add a transformer', () => { - const mapper = new ParameterMapper(); - - const transformer: ParameterTransformer = { - transforms: { - targetParam: (value) => `transformed-${value}`, - }, - }; - - mapper.addTransformer('sourceParam', transformer); - - const retrievedTransformer = mapper.getTransformer('sourceParam'); - expect(retrievedTransformer).toBe(transformer); - }); - - it('should map parameters without transformations', () => { - const mapper = new ParameterMapper(); - const params = { param1: 'value1', param2: 'value2' }; - - const result = mapper.mapParameters(params); - - expect(result).toEqual(params); - }); - - it('should map parameters with transformations', () => { - const transformers = new Map(); - transformers.set('sourceParam', { - transforms: { - targetParam: (value) => `transformed-${value}`, - }, - }); - - const mapper = new ParameterMapper(transformers); - const params = { sourceParam: 'value', otherParam: 'not-transformed' }; - - const result = mapper.mapParameters(params); - - expect(result).toEqual({ - otherParam: 'not-transformed', - targetParam: 'transformed-value', - }); - }); - - it('should handle parameters provided as a JSON string', () => { - const mapper = new ParameterMapper(); - const paramsString = JSON.stringify({ param1: 'value1', param2: 'value2' }); - - const result = mapper.mapParameters(paramsString); - - expect(result).toEqual({ param1: 'value1', param2: 'value2' }); - }); - - it('should handle undefined parameters', () => { - const mapper = new ParameterMapper(); - const result = mapper.mapParameters(undefined); - - expect(result).toEqual({}); - }); - - it('should skip transformation if source parameter is not present', () => { - const transformers = new Map(); - transformers.set('sourceParam', { - transforms: { - targetParam: (value) => `transformed-${value}`, - }, - }); - - const mapper = new ParameterMapper(transformers); - const params = { otherParam: 'value' }; - - const result = mapper.mapParameters(params); - - expect(result).toEqual({ otherParam: 'value' }); - expect(result).not.toHaveProperty('targetParam'); - }); - - it('should handle multiple target parameters from a single source', () => { - const transformers = new Map(); - transformers.set('sourceParam', { - transforms: { - targetParam1: (value) => `${value}-1`, - targetParam2: (value) => `${value}-2`, - }, - }); - - const mapper = new ParameterMapper(transformers); - const params = { sourceParam: 'value' }; - - const result = mapper.mapParameters(params); - - expect(result).toEqual({ - targetParam1: 'value-1', - targetParam2: 'value-2', - }); - }); - - it('should handle multiple source parameters with transformations', () => { - const transformers = new Map(); - - transformers.set('sourceParam1', { - transforms: { - targetParam1: (value) => `${value}-1`, - }, - }); - - transformers.set('sourceParam2', { - transforms: { - targetParam2: (value) => `${value}-2`, - }, - }); - - const mapper = new ParameterMapper(transformers); - const params = { sourceParam1: 'value1', sourceParam2: 'value2' }; - - const result = mapper.mapParameters(params); - - expect(result).toEqual({ - targetParam1: 'value1-1', - targetParam2: 'value2-2', - }); - }); -}); - -describe('transformParameter', () => { - it('should transform a parameter correctly', () => { - const sourceValue = 'test'; - const targetParam = 'target'; - const sourceParam = 'source'; - const transformer: ParameterTransformer = { - transforms: { - target: (value) => `transformed-${value}`, - }, - }; - - const result = transformParameter(sourceValue, targetParam, sourceParam, transformer); - - expect(result).toEqual({ target: 'transformed-test' }); - }); - - it('should return empty object if transformer for target param does not exist', () => { - const sourceValue = 'test'; - const targetParam = 'nonExistentTarget'; - const sourceParam = 'source'; - const transformer: ParameterTransformer = { - transforms: { - target: (value) => `transformed-${value}`, - }, - }; - - const result = transformParameter(sourceValue, targetParam, sourceParam, transformer); - - expect(result).toEqual({}); - }); - - it('should handle null return from transformation function', () => { - const sourceValue = 'test'; - const targetParam = 'target'; - const sourceParam = 'source'; - const transformer: ParameterTransformer = { - transforms: { - target: () => null, - }, - }; - - const result = transformParameter(sourceValue, targetParam, sourceParam, transformer); - - expect(result).toEqual({}); - }); - - it('should throw StackOneError when transformation function throws', () => { - const sourceValue = 'test'; - const targetParam = 'target'; - const sourceParam = 'source'; - const transformer: ParameterTransformer = { - transforms: { - target: () => { - throw new Error('Transformation error'); - }, - }, - }; - - expect(() => { - transformParameter(sourceValue, targetParam, sourceParam, transformer); - }).toThrow(StackOneError); - }); -}); From 95050ff41342318d5deffd3d7aab42c03521fbe9 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 18:44:38 +0000 Subject: [PATCH 08/16] feat: remove old experimental transformations example Remove example that used deprecated ParameterMapper approach in favor of new schema override + preExecute API --- examples/experimental_transformations.ts | 397 ----------------------- 1 file changed, 397 deletions(-) delete mode 100644 examples/experimental_transformations.ts diff --git a/examples/experimental_transformations.ts b/examples/experimental_transformations.ts deleted file mode 100644 index 09428ca8..00000000 --- a/examples/experimental_transformations.ts +++ /dev/null @@ -1,397 +0,0 @@ -/** - * EXPERIMENTAL: Parameter Transformations - * - * This example demonstrates experimental parameter transformation functionality - * with experimental_ prefixed APIs for comparison with the current ParameterMapper approach. - * - * This is an experimental feature and the API may change in future versions. - * - * Run this example with: - * bun run examples/experimental_transformations.ts - */ - -import assert from 'node:assert'; -import * as fs from 'node:fs'; -import * as path from 'node:path'; -import { StackOneToolSet, type JsonDict } from '../src'; - -const accountId = '45072196112816593343'; - -/** - * EXPERIMENTAL: Type definition for a transformation function - */ -type Experimental_TransformFunction = (sourceValue: unknown) => unknown; - -/** - * EXPERIMENTAL: Type definition for a map of transformation functions - */ -type Experimental_TransformFunctions = Record; - -/** - * EXPERIMENTAL: Configuration for parameter transformations - */ -type Experimental_ParameterTransformer = { - transforms: Experimental_TransformFunctions; -}; - -/** - * EXPERIMENTAL: Type definition for a map of transformation configurations - */ -type Experimental_ParameterTransformerMap = Map; - -/** - * EXPERIMENTAL: Parameter transformation handler - */ -class Experimental_ParameterMapper { - private transformers: Experimental_ParameterTransformerMap; - - constructor(transformers?: Experimental_ParameterTransformerMap) { - this.transformers = transformers || new Map(); - } - - /** - * Add a transformer for a parameter - */ - addTransformer(sourceParam: string, transformer: Experimental_ParameterTransformer): void { - this.transformers.set(sourceParam, transformer); - } - - /** - * Get a transformer for a parameter - */ - getTransformer(sourceParam: string): Experimental_ParameterTransformer | undefined { - return this.transformers.get(sourceParam); - } - - /** - * Create a preExecute function that applies transformations - */ - createPreExecuteFunction() { - return async (params: JsonDict): Promise => { - // Create a copy of the parameters to avoid modifying the original - const mappedParams: JsonDict = { ...params }; - - // Process transformed parameters - for (const [sourceParam, config] of this.transformers.entries()) { - // Skip if source parameter is not present - if (!(sourceParam in params)) continue; - - // Get the source parameter value - const sourceValue = params[sourceParam]; - - // Process each transformation function - for (const targetParam of Object.keys(config.transforms)) { - try { - // Transform the parameter value - const derivedValue = config.transforms[targetParam](sourceValue); - if (derivedValue !== null) { - mappedParams[targetParam] = derivedValue; - } - } catch (error) { - throw new Error( - `Error transforming parameter ${targetParam} from ${sourceParam}: ${error instanceof Error ? error.message : 'Unknown error'}` - ); - } - } - - // Remove source parameter after transformation - delete mappedParams[sourceParam]; - } - - return mappedParams; - }; - } -} - -/** - * EXPERIMENTAL: File handling transformations - */ -const createExperimental_FileTransformations = (): Experimental_ParameterMapper => { - const mapper = new Experimental_ParameterMapper(); - - // Transform file_path to multiple parameters - mapper.addTransformer('file_path', { - transforms: { - // Extract file content as base64 - content: (filePath: unknown): string => { - if (typeof filePath !== 'string') { - throw new Error('file_path must be a string'); - } - - if (!fs.existsSync(filePath)) { - throw new Error(`File not found: ${filePath}`); - } - - const fileContent = fs.readFileSync(filePath); - return fileContent.toString('base64'); - }, - - // Extract filename - name: (filePath: unknown): string => { - if (typeof filePath !== 'string') { - throw new Error('file_path must be a string'); - } - return path.basename(filePath); - }, - - // Extract file format - file_format: (filePath: unknown): { value: string } => { - if (typeof filePath !== 'string') { - throw new Error('file_path must be a string'); - } - const extension = path.extname(filePath).slice(1); - return { value: extension || 'txt' }; - } - } - }); - - return mapper; -}; - -/** - * EXPERIMENTAL: User data transformations - */ -const createExperimental_UserDataTransformations = (): Experimental_ParameterMapper => { - const mapper = new Experimental_ParameterMapper(); - - // Transform full_name to first_name and last_name - mapper.addTransformer('full_name', { - transforms: { - first_name: (fullName: unknown): string => { - if (typeof fullName !== 'string') { - throw new Error('full_name must be a string'); - } - const parts = fullName.trim().split(/\s+/); - return parts[0] || ''; - }, - - last_name: (fullName: unknown): string => { - if (typeof fullName !== 'string') { - throw new Error('full_name must be a string'); - } - const parts = fullName.trim().split(/\s+/); - return parts.slice(1).join(' ') || ''; - } - } - }); - - // Transform email to username and domain - mapper.addTransformer('email', { - transforms: { - username: (email: unknown): string => { - if (typeof email !== 'string') { - throw new Error('email must be a string'); - } - const [username] = email.split('@'); - return username || ''; - }, - - email_domain: (email: unknown): string => { - if (typeof email !== 'string') { - throw new Error('email must be a string'); - } - const [, domain] = email.split('@'); - return domain || ''; - } - } - }); - - return mapper; -}; - -/** - * EXPERIMENTAL: Date formatting transformations - */ -const createExperimental_DateTransformations = (): Experimental_ParameterMapper => { - const mapper = new Experimental_ParameterMapper(); - - // Transform date_string to various formats - mapper.addTransformer('date_string', { - transforms: { - start_date: (dateString: unknown): string => { - if (typeof dateString !== 'string') { - throw new Error('date_string must be a string'); - } - const date = new Date(dateString); - if (isNaN(date.getTime())) { - throw new Error('Invalid date format'); - } - return date.toISOString().split('T')[0]; // YYYY-MM-DD format - }, - - formatted_date: (dateString: unknown): { value: string } => { - if (typeof dateString !== 'string') { - throw new Error('date_string must be a string'); - } - const date = new Date(dateString); - if (isNaN(date.getTime())) { - throw new Error('Invalid date format'); - } - return { value: date.toLocaleDateString('en-US') }; // MM/DD/YYYY format - } - } - }); - - return mapper; -}; - -const experimentalTransformationsExample = async (): Promise => { - // Create a sample file for testing - const sampleFilePath = path.join(__dirname, 'sample-transform-file.txt'); - fs.writeFileSync(sampleFilePath, 'This is a test file for experimental transformations.'); - - try { - // Initialize the StackOne toolset - const toolset = new StackOneToolSet(); - - // Get tools for testing - const tools = toolset.getStackOneTools('hris_*', accountId); - - console.log('๐Ÿงช Testing EXPERIMENTAL file transformations...'); - - // EXPERIMENTAL: Create file transformation mapper - const fileMapper = createExperimental_FileTransformations(); - const filePreExecute = fileMapper.createPreExecuteFunction(); - - // Get the upload file tool - const uploadTool = tools.getTool('hris_upload_employee_document'); - assert(uploadTool !== undefined, 'Upload document tool not found'); - - // Test file transformations - const fileResult = await uploadTool.execute( - { - file_path: sampleFilePath, // Will be transformed to content, name, file_format - id: 'c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA', - category: { value: 'shared' }, - }, - { - dryRun: true, - experimental_PreExecute: filePreExecute, - } - ); - - console.log('โœ… File transformations successful'); - const fileParams = fileResult.mappedParams as Record; - assert(typeof fileParams.content === 'string', 'Content should be base64 string'); - assert(fileParams.name === 'sample-transform-file.txt', 'Filename not extracted correctly'); - assert( - (fileParams.file_format as { value: string }).value === 'txt', - 'File format not extracted correctly' - ); - - console.log('๐Ÿงช Testing EXPERIMENTAL user data transformations...'); - - // EXPERIMENTAL: Create user data transformation mapper - const userMapper = createExperimental_UserDataTransformations(); - const userPreExecute = userMapper.createPreExecuteFunction(); - - // Get a tool that might use user data - const employeeTool = tools.getTool('hris_create_employee'); - assert(employeeTool !== undefined, 'Create employee tool not found'); - - // Test user data transformations - const userResult = await employeeTool.execute( - { - full_name: 'John William Smith', // Will be transformed to first_name, last_name - email: 'john.smith@company.com', // Will be transformed to username, email_domain - employment_status: { value: 'active' }, - }, - { - dryRun: true, - experimental_PreExecute: userPreExecute, - } - ); - - console.log('โœ… User data transformations successful'); - const userParams = userResult.mappedParams as Record; - assert(userParams.first_name === 'John', 'First name not extracted correctly'); - assert(userParams.last_name === 'William Smith', 'Last name not extracted correctly'); - assert(userParams.username === 'john.smith', 'Username not extracted correctly'); - assert(userParams.email_domain === 'company.com', 'Email domain not extracted correctly'); - - console.log('๐Ÿงช Testing EXPERIMENTAL date transformations...'); - - // EXPERIMENTAL: Create date transformation mapper - const dateMapper = createExperimental_DateTransformations(); - const datePreExecute = dateMapper.createPreExecuteFunction(); - - // Test date transformations - const testParams = { - date_string: '2024-01-15T10:30:00Z', // Will be transformed to start_date, formatted_date - other_param: 'unchanged', - }; - - const dateResult = await datePreExecute(testParams); - - console.log('โœ… Date transformations successful'); - assert(dateResult.start_date === '2024-01-15', 'Start date not formatted correctly'); - assert( - (dateResult.formatted_date as { value: string }).value === '1/15/2024', - 'Formatted date not created correctly' - ); - assert(dateResult.other_param === 'unchanged', 'Other parameters should remain unchanged'); - - console.log('๐Ÿงช Testing EXPERIMENTAL composite transformations...'); - - // EXPERIMENTAL: Combine multiple transformations - const compositePreExecute = async (params: JsonDict): Promise => { - let result = params; - - // Apply file transformations if file_path exists - if (result.file_path) { - const fileMapper = createExperimental_FileTransformations(); - const fileTransform = fileMapper.createPreExecuteFunction(); - result = await fileTransform(result); - } - - // Apply user transformations if full_name or email exists - if (result.full_name || result.email) { - const userMapper = createExperimental_UserDataTransformations(); - const userTransform = userMapper.createPreExecuteFunction(); - result = await userTransform(result); - } - - // Apply date transformations if date_string exists - if (result.date_string) { - const dateMapper = createExperimental_DateTransformations(); - const dateTransform = dateMapper.createPreExecuteFunction(); - result = await dateTransform(result); - } - - return result; - }; - - // Test composite transformations - const compositeResult = await compositePreExecute({ - file_path: sampleFilePath, - full_name: 'Jane Doe', - email: 'jane@example.com', - date_string: '2024-02-20T15:00:00Z', - unchanged_param: 'stays the same', - }); - - console.log('โœ… Composite transformations successful'); - assert(typeof compositeResult.content === 'string', 'File content should be transformed'); - assert(compositeResult.first_name === 'Jane', 'Name should be transformed'); - assert(compositeResult.username === 'jane', 'Email should be transformed'); - assert(compositeResult.start_date === '2024-02-20', 'Date should be transformed'); - assert(compositeResult.unchanged_param === 'stays the same', 'Other params should remain'); - - console.log('๐ŸŽ‰ All EXPERIMENTAL transformation tests passed!'); - console.log(''); - console.log('๐Ÿ”„ Transformation Comparison:'); - console.log(' Current API: ParameterMapper with static configuration'); - console.log(' Experimental API: Dynamic preExecute functions with async support'); - console.log(''); - console.log('โš ๏ธ IMPORTANT: This is experimental functionality.'); - console.log(' The API may change in future versions.'); - console.log(' Use at your own risk in production environments.'); - } finally { - // Clean up the sample file - if (fs.existsSync(sampleFilePath)) { - fs.unlinkSync(sampleFilePath); - } - } -}; - -experimentalTransformationsExample(); \ No newline at end of file From 1314fe8859aedbb4c3a16af59f5e7ac39e5e48af Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 18:47:19 +0000 Subject: [PATCH 09/16] feat: implement experimental schema override + preExecute API Complete implementation of the new experimental two-stage transformation API: - Add experimental_schemaOverride for schema modification at tool creation time - Add experimental_preExecute for parameter transformation at execution time - Remove all old parameter transformation infrastructure (ParameterMapper, etc.) - Update all toolset classes to support new experimental options - Rewrite document handling example to demonstrate new API - Ensure type safety and proper tool creation with experimental options This replaces the old parameter transformation system with a more flexible and developer-friendly approach that separates schema definition from parameter transformation. Co-authored-by: mattzcarey --- examples/experimental-document-handling.ts | 277 ++++++++++++++++----- examples/index.ts | 1 - src/index.ts | 4 +- src/tool.ts | 105 +++++--- src/toolsets/base.ts | 105 +++----- src/toolsets/openapi.ts | 15 +- src/toolsets/stackone.ts | 15 +- src/types.ts | 50 ++-- 8 files changed, 348 insertions(+), 224 deletions(-) diff --git a/examples/experimental-document-handling.ts b/examples/experimental-document-handling.ts index aa060228..35dd00c6 100644 --- a/examples/experimental-document-handling.ts +++ b/examples/experimental-document-handling.ts @@ -1,9 +1,13 @@ /** - * EXPERIMENTAL: Document Handling with PreExecute Functions + * EXPERIMENTAL: Document Handling with Schema Override + PreExecute * - * This example demonstrates the new experimental preExecute functionality + * This example demonstrates the new experimental schema override + preExecute functionality * for handling documents from various sources (local files, URLs, databases, etc.) * + * The new API provides two-stage transformation: + * 1. Schema Override: Changes the tool's input schema at creation time + * 2. PreExecute: Transforms from override schema back to original API format at execution time + * * This is an experimental feature and the API may change in future versions. * * Run this example with: @@ -13,39 +17,77 @@ import assert from 'node:assert'; import * as fs from 'node:fs'; import * as path from 'node:path'; -import { StackOneToolSet, type Experimental_PreExecuteFunction } from '../src'; +import { + StackOneToolSet, + type Experimental_PreExecuteFunction, + type Experimental_SchemaOverride, +} from '../src'; const accountId = '45072196112816593343'; /** - * EXPERIMENTAL: Create a document handler that fetches files from local storage + * EXPERIMENTAL: Schema override for document upload - changes from complex schema to simple doc_id + */ +const createDocumentSchemaOverride = (): Experimental_SchemaOverride => { + return (originalSchema) => { + // Extract only the category from original schema, replace file-related params with doc_id + const newProperties: Record = {}; + + // Keep non-file parameters from original schema + for (const [key, value] of Object.entries(originalSchema.properties)) { + if (!['content', 'name', 'file_format'].includes(key)) { + newProperties[key] = value; + } + } + + // Add simplified document ID parameter + newProperties.doc_id = { + type: 'string', + description: 'Document identifier or file path', + }; + + return { + type: 'object', + properties: newProperties, + required: [ + 'doc_id', + ...(originalSchema.required?.filter( + (r) => !['content', 'name', 'file_format'].includes(r) + ) || []), + ], + }; + }; +}; + +/** + * EXPERIMENTAL: PreExecute function that transforms doc_id back to original file parameters */ -const createLocalFileHandler = (allowedPaths: string[]): Experimental_PreExecuteFunction => { +const createDocumentPreExecute = (allowedPaths: string[]): Experimental_PreExecuteFunction => { return async (params) => { - const { document_id, ...otherParams } = params; + const { doc_id, ...otherParams } = params; - if (typeof document_id !== 'string') { - return params; // Pass through if not a string + if (typeof doc_id !== 'string') { + throw new Error('doc_id must be a string'); } // Security check: only allow certain paths - const isAllowed = allowedPaths.some((allowedPath) => document_id.startsWith(allowedPath)); + const isAllowed = allowedPaths.some((allowedPath) => doc_id.startsWith(allowedPath)); if (!isAllowed) { - throw new Error(`Document path not allowed: ${document_id}`); + throw new Error(`Document path not allowed: ${doc_id}`); } - if (!fs.existsSync(document_id)) { - throw new Error(`Document not found: ${document_id}`); + if (!fs.existsSync(doc_id)) { + throw new Error(`Document not found: ${doc_id}`); } // Read file and convert to base64 - const fileContent = fs.readFileSync(document_id); + const fileContent = fs.readFileSync(doc_id); const base64Content = fileContent.toString('base64'); - const fileName = path.basename(document_id); - const extension = path.extname(document_id).slice(1); + const fileName = path.basename(doc_id); + const extension = path.extname(doc_id).slice(1); - // Return modified parameters with document content + // Transform back to original API format return { ...otherParams, content: base64Content, @@ -56,14 +98,47 @@ const createLocalFileHandler = (allowedPaths: string[]): Experimental_PreExecute }; /** - * EXPERIMENTAL: Create a document handler for external sources (S3, databases, etc.) + * EXPERIMENTAL: Schema override for external document references */ -const createExternalDocumentHandler = (): Experimental_PreExecuteFunction => { +const createExternalDocumentSchemaOverride = (): Experimental_SchemaOverride => { + return (originalSchema) => { + const newProperties: Record = {}; + + // Keep non-file parameters from original schema + for (const [key, value] of Object.entries(originalSchema.properties)) { + if (!['content', 'name', 'file_format'].includes(key)) { + newProperties[key] = value; + } + } + + // Add external document reference parameter + newProperties.document_reference = { + type: 'string', + description: 'External document reference (S3 key, database ID, etc.)', + }; + + return { + type: 'object', + properties: newProperties, + required: [ + 'document_reference', + ...(originalSchema.required?.filter( + (r) => !['content', 'name', 'file_format'].includes(r) + ) || []), + ], + }; + }; +}; + +/** + * EXPERIMENTAL: PreExecute function for external document fetching + */ +const createExternalDocumentPreExecute = (): Experimental_PreExecuteFunction => { return async (params) => { const { document_reference, ...otherParams } = params; if (typeof document_reference !== 'string') { - return params; // Pass through if not a document reference + throw new Error('document_reference must be a string'); } // Simulate fetching from external source (S3, database, etc.) @@ -73,6 +148,7 @@ const createExternalDocumentHandler = (): Experimental_PreExecuteFunction => { const mockDocumentContent = 'This is a mock document fetched from external source'; const base64Content = Buffer.from(mockDocumentContent).toString('base64'); + // Transform back to original API format return { ...otherParams, content: base64Content, @@ -83,29 +159,66 @@ const createExternalDocumentHandler = (): Experimental_PreExecuteFunction => { }; /** - * EXPERIMENTAL: Create a multi-source document handler with fallback logic + * EXPERIMENTAL: Schema override for multi-source documents (supports both local and external) + */ +const createMultiSourceSchemaOverride = (): Experimental_SchemaOverride => { + return (originalSchema) => { + const newProperties: Record = {}; + + // Keep non-file parameters from original schema + for (const [key, value] of Object.entries(originalSchema.properties)) { + if (!['content', 'name', 'file_format'].includes(key)) { + newProperties[key] = value; + } + } + + // Add both document parameters (user can provide either) + newProperties.doc_id = { + type: 'string', + description: 'Local document path (takes precedence if both provided)', + }; + + newProperties.document_reference = { + type: 'string', + description: 'External document reference (used if doc_id not provided)', + }; + + return { + type: 'object', + properties: newProperties, + required: [ + ...(originalSchema.required?.filter( + (r) => !['content', 'name', 'file_format'].includes(r) + ) || []), + ], + }; + }; +}; + +/** + * EXPERIMENTAL: PreExecute function for multi-source document handling with fallback */ -const createMultiSourceHandler = (localPaths: string[]): Experimental_PreExecuteFunction => { - const localHandler = createLocalFileHandler(localPaths); - const externalHandler = createExternalDocumentHandler(); +const createMultiSourcePreExecute = (localPaths: string[]): Experimental_PreExecuteFunction => { + const localPreExecute = createDocumentPreExecute(localPaths); + const externalPreExecute = createExternalDocumentPreExecute(); return async (params) => { - // Try local file handler first - if (params.document_id) { + // Try local file first if doc_id is provided + if (params.doc_id) { try { - return await localHandler(params); + return await localPreExecute(params); } catch (error) { console.warn(`Local file handler failed: ${error}`); } } - // Fallback to external handler + // Fallback to external handler if document_reference is provided if (params.document_reference) { - return await externalHandler(params); + return await externalPreExecute(params); } - // No document parameters, pass through - return params; + // No document parameters provided + throw new Error('Either doc_id or document_reference must be provided'); }; }; @@ -118,87 +231,117 @@ const experimentalDocumentHandling = async (): Promise => { // Initialize the StackOne toolset const toolset = new StackOneToolSet(); - // Get tools for documents + // Get base tools for documents const tools = toolset.getStackOneTools('hris_*', accountId); - // Get the upload file tool - const uploadTool = tools.getTool('hris_upload_employee_document'); + console.log('๐Ÿงช Testing EXPERIMENTAL schema override + preExecute for local files...'); - // Check if upload tool exists - assert(uploadTool !== undefined, 'Upload document tool not found'); + // EXPERIMENTAL: Create a tool with schema override and preExecute for local files + const localDocumentTool = tools.getTool('hris_upload_employee_document', { + experimental_schemaOverride: createDocumentSchemaOverride(), + experimental_preExecute: createDocumentPreExecute([__dirname]), + }); - console.log('๐Ÿงช Testing EXPERIMENTAL local file document handling...'); + assert(localDocumentTool !== undefined, 'Local document tool not found'); - // EXPERIMENTAL: Create a secure local file handler - const localFileHandler = createLocalFileHandler([__dirname]); + // Use the new simplified schema (doc_id instead of content/name/file_format) + const localFileResult = await localDocumentTool.execute( + { + doc_id: sampleFilePath, // Simplified schema - just document ID + id: 'c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA', + category: { value: 'shared' }, + }, + { + dryRun: true, + } + ); + + console.log('โœ… Local file schema override + preExecute successful'); + const localParams = localFileResult.mappedParams as Record; + assert(localParams.file_format?.value === 'txt', 'File format was not transformed correctly'); + assert(localParams.name === 'sample-document.txt', 'File name was not transformed correctly'); + assert(typeof localParams.content === 'string', 'File content was not transformed correctly'); - // Use the experimental preExecute function for local file handling - const localFileResult = await uploadTool.execute( + console.log('๐Ÿงช Testing EXPERIMENTAL schema override + preExecute for external documents...'); + + // EXPERIMENTAL: Create a tool for external document references + const externalDocumentTool = tools.getTool('hris_upload_employee_document', { + experimental_schemaOverride: createExternalDocumentSchemaOverride(), + experimental_preExecute: createExternalDocumentPreExecute(), + }); + + const externalResult = await externalDocumentTool.execute( { - document_id: sampleFilePath, // Use document_id instead of file_path + document_reference: 'external-doc-123', // Simplified schema - just reference id: 'c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA', category: { value: 'shared' }, }, { dryRun: true, - experimental_PreExecute: localFileHandler, } ); - console.log('โœ… Local file handling successful'); + console.log('โœ… External document schema override + preExecute successful'); + const externalParams = externalResult.mappedParams as Record; assert( - (localFileResult.mappedParams as Record).file_format.value === - 'txt', - 'File format was not mapped correctly' + externalParams.name.includes('external-doc-123'), + 'External document name was not transformed correctly' ); - console.log('๐Ÿงช Testing EXPERIMENTAL external document handling...'); + console.log('๐Ÿงช Testing EXPERIMENTAL multi-source schema override + preExecute...'); - // EXPERIMENTAL: Test external document handler - const externalHandler = createExternalDocumentHandler(); + // EXPERIMENTAL: Create a tool that supports both local and external documents + const multiSourceTool = tools.getTool('hris_upload_employee_document', { + experimental_schemaOverride: createMultiSourceSchemaOverride(), + experimental_preExecute: createMultiSourcePreExecute([__dirname]), + }); - const externalResult = await uploadTool.execute( + // Test with local file + const multiSourceLocalResult = await multiSourceTool.execute( { - document_reference: 'external-doc-123', + doc_id: sampleFilePath, // Local file takes precedence id: 'c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA', category: { value: 'shared' }, }, { dryRun: true, - experimental_PreExecute: externalHandler, } ); - console.log('โœ… External document handling successful'); + console.log('โœ… Multi-source (local) schema override + preExecute successful'); + const multiLocalParams = multiSourceLocalResult.mappedParams as Record; assert( - (externalResult.mappedParams as Record).name.includes('external-doc-123'), - 'External document name was not mapped correctly' + multiLocalParams.name === 'sample-document.txt', + 'Multi-source local document name was not transformed correctly' ); - console.log('๐Ÿงช Testing EXPERIMENTAL multi-source handler...'); - - // EXPERIMENTAL: Test multi-source handler with fallback - const multiSourceHandler = createMultiSourceHandler([__dirname]); - - const multiSourceResult = await uploadTool.execute( + // Test with external reference + const multiSourceExternalResult = await multiSourceTool.execute( { - document_id: sampleFilePath, + document_reference: 'external-doc-456', // Fallback to external id: 'c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA', category: { value: 'shared' }, }, { dryRun: true, - experimental_PreExecute: multiSourceHandler, } ); - console.log('โœ… Multi-source handling successful'); + console.log('โœ… Multi-source (external) schema override + preExecute successful'); + const multiExternalParams = multiSourceExternalResult.mappedParams as Record; assert( - (multiSourceResult.mappedParams as Record).name === 'sample-document.txt', - 'Multi-source document name was not mapped correctly' + multiExternalParams.name.includes('external-doc-456'), + 'Multi-source external document name was not transformed correctly' ); - console.log('๐ŸŽ‰ All EXPERIMENTAL document handling tests passed!'); + console.log('๐ŸŽ‰ All EXPERIMENTAL schema override + preExecute tests passed!'); + console.log(''); + console.log('๐Ÿ“‹ API Summary:'); + console.log(' 1. experimental_schemaOverride: Changes tool input schema at creation time'); + console.log( + ' 2. experimental_preExecute: Transforms from override schema to original API format' + ); + console.log(' 3. Two-stage transformation: Schema definition โ†’ Parameter transformation'); console.log(''); console.log('โš ๏ธ IMPORTANT: This is experimental functionality.'); console.log(' The API may change in future versions.'); diff --git a/examples/index.ts b/examples/index.ts index 51f3b9ac..0f06a4e4 100644 --- a/examples/index.ts +++ b/examples/index.ts @@ -76,7 +76,6 @@ quickstart(); * - [AI SDK Integration](ai-sdk-integration.md) * - [Error Handling](error-handling.md) * - [EXPERIMENTAL: Document Handling](experimental-document-handling.md) - * - [EXPERIMENTAL: Transformations](experimental_transformations.md) * - [Custom Base URL](custom-base-url.md) * - [Account ID Usage](account-id-usage.md) */ diff --git a/src/index.ts b/src/index.ts index fdf793fd..cef2c094 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,9 +24,9 @@ export type { ExecuteConfig, ExecuteOptions, Experimental_PreExecuteFunction, + Experimental_SchemaOverride, + Experimental_ToolCreationOptions, JsonDict, ParameterLocation, - ParameterTransformer, - ParameterTransformerMap, ToolDefinition, } from './types'; diff --git a/src/tool.ts b/src/tool.ts index ffcdb223..aa116f66 100644 --- a/src/tool.ts +++ b/src/tool.ts @@ -1,13 +1,12 @@ import { type ToolSet, jsonSchema } from 'ai'; import type { ChatCompletionTool } from 'openai/resources/chat/completions'; -import { ParameterMapper } from './modules/parameterMapper'; import { RequestBuilder } from './modules/requestBuilder'; import type { ExecuteConfig, ExecuteOptions, + Experimental_PreExecuteFunction, + Experimental_ToolCreationOptions, JsonDict, - ParameterTransformer, - ParameterTransformerMap, ToolParameters, } from './types'; import { StackOneError } from './utils/errors'; @@ -21,8 +20,8 @@ export class BaseTool { description: string; parameters: ToolParameters; executeConfig: ExecuteConfig; - protected parameterMapper: ParameterMapper; protected requestBuilder: RequestBuilder; + protected experimental_preExecute?: Experimental_PreExecuteFunction; constructor( name: string, @@ -30,28 +29,14 @@ export class BaseTool { parameters: ToolParameters, executeConfig: ExecuteConfig, headers?: Record, - transformers?: ParameterTransformerMap + experimental_preExecute?: Experimental_PreExecuteFunction ) { this.name = name; this.description = description; this.parameters = parameters; this.executeConfig = executeConfig; - this.parameterMapper = new ParameterMapper(transformers); this.requestBuilder = new RequestBuilder(executeConfig, headers); - } - - /** - * Add a parameter transformer - */ - public setParameterTransformer(sourceParam: string, config: ParameterTransformer): void { - this.parameterMapper.addTransformer(sourceParam, config); - } - - /** - * Get a parameter transformer - */ - public getParameterTransformer(sourceParam: string): ParameterTransformer | undefined { - return this.parameterMapper.getTransformer(sourceParam); + this.experimental_preExecute = experimental_preExecute; } /** @@ -85,19 +70,21 @@ export class BaseTool { ); } - // Apply experimental preExecute function if provided - let processedParams = inputParams; - if (options?.experimental_PreExecute) { - processedParams = await options.experimental_PreExecute( - typeof inputParams === 'string' ? JSON.parse(inputParams) : inputParams || {} - ); - } + // Convert string params to object + const params = typeof inputParams === 'string' ? JSON.parse(inputParams) : inputParams || {}; + + // Apply experimental preExecute function (either from tool creation or execution options) + let processedParams = params; + + // Prioritize tool-level experimental_preExecute over execution-time experimental_PreExecute + const preExecuteFunction = this.experimental_preExecute || options?.experimental_PreExecute; - // Map parameters from user input to API parameters - const mappedParams = this.parameterMapper.mapParameters(processedParams); + if (preExecuteFunction) { + processedParams = await preExecuteFunction(params); + } - // Execute the request - return await this.requestBuilder.execute(mappedParams, options); + // Execute the request directly with processed parameters + return await this.requestBuilder.execute(processedParams, options); } catch (error) { if (error instanceof StackOneError) { throw error; @@ -159,6 +146,17 @@ export class BaseTool { * StackOne-specific tool class with additional functionality */ export class StackOneTool extends BaseTool { + constructor( + name: string, + description: string, + parameters: ToolParameters, + executeConfig: ExecuteConfig, + headers?: Record, + experimental_preExecute?: Experimental_PreExecuteFunction + ) { + super(name, description, parameters, executeConfig, headers, experimental_preExecute); + } + /** * Get the current account ID */ @@ -195,8 +193,49 @@ export class Tools implements Iterable { /** * Get a tool by name */ - getTool(name: string): BaseTool | undefined { - return this.tools.find((tool) => tool.name === name); + getTool(name: string): BaseTool | undefined; + getTool(name: string, options: Experimental_ToolCreationOptions): BaseTool | undefined; + getTool(name: string, options?: Experimental_ToolCreationOptions): BaseTool | undefined { + const originalTool = this.tools.find((tool) => tool.name === name); + if (!originalTool) { + return undefined; + } + + // If no experimental options provided, return original tool + if (!options?.experimental_schemaOverride && !options?.experimental_preExecute) { + return originalTool; + } + + // Create a new tool with experimental schema override and preExecute + let parameters = originalTool.parameters; + + // Apply schema override if provided + if (options.experimental_schemaOverride) { + parameters = options.experimental_schemaOverride(originalTool.parameters); + } + + // Create new tool instance with modified schema and preExecute function + if (originalTool instanceof StackOneTool) { + const newTool = new StackOneTool( + originalTool.name, + originalTool.description, + parameters, + originalTool.executeConfig, + originalTool.getHeaders(), + options.experimental_preExecute + ); + return newTool; + } else { + const newTool = new BaseTool( + originalTool.name, + originalTool.description, + parameters, + originalTool.executeConfig, + originalTool.getHeaders(), + options.experimental_preExecute + ); + return newTool; + } } /** diff --git a/src/toolsets/base.ts b/src/toolsets/base.ts index b9e4f873..7e534a11 100644 --- a/src/toolsets/base.ts +++ b/src/toolsets/base.ts @@ -1,10 +1,5 @@ import { type BaseTool, Tools } from '../tool'; -import { - ParameterLocation, - type ParameterTransformer, - type ParameterTransformerMap, - type ToolDefinition, -} from '../types'; +import { type Experimental_ToolCreationOptions, type ToolDefinition } from '../types'; /** * Base exception for toolset errors @@ -56,7 +51,6 @@ export interface BaseToolSetConfig { baseUrl?: string; authentication?: AuthenticationConfig; headers?: Record; - transformers?: ParameterTransformerMap; _oasUrl?: string; } @@ -68,7 +62,6 @@ export abstract class ToolSet { protected authentication?: AuthenticationConfig; protected headers: Record; protected tools: BaseTool[] = []; - protected transformers: ParameterTransformerMap; /** * Initialize a toolset with optional configuration @@ -78,7 +71,6 @@ export abstract class ToolSet { this.baseUrl = config?.baseUrl; this.authentication = config?.authentication; this.headers = config?.headers || {}; - this.transformers = new Map(config?.transformers || []); // Set Authentication headers if provided if (this.authentication) { @@ -113,15 +105,6 @@ export abstract class ToolSet { } } - /** - * Add a parameter transformer to the toolset - * @param sourceParam Source parameter name - * @param config Transformer configuration - */ - public setParameterTransformer(sourceParam: string, config: ParameterTransformer): void { - this.transformers.set(sourceParam, config); - } - /** * Check if a tool name matches a filter pattern * @param toolName Tool name to check @@ -206,74 +189,48 @@ export abstract class ToolSet { * @param headers Optional headers to apply to the tool * @returns Tool instance */ - getTool(name: string, headers?: Record): BaseTool { + getTool(name: string, headers?: Record): BaseTool; + getTool(name: string, options: Experimental_ToolCreationOptions): BaseTool; + getTool( + name: string, + headersOrOptions?: Record | Experimental_ToolCreationOptions + ): BaseTool { const tool = this.tools.find((tool) => tool.name === name); if (!tool) { throw new ToolSetError(`Tool with name ${name} not found`); } - const mergedHeaders = { ...this.headers, ...headers }; - if (mergedHeaders && tool.setHeaders) { - tool.setHeaders(mergedHeaders); - } - return tool; - } - /** - * Process transformed parameters in a tool definition - * @param toolDef Tool definition to process - * @returns Updated tool definition with transformed parameters - */ - protected processDerivedValues(toolDef: ToolDefinition): ToolDefinition { - // Create a copy of the tool definition to avoid modifying the original - const processedDef = { ...toolDef }; - - // Process each parameter in the execute config - for (const param of processedDef.execute.params) { - // Skip parameters that are already derived - if (param.derivedFrom) continue; + // Determine if the second parameter is headers or experimental options + const isExperimentalOptions = + headersOrOptions && + ('experimental_schemaOverride' in headersOrOptions || + 'experimental_preExecute' in headersOrOptions); - // Check if this parameter is a source for any derivation config - if (this.transformers.has(param.name)) { - const config = this.transformers.get(param.name); + if (isExperimentalOptions) { + const options = headersOrOptions as Experimental_ToolCreationOptions; - // Only proceed if config exists - if (config) { - // Add transformed parameters to the tool definition - for (const targetParam of Object.keys(config.transforms)) { - // Skip if the parameter already exists in execute params - if (processedDef.execute.params.some((p) => p.name === targetParam)) continue; + // Get the tools collection and use its getTool method with experimental options + const toolsCollection = new Tools([tool]); + const experimentalTool = toolsCollection.getTool(name, options); - // Add the transformed parameter to execute params - processedDef.execute.params.push({ - name: targetParam, - location: this.determineParameterLocation(targetParam), - type: param.type, - derivedFrom: param.name, - }); - } - } + if (!experimentalTool) { + throw new ToolSetError(`Tool with name ${name} not found`); } - } - return processedDef; - } + // Apply instance headers to the tool + if (this.headers && experimentalTool.setHeaders) { + experimentalTool.setHeaders(this.headers); + } - /** - * Determine the location of a parameter - * @param paramName Parameter name - * @returns Parameter location (HEADER, QUERY, PATH, or BODY) - */ - protected determineParameterLocation(paramName: string): ParameterLocation { - // Check if the parameter exists in any of the tools - for (const tool of this.tools) { - // Check if the parameter exists in the execute config - const param = tool.executeConfig.params.find((p) => p.name === paramName); - if (param) { - return param.location; + return experimentalTool; + } else { + // Traditional headers-based approach + const headers = headersOrOptions as Record | undefined; + const mergedHeaders = { ...this.headers, ...headers }; + if (mergedHeaders && tool.setHeaders) { + tool.setHeaders(mergedHeaders); } + return tool; } - - // Default to BODY if not found - return ParameterLocation.BODY; } } diff --git a/src/toolsets/openapi.ts b/src/toolsets/openapi.ts index a9a0fb11..f6e21bdd 100644 --- a/src/toolsets/openapi.ts +++ b/src/toolsets/openapi.ts @@ -39,7 +39,6 @@ export class OpenAPIToolSet extends ToolSet { baseUrl: config?.baseUrl, authentication: config?.authentication, headers: config?.headers, - transformers: config?.transformers, }); if ('filePath' in config) { @@ -67,7 +66,6 @@ export class OpenAPIToolSet extends ToolSet { baseUrl: config.baseUrl, authentication: config.authentication, headers: config.headers, - transformers: config.transformers, _oasUrl: config.url, }); @@ -88,11 +86,8 @@ export class OpenAPIToolSet extends ToolSet { // Process each tool for (const [toolName, toolDef] of Object.entries(tools)) { - // Process derived values - const processedDef = this.processDerivedValues(toolDef); - // Create tool - const tool = this.createTool(toolName, processedDef); + const tool = this.createTool(toolName, toolDef); // Add tool to the list this.tools.push(tool); @@ -116,11 +111,8 @@ export class OpenAPIToolSet extends ToolSet { // Process each tool for (const [toolName, toolDef] of Object.entries(tools)) { - // Process derived values - const processedDef = this.processDerivedValues(toolDef); - // Create tool - const tool = this.createTool(toolName, processedDef); + const tool = this.createTool(toolName, toolDef); // Add tool to the list this.tools.push(tool); @@ -146,8 +138,7 @@ export class OpenAPIToolSet extends ToolSet { description, parameters, execute, - this.headers, - this.transformers + this.headers ); return tool; diff --git a/src/toolsets/stackone.ts b/src/toolsets/stackone.ts index 66ff9ce5..907b5a92 100644 --- a/src/toolsets/stackone.ts +++ b/src/toolsets/stackone.ts @@ -75,7 +75,6 @@ export class StackOneToolSet extends ToolSet { baseUrl: config?.baseUrl, authentication, headers, - transformers: config?.transformers, }); this.accountId = accountId; @@ -123,22 +122,18 @@ export class StackOneToolSet extends ToolSet { for (const [_, tools] of Object.entries(specs)) { // Process each tool for (const [toolName, toolDef] of Object.entries(tools)) { - // Process derived values - const processedDef = this.processDerivedValues(toolDef); - // Remove account ID parameter if not provided if (!this.accountId) { - this.removeAccountIdParameter(processedDef); + this.removeAccountIdParameter(toolDef); } // Create tool const tool = new StackOneTool( toolName, - processedDef.description, - processedDef.parameters, - processedDef.execute, - this.headers, - this.transformers + toolDef.description, + toolDef.parameters, + toolDef.execute, + this.headers ); // Add tool to the list diff --git a/src/types.ts b/src/types.ts index 2af2ea53..3e3325c9 100644 --- a/src/types.ts +++ b/src/types.ts @@ -25,30 +25,20 @@ export type JsonSchemaProperties = Record; export type JsonSchemaType = JSONSchema7['type']; /** - * Type definition for a derivation function - * Takes a source value and returns a derived value + * EXPERIMENTAL: Function to override the tool schema at creation time + * Takes the original tool parameters and returns a new schema + * @param originalSchema - The original tool parameters schema from OpenAPI + * @returns New schema definition for the tool */ -export type TransformFunction = (sourceValue: unknown) => unknown; +export type Experimental_SchemaOverride = (originalSchema: ToolParameters) => ToolParameters; /** - * Type definition for a map of derivation functions - * Keys are transformed parameter names, values are functions to derive that parameter - */ -export type TransformFunctions = Record; - -/** - * Configuration for parameter transformations - * The key in the derivation configs map is the source parameter name - */ -export type ParameterTransformer = { - transforms: TransformFunctions; -}; - -/** - * Type definition for a map of derivation configurations - * Keys are source parameter names, values are derivation functions + * EXPERIMENTAL: Function to preprocess parameters before tool execution + * Transforms parameters from override schema format back to original API format + * @param params - The input parameters in override schema format + * @returns Parameters in original API format */ -export type ParameterTransformerMap = Map; +export type Experimental_PreExecuteFunction = (params: JsonDict) => Promise | JsonDict; /** * Valid locations for parameters in requests @@ -76,12 +66,21 @@ export interface ExecuteConfig { } /** - * EXPERIMENTAL: Function to preprocess parameters before tool execution - * Can be used to transform parameters, fetch documents from external sources, etc. - * @param params - The input parameters - * @returns Modified parameters or Promise + * EXPERIMENTAL: Options for creating tools with schema overrides and preExecute functions */ -export type Experimental_PreExecuteFunction = (params: JsonDict) => Promise | JsonDict; +export interface Experimental_ToolCreationOptions { + /** + * EXPERIMENTAL: Function to override the tool schema at creation time + * Takes the original schema and returns a new schema for the tool + */ + experimental_schemaOverride?: Experimental_SchemaOverride; + + /** + * EXPERIMENTAL: Function to preprocess parameters before execution + * Transforms parameters from override schema format back to original API format + */ + experimental_preExecute?: Experimental_PreExecuteFunction; +} /** * Options for executing a tool @@ -96,6 +95,7 @@ export interface ExecuteOptions { /** * EXPERIMENTAL: Function to preprocess parameters before execution * Allows for document fetching, parameter override, etc. + * @deprecated Use experimental_preExecute in tool creation options instead */ experimental_PreExecute?: Experimental_PreExecuteFunction; } From b7d5cb86df6d8d8e8229b37e948e85c8cfd81c33 Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Fri, 6 Jun 2025 20:08:05 +0100 Subject: [PATCH 10/16] linting --- .../__snapshots__/openapi-parser.spec.ts.snap | 2072 +++++++------ src/tool.ts | 2 - src/toolsets/base.ts | 18 +- src/toolsets/openapi.ts | 8 +- .../tests/__snapshots__/stackone.spec.ts.snap | 2715 ++++++++--------- 5 files changed, 2509 insertions(+), 2306 deletions(-) diff --git a/src/openapi/tests/__snapshots__/openapi-parser.spec.ts.snap b/src/openapi/tests/__snapshots__/openapi-parser.spec.ts.snap index 2fda2ac7..ae96bb6e 100644 --- a/src/openapi/tests/__snapshots__/openapi-parser.spec.ts.snap +++ b/src/openapi/tests/__snapshots__/openapi-parser.spec.ts.snap @@ -117,7 +117,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "enum": [ "true", "false", - "unmapped_value", null, ], "example": "true", @@ -135,7 +134,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "description": "The file format of the file", "properties": { "source_value": { - "example": "application/pdf", + "example": "abc", "oneOf": [ { "type": "string", @@ -1404,110 +1403,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, }, - "hris_cancel_employee_time_off_request": { - "description": "Cancel Employee Time Off Request", - "execute": { - "bodyType": "json", - "method": "DELETE", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "path", - "name": "id", - "type": "string", - }, - { - "location": "path", - "name": "subResourceId", - "type": "string", - }, - ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off/{subResourceId}", - }, - "parameters": { - "properties": { - "id": { - "type": "string", - }, - "subResourceId": { - "type": "string", - }, - "x-account-id": { - "description": "The account identifier", - "type": "string", - }, - }, - "required": [ - "id", - "subResourceId", - ], - "type": "object", - }, - }, - "hris_complete_employee_task": { - "description": "Complete Employee Task", - "execute": { - "bodyType": "json", - "method": "PATCH", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "path", - "name": "id", - "type": "string", - }, - { - "location": "path", - "name": "subResourceId", - "type": "string", - }, - { - "location": "query", - "name": "proxy", - "type": "string", - }, - { - "location": "body", - "name": "comment", - "type": "string", - }, - ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks/{subResourceId}", - }, - "parameters": { - "properties": { - "comment": { - "description": "Comment or note about the task completion", - "example": "All required documents have been submitted", - "type": "string", - }, - "id": { - "type": "string", - }, - "proxy": {}, - "subResourceId": { - "type": "string", - }, - "x-account-id": { - "description": "The account identifier", - "type": "string", - }, - }, - "required": [ - "id", - "subResourceId", - ], - "type": "object", - }, - }, "hris_create_employee": { "description": "Creates an employee", "execute": { @@ -1564,6 +1459,11 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "name": "work_phone_number", "type": "string", }, + { + "location": "body", + "name": "job_id", + "type": "string", + }, { "location": "body", "name": "job_title", @@ -1634,6 +1534,16 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "name": "start_date", "type": "string", }, + { + "location": "body", + "name": "employment_type", + "type": "object", + }, + { + "location": "body", + "name": "employment_contract_type", + "type": "object", + }, { "location": "body", "name": "employment_status", @@ -2179,7 +2089,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "date_of_birth": { "description": "The employee date_of_birth", - "example": "1990-01-01T00:00:00.000Z", + "example": "1990-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -2206,51 +2116,103 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "employment": { "description": "The employee employment", "properties": { - "end_date": { - "description": "The end date of employment", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "grade": { - "description": "Represents the employeeโ€™s position within the organizational hierarchy.", + "employment_contract_type": { + "description": "The employment work schedule type (e.g., full-time, part-time)", + "example": "full_time", "properties": { - "description": { - "description": "description of the grade", - "example": "Mid-level employee demonstrating proficiency and autonomy.", - "type": "string", + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], }, - "id": { - "description": "The reference id", - "example": "1687-3", + "value": { + "enum": [ + "full_time", + "shifts", + "part_time", + "unmapped_value", + null, + ], "type": "string", }, - "name": { - "description": "The reference name", - "example": "1687-4", - "type": "string", + }, + "type": "object", + }, + "employment_type": { + "description": "The type of employment (e.g., contractor, permanent)", + "example": "permanent", + "properties": { + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], }, - "remote_id": { - "description": "Provider's unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "value": { + "enum": [ + "contractor", + "intern", + "permanent", + "apprentice", + "freelance", + "terminated", + "temporary", + "seasonal", + "volunteer", + "probation", + "internal", + "external", + "expatriate", + "employer_of_record", + "casual", + "Programme", + "unmapped_value", + null, + ], "type": "string", }, }, "type": "object", }, + "id": { + "description": "Unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, "job_title": { "description": "The job title of the employee", "example": "Software Engineer", "type": "string", }, - "passthrough": { - "additionalProperties": true, - "description": "Value to pass through to the provider", - "example": { - "other_known_names": "John Doe", - }, - "type": "object", - }, "pay_currency": { "description": "The currency used for pay", "example": "USD", @@ -2352,9 +2314,10 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "example": "40.00", "type": "string", }, - "payroll_code": { - "description": "The payroll code of the employee", - "example": "PC1", + "time_worked": { + "description": "The time worked for the employee in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", "type": "string", }, "unified_custom_fields": { @@ -2366,56 +2329,42 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "type": "object", }, - "work_time": { - "properties": { - "duration": { - "description": "The work time duration in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", + }, + "type": "object", + }, + "employment_contract_type": { + "description": "The employment work schedule type (e.g., full-time, part-time)", + "example": "full_time", + "properties": { + "source_value": { + "oneOf": [ + { "type": "string", }, - "duration_unit": { - "description": "The duration unit of the work time", - "example": "month", - "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], - }, - "value": { - "description": "The unified value for the period.", - "enum": [ - "day", - "week", - "month", - "year", - "unmapped_value", - null, - ], - "example": "month", - "type": "string", - }, - }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { "type": "object", }, - }, - "type": "object", + { + "items": {}, + "type": "array", + }, + ], + }, + "value": { + "enum": [ + "full_time", + "shifts", + "part_time", + "unmapped_value", + null, + ], + "type": "string", }, }, "type": "object", @@ -2460,6 +2409,56 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "type": "object", }, + "employment_type": { + "description": "The employee employment type", + "example": "full_time", + "properties": { + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], + }, + "value": { + "enum": [ + "contractor", + "intern", + "permanent", + "apprentice", + "freelance", + "terminated", + "temporary", + "seasonal", + "volunteer", + "probation", + "internal", + "external", + "expatriate", + "employer_of_record", + "casual", + "Programme", + "unmapped_value", + null, + ], + "type": "string", + }, + }, + "type": "object", + }, "ethnicity": { "description": "The employee ethnicity", "example": "white", @@ -2550,7 +2549,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "hire_date": { "description": "The employee hire date", - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -2917,8 +2916,13 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "type": "object", }, + "job_id": { + "description": "The employee job id", + "example": "R-6789", + "type": "string", + }, "job_title": { - "description": "If the source of the job_title is the Employee's current Employment, and that Employment pertains exclusively to this Employee, then the active Employment job_title will also be written", + "description": "The employee job title", "example": "Physicist", "type": "string", }, @@ -3473,7 +3477,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "preferred_language": { "description": "The employee preferred language", - "example": "eng", + "example": "en_US", "properties": { "source_value": { "oneOf": [ @@ -3513,7 +3517,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "cat", "cha", "ces", - "dan", "deu", "div", "dzo", @@ -3530,7 +3533,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "fra", "gle", "grn", - "guj", "glv", "heb", "hin", @@ -3561,8 +3563,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "mah", "mri", "mkd", - "mon", - "mar", "msa", "mlt", "mya", @@ -3577,18 +3577,15 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "pol", "pus", "por", - "que", "rar", "roh", "rup", "ron", "rus", "kin", - "sme", "sag", "sin", "slk", - "slv", "smo", "sna", "som", @@ -3598,24 +3595,11 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "swe", "swa", "tam", - "tel", "tgk", "tha", "tir", "tig", - "tuk", - "tsn", - "ton", - "tur", - "tso", - "ukr", - "urd", - "uzb", - "ven", - "vie", - "xho", "zho", - "zul", "unmapped_value", null, ], @@ -3627,7 +3611,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "start_date": { "description": "The employee start date", - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -4036,7 +4020,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "string", }, { - "location": "path", + "location": "body", "name": "id", "type": "string", }, @@ -4072,32 +4056,17 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, { "location": "body", - "name": "effective_date", - "type": "string", + "name": "employment_type", + "type": "object", }, { "location": "body", - "name": "end_date", - "type": "string", - }, - { - "location": "body", - "name": "grade", - "type": "object", - }, - { - "location": "body", - "name": "work_time", + "name": "employment_contract_type", "type": "object", }, { "location": "body", - "name": "payroll_code", - "type": "string", - }, - { - "location": "body", - "name": "job_id", + "name": "time_worked", "type": "string", }, { @@ -4110,50 +4079,96 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "parameters": { "properties": { - "effective_date": { - "description": "The effective date of the employment contract", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "end_date": { - "description": "The end date of employment", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "grade": { - "description": "Represents the employeeโ€™s position within the organizational hierarchy.", + "employment_contract_type": { + "description": "The employment work schedule type (e.g., full-time, part-time)", + "example": "full_time", "properties": { - "description": { - "description": "description of the grade", - "example": "Mid-level employee demonstrating proficiency and autonomy.", - "type": "string", + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], }, - "id": { - "description": "The reference id", - "example": "1687-3", + "value": { + "enum": [ + "full_time", + "shifts", + "part_time", + "unmapped_value", + null, + ], "type": "string", }, - "name": { - "description": "The reference name", - "example": "1687-4", - "type": "string", + }, + "type": "object", + }, + "employment_type": { + "description": "The type of employment (e.g., contractor, permanent)", + "example": "permanent", + "properties": { + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], }, - "remote_id": { - "description": "Provider's unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "value": { + "enum": [ + "contractor", + "intern", + "permanent", + "apprentice", + "freelance", + "terminated", + "temporary", + "seasonal", + "volunteer", + "probation", + "internal", + "external", + "expatriate", + "employer_of_record", + "casual", + "Programme", + "unmapped_value", + null, + ], "type": "string", }, }, "type": "object", }, "id": { - "type": "string", - }, - "job_id": { - "description": "The employee job id", - "example": "5290", + "description": "Unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", "type": "string", }, "job_title": { @@ -4270,9 +4285,10 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "example": "40.00", "type": "string", }, - "payroll_code": { - "description": "The payroll code of the employee", - "example": "PC1", + "time_worked": { + "description": "The time worked for the employee in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", "type": "string", }, "unified_custom_fields": { @@ -4284,57 +4300,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "type": "object", }, - "work_time": { - "properties": { - "duration": { - "description": "The work time duration in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", - "type": "string", - }, - "duration_unit": { - "description": "The duration unit of the work time", - "example": "month", - "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], - }, - "value": { - "description": "The unified value for the period.", - "enum": [ - "day", - "week", - "month", - "year", - "unmapped_value", - null, - ], - "example": "month", - "type": "string", - }, - }, - "type": "object", - }, - }, - "type": "object", - }, "x-account-id": { "description": "The account identifier", "type": "string", @@ -4432,7 +4397,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "3", "4", "5", - "unmapped_value", null, ], "type": "string", @@ -4485,7 +4449,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "3", "4", "5", - "unmapped_value", null, ], "type": "string", @@ -4525,6 +4488,11 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "name": "id", "type": "string", }, + { + "location": "body", + "name": "employee_id", + "type": "string", + }, { "location": "body", "name": "approver_id", @@ -4580,10 +4548,15 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "example": "1687-4", "type": "string", }, + "employee_id": { + "description": "The employee ID", + "example": "1687-3", + "type": "string", + }, "end_date": { - "description": "Inclusive end date of the time off request (ISO8601 date-time without timezone). The time off includes this day", - "example": "2021-01-01T01:01:01.000", - "format": "datetime-local", + "description": "The end date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", "type": "string", }, "end_half_day": { @@ -4632,9 +4605,9 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, "start_date": { - "description": "The start date of the time off request (ISO8601 date-time without timezone)", - "example": "2021-01-01T01:01:01.000", - "format": "datetime-local", + "description": "The start date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", "type": "string", }, "start_half_day": { @@ -4683,7 +4656,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "rejected", "pending", "deleted", - "draft", "unmapped_value", null, ], @@ -4817,7 +4789,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "description": "The file format of the file", "properties": { "source_value": { - "example": "application/pdf", + "example": "abc", "oneOf": [ { "type": "string", @@ -6425,7 +6397,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "driver_license", "birth_certificate", "other", - "unmapped_value", null, ], "type": "string", @@ -6434,12 +6405,12 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, "valid_from": { - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, "valid_to": { - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -6454,11 +6425,11 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, }, - "hris_download_employee_document": { - "description": "Download Employee Document", + "hris_create_time_off_request": { + "description": "Creates a time off request", "execute": { "bodyType": "json", - "method": "GET", + "method": "POST", "params": [ { "location": "header", @@ -6466,126 +6437,314 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "string", }, { - "location": "path", - "name": "id", + "location": "body", + "name": "employee_id", "type": "string", }, { - "location": "path", - "name": "subResourceId", + "location": "body", + "name": "approver_id", "type": "string", }, { - "location": "query", - "name": "format", - "type": "string", + "location": "body", + "name": "status", + "type": "object", }, { - "location": "query", - "name": "export_format", - "type": "string", - }, - ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/documents/{subResourceId}/download", - }, - "parameters": { - "properties": { - "export_format": { - "description": "The export format of the file", - "example": "text/plain", - "type": "string", - }, - "format": { - "description": "The format to download the file in", - "example": "base64", - "type": "string", - }, - "id": { - "type": "string", - }, - "subResourceId": { + "location": "body", + "name": "start_date", "type": "string", }, - "x-account-id": { - "description": "The account identifier", + { + "location": "body", + "name": "end_date", "type": "string", }, - }, - "required": [ - "id", - "subResourceId", - ], - "type": "object", - }, - }, - "hris_get_benefit": { - "description": "Get Benefit", - "execute": { - "bodyType": "json", - "method": "GET", - "params": [ { - "location": "header", - "name": "x-account-id", + "location": "body", + "name": "start_half_day", "type": "string", }, { - "location": "path", - "name": "id", + "location": "body", + "name": "end_half_day", "type": "string", }, { - "location": "query", - "name": "raw", - "type": "boolean", + "location": "body", + "name": "time_off_policy_id", + "type": "string", }, { - "location": "query", - "name": "proxy", + "location": "body", + "name": "reason", "type": "object", }, { - "location": "query", - "name": "fields", - "type": "string", + "location": "body", + "name": "passthrough", + "type": "object", }, ], - "url": "https://api.stackone.com/unified/hris/benefits/{id}", + "url": "https://api.stackone.com/unified/hris/time_off", }, "parameters": { "properties": { - "fields": { - "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,benefit_type,provider,description,created_at,updated_at", + "approver_id": { + "description": "The approver ID", + "example": "1687-4", "type": "string", }, - "id": { + "employee_id": { + "description": "The employee ID", + "example": "1687-3", "type": "string", }, - "proxy": { - "additionalProperties": true, - "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", - "type": "object", - }, - "raw": { - "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", - "type": "boolean", - }, - "x-account-id": { - "description": "The account identifier", + "end_date": { + "description": "The end date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", "type": "string", }, - }, - "required": [ - "id", - ], - "type": "object", - }, - }, - "hris_get_company": { - "description": "Get Company", - "execute": { - "bodyType": "json", + "end_half_day": { + "description": "True if the end of the time off request ends half way through the day", + "example": true, + "oneOf": [ + { + "type": "boolean", + }, + { + "enum": [ + "true", + "false", + ], + "type": "string", + }, + ], + }, + "passthrough": { + "additionalProperties": true, + "description": "Value to pass through to the provider", + "example": { + "other_known_names": "John Doe", + }, + "type": "object", + }, + "reason": { + "properties": { + "id": { + "description": "Unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, + "name": { + "type": "string", + }, + "remote_id": { + "description": "Provider's unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, + }, + "type": "object", + }, + "start_date": { + "description": "The start date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "start_half_day": { + "description": "True if the start of the time off request begins half way through the day", + "example": true, + "oneOf": [ + { + "type": "boolean", + }, + { + "enum": [ + "true", + "false", + ], + "type": "string", + }, + ], + }, + "status": { + "description": "The status of the time off request", + "properties": { + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], + }, + "value": { + "enum": [ + "approved", + "cancelled", + "rejected", + "pending", + "deleted", + "unmapped_value", + null, + ], + "type": "string", + }, + }, + "type": "object", + }, + "time_off_policy_id": { + "description": "The time off policy id associated with this time off request", + "example": "cx280928933", + "type": "string", + }, + "x-account-id": { + "description": "The account identifier", + "type": "string", + }, + }, + "required": undefined, + "type": "object", + }, + }, + "hris_download_employee_document": { + "description": "Download Employee Document", + "execute": { + "bodyType": "json", + "method": "GET", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "path", + "name": "id", + "type": "string", + }, + { + "location": "path", + "name": "subResourceId", + "type": "string", + }, + { + "location": "query", + "name": "format", + "type": "string", + }, + ], + "url": "https://api.stackone.com/unified/hris/employees/{id}/documents/{subResourceId}/download", + }, + "parameters": { + "properties": { + "format": { + "description": "The format to download the file in", + "example": "base64", + "type": "string", + }, + "id": { + "type": "string", + }, + "subResourceId": { + "type": "string", + }, + "x-account-id": { + "description": "The account identifier", + "type": "string", + }, + }, + "required": [ + "id", + "subResourceId", + ], + "type": "object", + }, + }, + "hris_get_benefit": { + "description": "Get Benefit", + "execute": { + "bodyType": "json", + "method": "GET", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "path", + "name": "id", + "type": "string", + }, + { + "location": "query", + "name": "raw", + "type": "boolean", + }, + { + "location": "query", + "name": "proxy", + "type": "object", + }, + { + "location": "query", + "name": "fields", + "type": "string", + }, + ], + "url": "https://api.stackone.com/unified/hris/benefits/{id}", + }, + "parameters": { + "properties": { + "fields": { + "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", + "example": "id,remote_id,name,benefit_type,provider,description,created_at,updated_at", + "type": "string", + }, + "id": { + "type": "string", + }, + "proxy": { + "additionalProperties": true, + "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", + "type": "object", + }, + "raw": { + "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", + "type": "boolean", + }, + "x-account-id": { + "description": "The account identifier", + "type": "string", + }, + }, + "required": [ + "id", + ], + "type": "object", + }, + }, + "hris_get_company": { + "description": "Get Company", + "execute": { + "bodyType": "json", "method": "GET", "params": [ { @@ -6684,7 +6843,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", + "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", "type": "string", }, "id": { @@ -6827,7 +6986,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,benefits,employee_number,national_identity_number,national_identity_numbers,skills", + "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,benefits,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,employee_number,national_identity_number,national_identity_numbers,skills", "type": "string", }, "id": { @@ -7147,7 +7306,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "id": { @@ -7250,89 +7409,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, }, - "hris_get_employee_task": { - "description": "Get Employee Task", - "execute": { - "bodyType": "json", - "method": "GET", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "path", - "name": "id", - "type": "string", - }, - { - "location": "path", - "name": "subResourceId", - "type": "string", - }, - { - "location": "query", - "name": "raw", - "type": "boolean", - }, - { - "location": "query", - "name": "proxy", - "type": "object", - }, - { - "location": "query", - "name": "fields", - "type": "string", - }, - { - "location": "query", - "name": "expand", - "type": "string", - }, - ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks/{subResourceId}", - }, - "parameters": { - "properties": { - "expand": { - "description": "The comma separated list of fields that will be expanded in the response", - "example": "attachments", - "type": "string", - }, - "fields": { - "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,name,description,type,status,due_date,completion_date,assigned_by_employee_id,remote_assigned_by_employee_id,assigned_by_employee_name,link_to_task,extracted_links,next_task_id,remote_next_task_id,parent_process_name,comments,attachments,created_at,updated_at", - "type": "string", - }, - "id": { - "type": "string", - }, - "proxy": { - "additionalProperties": true, - "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", - "type": "object", - }, - "raw": { - "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", - "type": "boolean", - }, - "subResourceId": { - "type": "string", - }, - "x-account-id": { - "description": "The account identifier", - "type": "string", - }, - }, - "required": [ - "id", - "subResourceId", - ], - "type": "object", - }, - }, "hris_get_employee_time_off_balance": { "description": "Get Employee Time Off Balance", "execute": { @@ -7469,7 +7545,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", "type": "string", }, "id": { @@ -7620,7 +7696,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "id": { @@ -7684,7 +7760,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", "type": "string", }, "id": { @@ -7748,7 +7824,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", "type": "string", }, "id": { @@ -8078,7 +8154,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", "type": "string", }, "id": { @@ -8442,7 +8518,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", + "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", "type": "string", }, "filter": { @@ -8912,7 +8988,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "filter": { @@ -9057,115 +9133,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, }, - "hris_list_employee_tasks": { - "description": "List Employee Tasks", - "execute": { - "bodyType": "json", - "method": "GET", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "path", - "name": "id", - "type": "string", - }, - { - "location": "query", - "name": "raw", - "type": "boolean", - }, - { - "location": "query", - "name": "proxy", - "type": "object", - }, - { - "location": "query", - "name": "fields", - "type": "string", - }, - { - "location": "query", - "name": "filter", - "type": "object", - }, - { - "location": "query", - "name": "page_size", - "type": "string", - }, - { - "location": "query", - "name": "next", - "type": "string", - }, - { - "location": "query", - "name": "expand", - "type": "string", - }, - ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks", - }, - "parameters": { - "properties": { - "expand": { - "description": "The comma separated list of fields that will be expanded in the response", - "example": "attachments", - "type": "string", - }, - "fields": { - "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,name,description,type,status,due_date,completion_date,assigned_by_employee_id,remote_assigned_by_employee_id,assigned_by_employee_name,link_to_task,extracted_links,next_task_id,remote_next_task_id,parent_process_name,comments,attachments,created_at,updated_at", - "type": "string", - }, - "filter": { - "description": "Filter parameters that allow greater customisation of the list response", - "properties": { - "updated_after": { - "additionalProperties": false, - "description": "Use a string with a date to only select results updated after that given date", - "example": "2020-01-01T00:00:00.000Z", - "type": "string", - }, - }, - "type": "object", - }, - "id": { - "type": "string", - }, - "next": { - "description": "The unified cursor", - "type": "string", - }, - "page_size": { - "description": "The number of results per page (default value is 25)", - "type": "string", - }, - "proxy": { - "additionalProperties": true, - "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", - "type": "object", - }, - "raw": { - "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", - "type": "boolean", - }, - "x-account-id": { - "description": "The account identifier", - "type": "string", - }, - }, - "required": [ - "id", - ], - "type": "object", - }, - }, "hris_list_employee_time_off_balances": { "description": "List Employee Time Off Balances", "execute": { @@ -9340,32 +9307,8 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "string", }, "filter": { - "description": "HRIS Time-Off Policies filters", + "description": "Filter parameters that allow greater customisation of the list response", "properties": { - "type": { - "description": "Filter to select time-off policies by type", - "enum": [ - "sick", - "unmapped_value", - "vacation", - "long_term_disability", - "short_term_disability", - "absent", - "comp_time", - "training", - "annual_leave", - "leave_of_absence", - "break", - "child_care_leave", - "maternity_leave", - "jury_duty", - "bereavement_leave", - "sabbatical", - "accident", - null, - ], - "type": "string", - }, "updated_after": { "additionalProperties": false, "description": "Use a string with a date to only select results updated after that given date", @@ -9469,7 +9412,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", "type": "string", }, "filter": { @@ -9684,7 +9627,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,benefits,employee_number,national_identity_number,national_identity_numbers,skills", + "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,benefits,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,employee_number,national_identity_number,national_identity_numbers,skills", "type": "string", }, "filter": { @@ -9796,7 +9739,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "filter": { @@ -9885,7 +9828,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", "type": "string", }, "filter": { @@ -9974,7 +9917,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", "type": "string", }, "filter": { @@ -10351,32 +10294,8 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "string", }, "filter": { - "description": "HRIS Time-Off Policies filters", + "description": "Filter parameters that allow greater customisation of the list response", "properties": { - "type": { - "description": "Filter to select time-off policies by type", - "enum": [ - "sick", - "unmapped_value", - "vacation", - "long_term_disability", - "short_term_disability", - "absent", - "comp_time", - "training", - "annual_leave", - "leave_of_absence", - "break", - "child_care_leave", - "maternity_leave", - "jury_duty", - "bereavement_leave", - "sabbatical", - "accident", - null, - ], - "type": "string", - }, "updated_after": { "additionalProperties": false, "description": "Use a string with a date to only select results updated after that given date", @@ -10470,7 +10389,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", "type": "string", }, "filter": { @@ -10668,6 +10587,11 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "name": "work_phone_number", "type": "string", }, + { + "location": "body", + "name": "job_id", + "type": "string", + }, { "location": "body", "name": "job_title", @@ -10738,6 +10662,16 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "name": "start_date", "type": "string", }, + { + "location": "body", + "name": "employment_type", + "type": "object", + }, + { + "location": "body", + "name": "employment_contract_type", + "type": "object", + }, { "location": "body", "name": "employment_status", @@ -11256,7 +11190,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "date_of_birth": { "description": "The employee date_of_birth", - "example": "1990-01-01T00:00:00.000Z", + "example": "1990-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -11283,51 +11217,103 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "employment": { "description": "The employee employment", "properties": { - "end_date": { - "description": "The end date of employment", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "grade": { - "description": "Represents the employeeโ€™s position within the organizational hierarchy.", + "employment_contract_type": { + "description": "The employment work schedule type (e.g., full-time, part-time)", + "example": "full_time", "properties": { - "description": { - "description": "description of the grade", - "example": "Mid-level employee demonstrating proficiency and autonomy.", - "type": "string", + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], }, - "id": { - "description": "The reference id", - "example": "1687-3", + "value": { + "enum": [ + "full_time", + "shifts", + "part_time", + "unmapped_value", + null, + ], "type": "string", }, - "name": { - "description": "The reference name", - "example": "1687-4", - "type": "string", + }, + "type": "object", + }, + "employment_type": { + "description": "The type of employment (e.g., contractor, permanent)", + "example": "permanent", + "properties": { + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], }, - "remote_id": { - "description": "Provider's unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "value": { + "enum": [ + "contractor", + "intern", + "permanent", + "apprentice", + "freelance", + "terminated", + "temporary", + "seasonal", + "volunteer", + "probation", + "internal", + "external", + "expatriate", + "employer_of_record", + "casual", + "Programme", + "unmapped_value", + null, + ], "type": "string", }, }, "type": "object", }, + "id": { + "description": "Unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, "job_title": { "description": "The job title of the employee", "example": "Software Engineer", "type": "string", }, - "passthrough": { - "additionalProperties": true, - "description": "Value to pass through to the provider", - "example": { - "other_known_names": "John Doe", - }, - "type": "object", - }, "pay_currency": { "description": "The currency used for pay", "example": "USD", @@ -11429,9 +11415,10 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "example": "40.00", "type": "string", }, - "payroll_code": { - "description": "The payroll code of the employee", - "example": "PC1", + "time_worked": { + "description": "The time worked for the employee in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", "type": "string", }, "unified_custom_fields": { @@ -11443,56 +11430,42 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "type": "object", }, - "work_time": { - "properties": { - "duration": { - "description": "The work time duration in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", + }, + "type": "object", + }, + "employment_contract_type": { + "description": "The employment work schedule type (e.g., full-time, part-time)", + "example": "full_time", + "properties": { + "source_value": { + "oneOf": [ + { "type": "string", }, - "duration_unit": { - "description": "The duration unit of the work time", - "example": "month", - "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], - }, - "value": { - "description": "The unified value for the period.", - "enum": [ - "day", - "week", - "month", - "year", - "unmapped_value", - null, - ], - "example": "month", - "type": "string", - }, - }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { "type": "object", }, - }, - "type": "object", + { + "items": {}, + "type": "array", + }, + ], + }, + "value": { + "enum": [ + "full_time", + "shifts", + "part_time", + "unmapped_value", + null, + ], + "type": "string", }, }, "type": "object", @@ -11537,6 +11510,56 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "type": "object", }, + "employment_type": { + "description": "The employee employment type", + "example": "full_time", + "properties": { + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], + }, + "value": { + "enum": [ + "contractor", + "intern", + "permanent", + "apprentice", + "freelance", + "terminated", + "temporary", + "seasonal", + "volunteer", + "probation", + "internal", + "external", + "expatriate", + "employer_of_record", + "casual", + "Programme", + "unmapped_value", + null, + ], + "type": "string", + }, + }, + "type": "object", + }, "ethnicity": { "description": "The employee ethnicity", "example": "white", @@ -11627,7 +11650,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "hire_date": { "description": "The employee hire date", - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -11997,8 +12020,13 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "id": { "type": "string", }, + "job_id": { + "description": "The employee job id", + "example": "R-6789", + "type": "string", + }, "job_title": { - "description": "If the source of the job_title is the Employee's current Employment, and that Employment pertains exclusively to this Employee, then the active Employment job_title will also be written", + "description": "The employee job title", "example": "Physicist", "type": "string", }, @@ -12553,7 +12581,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "preferred_language": { "description": "The employee preferred language", - "example": "eng", + "example": "en_US", "properties": { "source_value": { "oneOf": [ @@ -12593,7 +12621,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "cat", "cha", "ces", - "dan", "deu", "div", "dzo", @@ -12610,7 +12637,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "fra", "gle", "grn", - "guj", "glv", "heb", "hin", @@ -12641,8 +12667,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "mah", "mri", "mkd", - "mon", - "mar", "msa", "mlt", "mya", @@ -12657,18 +12681,15 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "pol", "pus", "por", - "que", "rar", "roh", "rup", "ron", "rus", "kin", - "sme", "sag", "sin", "slk", - "slv", "smo", "sna", "som", @@ -12678,24 +12699,11 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "swe", "swa", "tam", - "tel", "tgk", "tha", "tir", "tig", - "tuk", - "tsn", - "ton", - "tur", - "tso", - "ukr", - "urd", - "uzb", - "ven", - "vie", - "xho", "zho", - "zul", "unmapped_value", null, ], @@ -12707,7 +12715,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "start_date": { "description": "The employee start date", - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -13118,7 +13126,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "string", }, { - "location": "path", + "location": "body", "name": "id", "type": "string", }, @@ -13159,27 +13167,17 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, { "location": "body", - "name": "effective_date", - "type": "string", - }, - { - "location": "body", - "name": "end_date", - "type": "string", - }, - { - "location": "body", - "name": "grade", + "name": "employment_type", "type": "object", }, { "location": "body", - "name": "work_time", + "name": "employment_contract_type", "type": "object", }, { "location": "body", - "name": "payroll_code", + "name": "time_worked", "type": "string", }, { @@ -13192,45 +13190,96 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "parameters": { "properties": { - "effective_date": { - "description": "The effective date of the employment contract", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "end_date": { - "description": "The end date of employment", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "grade": { - "description": "Represents the employeeโ€™s position within the organizational hierarchy.", + "employment_contract_type": { + "description": "The employment work schedule type (e.g., full-time, part-time)", + "example": "full_time", "properties": { - "description": { - "description": "description of the grade", - "example": "Mid-level employee demonstrating proficiency and autonomy.", - "type": "string", + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], }, - "id": { - "description": "The reference id", - "example": "1687-3", + "value": { + "enum": [ + "full_time", + "shifts", + "part_time", + "unmapped_value", + null, + ], "type": "string", }, - "name": { - "description": "The reference name", - "example": "1687-4", - "type": "string", + }, + "type": "object", + }, + "employment_type": { + "description": "The type of employment (e.g., contractor, permanent)", + "example": "permanent", + "properties": { + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], }, - "remote_id": { - "description": "Provider's unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "value": { + "enum": [ + "contractor", + "intern", + "permanent", + "apprentice", + "freelance", + "terminated", + "temporary", + "seasonal", + "volunteer", + "probation", + "internal", + "external", + "expatriate", + "employer_of_record", + "casual", + "Programme", + "unmapped_value", + null, + ], "type": "string", }, }, "type": "object", }, "id": { + "description": "Unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", "type": "string", }, "job_title": { @@ -13318,103 +13367,53 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 { "type": "object", }, - { - "items": {}, - "type": "array", - }, - ], - }, - "value": { - "enum": [ - "hour", - "day", - "week", - "every_two_weeks", - "month", - "quarter", - "every_six_months", - "year", - "unmapped_value", - null, - ], - "type": "string", - }, - }, - "type": "object", - }, - "pay_rate": { - "description": "The pay rate for the employee", - "example": "40.00", - "type": "string", - }, - "payroll_code": { - "description": "The payroll code of the employee", - "example": "PC1", - "type": "string", - }, - "subResourceId": { - "type": "string", - }, - "unified_custom_fields": { - "additionalProperties": true, - "description": "Custom Unified Fields configured in your StackOne project", - "example": { - "my_project_custom_field_1": "REF-1236", - "my_project_custom_field_2": "some other value", - }, - "type": "object", - }, - "work_time": { - "properties": { - "duration": { - "description": "The work time duration in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", - "type": "string", - }, - "duration_unit": { - "description": "The duration unit of the work time", - "example": "month", - "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], - }, - "value": { - "description": "The unified value for the period.", - "enum": [ - "day", - "week", - "month", - "year", - "unmapped_value", - null, - ], - "example": "month", - "type": "string", + { + "items": {}, + "type": "array", }, - }, - "type": "object", + ], + }, + "value": { + "enum": [ + "hour", + "day", + "week", + "every_two_weeks", + "month", + "quarter", + "every_six_months", + "year", + "unmapped_value", + null, + ], + "type": "string", }, }, "type": "object", }, + "pay_rate": { + "description": "The pay rate for the employee", + "example": "40.00", + "type": "string", + }, + "subResourceId": { + "type": "string", + }, + "time_worked": { + "description": "The time worked for the employee in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", + "type": "string", + }, + "unified_custom_fields": { + "additionalProperties": true, + "description": "Custom Unified Fields configured in your StackOne project", + "example": { + "my_project_custom_field_1": "REF-1236", + "my_project_custom_field_2": "some other value", + }, + "type": "object", + }, "x-account-id": { "description": "The account identifier", "type": "string", @@ -13448,6 +13447,11 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "name": "subResourceId", "type": "string", }, + { + "location": "body", + "name": "employee_id", + "type": "string", + }, { "location": "body", "name": "approver_id", @@ -13503,10 +13507,15 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "example": "1687-4", "type": "string", }, + "employee_id": { + "description": "The employee ID", + "example": "1687-3", + "type": "string", + }, "end_date": { - "description": "Inclusive end date of the time off request (ISO8601 date-time without timezone). The time off includes this day", - "example": "2021-01-01T01:01:01.000", - "format": "datetime-local", + "description": "The end date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", "type": "string", }, "end_half_day": { @@ -13555,9 +13564,9 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, "start_date": { - "description": "The start date of the time off request (ISO8601 date-time without timezone)", - "example": "2021-01-01T01:01:01.000", - "format": "datetime-local", + "description": "The start date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", "type": "string", }, "start_half_day": { @@ -13606,7 +13615,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "rejected", "pending", "deleted", - "draft", "unmapped_value", null, ], @@ -13749,7 +13757,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "description": "The file format of the file", "properties": { "source_value": { - "example": "application/pdf", + "example": "abc", "oneOf": [ { "type": "string", @@ -15360,7 +15368,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "driver_license", "birth_certificate", "other", - "unmapped_value", null, ], "type": "string", @@ -15369,12 +15376,12 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, "valid_from": { - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, "valid_to": { - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -15390,6 +15397,214 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, }, + "hris_update_time_off_request": { + "description": "Update time off request", + "execute": { + "bodyType": "json", + "method": "PATCH", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "path", + "name": "id", + "type": "string", + }, + { + "location": "body", + "name": "employee_id", + "type": "string", + }, + { + "location": "body", + "name": "approver_id", + "type": "string", + }, + { + "location": "body", + "name": "status", + "type": "object", + }, + { + "location": "body", + "name": "start_date", + "type": "string", + }, + { + "location": "body", + "name": "end_date", + "type": "string", + }, + { + "location": "body", + "name": "start_half_day", + "type": "string", + }, + { + "location": "body", + "name": "end_half_day", + "type": "string", + }, + { + "location": "body", + "name": "time_off_policy_id", + "type": "string", + }, + { + "location": "body", + "name": "reason", + "type": "object", + }, + { + "location": "body", + "name": "passthrough", + "type": "object", + }, + ], + "url": "https://api.stackone.com/unified/hris/time_off/{id}", + }, + "parameters": { + "properties": { + "approver_id": { + "description": "The approver ID", + "example": "1687-4", + "type": "string", + }, + "employee_id": { + "description": "The employee ID", + "example": "1687-3", + "type": "string", + }, + "end_date": { + "description": "The end date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "end_half_day": { + "description": "True if the end of the time off request ends half way through the day", + "example": true, + "oneOf": [ + { + "type": "boolean", + }, + { + "enum": [ + "true", + "false", + ], + "type": "string", + }, + ], + }, + "id": { + "type": "string", + }, + "passthrough": { + "additionalProperties": true, + "description": "Value to pass through to the provider", + "example": { + "other_known_names": "John Doe", + }, + "type": "object", + }, + "reason": { + "properties": { + "id": { + "description": "Unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, + "name": { + "type": "string", + }, + "remote_id": { + "description": "Provider's unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, + }, + "type": "object", + }, + "start_date": { + "description": "The start date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "start_half_day": { + "description": "True if the start of the time off request begins half way through the day", + "example": true, + "oneOf": [ + { + "type": "boolean", + }, + { + "enum": [ + "true", + "false", + ], + "type": "string", + }, + ], + }, + "status": { + "description": "The status of the time off request", + "properties": { + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], + }, + "value": { + "enum": [ + "approved", + "cancelled", + "rejected", + "pending", + "deleted", + "unmapped_value", + null, + ], + "type": "string", + }, + }, + "type": "object", + }, + "time_off_policy_id": { + "description": "The time off policy id associated with this time off request", + "example": "cx280928933", + "type": "string", + }, + "x-account-id": { + "description": "The account identifier", + "type": "string", + }, + }, + "required": [ + "id", + ], + "type": "object", + }, + }, "hris_upload_employee_document": { "description": "Upload Employee Document", "execute": { @@ -15433,12 +15648,12 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, { "location": "body", - "name": "confidential", + "name": "category", "type": "object", }, { "location": "body", - "name": "category", + "name": "confidential", "type": "object", }, ], @@ -15528,7 +15743,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "enum": [ "true", "false", - "unmapped_value", null, ], "example": "true", @@ -15546,7 +15760,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "description": "The file format of the file", "properties": { "source_value": { - "example": "application/pdf", + "example": "abc", "oneOf": [ { "type": "string", diff --git a/src/tool.ts b/src/tool.ts index aa116f66..eedd837e 100644 --- a/src/tool.ts +++ b/src/tool.ts @@ -193,8 +193,6 @@ export class Tools implements Iterable { /** * Get a tool by name */ - getTool(name: string): BaseTool | undefined; - getTool(name: string, options: Experimental_ToolCreationOptions): BaseTool | undefined; getTool(name: string, options?: Experimental_ToolCreationOptions): BaseTool | undefined { const originalTool = this.tools.find((tool) => tool.name === name); if (!originalTool) { diff --git a/src/toolsets/base.ts b/src/toolsets/base.ts index 7e534a11..982dd7a5 100644 --- a/src/toolsets/base.ts +++ b/src/toolsets/base.ts @@ -1,5 +1,5 @@ import { type BaseTool, Tools } from '../tool'; -import { type Experimental_ToolCreationOptions, type ToolDefinition } from '../types'; +import type { Experimental_ToolCreationOptions } from '../types'; /** * Base exception for toolset errors @@ -223,14 +223,14 @@ export abstract class ToolSet { } return experimentalTool; - } else { - // Traditional headers-based approach - const headers = headersOrOptions as Record | undefined; - const mergedHeaders = { ...this.headers, ...headers }; - if (mergedHeaders && tool.setHeaders) { - tool.setHeaders(mergedHeaders); - } - return tool; } + + // Traditional headers-based approach + const headers = headersOrOptions as Record | undefined; + const mergedHeaders = { ...this.headers, ...headers }; + if (mergedHeaders && tool.setHeaders) { + tool.setHeaders(mergedHeaders); + } + return tool; } } diff --git a/src/toolsets/openapi.ts b/src/toolsets/openapi.ts index f6e21bdd..45c017ee 100644 --- a/src/toolsets/openapi.ts +++ b/src/toolsets/openapi.ts @@ -133,13 +133,7 @@ export class OpenAPIToolSet extends ToolSet { private createTool(toolName: string, toolDef: ToolDefinition): BaseTool { // Create tool const { description, parameters, execute } = toolDef; - const tool = new BaseTool( - toolName, - description, - parameters, - execute, - this.headers - ); + const tool = new BaseTool(toolName, description, parameters, execute, this.headers); return tool; } diff --git a/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap b/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap index 600148ec..c1936ebd 100644 --- a/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap +++ b/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap @@ -590,7 +590,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,benefits,employee_number,national_identity_number,national_identity_numbers,skills", + "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,benefits,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,employee_number,national_identity_number,national_identity_numbers,skills", "type": "string", }, "filter": { @@ -752,6 +752,11 @@ Tools { "name": "work_phone_number", "type": "string", }, + { + "location": "body", + "name": "job_id", + "type": "string", + }, { "location": "body", "name": "job_title", @@ -822,6 +827,16 @@ Tools { "name": "start_date", "type": "string", }, + { + "location": "body", + "name": "employment_type", + "type": "object", + }, + { + "location": "body", + "name": "employment_contract_type", + "type": "object", + }, { "location": "body", "name": "employment_status", @@ -1331,7 +1346,7 @@ Tools { }, "date_of_birth": { "description": "The employee date_of_birth", - "example": "1990-01-01T00:00:00.000Z", + "example": "1990-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -1358,51 +1373,63 @@ Tools { "employment": { "description": "The employee employment", "properties": { - "end_date": { - "description": "The end date of employment", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "grade": { - "description": "Represents the employeeโ€™s position within the organizational hierarchy.", + "employment_contract_type": { + "description": "The employment work schedule type (e.g., full-time, part-time)", + "example": "full_time", "properties": { - "description": { - "description": "description of the grade", - "example": "Mid-level employee demonstrating proficiency and autonomy.", - "type": "string", - }, - "id": { - "description": "The reference id", - "example": "1687-3", - "type": "string", - }, - "name": { - "description": "The reference name", - "example": "1687-4", + "value": { + "enum": [ + "full_time", + "shifts", + "part_time", + "unmapped_value", + null, + ], "type": "string", }, - "remote_id": { - "description": "Provider's unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + }, + "type": "object", + }, + "employment_type": { + "description": "The type of employment (e.g., contractor, permanent)", + "example": "permanent", + "properties": { + "value": { + "enum": [ + "contractor", + "intern", + "permanent", + "apprentice", + "freelance", + "terminated", + "temporary", + "seasonal", + "volunteer", + "probation", + "internal", + "external", + "expatriate", + "employer_of_record", + "casual", + "Programme", + "unmapped_value", + null, + ], "type": "string", }, }, "type": "object", }, + "id": { + "description": "Unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, "job_title": { "description": "The job title of the employee", "example": "Software Engineer", "type": "string", }, - "passthrough": { - "additionalProperties": true, - "description": "Value to pass through to the provider", - "example": { - "other_known_names": "John Doe", - }, - "type": "object", - }, "pay_currency": { "description": "The currency used for pay", "example": "USD", @@ -1464,9 +1491,10 @@ Tools { "example": "40.00", "type": "string", }, - "payroll_code": { - "description": "The payroll code of the employee", - "example": "PC1", + "time_worked": { + "description": "The time worked for the employee in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", "type": "string", }, "unified_custom_fields": { @@ -1478,36 +1506,22 @@ Tools { }, "type": "object", }, - "work_time": { - "properties": { - "duration": { - "description": "The work time duration in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", - "type": "string", - }, - "duration_unit": { - "description": "The duration unit of the work time", - "example": "month", - "properties": { - "value": { - "description": "The unified value for the period.", - "enum": [ - "day", - "week", - "month", - "year", - "unmapped_value", - null, - ], - "example": "month", - "type": "string", - }, - }, - "type": "object", - }, - }, - "type": "object", + }, + "type": "object", + }, + "employment_contract_type": { + "description": "The employment work schedule type (e.g., full-time, part-time)", + "example": "full_time", + "properties": { + "value": { + "enum": [ + "full_time", + "shifts", + "part_time", + "unmapped_value", + null, + ], + "type": "string", }, }, "type": "object", @@ -1532,6 +1546,36 @@ Tools { }, "type": "object", }, + "employment_type": { + "description": "The employee employment type", + "example": "full_time", + "properties": { + "value": { + "enum": [ + "contractor", + "intern", + "permanent", + "apprentice", + "freelance", + "terminated", + "temporary", + "seasonal", + "volunteer", + "probation", + "internal", + "external", + "expatriate", + "employer_of_record", + "casual", + "Programme", + "unmapped_value", + null, + ], + "type": "string", + }, + }, + "type": "object", + }, "ethnicity": { "description": "The employee ethnicity", "example": "white", @@ -1582,7 +1626,7 @@ Tools { }, "hire_date": { "description": "The employee hire date", - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -1909,8 +1953,13 @@ Tools { }, "type": "object", }, + "job_id": { + "description": "The employee job id", + "example": "R-6789", + "type": "string", + }, "job_title": { - "description": "If the source of the job_title is the Employee's current Employment, and that Employment pertains exclusively to this Employee, then the active Employment job_title will also be written", + "description": "The employee job title", "example": "Physicist", "type": "string", }, @@ -2405,7 +2454,7 @@ Tools { }, "preferred_language": { "description": "The employee preferred language", - "example": "eng", + "example": "en_US", "properties": { "value": { "description": "The ISO639-2 Code of the language", @@ -2425,7 +2474,6 @@ Tools { "cat", "cha", "ces", - "dan", "deu", "div", "dzo", @@ -2442,7 +2490,6 @@ Tools { "fra", "gle", "grn", - "guj", "glv", "heb", "hin", @@ -2473,8 +2520,6 @@ Tools { "mah", "mri", "mkd", - "mon", - "mar", "msa", "mlt", "mya", @@ -2489,18 +2534,15 @@ Tools { "pol", "pus", "por", - "que", "rar", "roh", "rup", "ron", "rus", "kin", - "sme", "sag", "sin", "slk", - "slv", "smo", "sna", "som", @@ -2510,24 +2552,11 @@ Tools { "swe", "swa", "tam", - "tel", "tgk", "tha", "tir", "tig", - "tuk", - "tsn", - "ton", - "tur", - "tso", - "ukr", - "urd", - "uzb", - "ven", - "vie", - "xho", "zho", - "zul", "unmapped_value", null, ], @@ -2539,7 +2568,7 @@ Tools { }, "start_date": { "description": "The employee start date", - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -2949,6 +2978,11 @@ Tools { "name": "work_phone_number", "type": "string", }, + { + "location": "body", + "name": "job_id", + "type": "string", + }, { "location": "body", "name": "job_title", @@ -3019,6 +3053,16 @@ Tools { "name": "start_date", "type": "string", }, + { + "location": "body", + "name": "employment_type", + "type": "object", + }, + { + "location": "body", + "name": "employment_contract_type", + "type": "object", + }, { "location": "body", "name": "employment_status", @@ -3145,7 +3189,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,benefits,employee_number,national_identity_number,national_identity_numbers,skills", + "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,benefits,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,employee_number,national_identity_number,national_identity_numbers,skills", "type": "string", }, "id": { @@ -3279,6 +3323,11 @@ Tools { "name": "work_phone_number", "type": "string", }, + { + "location": "body", + "name": "job_id", + "type": "string", + }, { "location": "body", "name": "job_title", @@ -3349,6 +3398,16 @@ Tools { "name": "start_date", "type": "string", }, + { + "location": "body", + "name": "employment_type", + "type": "object", + }, + { + "location": "body", + "name": "employment_contract_type", + "type": "object", + }, { "location": "body", "name": "employment_status", @@ -3831,7 +3890,7 @@ Tools { }, "date_of_birth": { "description": "The employee date_of_birth", - "example": "1990-01-01T00:00:00.000Z", + "example": "1990-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -3858,51 +3917,63 @@ Tools { "employment": { "description": "The employee employment", "properties": { - "end_date": { - "description": "The end date of employment", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "grade": { - "description": "Represents the employeeโ€™s position within the organizational hierarchy.", + "employment_contract_type": { + "description": "The employment work schedule type (e.g., full-time, part-time)", + "example": "full_time", "properties": { - "description": { - "description": "description of the grade", - "example": "Mid-level employee demonstrating proficiency and autonomy.", - "type": "string", - }, - "id": { - "description": "The reference id", - "example": "1687-3", - "type": "string", - }, - "name": { - "description": "The reference name", - "example": "1687-4", + "value": { + "enum": [ + "full_time", + "shifts", + "part_time", + "unmapped_value", + null, + ], "type": "string", }, - "remote_id": { - "description": "Provider's unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + }, + "type": "object", + }, + "employment_type": { + "description": "The type of employment (e.g., contractor, permanent)", + "example": "permanent", + "properties": { + "value": { + "enum": [ + "contractor", + "intern", + "permanent", + "apprentice", + "freelance", + "terminated", + "temporary", + "seasonal", + "volunteer", + "probation", + "internal", + "external", + "expatriate", + "employer_of_record", + "casual", + "Programme", + "unmapped_value", + null, + ], "type": "string", }, }, "type": "object", }, + "id": { + "description": "Unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, "job_title": { "description": "The job title of the employee", "example": "Software Engineer", "type": "string", }, - "passthrough": { - "additionalProperties": true, - "description": "Value to pass through to the provider", - "example": { - "other_known_names": "John Doe", - }, - "type": "object", - }, "pay_currency": { "description": "The currency used for pay", "example": "USD", @@ -3964,9 +4035,10 @@ Tools { "example": "40.00", "type": "string", }, - "payroll_code": { - "description": "The payroll code of the employee", - "example": "PC1", + "time_worked": { + "description": "The time worked for the employee in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", "type": "string", }, "unified_custom_fields": { @@ -3978,36 +4050,22 @@ Tools { }, "type": "object", }, - "work_time": { - "properties": { - "duration": { - "description": "The work time duration in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", - "type": "string", - }, - "duration_unit": { - "description": "The duration unit of the work time", - "example": "month", - "properties": { - "value": { - "description": "The unified value for the period.", - "enum": [ - "day", - "week", - "month", - "year", - "unmapped_value", - null, - ], - "example": "month", - "type": "string", - }, - }, - "type": "object", - }, - }, - "type": "object", + }, + "type": "object", + }, + "employment_contract_type": { + "description": "The employment work schedule type (e.g., full-time, part-time)", + "example": "full_time", + "properties": { + "value": { + "enum": [ + "full_time", + "shifts", + "part_time", + "unmapped_value", + null, + ], + "type": "string", }, }, "type": "object", @@ -4032,6 +4090,36 @@ Tools { }, "type": "object", }, + "employment_type": { + "description": "The employee employment type", + "example": "full_time", + "properties": { + "value": { + "enum": [ + "contractor", + "intern", + "permanent", + "apprentice", + "freelance", + "terminated", + "temporary", + "seasonal", + "volunteer", + "probation", + "internal", + "external", + "expatriate", + "employer_of_record", + "casual", + "Programme", + "unmapped_value", + null, + ], + "type": "string", + }, + }, + "type": "object", + }, "ethnicity": { "description": "The employee ethnicity", "example": "white", @@ -4082,7 +4170,7 @@ Tools { }, "hire_date": { "description": "The employee hire date", - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -4412,8 +4500,13 @@ Tools { "id": { "type": "string", }, + "job_id": { + "description": "The employee job id", + "example": "R-6789", + "type": "string", + }, "job_title": { - "description": "If the source of the job_title is the Employee's current Employment, and that Employment pertains exclusively to this Employee, then the active Employment job_title will also be written", + "description": "The employee job title", "example": "Physicist", "type": "string", }, @@ -4908,7 +5001,7 @@ Tools { }, "preferred_language": { "description": "The employee preferred language", - "example": "eng", + "example": "en_US", "properties": { "value": { "description": "The ISO639-2 Code of the language", @@ -4928,7 +5021,6 @@ Tools { "cat", "cha", "ces", - "dan", "deu", "div", "dzo", @@ -4945,7 +5037,6 @@ Tools { "fra", "gle", "grn", - "guj", "glv", "heb", "hin", @@ -4976,8 +5067,6 @@ Tools { "mah", "mri", "mkd", - "mon", - "mar", "msa", "mlt", "mya", @@ -4992,18 +5081,15 @@ Tools { "pol", "pus", "por", - "que", "rar", "roh", "rup", "ron", "rus", "kin", - "sme", "sag", "sin", "slk", - "slv", "smo", "sna", "som", @@ -5013,24 +5099,11 @@ Tools { "swe", "swa", "tam", - "tel", "tgk", "tha", "tir", "tig", - "tuk", - "tsn", - "ton", - "tur", - "tso", - "ukr", - "urd", - "uzb", - "ven", - "vie", - "xho", "zho", - "zul", "unmapped_value", null, ], @@ -5042,7 +5115,7 @@ Tools { }, "start_date": { "description": "The employee start date", - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -5459,6 +5532,11 @@ Tools { "name": "work_phone_number", "type": "string", }, + { + "location": "body", + "name": "job_id", + "type": "string", + }, { "location": "body", "name": "job_title", @@ -5529,6 +5607,16 @@ Tools { "name": "start_date", "type": "string", }, + { + "location": "body", + "name": "employment_type", + "type": "object", + }, + { + "location": "body", + "name": "employment_contract_type", + "type": "object", + }, { "location": "body", "name": "employment_status", @@ -5734,7 +5822,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", "type": "string", }, "filter": { @@ -5855,6 +5943,11 @@ Tools { "name": "id", "type": "string", }, + { + "location": "body", + "name": "employee_id", + "type": "string", + }, { "location": "body", "name": "approver_id", @@ -5914,10 +6007,15 @@ Tools { "example": "1687-4", "type": "string", }, + "employee_id": { + "description": "The employee ID", + "example": "1687-3", + "type": "string", + }, "end_date": { - "description": "Inclusive end date of the time off request (ISO8601 date-time without timezone). The time off includes this day", - "example": "2021-01-01T01:01:01.000", - "format": "datetime-local", + "description": "The end date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", "type": "string", }, "end_half_day": { @@ -5966,9 +6064,9 @@ Tools { "type": "object", }, "start_date": { - "description": "The start date of the time off request (ISO8601 date-time without timezone)", - "example": "2021-01-01T01:01:01.000", - "format": "datetime-local", + "description": "The start date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", "type": "string", }, "start_half_day": { @@ -5997,7 +6095,6 @@ Tools { "rejected", "pending", "deleted", - "draft", "unmapped_value", null, ], @@ -6035,6 +6132,11 @@ Tools { "name": "id", "type": "string", }, + { + "location": "body", + "name": "employee_id", + "type": "string", + }, { "location": "body", "name": "approver_id", @@ -6141,7 +6243,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", "type": "string", }, "id": { @@ -6214,10 +6316,10 @@ Tools { }, }, StackOneTool { - "description": "Cancel Employee Time Off Request", + "description": "Update Employee Time Off Request", "executeConfig": { "bodyType": "json", - "method": "DELETE", + "method": "PATCH", "params": [ { "location": "header", @@ -6234,99 +6336,34 @@ Tools { "name": "subResourceId", "type": "string", }, - ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off/{subResourceId}", - }, - "name": "hris_cancel_employee_time_off_request", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, - "parameters": { - "properties": { - "id": { + { + "location": "body", + "name": "employee_id", "type": "string", }, - "subResourceId": { + { + "location": "body", + "name": "approver_id", "type": "string", }, - "x-account-id": undefined, - }, - "required": [ - "id", - "subResourceId", - ], - "type": "object", - }, - "requestBuilder": RequestBuilder { - "bodyType": "json", - "headers": { - "Authorization": "Basic dGVzdF9rZXk6", - }, - "method": "DELETE", - "params": [ { - "location": "header", - "name": "x-account-id", + "location": "body", + "name": "status", + "type": "object", + }, + { + "location": "body", + "name": "start_date", "type": "string", }, { - "location": "path", - "name": "id", + "location": "body", + "name": "end_date", "type": "string", }, { - "location": "path", - "name": "subResourceId", - "type": "string", - }, - ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off/{subResourceId}", - }, - }, - StackOneTool { - "description": "Update Employee Time Off Request", - "executeConfig": { - "bodyType": "json", - "method": "PATCH", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "path", - "name": "id", - "type": "string", - }, - { - "location": "path", - "name": "subResourceId", - "type": "string", - }, - { - "location": "body", - "name": "approver_id", - "type": "string", - }, - { - "location": "body", - "name": "status", - "type": "object", - }, - { - "location": "body", - "name": "start_date", - "type": "string", - }, - { - "location": "body", - "name": "end_date", - "type": "string", - }, - { - "location": "body", - "name": "start_half_day", + "location": "body", + "name": "start_half_day", "type": "string", }, { @@ -6363,10 +6400,15 @@ Tools { "example": "1687-4", "type": "string", }, + "employee_id": { + "description": "The employee ID", + "example": "1687-3", + "type": "string", + }, "end_date": { - "description": "Inclusive end date of the time off request (ISO8601 date-time without timezone). The time off includes this day", - "example": "2021-01-01T01:01:01.000", - "format": "datetime-local", + "description": "The end date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", "type": "string", }, "end_half_day": { @@ -6415,9 +6457,9 @@ Tools { "type": "object", }, "start_date": { - "description": "The start date of the time off request (ISO8601 date-time without timezone)", - "example": "2021-01-01T01:01:01.000", - "format": "datetime-local", + "description": "The start date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", "type": "string", }, "start_half_day": { @@ -6446,7 +6488,6 @@ Tools { "rejected", "pending", "deleted", - "draft", "unmapped_value", null, ], @@ -6493,6 +6534,11 @@ Tools { "name": "subResourceId", "type": "string", }, + { + "location": "body", + "name": "employee_id", + "type": "string", + }, { "location": "body", "name": "approver_id", @@ -6635,7 +6681,6 @@ Tools { "enum": [ "true", "false", - "unmapped_value", null, ], "example": "true", @@ -7966,12 +8011,12 @@ Tools { }, { "location": "body", - "name": "confidential", + "name": "category", "type": "object", }, { "location": "body", - "name": "category", + "name": "confidential", "type": "object", }, ], @@ -8039,7 +8084,6 @@ Tools { "enum": [ "true", "false", - "unmapped_value", null, ], "example": "true", @@ -9342,12 +9386,12 @@ Tools { }, { "location": "body", - "name": "confidential", + "name": "category", "type": "object", }, { "location": "body", - "name": "category", + "name": "confidential", "type": "object", }, ], @@ -9380,11 +9424,6 @@ Tools { "name": "format", "type": "string", }, - { - "location": "query", - "name": "export_format", - "type": "string", - }, ], "url": "https://api.stackone.com/unified/hris/employees/{id}/documents/{subResourceId}/download", }, @@ -9394,11 +9433,6 @@ Tools { }, "parameters": { "properties": { - "export_format": { - "description": "The export format of the file", - "example": "text/plain", - "type": "string", - }, "format": { "description": "The format to download the file in", "example": "base64", @@ -9445,11 +9479,6 @@ Tools { "name": "format", "type": "string", }, - { - "location": "query", - "name": "export_format", - "type": "string", - }, ], "url": "https://api.stackone.com/unified/hris/employees/{id}/documents/{subResourceId}/download", }, @@ -11743,7 +11772,6 @@ Tools { "driver_license", "birth_certificate", "other", - "unmapped_value", null, ], "type": "string", @@ -11752,12 +11780,12 @@ Tools { "type": "object", }, "valid_from": { - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, "valid_to": { - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -13591,7 +13619,6 @@ Tools { "driver_license", "birth_certificate", "other", - "unmapped_value", null, ], "type": "string", @@ -13600,12 +13627,12 @@ Tools { "type": "object", }, "valid_from": { - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, "valid_to": { - "example": "2021-01-01T00:00:00.000Z", + "example": "2021-01-01T00:00.000Z", "format": "date-time", "type": "string", }, @@ -14047,7 +14074,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "filter": { @@ -14187,7 +14214,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "id": { @@ -14317,7 +14344,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "filter": { @@ -14427,7 +14454,7 @@ Tools { "type": "string", }, { - "location": "path", + "location": "body", "name": "id", "type": "string", }, @@ -14463,32 +14490,17 @@ Tools { }, { "location": "body", - "name": "effective_date", - "type": "string", - }, - { - "location": "body", - "name": "end_date", - "type": "string", - }, - { - "location": "body", - "name": "grade", + "name": "employment_type", "type": "object", }, { "location": "body", - "name": "work_time", + "name": "employment_contract_type", "type": "object", }, { "location": "body", - "name": "payroll_code", - "type": "string", - }, - { - "location": "body", - "name": "job_id", + "name": "time_worked", "type": "string", }, { @@ -14505,50 +14517,56 @@ Tools { }, "parameters": { "properties": { - "effective_date": { - "description": "The effective date of the employment contract", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "end_date": { - "description": "The end date of employment", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "grade": { - "description": "Represents the employeeโ€™s position within the organizational hierarchy.", + "employment_contract_type": { + "description": "The employment work schedule type (e.g., full-time, part-time)", + "example": "full_time", "properties": { - "description": { - "description": "description of the grade", - "example": "Mid-level employee demonstrating proficiency and autonomy.", - "type": "string", - }, - "id": { - "description": "The reference id", - "example": "1687-3", - "type": "string", - }, - "name": { - "description": "The reference name", - "example": "1687-4", + "value": { + "enum": [ + "full_time", + "shifts", + "part_time", + "unmapped_value", + null, + ], "type": "string", }, - "remote_id": { - "description": "Provider's unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + }, + "type": "object", + }, + "employment_type": { + "description": "The type of employment (e.g., contractor, permanent)", + "example": "permanent", + "properties": { + "value": { + "enum": [ + "contractor", + "intern", + "permanent", + "apprentice", + "freelance", + "terminated", + "temporary", + "seasonal", + "volunteer", + "probation", + "internal", + "external", + "expatriate", + "employer_of_record", + "casual", + "Programme", + "unmapped_value", + null, + ], "type": "string", }, }, "type": "object", }, "id": { - "type": "string", - }, - "job_id": { - "description": "The employee job id", - "example": "5290", + "description": "Unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", "type": "string", }, "job_title": { @@ -14625,9 +14643,10 @@ Tools { "example": "40.00", "type": "string", }, - "payroll_code": { - "description": "The payroll code of the employee", - "example": "PC1", + "time_worked": { + "description": "The time worked for the employee in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", "type": "string", }, "unified_custom_fields": { @@ -14639,37 +14658,6 @@ Tools { }, "type": "object", }, - "work_time": { - "properties": { - "duration": { - "description": "The work time duration in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", - "type": "string", - }, - "duration_unit": { - "description": "The duration unit of the work time", - "example": "month", - "properties": { - "value": { - "description": "The unified value for the period.", - "enum": [ - "day", - "week", - "month", - "year", - "unmapped_value", - null, - ], - "example": "month", - "type": "string", - }, - }, - "type": "object", - }, - }, - "type": "object", - }, "x-account-id": undefined, }, "required": [ @@ -14690,7 +14678,7 @@ Tools { "type": "string", }, { - "location": "path", + "location": "body", "name": "id", "type": "string", }, @@ -14726,32 +14714,17 @@ Tools { }, { "location": "body", - "name": "effective_date", - "type": "string", - }, - { - "location": "body", - "name": "end_date", - "type": "string", - }, - { - "location": "body", - "name": "grade", + "name": "employment_type", "type": "object", }, { "location": "body", - "name": "work_time", + "name": "employment_contract_type", "type": "object", }, { "location": "body", - "name": "payroll_code", - "type": "string", - }, - { - "location": "body", - "name": "job_id", + "name": "time_worked", "type": "string", }, { @@ -14820,7 +14793,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "id": { @@ -14904,7 +14877,7 @@ Tools { "type": "string", }, { - "location": "path", + "location": "body", "name": "id", "type": "string", }, @@ -14945,27 +14918,17 @@ Tools { }, { "location": "body", - "name": "effective_date", - "type": "string", - }, - { - "location": "body", - "name": "end_date", - "type": "string", - }, - { - "location": "body", - "name": "grade", + "name": "employment_type", "type": "object", }, { "location": "body", - "name": "work_time", + "name": "employment_contract_type", "type": "object", }, { "location": "body", - "name": "payroll_code", + "name": "time_worked", "type": "string", }, { @@ -14982,45 +14945,56 @@ Tools { }, "parameters": { "properties": { - "effective_date": { - "description": "The effective date of the employment contract", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "end_date": { - "description": "The end date of employment", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "grade": { - "description": "Represents the employeeโ€™s position within the organizational hierarchy.", + "employment_contract_type": { + "description": "The employment work schedule type (e.g., full-time, part-time)", + "example": "full_time", "properties": { - "description": { - "description": "description of the grade", - "example": "Mid-level employee demonstrating proficiency and autonomy.", - "type": "string", - }, - "id": { - "description": "The reference id", - "example": "1687-3", - "type": "string", - }, - "name": { - "description": "The reference name", - "example": "1687-4", + "value": { + "enum": [ + "full_time", + "shifts", + "part_time", + "unmapped_value", + null, + ], "type": "string", }, - "remote_id": { - "description": "Provider's unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + }, + "type": "object", + }, + "employment_type": { + "description": "The type of employment (e.g., contractor, permanent)", + "example": "permanent", + "properties": { + "value": { + "enum": [ + "contractor", + "intern", + "permanent", + "apprentice", + "freelance", + "terminated", + "temporary", + "seasonal", + "volunteer", + "probation", + "internal", + "external", + "expatriate", + "employer_of_record", + "casual", + "Programme", + "unmapped_value", + null, + ], "type": "string", }, }, "type": "object", }, "id": { + "description": "Unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", "type": "string", }, "job_title": { @@ -15097,12 +15071,13 @@ Tools { "example": "40.00", "type": "string", }, - "payroll_code": { - "description": "The payroll code of the employee", - "example": "PC1", + "subResourceId": { "type": "string", }, - "subResourceId": { + "time_worked": { + "description": "The time worked for the employee in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", "type": "string", }, "unified_custom_fields": { @@ -15114,37 +15089,6 @@ Tools { }, "type": "object", }, - "work_time": { - "properties": { - "duration": { - "description": "The work time duration in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", - "type": "string", - }, - "duration_unit": { - "description": "The duration unit of the work time", - "example": "month", - "properties": { - "value": { - "description": "The unified value for the period.", - "enum": [ - "day", - "week", - "month", - "year", - "unmapped_value", - null, - ], - "example": "month", - "type": "string", - }, - }, - "type": "object", - }, - }, - "type": "object", - }, "x-account-id": undefined, }, "required": [ @@ -15166,7 +15110,7 @@ Tools { "type": "string", }, { - "location": "path", + "location": "body", "name": "id", "type": "string", }, @@ -15207,27 +15151,17 @@ Tools { }, { "location": "body", - "name": "effective_date", - "type": "string", - }, - { - "location": "body", - "name": "end_date", - "type": "string", - }, - { - "location": "body", - "name": "grade", + "name": "employment_type", "type": "object", }, { "location": "body", - "name": "work_time", + "name": "employment_contract_type", "type": "object", }, { "location": "body", - "name": "payroll_code", + "name": "time_worked", "type": "string", }, { @@ -15536,7 +15470,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", "type": "string", }, "filter": { @@ -15632,10 +15566,254 @@ Tools { }, }, StackOneTool { - "description": "Get time off request", + "description": "Creates a time off request", "executeConfig": { "bodyType": "json", - "method": "GET", + "method": "POST", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "body", + "name": "employee_id", + "type": "string", + }, + { + "location": "body", + "name": "approver_id", + "type": "string", + }, + { + "location": "body", + "name": "status", + "type": "object", + }, + { + "location": "body", + "name": "start_date", + "type": "string", + }, + { + "location": "body", + "name": "end_date", + "type": "string", + }, + { + "location": "body", + "name": "start_half_day", + "type": "string", + }, + { + "location": "body", + "name": "end_half_day", + "type": "string", + }, + { + "location": "body", + "name": "time_off_policy_id", + "type": "string", + }, + { + "location": "body", + "name": "reason", + "type": "object", + }, + { + "location": "body", + "name": "passthrough", + "type": "object", + }, + ], + "url": "https://api.stackone.com/unified/hris/time_off", + }, + "name": "hris_create_time_off_request", + "parameterMapper": ParameterMapper { + "transformers": Map {}, + }, + "parameters": { + "properties": { + "approver_id": { + "description": "The approver ID", + "example": "1687-4", + "type": "string", + }, + "employee_id": { + "description": "The employee ID", + "example": "1687-3", + "type": "string", + }, + "end_date": { + "description": "The end date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "end_half_day": { + "description": "True if the end of the time off request ends half way through the day", + "example": true, + "oneOf": [ + { + "type": "boolean", + }, + { + "enum": [ + "true", + "false", + ], + "type": "string", + }, + ], + }, + "passthrough": { + "additionalProperties": true, + "description": "Value to pass through to the provider", + "example": { + "other_known_names": "John Doe", + }, + "type": "object", + }, + "reason": { + "properties": { + "id": { + "description": "Unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, + "name": { + "type": "string", + }, + "remote_id": { + "description": "Provider's unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, + }, + "type": "object", + }, + "start_date": { + "description": "The start date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "start_half_day": { + "description": "True if the start of the time off request begins half way through the day", + "example": true, + "oneOf": [ + { + "type": "boolean", + }, + { + "enum": [ + "true", + "false", + ], + "type": "string", + }, + ], + }, + "status": { + "description": "The status of the time off request", + "properties": { + "value": { + "enum": [ + "approved", + "cancelled", + "rejected", + "pending", + "deleted", + "unmapped_value", + null, + ], + "type": "string", + }, + }, + "type": "object", + }, + "time_off_policy_id": { + "description": "The time off policy id associated with this time off request", + "example": "cx280928933", + "type": "string", + }, + "x-account-id": undefined, + }, + "required": undefined, + "type": "object", + }, + "requestBuilder": RequestBuilder { + "bodyType": "json", + "headers": { + "Authorization": "Basic dGVzdF9rZXk6", + }, + "method": "POST", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "body", + "name": "employee_id", + "type": "string", + }, + { + "location": "body", + "name": "approver_id", + "type": "string", + }, + { + "location": "body", + "name": "status", + "type": "object", + }, + { + "location": "body", + "name": "start_date", + "type": "string", + }, + { + "location": "body", + "name": "end_date", + "type": "string", + }, + { + "location": "body", + "name": "start_half_day", + "type": "string", + }, + { + "location": "body", + "name": "end_half_day", + "type": "string", + }, + { + "location": "body", + "name": "time_off_policy_id", + "type": "string", + }, + { + "location": "body", + "name": "reason", + "type": "object", + }, + { + "location": "body", + "name": "passthrough", + "type": "object", + }, + ], + "url": "https://api.stackone.com/unified/hris/time_off", + }, + }, + StackOneTool { + "description": "Get time off request", + "executeConfig": { + "bodyType": "json", + "method": "GET", "params": [ { "location": "header", @@ -15683,20 +15861,249 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", + "type": "string", + }, + "id": { + "type": "string", + }, + "proxy": { + "additionalProperties": true, + "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", + "type": "object", + }, + "raw": { + "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", + "type": "boolean", + }, + "x-account-id": undefined, + }, + "required": [ + "id", + ], + "type": "object", + }, + "requestBuilder": RequestBuilder { + "bodyType": "json", + "headers": { + "Authorization": "Basic dGVzdF9rZXk6", + }, + "method": "GET", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "path", + "name": "id", + "type": "string", + }, + { + "location": "query", + "name": "raw", + "type": "boolean", + }, + { + "location": "query", + "name": "proxy", + "type": "object", + }, + { + "location": "query", + "name": "fields", "type": "string", }, + { + "location": "query", + "name": "expand", + "type": "string", + }, + ], + "url": "https://api.stackone.com/unified/hris/time_off/{id}", + }, + }, + StackOneTool { + "description": "Update time off request", + "executeConfig": { + "bodyType": "json", + "method": "PATCH", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "path", + "name": "id", + "type": "string", + }, + { + "location": "body", + "name": "employee_id", + "type": "string", + }, + { + "location": "body", + "name": "approver_id", + "type": "string", + }, + { + "location": "body", + "name": "status", + "type": "object", + }, + { + "location": "body", + "name": "start_date", + "type": "string", + }, + { + "location": "body", + "name": "end_date", + "type": "string", + }, + { + "location": "body", + "name": "start_half_day", + "type": "string", + }, + { + "location": "body", + "name": "end_half_day", + "type": "string", + }, + { + "location": "body", + "name": "time_off_policy_id", + "type": "string", + }, + { + "location": "body", + "name": "reason", + "type": "object", + }, + { + "location": "body", + "name": "passthrough", + "type": "object", + }, + ], + "url": "https://api.stackone.com/unified/hris/time_off/{id}", + }, + "name": "hris_update_time_off_request", + "parameterMapper": ParameterMapper { + "transformers": Map {}, + }, + "parameters": { + "properties": { + "approver_id": { + "description": "The approver ID", + "example": "1687-4", + "type": "string", + }, + "employee_id": { + "description": "The employee ID", + "example": "1687-3", + "type": "string", + }, + "end_date": { + "description": "The end date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "end_half_day": { + "description": "True if the end of the time off request ends half way through the day", + "example": true, + "oneOf": [ + { + "type": "boolean", + }, + { + "enum": [ + "true", + "false", + ], + "type": "string", + }, + ], + }, "id": { "type": "string", }, - "proxy": { + "passthrough": { "additionalProperties": true, - "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", + "description": "Value to pass through to the provider", + "example": { + "other_known_names": "John Doe", + }, "type": "object", }, - "raw": { - "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", - "type": "boolean", + "reason": { + "properties": { + "id": { + "description": "Unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, + "name": { + "type": "string", + }, + "remote_id": { + "description": "Provider's unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, + }, + "type": "object", + }, + "start_date": { + "description": "The start date of the time off request", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "start_half_day": { + "description": "True if the start of the time off request begins half way through the day", + "example": true, + "oneOf": [ + { + "type": "boolean", + }, + { + "enum": [ + "true", + "false", + ], + "type": "string", + }, + ], + }, + "status": { + "description": "The status of the time off request", + "properties": { + "value": { + "enum": [ + "approved", + "cancelled", + "rejected", + "pending", + "deleted", + "unmapped_value", + null, + ], + "type": "string", + }, + }, + "type": "object", + }, + "time_off_policy_id": { + "description": "The time off policy id associated with this time off request", + "example": "cx280928933", + "type": "string", }, "x-account-id": undefined, }, @@ -15710,7 +16117,7 @@ Tools { "headers": { "Authorization": "Basic dGVzdF9rZXk6", }, - "method": "GET", + "method": "PATCH", "params": [ { "location": "header", @@ -15723,25 +16130,55 @@ Tools { "type": "string", }, { - "location": "query", - "name": "raw", - "type": "boolean", + "location": "body", + "name": "employee_id", + "type": "string", }, { - "location": "query", - "name": "proxy", + "location": "body", + "name": "approver_id", + "type": "string", + }, + { + "location": "body", + "name": "status", "type": "object", }, { - "location": "query", - "name": "fields", + "location": "body", + "name": "start_date", "type": "string", }, { - "location": "query", - "name": "expand", + "location": "body", + "name": "end_date", + "type": "string", + }, + { + "location": "body", + "name": "start_half_day", + "type": "string", + }, + { + "location": "body", + "name": "end_half_day", + "type": "string", + }, + { + "location": "body", + "name": "time_off_policy_id", "type": "string", }, + { + "location": "body", + "name": "reason", + "type": "object", + }, + { + "location": "body", + "name": "passthrough", + "type": "object", + }, ], "url": "https://api.stackone.com/unified/hris/time_off/{id}", }, @@ -16444,129 +16881,9 @@ Tools { "name": "x-account-id", "type": "string", }, - { - "location": "path", - "name": "id", - "type": "string", - }, - { - "location": "query", - "name": "raw", - "type": "boolean", - }, - { - "location": "query", - "name": "proxy", - "type": "object", - }, - { - "location": "query", - "name": "fields", - "type": "string", - }, - ], - "url": "https://api.stackone.com/unified/hris/benefits/{id}", - }, - }, - StackOneTool { - "description": "List Groups", - "executeConfig": { - "bodyType": "json", - "method": "GET", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "query", - "name": "raw", - "type": "boolean", - }, - { - "location": "query", - "name": "proxy", - "type": "object", - }, - { - "location": "query", - "name": "fields", - "type": "string", - }, - { - "location": "query", - "name": "filter", - "type": "object", - }, - { - "location": "query", - "name": "page_size", - "type": "string", - }, - { - "location": "query", - "name": "next", - "type": "string", - }, - ], - "url": "https://api.stackone.com/unified/hris/groups", - }, - "name": "hris_list_groups", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, - "parameters": { - "properties": { - "fields": { - "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", - "type": "string", - }, - "filter": { - "description": "Filter parameters that allow greater customisation of the list response", - "properties": { - "updated_after": { - "additionalProperties": false, - "description": "Use a string with a date to only select results updated after that given date", - "example": "2020-01-01T00:00:00.000Z", - "type": "string", - }, - }, - "type": "object", - }, - "next": { - "description": "The unified cursor", - "type": "string", - }, - "page_size": { - "description": "The number of results per page (default value is 25)", - "type": "string", - }, - "proxy": { - "additionalProperties": true, - "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", - "type": "object", - }, - "raw": { - "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", - "type": "boolean", - }, - "x-account-id": undefined, - }, - "required": undefined, - "type": "object", - }, - "requestBuilder": RequestBuilder { - "bodyType": "json", - "headers": { - "Authorization": "Basic dGVzdF9rZXk6", - }, - "method": "GET", - "params": [ - { - "location": "header", - "name": "x-account-id", + { + "location": "path", + "name": "id", "type": "string", }, { @@ -16584,27 +16901,12 @@ Tools { "name": "fields", "type": "string", }, - { - "location": "query", - "name": "filter", - "type": "object", - }, - { - "location": "query", - "name": "page_size", - "type": "string", - }, - { - "location": "query", - "name": "next", - "type": "string", - }, ], - "url": "https://api.stackone.com/unified/hris/groups", + "url": "https://api.stackone.com/unified/hris/benefits/{id}", }, }, StackOneTool { - "description": "List Department Groups", + "description": "List Groups", "executeConfig": { "bodyType": "json", "method": "GET", @@ -16645,9 +16947,9 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/groups/departments", + "url": "https://api.stackone.com/unified/hris/groups", }, - "name": "hris_list_department_groups", + "name": "hris_list_groups", "parameterMapper": ParameterMapper { "transformers": Map {}, }, @@ -16655,7 +16957,7 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", "type": "string", }, "filter": { @@ -16735,11 +17037,11 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/groups/departments", + "url": "https://api.stackone.com/unified/hris/groups", }, }, StackOneTool { - "description": "List Cost Center Groups", + "description": "List Department Groups", "executeConfig": { "bodyType": "json", "method": "GET", @@ -16780,9 +17082,9 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/groups/cost_centers", + "url": "https://api.stackone.com/unified/hris/groups/departments", }, - "name": "hris_list_cost_center_groups", + "name": "hris_list_department_groups", "parameterMapper": ParameterMapper { "transformers": Map {}, }, @@ -16790,7 +17092,7 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", + "example": "id,remote_id,name", "type": "string", }, "filter": { @@ -16870,11 +17172,11 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/groups/cost_centers", + "url": "https://api.stackone.com/unified/hris/groups/departments", }, }, StackOneTool { - "description": "List Team Groups", + "description": "List Cost Center Groups", "executeConfig": { "bodyType": "json", "method": "GET", @@ -16915,9 +17217,9 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/groups/teams", + "url": "https://api.stackone.com/unified/hris/groups/cost_centers", }, - "name": "hris_list_team_groups", + "name": "hris_list_cost_center_groups", "parameterMapper": ParameterMapper { "transformers": Map {}, }, @@ -16925,7 +17227,7 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", + "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", "type": "string", }, "filter": { @@ -17005,11 +17307,11 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/groups/teams", + "url": "https://api.stackone.com/unified/hris/groups/cost_centers", }, }, StackOneTool { - "description": "Get Group", + "description": "List Team Groups", "executeConfig": { "bodyType": "json", "method": "GET", @@ -17019,11 +17321,6 @@ Tools { "name": "x-account-id", "type": "string", }, - { - "location": "path", - "name": "id", - "type": "string", - }, { "location": "query", "name": "raw", @@ -17039,110 +17336,25 @@ Tools { "name": "fields", "type": "string", }, - ], - "url": "https://api.stackone.com/unified/hris/groups/{id}", - }, - "name": "hris_get_group", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, - "parameters": { - "properties": { - "fields": { - "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", - "type": "string", - }, - "id": { - "type": "string", - }, - "proxy": { - "additionalProperties": true, - "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", - "type": "object", - }, - "raw": { - "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", - "type": "boolean", - }, - "x-account-id": undefined, - }, - "required": [ - "id", - ], - "type": "object", - }, - "requestBuilder": RequestBuilder { - "bodyType": "json", - "headers": { - "Authorization": "Basic dGVzdF9rZXk6", - }, - "method": "GET", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "path", - "name": "id", - "type": "string", - }, { "location": "query", - "name": "raw", - "type": "boolean", - }, - { - "location": "query", - "name": "proxy", + "name": "filter", "type": "object", }, { "location": "query", - "name": "fields", - "type": "string", - }, - ], - "url": "https://api.stackone.com/unified/hris/groups/{id}", - }, - }, - StackOneTool { - "description": "Get Department Group", - "executeConfig": { - "bodyType": "json", - "method": "GET", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "path", - "name": "id", + "name": "page_size", "type": "string", }, { "location": "query", - "name": "raw", - "type": "boolean", - }, - { - "location": "query", - "name": "proxy", - "type": "object", - }, - { - "location": "query", - "name": "fields", + "name": "next", "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/groups/departments/{id}", + "url": "https://api.stackone.com/unified/hris/groups/teams", }, - "name": "hris_get_department_group", + "name": "hris_list_team_groups", "parameterMapper": ParameterMapper { "transformers": Map {}, }, @@ -17150,110 +17362,27 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name", - "type": "string", - }, - "id": { - "type": "string", - }, - "proxy": { - "additionalProperties": true, - "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", - "type": "object", - }, - "raw": { - "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", - "type": "boolean", - }, - "x-account-id": undefined, - }, - "required": [ - "id", - ], - "type": "object", - }, - "requestBuilder": RequestBuilder { - "bodyType": "json", - "headers": { - "Authorization": "Basic dGVzdF9rZXk6", - }, - "method": "GET", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "path", - "name": "id", - "type": "string", - }, - { - "location": "query", - "name": "raw", - "type": "boolean", - }, - { - "location": "query", - "name": "proxy", - "type": "object", - }, - { - "location": "query", - "name": "fields", - "type": "string", - }, - ], - "url": "https://api.stackone.com/unified/hris/groups/departments/{id}", - }, - }, - StackOneTool { - "description": "Get Cost Center Group", - "executeConfig": { - "bodyType": "json", - "method": "GET", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "path", - "name": "id", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", "type": "string", }, - { - "location": "query", - "name": "raw", - "type": "boolean", - }, - { - "location": "query", - "name": "proxy", + "filter": { + "description": "Filter parameters that allow greater customisation of the list response", + "properties": { + "updated_after": { + "additionalProperties": false, + "description": "Use a string with a date to only select results updated after that given date", + "example": "2020-01-01T00:00:00.000Z", + "type": "string", + }, + }, "type": "object", }, - { - "location": "query", - "name": "fields", - "type": "string", - }, - ], - "url": "https://api.stackone.com/unified/hris/groups/cost_centers/{id}", - }, - "name": "hris_get_cost_center_group", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, - "parameters": { - "properties": { - "fields": { - "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", + "next": { + "description": "The unified cursor", "type": "string", }, - "id": { + "page_size": { + "description": "The number of results per page (default value is 25)", "type": "string", }, "proxy": { @@ -17267,9 +17396,7 @@ Tools { }, "x-account-id": undefined, }, - "required": [ - "id", - ], + "required": undefined, "type": "object", }, "requestBuilder": RequestBuilder { @@ -17284,11 +17411,6 @@ Tools { "name": "x-account-id", "type": "string", }, - { - "location": "path", - "name": "id", - "type": "string", - }, { "location": "query", "name": "raw", @@ -17304,12 +17426,27 @@ Tools { "name": "fields", "type": "string", }, + { + "location": "query", + "name": "filter", + "type": "object", + }, + { + "location": "query", + "name": "page_size", + "type": "string", + }, + { + "location": "query", + "name": "next", + "type": "string", + }, ], - "url": "https://api.stackone.com/unified/hris/groups/cost_centers/{id}", + "url": "https://api.stackone.com/unified/hris/groups/teams", }, }, StackOneTool { - "description": "Get Team Group", + "description": "Get Group", "executeConfig": { "bodyType": "json", "method": "GET", @@ -17340,9 +17477,9 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/groups/teams/{id}", + "url": "https://api.stackone.com/unified/hris/groups/{id}", }, - "name": "hris_get_team_group", + "name": "hris_get_group", "parameterMapper": ParameterMapper { "transformers": Map {}, }, @@ -17405,11 +17542,11 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/groups/teams/{id}", + "url": "https://api.stackone.com/unified/hris/groups/{id}", }, }, StackOneTool { - "description": "List Jobs", + "description": "Get Department Group", "executeConfig": { "bodyType": "json", "method": "GET", @@ -17419,6 +17556,11 @@ Tools { "name": "x-account-id", "type": "string", }, + { + "location": "path", + "name": "id", + "type": "string", + }, { "location": "query", "name": "raw", @@ -17434,25 +17576,10 @@ Tools { "name": "fields", "type": "string", }, - { - "location": "query", - "name": "filter", - "type": "object", - }, - { - "location": "query", - "name": "page_size", - "type": "string", - }, - { - "location": "query", - "name": "next", - "type": "string", - }, ], - "url": "https://api.stackone.com/unified/hris/jobs", + "url": "https://api.stackone.com/unified/hris/groups/departments/{id}", }, - "name": "hris_list_jobs", + "name": "hris_get_department_group", "parameterMapper": ParameterMapper { "transformers": Map {}, }, @@ -17460,27 +17587,10 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", - "type": "string", - }, - "filter": { - "description": "Filter parameters that allow greater customisation of the list response", - "properties": { - "updated_after": { - "additionalProperties": false, - "description": "Use a string with a date to only select results updated after that given date", - "example": "2020-01-01T00:00:00.000Z", - "type": "string", - }, - }, - "type": "object", - }, - "next": { - "description": "The unified cursor", + "example": "id,remote_id,name", "type": "string", }, - "page_size": { - "description": "The number of results per page (default value is 25)", + "id": { "type": "string", }, "proxy": { @@ -17494,7 +17604,9 @@ Tools { }, "x-account-id": undefined, }, - "required": undefined, + "required": [ + "id", + ], "type": "object", }, "requestBuilder": RequestBuilder { @@ -17509,6 +17621,11 @@ Tools { "name": "x-account-id", "type": "string", }, + { + "location": "path", + "name": "id", + "type": "string", + }, { "location": "query", "name": "raw", @@ -17524,27 +17641,12 @@ Tools { "name": "fields", "type": "string", }, - { - "location": "query", - "name": "filter", - "type": "object", - }, - { - "location": "query", - "name": "page_size", - "type": "string", - }, - { - "location": "query", - "name": "next", - "type": "string", - }, ], - "url": "https://api.stackone.com/unified/hris/jobs", + "url": "https://api.stackone.com/unified/hris/groups/departments/{id}", }, }, StackOneTool { - "description": "Get Job", + "description": "Get Cost Center Group", "executeConfig": { "bodyType": "json", "method": "GET", @@ -17575,9 +17677,9 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/jobs/{id}", + "url": "https://api.stackone.com/unified/hris/groups/cost_centers/{id}", }, - "name": "hris_get_job", + "name": "hris_get_cost_center_group", "parameterMapper": ParameterMapper { "transformers": Map {}, }, @@ -17585,7 +17687,7 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", + "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", "type": "string", }, "id": { @@ -17640,11 +17742,11 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/jobs/{id}", + "url": "https://api.stackone.com/unified/hris/groups/cost_centers/{id}", }, }, StackOneTool { - "description": "List Employee Skills", + "description": "Get Team Group", "executeConfig": { "bodyType": "json", "method": "GET", @@ -17674,25 +17776,10 @@ Tools { "name": "fields", "type": "string", }, - { - "location": "query", - "name": "filter", - "type": "object", - }, - { - "location": "query", - "name": "page_size", - "type": "string", - }, - { - "location": "query", - "name": "next", - "type": "string", - }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/skills", + "url": "https://api.stackone.com/unified/hris/groups/teams/{id}", }, - "name": "hris_list_employee_skills", + "name": "hris_get_team_group", "parameterMapper": ParameterMapper { "transformers": Map {}, }, @@ -17700,32 +17787,12 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,active,language,maximum_proficiency,minimum_proficiency", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", "type": "string", }, - "filter": { - "description": "Filter parameters that allow greater customisation of the list response", - "properties": { - "updated_after": { - "additionalProperties": false, - "description": "Use a string with a date to only select results updated after that given date", - "example": "2020-01-01T00:00:00.000Z", - "type": "string", - }, - }, - "type": "object", - }, "id": { "type": "string", }, - "next": { - "description": "The unified cursor", - "type": "string", - }, - "page_size": { - "description": "The number of results per page (default value is 25)", - "type": "string", - }, "proxy": { "additionalProperties": true, "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", @@ -17774,30 +17841,15 @@ Tools { "name": "fields", "type": "string", }, - { - "location": "query", - "name": "filter", - "type": "object", - }, - { - "location": "query", - "name": "page_size", - "type": "string", - }, - { - "location": "query", - "name": "next", - "type": "string", - }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/skills", + "url": "https://api.stackone.com/unified/hris/groups/teams/{id}", }, }, StackOneTool { - "description": "Create Employee Skill", + "description": "List Jobs", "executeConfig": { "bodyType": "json", - "method": "POST", + "method": "GET", "params": [ { "location": "header", @@ -17805,115 +17857,81 @@ Tools { "type": "string", }, { - "location": "body", - "name": "id", - "type": "string", + "location": "query", + "name": "raw", + "type": "boolean", }, { - "location": "body", - "name": "name", + "location": "query", + "name": "proxy", + "type": "object", + }, + { + "location": "query", + "name": "fields", "type": "string", }, { - "location": "body", - "name": "maximum_proficiency", + "location": "query", + "name": "filter", "type": "object", }, { - "location": "body", - "name": "minimum_proficiency", - "type": "object", + "location": "query", + "name": "page_size", + "type": "string", + }, + { + "location": "query", + "name": "next", + "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/skills", + "url": "https://api.stackone.com/unified/hris/jobs", }, - "name": "hris_create_employee_skill", + "name": "hris_list_jobs", "parameterMapper": ParameterMapper { "transformers": Map {}, }, "parameters": { "properties": { - "id": { - "description": "The ID associated with this skill", - "example": "16873-IT345", - "type": "string", - }, - "maximum_proficiency": { - "description": "The proficiency level of the skill", - "properties": { - "id": { - "description": "Unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, - "name": { - "description": "The name associated with this proficiency", - "example": "Expert", - "type": "string", - }, - "remote_id": { - "description": "Provider's unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, - "value": { - "enum": [ - "1", - "2", - "3", - "4", - "5", - "unmapped_value", - null, - ], - "type": "string", - }, - }, - "type": "object", + "fields": { + "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", + "type": "string", }, - "minimum_proficiency": { - "description": "The proficiency level of the skill", + "filter": { + "description": "Filter parameters that allow greater customisation of the list response", "properties": { - "id": { - "description": "Unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, - "name": { - "description": "The name associated with this proficiency", - "example": "Expert", - "type": "string", - }, - "remote_id": { - "description": "Provider's unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, - "value": { - "enum": [ - "1", - "2", - "3", - "4", - "5", - "unmapped_value", - null, - ], + "updated_after": { + "additionalProperties": false, + "description": "Use a string with a date to only select results updated after that given date", + "example": "2020-01-01T00:00:00.000Z", "type": "string", }, }, "type": "object", }, - "name": { - "description": "The name associated with this skill", - "example": "Information-Technology", + "next": { + "description": "The unified cursor", "type": "string", }, + "page_size": { + "description": "The number of results per page (default value is 25)", + "type": "string", + }, + "proxy": { + "additionalProperties": true, + "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", + "type": "object", + }, + "raw": { + "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", + "type": "boolean", + }, "x-account-id": undefined, }, - "required": [ - "id", - ], + "required": undefined, "type": "object", }, "requestBuilder": RequestBuilder { @@ -17921,7 +17939,7 @@ Tools { "headers": { "Authorization": "Basic dGVzdF9rZXk6", }, - "method": "POST", + "method": "GET", "params": [ { "location": "header", @@ -17929,31 +17947,41 @@ Tools { "type": "string", }, { - "location": "body", - "name": "id", - "type": "string", + "location": "query", + "name": "raw", + "type": "boolean", }, { - "location": "body", - "name": "name", + "location": "query", + "name": "proxy", + "type": "object", + }, + { + "location": "query", + "name": "fields", "type": "string", }, { - "location": "body", - "name": "maximum_proficiency", + "location": "query", + "name": "filter", "type": "object", }, { - "location": "body", - "name": "minimum_proficiency", - "type": "object", + "location": "query", + "name": "page_size", + "type": "string", + }, + { + "location": "query", + "name": "next", + "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/skills", + "url": "https://api.stackone.com/unified/hris/jobs", }, }, StackOneTool { - "description": "Get Employee Skill", + "description": "Get Job", "executeConfig": { "bodyType": "json", "method": "GET", @@ -17968,11 +17996,6 @@ Tools { "name": "id", "type": "string", }, - { - "location": "path", - "name": "subResourceId", - "type": "string", - }, { "location": "query", "name": "raw", @@ -17989,9 +18012,9 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/skills/{subResourceId}", + "url": "https://api.stackone.com/unified/hris/jobs/{id}", }, - "name": "hris_get_employee_skill", + "name": "hris_get_job", "parameterMapper": ParameterMapper { "transformers": Map {}, }, @@ -17999,7 +18022,7 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,active,language,maximum_proficiency,minimum_proficiency", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", "type": "string", }, "id": { @@ -18014,14 +18037,10 @@ Tools { "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", "type": "boolean", }, - "subResourceId": { - "type": "string", - }, "x-account-id": undefined, }, "required": [ "id", - "subResourceId", ], "type": "object", }, @@ -18042,11 +18061,6 @@ Tools { "name": "id", "type": "string", }, - { - "location": "path", - "name": "subResourceId", - "type": "string", - }, { "location": "query", "name": "raw", @@ -18063,11 +18077,11 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/skills/{subResourceId}", + "url": "https://api.stackone.com/unified/hris/jobs/{id}", }, }, StackOneTool { - "description": "List Time Off Policies", + "description": "List Employee Skills", "executeConfig": { "bodyType": "json", "method": "GET", @@ -18077,6 +18091,11 @@ Tools { "name": "x-account-id", "type": "string", }, + { + "location": "path", + "name": "id", + "type": "string", + }, { "location": "query", "name": "raw", @@ -18108,9 +18127,9 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/time_off_policies", + "url": "https://api.stackone.com/unified/hris/employees/{id}/skills", }, - "name": "hris_list_time_off_policies", + "name": "hris_list_employee_skills", "parameterMapper": ParameterMapper { "transformers": Map {}, }, @@ -18118,36 +18137,12 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,description,type,duration_unit,reasons,updated_at,created_at", + "example": "id,remote_id,name,active,language,maximum_proficiency,minimum_proficiency", "type": "string", }, "filter": { - "description": "HRIS Time-Off Policies filters", + "description": "Filter parameters that allow greater customisation of the list response", "properties": { - "type": { - "description": "Filter to select time-off policies by type", - "enum": [ - "sick", - "unmapped_value", - "vacation", - "long_term_disability", - "short_term_disability", - "absent", - "comp_time", - "training", - "annual_leave", - "leave_of_absence", - "break", - "child_care_leave", - "maternity_leave", - "jury_duty", - "bereavement_leave", - "sabbatical", - "accident", - null, - ], - "type": "string", - }, "updated_after": { "additionalProperties": false, "description": "Use a string with a date to only select results updated after that given date", @@ -18157,6 +18152,9 @@ Tools { }, "type": "object", }, + "id": { + "type": "string", + }, "next": { "description": "The unified cursor", "type": "string", @@ -18176,7 +18174,9 @@ Tools { }, "x-account-id": undefined, }, - "required": undefined, + "required": [ + "id", + ], "type": "object", }, "requestBuilder": RequestBuilder { @@ -18191,6 +18191,11 @@ Tools { "name": "x-account-id", "type": "string", }, + { + "location": "path", + "name": "id", + "type": "string", + }, { "location": "query", "name": "raw", @@ -18222,14 +18227,14 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/time_off_policies", + "url": "https://api.stackone.com/unified/hris/employees/{id}/skills", }, }, StackOneTool { - "description": "Get Time Off Policy", + "description": "Create Employee Skill", "executeConfig": { "bodyType": "json", - "method": "GET", + "method": "POST", "params": [ { "location": "header", @@ -18237,50 +18242,107 @@ Tools { "type": "string", }, { - "location": "path", + "location": "body", "name": "id", "type": "string", }, { - "location": "query", - "name": "raw", - "type": "boolean", + "location": "body", + "name": "name", + "type": "string", }, { - "location": "query", - "name": "proxy", + "location": "body", + "name": "maximum_proficiency", "type": "object", }, { - "location": "query", - "name": "fields", - "type": "string", + "location": "body", + "name": "minimum_proficiency", + "type": "object", }, ], - "url": "https://api.stackone.com/unified/hris/time_off_policies/{id}", + "url": "https://api.stackone.com/unified/hris/employees/{id}/skills", }, - "name": "hris_get_time_off_policy", + "name": "hris_create_employee_skill", "parameterMapper": ParameterMapper { "transformers": Map {}, }, "parameters": { "properties": { - "fields": { - "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,description,type,duration_unit,reasons,updated_at,created_at", - "type": "string", - }, "id": { + "description": "The ID associated with this skill", + "example": "16873-IT345", "type": "string", }, - "proxy": { - "additionalProperties": true, - "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", + "maximum_proficiency": { + "description": "The proficiency level of the skill", + "properties": { + "id": { + "description": "Unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, + "name": { + "description": "The name associated with this proficiency", + "example": "Expert", + "type": "string", + }, + "remote_id": { + "description": "Provider's unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, + "value": { + "enum": [ + "1", + "2", + "3", + "4", + "5", + null, + ], + "type": "string", + }, + }, "type": "object", }, - "raw": { - "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", - "type": "boolean", + "minimum_proficiency": { + "description": "The proficiency level of the skill", + "properties": { + "id": { + "description": "Unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, + "name": { + "description": "The name associated with this proficiency", + "example": "Expert", + "type": "string", + }, + "remote_id": { + "description": "Provider's unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, + "value": { + "enum": [ + "1", + "2", + "3", + "4", + "5", + null, + ], + "type": "string", + }, + }, + "type": "object", + }, + "name": { + "description": "The name associated with this skill", + "example": "Information-Technology", + "type": "string", }, "x-account-id": undefined, }, @@ -18294,7 +18356,7 @@ Tools { "headers": { "Authorization": "Basic dGVzdF9rZXk6", }, - "method": "GET", + "method": "POST", "params": [ { "location": "header", @@ -18302,31 +18364,31 @@ Tools { "type": "string", }, { - "location": "path", + "location": "body", "name": "id", "type": "string", }, { - "location": "query", - "name": "raw", - "type": "boolean", + "location": "body", + "name": "name", + "type": "string", }, { - "location": "query", - "name": "proxy", + "location": "body", + "name": "maximum_proficiency", "type": "object", }, { - "location": "query", - "name": "fields", - "type": "string", + "location": "body", + "name": "minimum_proficiency", + "type": "object", }, ], - "url": "https://api.stackone.com/unified/hris/time_off_policies/{id}", + "url": "https://api.stackone.com/unified/hris/employees/{id}/skills", }, }, StackOneTool { - "description": "List Assigned Time Off Policies", + "description": "Get Employee Skill", "executeConfig": { "bodyType": "json", "method": "GET", @@ -18341,6 +18403,11 @@ Tools { "name": "id", "type": "string", }, + { + "location": "path", + "name": "subResourceId", + "type": "string", + }, { "location": "query", "name": "raw", @@ -18356,25 +18423,10 @@ Tools { "name": "fields", "type": "string", }, - { - "location": "query", - "name": "filter", - "type": "object", - }, - { - "location": "query", - "name": "page_size", - "type": "string", - }, - { - "location": "query", - "name": "next", - "type": "string", - }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off_policies", + "url": "https://api.stackone.com/unified/hris/employees/{id}/skills/{subResourceId}", }, - "name": "hris_list_employee_time_off_policies", + "name": "hris_get_employee_skill", "parameterMapper": ParameterMapper { "transformers": Map {}, }, @@ -18382,56 +18434,12 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,description,type,duration_unit,reasons,updated_at,created_at", + "example": "id,remote_id,name,active,language,maximum_proficiency,minimum_proficiency", "type": "string", }, - "filter": { - "description": "HRIS Time-Off Policies filters", - "properties": { - "type": { - "description": "Filter to select time-off policies by type", - "enum": [ - "sick", - "unmapped_value", - "vacation", - "long_term_disability", - "short_term_disability", - "absent", - "comp_time", - "training", - "annual_leave", - "leave_of_absence", - "break", - "child_care_leave", - "maternity_leave", - "jury_duty", - "bereavement_leave", - "sabbatical", - "accident", - null, - ], - "type": "string", - }, - "updated_after": { - "additionalProperties": false, - "description": "Use a string with a date to only select results updated after that given date", - "example": "2020-01-01T00:00:00.000Z", - "type": "string", - }, - }, - "type": "object", - }, "id": { "type": "string", }, - "next": { - "description": "The unified cursor", - "type": "string", - }, - "page_size": { - "description": "The number of results per page (default value is 25)", - "type": "string", - }, "proxy": { "additionalProperties": true, "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", @@ -18441,10 +18449,14 @@ Tools { "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", "type": "boolean", }, + "subResourceId": { + "type": "string", + }, "x-account-id": undefined, }, "required": [ "id", + "subResourceId", ], "type": "object", }, @@ -18465,6 +18477,11 @@ Tools { "name": "id", "type": "string", }, + { + "location": "path", + "name": "subResourceId", + "type": "string", + }, { "location": "query", "name": "raw", @@ -18480,27 +18497,12 @@ Tools { "name": "fields", "type": "string", }, - { - "location": "query", - "name": "filter", - "type": "object", - }, - { - "location": "query", - "name": "page_size", - "type": "string", - }, - { - "location": "query", - "name": "next", - "type": "string", - }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off_policies", + "url": "https://api.stackone.com/unified/hris/employees/{id}/skills/{subResourceId}", }, }, StackOneTool { - "description": "List Employee Tasks", + "description": "List Time Off Policies", "executeConfig": { "bodyType": "json", "method": "GET", @@ -18510,11 +18512,6 @@ Tools { "name": "x-account-id", "type": "string", }, - { - "location": "path", - "name": "id", - "type": "string", - }, { "location": "query", "name": "raw", @@ -18545,28 +18542,18 @@ Tools { "name": "next", "type": "string", }, - { - "location": "query", - "name": "expand", - "type": "string", - }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks", + "url": "https://api.stackone.com/unified/hris/time_off_policies", }, - "name": "hris_list_employee_tasks", + "name": "hris_list_time_off_policies", "parameterMapper": ParameterMapper { "transformers": Map {}, }, "parameters": { "properties": { - "expand": { - "description": "The comma separated list of fields that will be expanded in the response", - "example": "attachments", - "type": "string", - }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,name,description,type,status,due_date,completion_date,assigned_by_employee_id,remote_assigned_by_employee_id,assigned_by_employee_name,link_to_task,extracted_links,next_task_id,remote_next_task_id,parent_process_name,comments,attachments,created_at,updated_at", + "example": "id,remote_id,name,description,type,duration_unit,reasons,updated_at,created_at", "type": "string", }, "filter": { @@ -18581,9 +18568,6 @@ Tools { }, "type": "object", }, - "id": { - "type": "string", - }, "next": { "description": "The unified cursor", "type": "string", @@ -18603,9 +18587,7 @@ Tools { }, "x-account-id": undefined, }, - "required": [ - "id", - ], + "required": undefined, "type": "object", }, "requestBuilder": RequestBuilder { @@ -18620,11 +18602,6 @@ Tools { "name": "x-account-id", "type": "string", }, - { - "location": "path", - "name": "id", - "type": "string", - }, { "location": "query", "name": "raw", @@ -18655,17 +18632,12 @@ Tools { "name": "next", "type": "string", }, - { - "location": "query", - "name": "expand", - "type": "string", - }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks", + "url": "https://api.stackone.com/unified/hris/time_off_policies", }, }, StackOneTool { - "description": "Get Employee Task", + "description": "Get Time Off Policy", "executeConfig": { "bodyType": "json", "method": "GET", @@ -18680,11 +18652,6 @@ Tools { "name": "id", "type": "string", }, - { - "location": "path", - "name": "subResourceId", - "type": "string", - }, { "location": "query", "name": "raw", @@ -18700,28 +18667,18 @@ Tools { "name": "fields", "type": "string", }, - { - "location": "query", - "name": "expand", - "type": "string", - }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks/{subResourceId}", + "url": "https://api.stackone.com/unified/hris/time_off_policies/{id}", }, - "name": "hris_get_employee_task", + "name": "hris_get_time_off_policy", "parameterMapper": ParameterMapper { "transformers": Map {}, }, "parameters": { "properties": { - "expand": { - "description": "The comma separated list of fields that will be expanded in the response", - "example": "attachments", - "type": "string", - }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,name,description,type,status,due_date,completion_date,assigned_by_employee_id,remote_assigned_by_employee_id,assigned_by_employee_name,link_to_task,extracted_links,next_task_id,remote_next_task_id,parent_process_name,comments,attachments,created_at,updated_at", + "example": "id,remote_id,name,description,type,duration_unit,reasons,updated_at,created_at", "type": "string", }, "id": { @@ -18736,14 +18693,10 @@ Tools { "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", "type": "boolean", }, - "subResourceId": { - "type": "string", - }, "x-account-id": undefined, }, "required": [ "id", - "subResourceId", ], "type": "object", }, @@ -18764,11 +18717,6 @@ Tools { "name": "id", "type": "string", }, - { - "location": "path", - "name": "subResourceId", - "type": "string", - }, { "location": "query", "name": "raw", @@ -18784,20 +18732,15 @@ Tools { "name": "fields", "type": "string", }, - { - "location": "query", - "name": "expand", - "type": "string", - }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks/{subResourceId}", + "url": "https://api.stackone.com/unified/hris/time_off_policies/{id}", }, }, StackOneTool { - "description": "Complete Employee Task", + "description": "List Assigned Time Off Policies", "executeConfig": { "bodyType": "json", - "method": "PATCH", + "method": "GET", "params": [ { "location": "header", @@ -18810,46 +18753,85 @@ Tools { "type": "string", }, { - "location": "path", - "name": "subResourceId", - "type": "string", + "location": "query", + "name": "raw", + "type": "boolean", }, { "location": "query", "name": "proxy", + "type": "object", + }, + { + "location": "query", + "name": "fields", "type": "string", }, { - "location": "body", - "name": "comment", + "location": "query", + "name": "filter", + "type": "object", + }, + { + "location": "query", + "name": "page_size", + "type": "string", + }, + { + "location": "query", + "name": "next", "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks/{subResourceId}", + "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off_policies", }, - "name": "hris_complete_employee_task", + "name": "hris_list_employee_time_off_policies", "parameterMapper": ParameterMapper { "transformers": Map {}, }, "parameters": { "properties": { - "comment": { - "description": "Comment or note about the task completion", - "example": "All required documents have been submitted", + "fields": { + "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", + "example": "id,remote_id,name,description,type,duration_unit,reasons,updated_at,created_at", "type": "string", }, + "filter": { + "description": "Filter parameters that allow greater customisation of the list response", + "properties": { + "updated_after": { + "additionalProperties": false, + "description": "Use a string with a date to only select results updated after that given date", + "example": "2020-01-01T00:00:00.000Z", + "type": "string", + }, + }, + "type": "object", + }, "id": { "type": "string", }, - "proxy": {}, - "subResourceId": { + "next": { + "description": "The unified cursor", + "type": "string", + }, + "page_size": { + "description": "The number of results per page (default value is 25)", "type": "string", }, + "proxy": { + "additionalProperties": true, + "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", + "type": "object", + }, + "raw": { + "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", + "type": "boolean", + }, "x-account-id": undefined, }, "required": [ "id", - "subResourceId", ], "type": "object", }, @@ -18858,7 +18840,7 @@ Tools { "headers": { "Authorization": "Basic dGVzdF9rZXk6", }, - "method": "PATCH", + "method": "GET", "params": [ { "location": "header", @@ -18871,22 +18853,37 @@ Tools { "type": "string", }, { - "location": "path", - "name": "subResourceId", - "type": "string", + "location": "query", + "name": "raw", + "type": "boolean", }, { "location": "query", "name": "proxy", + "type": "object", + }, + { + "location": "query", + "name": "fields", "type": "string", }, { - "location": "body", - "name": "comment", + "location": "query", + "name": "filter", + "type": "object", + }, + { + "location": "query", + "name": "page_size", + "type": "string", + }, + { + "location": "query", + "name": "next", "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks/{subResourceId}", + "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off_policies", }, }, ], From 926c079792bb8dad1ab4805e57f23958e177b620 Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Fri, 6 Jun 2025 20:09:36 +0100 Subject: [PATCH 11/16] linting --- examples/experimental-document-handling.ts | 2 +- src/tool.ts | 30 +++++++--------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/examples/experimental-document-handling.ts b/examples/experimental-document-handling.ts index 35dd00c6..76ef5aa8 100644 --- a/examples/experimental-document-handling.ts +++ b/examples/experimental-document-handling.ts @@ -18,9 +18,9 @@ import assert from 'node:assert'; import * as fs from 'node:fs'; import * as path from 'node:path'; import { - StackOneToolSet, type Experimental_PreExecuteFunction, type Experimental_SchemaOverride, + StackOneToolSet, } from '../src'; const accountId = '45072196112816593343'; diff --git a/src/tool.ts b/src/tool.ts index eedd837e..7c90f2eb 100644 --- a/src/tool.ts +++ b/src/tool.ts @@ -146,17 +146,6 @@ export class BaseTool { * StackOne-specific tool class with additional functionality */ export class StackOneTool extends BaseTool { - constructor( - name: string, - description: string, - parameters: ToolParameters, - executeConfig: ExecuteConfig, - headers?: Record, - experimental_preExecute?: Experimental_PreExecuteFunction - ) { - super(name, description, parameters, executeConfig, headers, experimental_preExecute); - } - /** * Get the current account ID */ @@ -223,17 +212,16 @@ export class Tools implements Iterable { options.experimental_preExecute ); return newTool; - } else { - const newTool = new BaseTool( - originalTool.name, - originalTool.description, - parameters, - originalTool.executeConfig, - originalTool.getHeaders(), - options.experimental_preExecute - ); - return newTool; } + const newTool = new BaseTool( + originalTool.name, + originalTool.description, + parameters, + originalTool.executeConfig, + originalTool.getHeaders(), + options.experimental_preExecute + ); + return newTool; } /** From 17ac3a53dd308035384849a194ae91d5fb0fa974 Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Fri, 6 Jun 2025 20:15:47 +0100 Subject: [PATCH 12/16] chore: clean up new doc handling --- examples/experimental-document-handling.ts | 56 +++- .../tests/__snapshots__/stackone.spec.ts.snap | 240 +++++------------- 2 files changed, 103 insertions(+), 193 deletions(-) diff --git a/examples/experimental-document-handling.ts b/examples/experimental-document-handling.ts index 76ef5aa8..a8e43fb6 100644 --- a/examples/experimental-document-handling.ts +++ b/examples/experimental-document-handling.ts @@ -17,6 +17,7 @@ import assert from 'node:assert'; import * as fs from 'node:fs'; import * as path from 'node:path'; +import type { JSONSchema7Definition } from 'json-schema'; import { type Experimental_PreExecuteFunction, type Experimental_SchemaOverride, @@ -25,13 +26,24 @@ import { const accountId = '45072196112816593343'; +interface FileFormatParam { + value: string; +} + +interface DocumentParams { + content: string; + name: string; + file_format: FileFormatParam; + [key: string]: unknown; +} + /** * EXPERIMENTAL: Schema override for document upload - changes from complex schema to simple doc_id */ const createDocumentSchemaOverride = (): Experimental_SchemaOverride => { return (originalSchema) => { // Extract only the category from original schema, replace file-related params with doc_id - const newProperties: Record = {}; + const newProperties: Record = {}; // Keep non-file parameters from original schema for (const [key, value] of Object.entries(originalSchema.properties)) { @@ -102,7 +114,7 @@ const createDocumentPreExecute = (allowedPaths: string[]): Experimental_PreExecu */ const createExternalDocumentSchemaOverride = (): Experimental_SchemaOverride => { return (originalSchema) => { - const newProperties: Record = {}; + const newProperties: Record = {}; // Keep non-file parameters from original schema for (const [key, value] of Object.entries(originalSchema.properties)) { @@ -163,7 +175,7 @@ const createExternalDocumentPreExecute = (): Experimental_PreExecuteFunction => */ const createMultiSourceSchemaOverride = (): Experimental_SchemaOverride => { return (originalSchema) => { - const newProperties: Record = {}; + const newProperties: Record = {}; // Keep non-file parameters from original schema for (const [key, value] of Object.entries(originalSchema.properties)) { @@ -257,10 +269,20 @@ const experimentalDocumentHandling = async (): Promise => { ); console.log('โœ… Local file schema override + preExecute successful'); - const localParams = localFileResult.mappedParams as Record; - assert(localParams.file_format?.value === 'txt', 'File format was not transformed correctly'); - assert(localParams.name === 'sample-document.txt', 'File name was not transformed correctly'); - assert(typeof localParams.content === 'string', 'File content was not transformed correctly'); + const localParams = localFileResult.mappedParams as Record; + const localDocumentParams = localParams as DocumentParams & Record; + assert( + localDocumentParams.file_format?.value === 'txt', + 'File format was not transformed correctly' + ); + assert( + localDocumentParams.name === 'sample-document.txt', + 'File name was not transformed correctly' + ); + assert( + typeof localDocumentParams.content === 'string', + 'File content was not transformed correctly' + ); console.log('๐Ÿงช Testing EXPERIMENTAL schema override + preExecute for external documents...'); @@ -270,6 +292,8 @@ const experimentalDocumentHandling = async (): Promise => { experimental_preExecute: createExternalDocumentPreExecute(), }); + assert(externalDocumentTool !== undefined, 'External document tool not found'); + const externalResult = await externalDocumentTool.execute( { document_reference: 'external-doc-123', // Simplified schema - just reference @@ -282,9 +306,10 @@ const experimentalDocumentHandling = async (): Promise => { ); console.log('โœ… External document schema override + preExecute successful'); - const externalParams = externalResult.mappedParams as Record; + const externalParams = externalResult.mappedParams as Record; + const externalDocumentParams = externalParams as DocumentParams & Record; assert( - externalParams.name.includes('external-doc-123'), + externalDocumentParams.name.includes('external-doc-123'), 'External document name was not transformed correctly' ); @@ -296,6 +321,8 @@ const experimentalDocumentHandling = async (): Promise => { experimental_preExecute: createMultiSourcePreExecute([__dirname]), }); + assert(multiSourceTool !== undefined, 'Multi-source tool not found'); + // Test with local file const multiSourceLocalResult = await multiSourceTool.execute( { @@ -309,9 +336,10 @@ const experimentalDocumentHandling = async (): Promise => { ); console.log('โœ… Multi-source (local) schema override + preExecute successful'); - const multiLocalParams = multiSourceLocalResult.mappedParams as Record; + const multiLocalParams = multiSourceLocalResult.mappedParams as Record; + const multiLocalDocumentParams = multiLocalParams as DocumentParams & Record; assert( - multiLocalParams.name === 'sample-document.txt', + multiLocalDocumentParams.name === 'sample-document.txt', 'Multi-source local document name was not transformed correctly' ); @@ -328,9 +356,11 @@ const experimentalDocumentHandling = async (): Promise => { ); console.log('โœ… Multi-source (external) schema override + preExecute successful'); - const multiExternalParams = multiSourceExternalResult.mappedParams as Record; + const multiExternalParams = multiSourceExternalResult.mappedParams as Record; + const multiExternalDocumentParams = multiExternalParams as DocumentParams & + Record; assert( - multiExternalParams.name.includes('external-doc-456'), + multiExternalDocumentParams.name.includes('external-doc-456'), 'Multi-source external document name was not transformed correctly' ); diff --git a/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap b/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap index c1936ebd..0653d380 100644 --- a/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap +++ b/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap @@ -47,10 +47,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/companies", }, + "experimental_preExecute": undefined, "name": "hris_list_companies", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -172,10 +170,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/companies/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_company", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -282,10 +278,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/custom_field_definitions/employees", }, + "experimental_preExecute": undefined, "name": "hris_list_employee_custom_field_definitions", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -422,10 +416,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/custom_field_definitions/employees/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_employee_custom_field_definition", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -577,10 +569,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees", }, + "experimental_preExecute": undefined, "name": "hris_list_employees", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "expand": { @@ -905,10 +895,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees", }, + "experimental_preExecute": undefined, "name": "hris_create_employee", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "avatar": { @@ -3176,10 +3164,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_employee", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "expand": { @@ -3471,10 +3457,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}", }, + "experimental_preExecute": undefined, "name": "hris_update_employee", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "avatar": { @@ -5705,10 +5689,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/invite", }, + "experimental_preExecute": undefined, "name": "hris_invite_employee", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "id": { @@ -5809,10 +5791,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off", }, + "experimental_preExecute": undefined, "name": "hris_list_employee_time_off_requests", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "expand": { @@ -5996,10 +5976,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off", }, + "experimental_preExecute": undefined, "name": "hris_create_employee_time_off_request", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "approver_id": { @@ -6230,10 +6208,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off/{subResourceId}", }, + "experimental_preExecute": undefined, "name": "hris_get_employees_time_off_request", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "expand": { @@ -6389,10 +6365,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off/{subResourceId}", }, + "experimental_preExecute": undefined, "name": "hris_update_employee_time_off_request", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "approver_id": { @@ -6612,10 +6586,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/documents/upload/batch", }, + "experimental_preExecute": undefined, "name": "hris_batch_upload_employee_document", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "id": { @@ -8022,10 +7994,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/documents/upload", }, + "experimental_preExecute": undefined, "name": "hris_upload_employee_document", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "category": { @@ -9427,10 +9397,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/documents/{subResourceId}/download", }, + "experimental_preExecute": undefined, "name": "hris_download_employee_document", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "format": { @@ -9532,10 +9500,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/documents", }, + "experimental_preExecute": undefined, "name": "hris_list_employee_documents", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -9672,10 +9638,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/documents/{subResourceId}", }, + "experimental_preExecute": undefined, "name": "hris_get_employee_document", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -9791,10 +9755,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/documents/employee_categories", }, + "experimental_preExecute": undefined, "name": "hris_list_employee_categories", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -9916,10 +9878,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/documents/employee_categories/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_employee_document_category", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -10031,10 +9991,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/work_eligibility", }, + "experimental_preExecute": undefined, "name": "hris_list_employee_work_eligibility", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -10191,10 +10149,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/work_eligibility", }, + "experimental_preExecute": undefined, "name": "hris_create_employee_work_eligibility_request", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "document": { @@ -11896,10 +11852,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/work_eligibility/{subResourceId}", }, + "experimental_preExecute": undefined, "name": "hris_get_employees_work_eligibility", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -12035,10 +11989,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/work_eligibility/{subResourceId}", }, + "experimental_preExecute": undefined, "name": "hris_update_employee_work_eligibility_request", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "document": { @@ -13764,10 +13716,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off_balances", }, + "experimental_preExecute": undefined, "name": "hris_list_employee_time_off_balances", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "expand": { @@ -13927,10 +13877,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off_balances/{subResourceId}", }, + "experimental_preExecute": undefined, "name": "hris_get_employee_time_off_balance", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "expand": { @@ -14061,10 +14009,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employments", }, + "experimental_preExecute": undefined, "name": "hris_list_employments", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "expand": { @@ -14201,10 +14147,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employments/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_employment", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "expand": { @@ -14331,10 +14275,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/employments", }, + "experimental_preExecute": undefined, "name": "hris_list_employee_employments", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "expand": { @@ -14511,10 +14453,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/employments", }, + "experimental_preExecute": undefined, "name": "hris_create_employee_employment", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "employment_contract_type": { @@ -14780,10 +14720,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/employments/{subResourceId}", }, + "experimental_preExecute": undefined, "name": "hris_get_employee_employment", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "expand": { @@ -14939,10 +14877,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/employments/{subResourceId}", }, + "experimental_preExecute": undefined, "name": "hris_update_employee_employment", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "employment_contract_type": { @@ -15217,10 +15153,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/locations", }, + "experimental_preExecute": undefined, "name": "hris_list_locations", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -15342,10 +15276,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/locations/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_location", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -15457,10 +15389,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/time_off", }, + "experimental_preExecute": undefined, "name": "hris_list_time_off_requests", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "expand": { @@ -15629,10 +15559,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/time_off", }, + "experimental_preExecute": undefined, "name": "hris_create_time_off_request", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "approver_id": { @@ -15848,10 +15776,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/time_off/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_time_off_request", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "expand": { @@ -15993,10 +15919,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/time_off/{id}", }, + "experimental_preExecute": undefined, "name": "hris_update_time_off_request", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "approver_id": { @@ -16227,10 +16151,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/time_off_types", }, + "experimental_preExecute": undefined, "name": "hris_list_time_off_types", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -16352,10 +16274,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/time_off_types/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_time_off_type", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -16462,10 +16382,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/time_entries", }, + "experimental_preExecute": undefined, "name": "hris_list_time_entries", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -16604,10 +16522,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/time_entries/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_time_entries", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -16714,10 +16630,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/benefits", }, + "experimental_preExecute": undefined, "name": "hris_list_benefits", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -16839,10 +16753,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/benefits/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_benefit", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -16949,10 +16861,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/groups", }, + "experimental_preExecute": undefined, "name": "hris_list_groups", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -17084,10 +16994,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/groups/departments", }, + "experimental_preExecute": undefined, "name": "hris_list_department_groups", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -17219,10 +17127,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/groups/cost_centers", }, + "experimental_preExecute": undefined, "name": "hris_list_cost_center_groups", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -17354,10 +17260,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/groups/teams", }, + "experimental_preExecute": undefined, "name": "hris_list_team_groups", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -17479,10 +17383,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/groups/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_group", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -17579,10 +17481,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/groups/departments/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_department_group", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -17679,10 +17579,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/groups/cost_centers/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_cost_center_group", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -17779,10 +17677,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/groups/teams/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_team_group", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -17889,10 +17785,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/jobs", }, + "experimental_preExecute": undefined, "name": "hris_list_jobs", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -18014,10 +17908,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/jobs/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_job", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -18129,10 +18021,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/skills", }, + "experimental_preExecute": undefined, "name": "hris_list_employee_skills", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -18264,10 +18154,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/skills", }, + "experimental_preExecute": undefined, "name": "hris_create_employee_skill", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "id": { @@ -18426,10 +18314,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/skills/{subResourceId}", }, + "experimental_preExecute": undefined, "name": "hris_get_employee_skill", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -18545,10 +18431,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/time_off_policies", }, + "experimental_preExecute": undefined, "name": "hris_list_time_off_policies", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -18670,10 +18554,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/time_off_policies/{id}", }, + "experimental_preExecute": undefined, "name": "hris_get_time_off_policy", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { @@ -18785,10 +18667,8 @@ Tools { ], "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off_policies", }, + "experimental_preExecute": undefined, "name": "hris_list_employee_time_off_policies", - "parameterMapper": ParameterMapper { - "transformers": Map {}, - }, "parameters": { "properties": { "fields": { From 19e8383cf24f1ee5f74933de6559f3804f27fc85 Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Tue, 17 Jun 2025 11:07:06 +0100 Subject: [PATCH 13/16] fix: bad types --- src/tool.ts | 7 ++----- src/types.ts | 7 ------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/tool.ts b/src/tool.ts index 7c90f2eb..1672c408 100644 --- a/src/tool.ts +++ b/src/tool.ts @@ -76,11 +76,8 @@ export class BaseTool { // Apply experimental preExecute function (either from tool creation or execution options) let processedParams = params; - // Prioritize tool-level experimental_preExecute over execution-time experimental_PreExecute - const preExecuteFunction = this.experimental_preExecute || options?.experimental_PreExecute; - - if (preExecuteFunction) { - processedParams = await preExecuteFunction(params); + if (this.experimental_preExecute) { + processedParams = await this.experimental_preExecute(params); } // Execute the request directly with processed parameters diff --git a/src/types.ts b/src/types.ts index 3e3325c9..167647aa 100644 --- a/src/types.ts +++ b/src/types.ts @@ -91,13 +91,6 @@ export interface ExecuteOptions { * Useful for debugging and testing transformed parameters */ dryRun?: boolean; - - /** - * EXPERIMENTAL: Function to preprocess parameters before execution - * Allows for document fetching, parameter override, etc. - * @deprecated Use experimental_preExecute in tool creation options instead - */ - experimental_PreExecute?: Experimental_PreExecuteFunction; } /** From 4a8be2a810ae7435e80757a2d04f14232a08996a Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Tue, 17 Jun 2025 11:59:28 +0100 Subject: [PATCH 14/16] feat: unify account ids --- .github/workflows/test.yml | 2 +- examples/account-id-usage.ts | 13 +- examples/ai-sdk-integration.ts | 7 +- examples/constants.ts | 45 + examples/error-handling.ts | 3 +- examples/examples.spec.ts | 61 + examples/experimental-document-handling.ts | 3 +- examples/filters.ts | 3 +- examples/human-in-the-loop.ts | 3 +- examples/index.ts | 12 +- examples/openai-integration.ts | 3 +- examples/planning.ts | 59 +- package.json | 5 +- ...{build-docs.test.ts => build-docs.spec.ts} | 0 .../__snapshots__/openapi-parser.spec.ts.snap | 2072 ++++++++--------- .../tests/__snapshots__/stackone.spec.ts.snap | 2055 ++++++++-------- 16 files changed, 2134 insertions(+), 2212 deletions(-) create mode 100644 examples/constants.ts create mode 100644 examples/examples.spec.ts rename scripts/{build-docs.test.ts => build-docs.spec.ts} (100%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a2ece082..42dc1520 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,4 +19,4 @@ jobs: # TODO change this to bun test - name: Run tests - run: bun test -u + run: bun test:unit -u diff --git a/examples/account-id-usage.ts b/examples/account-id-usage.ts index b64c9b5d..1b6684e0 100644 --- a/examples/account-id-usage.ts +++ b/examples/account-id-usage.ts @@ -16,39 +16,40 @@ import assert from 'node:assert'; import { StackOneToolSet } from '../src'; +import { ACCOUNT_IDS } from './constants'; const accountIdUsage = async (): Promise => { /* * Set account ID on toolset initialization */ - const toolset = new StackOneToolSet({ accountId: 'initial-account-id' }); + const toolset = new StackOneToolSet({ accountId: ACCOUNT_IDS.TEST.VALID }); const tools = toolset.getTools('hris_*'); const employeeTool = tools.getStackOneTool('hris_list_employees'); assert( - employeeTool.getAccountId() === 'initial-account-id', + employeeTool.getAccountId() === ACCOUNT_IDS.TEST.VALID, 'Account ID should match what was set' ); /* * Setting account ID when getting tools (overrides toolset account ID) */ - const toolsWithOverride = toolset.getStackOneTools('hris_*', 'override-account-id'); + const toolsWithOverride = toolset.getStackOneTools('hris_*', ACCOUNT_IDS.TEST.OVERRIDE); const employeeToolWithOverride = toolsWithOverride.getStackOneTool('hris_list_employees'); assert( - employeeToolWithOverride?.getAccountId() === 'override-account-id', + employeeToolWithOverride?.getAccountId() === ACCOUNT_IDS.TEST.OVERRIDE, 'Account ID should match what was set' ); /* * Set the account ID directly on the tool */ - employeeTool.setAccountId('direct-account-id'); + employeeTool.setAccountId(ACCOUNT_IDS.TEST.DIRECT); assert( - employeeTool.getAccountId() === 'direct-account-id', + employeeTool.getAccountId() === ACCOUNT_IDS.TEST.DIRECT, 'Account ID should match what was set' ); }; diff --git a/examples/ai-sdk-integration.ts b/examples/ai-sdk-integration.ts index 59aad384..d51eed72 100644 --- a/examples/ai-sdk-integration.ts +++ b/examples/ai-sdk-integration.ts @@ -6,11 +6,12 @@ import assert from 'node:assert'; import { openai } from '@ai-sdk/openai'; import { generateText } from 'ai'; import { StackOneToolSet } from '../src'; +import { ACCOUNT_IDS } from './constants'; const aiSdkIntegration = async (): Promise => { // Initialize StackOne const toolset = new StackOneToolSet(); - const accountId = '45072196112816593343'; + const accountId = ACCOUNT_IDS.HRIS; // Get HRIS tools const tools = toolset.getStackOneTools('hris_get_*', accountId); @@ -20,13 +21,13 @@ const aiSdkIntegration = async (): Promise => { // Use max steps to automatically call the tool if it's needed const { text } = await generateText({ - model: openai('gpt-4o-mini'), + model: openai('gpt-4.1-mini'), tools: aiSdkTools, prompt: 'Get all details about employee with id: c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA', maxSteps: 3, }); - assert(text.includes('Isacc Newton'), 'Expected employee name to be included in the response'); + assert(text.includes('Michael'), 'Expected employee name to be included in the response'); }; aiSdkIntegration(); diff --git a/examples/constants.ts b/examples/constants.ts new file mode 100644 index 00000000..c0ee0c75 --- /dev/null +++ b/examples/constants.ts @@ -0,0 +1,45 @@ +/** + * Centralized account IDs for StackOne examples + * + * These account IDs are organized by vertical and can be reused across examples. + * Update these values with your actual account IDs for each integration. + */ + +export const ACCOUNT_IDS = { + // Human Resources Information System + HRIS: '46132201201510402136', + + // Applicant Tracking System + ATS: '46132127373317208518', + + // Customer Relationship Management + CRM: '46132129512514182883', + + // Document Management System + DOCUMENTS: '46132143471913690795', + + TEST: { + VALID: 'test_account_id', + OVERRIDE: 'test_account_id_override', + DIRECT: 'test_account_id_direct', + INVALID: 'invalid_test_account_id', + }, +} as const; + +/** + * Helper function to get account ID by vertical + */ +export const getAccountId = (vertical: keyof typeof ACCOUNT_IDS): string => { + const accountId = ACCOUNT_IDS[vertical]; + + if (typeof accountId === 'string') { + return accountId; + } + + // For TEST vertical, return VALID as default + if (vertical === 'TEST') { + return ACCOUNT_IDS.TEST.VALID; + } + + throw new Error(`Invalid vertical: ${vertical}`); +}; diff --git a/examples/error-handling.ts b/examples/error-handling.ts index b653530c..fa7f6f4e 100644 --- a/examples/error-handling.ts +++ b/examples/error-handling.ts @@ -6,6 +6,7 @@ import assert from 'node:assert'; import { StackOneAPIError, StackOneError, StackOneToolSet, ToolSetConfigError } from '../src'; +import { ACCOUNT_IDS } from './constants'; const errorHandling = async (): Promise => { // Example 1: Handle initialization errors @@ -32,7 +33,7 @@ const errorHandling = async (): Promise => { // Example 2: Handle API errors const testApiErrors = async (): Promise => { const toolset = new StackOneToolSet(); - const accountId = 'invalid-account-id'; // Invalid account ID to force an error + const accountId = ACCOUNT_IDS.TEST.INVALID; // Invalid account ID to force an error try { const tools = toolset.getStackOneTools('hris_*', accountId); diff --git a/examples/examples.spec.ts b/examples/examples.spec.ts new file mode 100644 index 00000000..f369b818 --- /dev/null +++ b/examples/examples.spec.ts @@ -0,0 +1,61 @@ +import { describe, expect, it } from 'bun:test'; +import { $ } from 'bun'; +import { directoryExists, listFilesInDirectory, joinPaths } from '../src/utils/file'; + +describe('Examples', () => { + it( + 'should run all example files without errors', + async () => { + const examplesDir = joinPaths(process.cwd(), 'examples'); + + if (!directoryExists(examplesDir)) { + throw new Error('Examples directory not found'); + } + + const exampleFiles = listFilesInDirectory( + examplesDir, + (fileName) => fileName.endsWith('.ts') && !fileName.includes('.spec.') + ); + + expect(exampleFiles.length).toBeGreaterThan(0); + + const results = await Promise.all( + exampleFiles.map(async (file) => { + const filePath = joinPaths(examplesDir, file); + + try { + const result = await $`bun run ${filePath}`.quiet(); + return { + file, + success: result.exitCode === 0, + exitCode: result.exitCode, + stdout: result.stdout?.toString() || '', + stderr: result.stderr?.toString() || '', + }; + } catch (error) { + return { + file, + success: false, + exitCode: 1, + stdout: '', + stderr: error instanceof Error ? error.message : String(error), + }; + } + }) + ); + + const failedExamples = results.filter((result) => !result.success); + + if (failedExamples.length > 0) { + const errorMessage = failedExamples + .map(({ file, exitCode, stderr }) => `${file} (exit code: ${exitCode}): ${stderr}`) + .join('\n'); + + throw new Error(`Examples failed:\n${errorMessage}`); + } + + expect(results.every((result) => result.success)).toBe(true); + }, + { timeout: 30000 } + ); +}); diff --git a/examples/experimental-document-handling.ts b/examples/experimental-document-handling.ts index a8e43fb6..c9a53d97 100644 --- a/examples/experimental-document-handling.ts +++ b/examples/experimental-document-handling.ts @@ -23,8 +23,9 @@ import { type Experimental_SchemaOverride, StackOneToolSet, } from '../src'; +import { ACCOUNT_IDS } from './constants'; -const accountId = '45072196112816593343'; +const accountId = ACCOUNT_IDS.HRIS; interface FileFormatParam { value: string; diff --git a/examples/filters.ts b/examples/filters.ts index 7a6e6e6f..481d0bcb 100644 --- a/examples/filters.ts +++ b/examples/filters.ts @@ -21,13 +21,14 @@ import assert from 'node:assert'; import { StackOneToolSet } from '../src'; +import { ACCOUNT_IDS } from './constants'; type DryRunResult = { url: string }; const hriseEmployeeFilters = async (): Promise => { // Initialize the toolset const toolset = new StackOneToolSet(); - const accountId = 'test-account-id'; + const accountId = ACCOUNT_IDS.TEST.VALID; // Get the HRIS tools with account ID const tools = toolset.getStackOneTools('hris_*', accountId); diff --git a/examples/human-in-the-loop.ts b/examples/human-in-the-loop.ts index aa36deff..eeaf6a81 100644 --- a/examples/human-in-the-loop.ts +++ b/examples/human-in-the-loop.ts @@ -11,6 +11,7 @@ import { openai } from '@ai-sdk/openai'; import { generateText } from 'ai'; import { StackOneToolSet } from '../src'; import type { JsonDict } from '../src/types'; +import { ACCOUNT_IDS } from './constants'; interface ToolCall { toolName: string; @@ -20,7 +21,7 @@ interface ToolCall { const humanInTheLoopExample = async (): Promise => { // Create a toolset const toolset = new StackOneToolSet(); - const hrisAccountId = 'workday_account_id'; + const hrisAccountId = ACCOUNT_IDS.HRIS; // Get the create employee tool const createEmployeeTool = toolset.getTool('hris_create_employee', { diff --git a/examples/index.ts b/examples/index.ts index 0f06a4e4..3dcfb3d9 100644 --- a/examples/index.ts +++ b/examples/index.ts @@ -33,10 +33,12 @@ dotenv.config(); * StackOne uses account IDs to identify different integrations. * See the example in the README for more details. * - * This example will hardcode the account ID: + * This example will use the centralized account ID: */ -const accountId = '45072196112816593343'; +import { ACCOUNT_IDS } from './constants'; + +const accountId = ACCOUNT_IDS.HRIS; /** * # Quickstart @@ -59,9 +61,9 @@ const quickstart = async (): Promise => { assert(employeeTool !== undefined, 'Expected to find hris_list_employees tool'); // Execute the tool and verify the response - const employees = await employeeTool.execute(); - assert(Array.isArray(employees), 'Expected employees to be an array'); - assert(employees.length > 0, 'Expected to find at least one employee'); + const result = await employeeTool.execute(); + assert(Array.isArray(result.data), 'Expected employees to be an array'); + assert(result.data.length > 0, 'Expected to find at least one employee'); }; // Run the example diff --git a/examples/openai-integration.ts b/examples/openai-integration.ts index e9bff1b0..d2cae53a 100644 --- a/examples/openai-integration.ts +++ b/examples/openai-integration.ts @@ -5,11 +5,12 @@ import assert from 'node:assert'; import OpenAI from 'openai'; import { StackOneToolSet } from '../src'; +import { ACCOUNT_IDS } from './constants'; const openaiIntegration = async (): Promise => { // Initialize StackOne const toolset = new StackOneToolSet(); - const accountId = '45072196112816593343'; + const accountId = ACCOUNT_IDS.HRIS; // Get the correct tool const tools = toolset.getStackOneTools('hris_get_*', accountId); diff --git a/examples/planning.ts b/examples/planning.ts index 4b863460..1cdb303b 100644 --- a/examples/planning.ts +++ b/examples/planning.ts @@ -7,35 +7,34 @@ */ import { StackOneToolSet } from '../src'; - -const toolset = new StackOneToolSet(); - -const onboardWorkflow = await toolset.plan({ - key: 'custom_onboarding', - input: 'Onboard the last new hire from Teamtailor to Workday', - model: 'stackone-planner-latest', - tools: ['hris_*', 'ats_*'], - accountIds: ['teamtailor_account_id', 'workday_account_id'], - cache: true, // saves the plan to $HOME/.stackone/plans -}); - -await onboardWorkflow.execute(); - -/** - * or use as part of a larger agent (using AI SDK by Vercel) - */ - import { openai } from '@ai-sdk/openai'; import { generateText } from 'ai'; - -await generateText({ - model: openai('gpt-4o'), - prompt: 'You are a workplace agent, onboard the latest hires to our systems', - tools: onboardWorkflow.toAISDK(), - maxSteps: 3, -}); - -/* - * The planning model is in closed beta and only available to design partners. - * Apply for the waitlist [here](https://www.stackone.com/demo). - */ +import { ACCOUNT_IDS } from './constants'; + +export const planningModule = async (): Promise => { + const toolset = new StackOneToolSet(); + + const onboardWorkflow = await toolset.plan({ + key: 'custom_onboarding', + input: 'Onboard the last new hire from Teamtailor to Workday', + model: 'stackone-planner-latest', + tools: ['hris_*', 'ats_*'], + accountIds: [ACCOUNT_IDS.ATS, ACCOUNT_IDS.HRIS], + cache: true, // saves the plan to $HOME/.stackone/plans + }); + + await onboardWorkflow.execute(); + + /** + * or use as part of a larger agent (using AI SDK by Vercel) + */ + await generateText({ + model: openai('gpt-4o'), + prompt: 'You are a workplace agent, onboard the latest hires to our systems', + tools: onboardWorkflow.toAISDK(), + maxSteps: 3, + }); +}; + +console.log('Planning module is in closed beta and only available to design partners.'); +console.log('Apply for the waitlist [here](https://www.stackone.com/demo).'); diff --git a/package.json b/package.json index b5a647ec..fff8b2c3 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,10 @@ "build": "bun build ./src/index.ts --outdir ./dist --target node && tsc --emitDeclarationOnly", "rebuild": "bun run fetch:specs && bun run build", "prepublishOnly": "bun run rebuild", - "test": "bun test", + "test:unit": "bun test src", + "test:examples": "bun test examples", + "test:scripts": "bun test scripts", + "test": "bun run test:unit && bun run test:examples && bun run test:scripts", "fetch:specs": "bun run ./scripts/fetch-specs.ts && bun run format", "build:docs": "bun run ./scripts/build-docs.ts", "docs:serve": "mkdocs serve", diff --git a/scripts/build-docs.test.ts b/scripts/build-docs.spec.ts similarity index 100% rename from scripts/build-docs.test.ts rename to scripts/build-docs.spec.ts diff --git a/src/openapi/tests/__snapshots__/openapi-parser.spec.ts.snap b/src/openapi/tests/__snapshots__/openapi-parser.spec.ts.snap index ae96bb6e..196b0bef 100644 --- a/src/openapi/tests/__snapshots__/openapi-parser.spec.ts.snap +++ b/src/openapi/tests/__snapshots__/openapi-parser.spec.ts.snap @@ -117,6 +117,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "enum": [ "true", "false", + "unmapped_value", null, ], "example": "true", @@ -134,7 +135,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "description": "The file format of the file", "properties": { "source_value": { - "example": "abc", + "example": "application/pdf", "oneOf": [ { "type": "string", @@ -1403,6 +1404,110 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, }, + "hris_cancel_employee_time_off_request": { + "description": "Cancel Employee Time Off Request", + "execute": { + "bodyType": "json", + "method": "DELETE", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "path", + "name": "id", + "type": "string", + }, + { + "location": "path", + "name": "subResourceId", + "type": "string", + }, + ], + "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off/{subResourceId}", + }, + "parameters": { + "properties": { + "id": { + "type": "string", + }, + "subResourceId": { + "type": "string", + }, + "x-account-id": { + "description": "The account identifier", + "type": "string", + }, + }, + "required": [ + "id", + "subResourceId", + ], + "type": "object", + }, + }, + "hris_complete_employee_task": { + "description": "Complete Employee Task", + "execute": { + "bodyType": "json", + "method": "PATCH", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "path", + "name": "id", + "type": "string", + }, + { + "location": "path", + "name": "subResourceId", + "type": "string", + }, + { + "location": "query", + "name": "proxy", + "type": "string", + }, + { + "location": "body", + "name": "comment", + "type": "string", + }, + ], + "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks/{subResourceId}", + }, + "parameters": { + "properties": { + "comment": { + "description": "Comment or note about the task completion", + "example": "All required documents have been submitted", + "type": "string", + }, + "id": { + "type": "string", + }, + "proxy": {}, + "subResourceId": { + "type": "string", + }, + "x-account-id": { + "description": "The account identifier", + "type": "string", + }, + }, + "required": [ + "id", + "subResourceId", + ], + "type": "object", + }, + }, "hris_create_employee": { "description": "Creates an employee", "execute": { @@ -1459,11 +1564,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "name": "work_phone_number", "type": "string", }, - { - "location": "body", - "name": "job_id", - "type": "string", - }, { "location": "body", "name": "job_title", @@ -1534,16 +1634,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "name": "start_date", "type": "string", }, - { - "location": "body", - "name": "employment_type", - "type": "object", - }, - { - "location": "body", - "name": "employment_contract_type", - "type": "object", - }, { "location": "body", "name": "employment_status", @@ -2089,7 +2179,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "date_of_birth": { "description": "The employee date_of_birth", - "example": "1990-01-01T00:00.000Z", + "example": "1990-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -2116,103 +2206,51 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "employment": { "description": "The employee employment", "properties": { - "employment_contract_type": { - "description": "The employment work schedule type (e.g., full-time, part-time)", - "example": "full_time", + "end_date": { + "description": "The end date of employment", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "grade": { + "description": "Represents the employeeโ€™s position within the organizational hierarchy.", "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], + "description": { + "description": "description of the grade", + "example": "Mid-level employee demonstrating proficiency and autonomy.", + "type": "string", }, - "value": { - "enum": [ - "full_time", - "shifts", - "part_time", - "unmapped_value", - null, - ], + "id": { + "description": "The reference id", + "example": "1687-3", "type": "string", }, - }, - "type": "object", - }, - "employment_type": { - "description": "The type of employment (e.g., contractor, permanent)", - "example": "permanent", - "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], + "name": { + "description": "The reference name", + "example": "1687-4", + "type": "string", }, - "value": { - "enum": [ - "contractor", - "intern", - "permanent", - "apprentice", - "freelance", - "terminated", - "temporary", - "seasonal", - "volunteer", - "probation", - "internal", - "external", - "expatriate", - "employer_of_record", - "casual", - "Programme", - "unmapped_value", - null, - ], + "remote_id": { + "description": "Provider's unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", "type": "string", }, }, "type": "object", }, - "id": { - "description": "Unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, "job_title": { "description": "The job title of the employee", "example": "Software Engineer", "type": "string", }, + "passthrough": { + "additionalProperties": true, + "description": "Value to pass through to the provider", + "example": { + "other_known_names": "John Doe", + }, + "type": "object", + }, "pay_currency": { "description": "The currency used for pay", "example": "USD", @@ -2314,10 +2352,9 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "example": "40.00", "type": "string", }, - "time_worked": { - "description": "The time worked for the employee in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", + "payroll_code": { + "description": "The payroll code of the employee", + "example": "PC1", "type": "string", }, "unified_custom_fields": { @@ -2329,42 +2366,56 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "type": "object", }, - }, - "type": "object", - }, - "employment_contract_type": { - "description": "The employment work schedule type (e.g., full-time, part-time)", - "example": "full_time", - "properties": { - "source_value": { - "oneOf": [ - { + "work_time": { + "properties": { + "duration": { + "description": "The work time duration in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", "type": "string", }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { + "duration_unit": { + "description": "The duration unit of the work time", + "example": "month", + "properties": { + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], + }, + "value": { + "description": "The unified value for the period.", + "enum": [ + "day", + "week", + "month", + "year", + "unmapped_value", + null, + ], + "example": "month", + "type": "string", + }, + }, "type": "object", }, - { - "items": {}, - "type": "array", - }, - ], - }, - "value": { - "enum": [ - "full_time", - "shifts", - "part_time", - "unmapped_value", - null, - ], - "type": "string", + }, + "type": "object", }, }, "type": "object", @@ -2409,56 +2460,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "type": "object", }, - "employment_type": { - "description": "The employee employment type", - "example": "full_time", - "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], - }, - "value": { - "enum": [ - "contractor", - "intern", - "permanent", - "apprentice", - "freelance", - "terminated", - "temporary", - "seasonal", - "volunteer", - "probation", - "internal", - "external", - "expatriate", - "employer_of_record", - "casual", - "Programme", - "unmapped_value", - null, - ], - "type": "string", - }, - }, - "type": "object", - }, "ethnicity": { "description": "The employee ethnicity", "example": "white", @@ -2549,7 +2550,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "hire_date": { "description": "The employee hire date", - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -2916,13 +2917,8 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "type": "object", }, - "job_id": { - "description": "The employee job id", - "example": "R-6789", - "type": "string", - }, "job_title": { - "description": "The employee job title", + "description": "If the source of the job_title is the Employee's current Employment, and that Employment pertains exclusively to this Employee, then the active Employment job_title will also be written", "example": "Physicist", "type": "string", }, @@ -3477,7 +3473,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "preferred_language": { "description": "The employee preferred language", - "example": "en_US", + "example": "eng", "properties": { "source_value": { "oneOf": [ @@ -3517,6 +3513,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "cat", "cha", "ces", + "dan", "deu", "div", "dzo", @@ -3533,6 +3530,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "fra", "gle", "grn", + "guj", "glv", "heb", "hin", @@ -3563,6 +3561,8 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "mah", "mri", "mkd", + "mon", + "mar", "msa", "mlt", "mya", @@ -3577,15 +3577,18 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "pol", "pus", "por", + "que", "rar", "roh", "rup", "ron", "rus", "kin", + "sme", "sag", "sin", "slk", + "slv", "smo", "sna", "som", @@ -3595,11 +3598,24 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "swe", "swa", "tam", + "tel", "tgk", "tha", "tir", "tig", + "tuk", + "tsn", + "ton", + "tur", + "tso", + "ukr", + "urd", + "uzb", + "ven", + "vie", + "xho", "zho", + "zul", "unmapped_value", null, ], @@ -3611,7 +3627,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "start_date": { "description": "The employee start date", - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -4020,7 +4036,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "string", }, { - "location": "body", + "location": "path", "name": "id", "type": "string", }, @@ -4056,17 +4072,32 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, { "location": "body", - "name": "employment_type", - "type": "object", + "name": "effective_date", + "type": "string", }, { "location": "body", - "name": "employment_contract_type", - "type": "object", - }, + "name": "end_date", + "type": "string", + }, + { + "location": "body", + "name": "grade", + "type": "object", + }, + { + "location": "body", + "name": "work_time", + "type": "object", + }, + { + "location": "body", + "name": "payroll_code", + "type": "string", + }, { "location": "body", - "name": "time_worked", + "name": "job_id", "type": "string", }, { @@ -4079,96 +4110,50 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "parameters": { "properties": { - "employment_contract_type": { - "description": "The employment work schedule type (e.g., full-time, part-time)", - "example": "full_time", + "effective_date": { + "description": "The effective date of the employment contract", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "end_date": { + "description": "The end date of employment", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "grade": { + "description": "Represents the employeeโ€™s position within the organizational hierarchy.", "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], + "description": { + "description": "description of the grade", + "example": "Mid-level employee demonstrating proficiency and autonomy.", + "type": "string", }, - "value": { - "enum": [ - "full_time", - "shifts", - "part_time", - "unmapped_value", - null, - ], + "id": { + "description": "The reference id", + "example": "1687-3", "type": "string", }, - }, - "type": "object", - }, - "employment_type": { - "description": "The type of employment (e.g., contractor, permanent)", - "example": "permanent", - "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], + "name": { + "description": "The reference name", + "example": "1687-4", + "type": "string", }, - "value": { - "enum": [ - "contractor", - "intern", - "permanent", - "apprentice", - "freelance", - "terminated", - "temporary", - "seasonal", - "volunteer", - "probation", - "internal", - "external", - "expatriate", - "employer_of_record", - "casual", - "Programme", - "unmapped_value", - null, - ], + "remote_id": { + "description": "Provider's unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", "type": "string", }, }, "type": "object", }, "id": { - "description": "Unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, + "job_id": { + "description": "The employee job id", + "example": "5290", "type": "string", }, "job_title": { @@ -4285,10 +4270,9 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "example": "40.00", "type": "string", }, - "time_worked": { - "description": "The time worked for the employee in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", + "payroll_code": { + "description": "The payroll code of the employee", + "example": "PC1", "type": "string", }, "unified_custom_fields": { @@ -4300,6 +4284,57 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "type": "object", }, + "work_time": { + "properties": { + "duration": { + "description": "The work time duration in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", + "type": "string", + }, + "duration_unit": { + "description": "The duration unit of the work time", + "example": "month", + "properties": { + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], + }, + "value": { + "description": "The unified value for the period.", + "enum": [ + "day", + "week", + "month", + "year", + "unmapped_value", + null, + ], + "example": "month", + "type": "string", + }, + }, + "type": "object", + }, + }, + "type": "object", + }, "x-account-id": { "description": "The account identifier", "type": "string", @@ -4397,6 +4432,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "3", "4", "5", + "unmapped_value", null, ], "type": "string", @@ -4449,6 +4485,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "3", "4", "5", + "unmapped_value", null, ], "type": "string", @@ -4488,11 +4525,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "name": "id", "type": "string", }, - { - "location": "body", - "name": "employee_id", - "type": "string", - }, { "location": "body", "name": "approver_id", @@ -4548,15 +4580,10 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "example": "1687-4", "type": "string", }, - "employee_id": { - "description": "The employee ID", - "example": "1687-3", - "type": "string", - }, "end_date": { - "description": "The end date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", + "description": "Inclusive end date of the time off request (ISO8601 date-time without timezone). The time off includes this day", + "example": "2021-01-01T01:01:01.000", + "format": "datetime-local", "type": "string", }, "end_half_day": { @@ -4605,9 +4632,9 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, "start_date": { - "description": "The start date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", + "description": "The start date of the time off request (ISO8601 date-time without timezone)", + "example": "2021-01-01T01:01:01.000", + "format": "datetime-local", "type": "string", }, "start_half_day": { @@ -4656,6 +4683,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "rejected", "pending", "deleted", + "draft", "unmapped_value", null, ], @@ -4789,7 +4817,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "description": "The file format of the file", "properties": { "source_value": { - "example": "abc", + "example": "application/pdf", "oneOf": [ { "type": "string", @@ -6397,6 +6425,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "driver_license", "birth_certificate", "other", + "unmapped_value", null, ], "type": "string", @@ -6405,12 +6434,12 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, "valid_from": { - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, "valid_to": { - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -6425,11 +6454,11 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, }, - "hris_create_time_off_request": { - "description": "Creates a time off request", + "hris_download_employee_document": { + "description": "Download Employee Document", "execute": { "bodyType": "json", - "method": "POST", + "method": "GET", "params": [ { "location": "header", @@ -6437,301 +6466,113 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "string", }, { - "location": "body", - "name": "employee_id", + "location": "path", + "name": "id", "type": "string", }, { - "location": "body", - "name": "approver_id", + "location": "path", + "name": "subResourceId", "type": "string", }, { - "location": "body", - "name": "status", - "type": "object", + "location": "query", + "name": "format", + "type": "string", }, { - "location": "body", - "name": "start_date", + "location": "query", + "name": "export_format", "type": "string", }, - { - "location": "body", - "name": "end_date", + ], + "url": "https://api.stackone.com/unified/hris/employees/{id}/documents/{subResourceId}/download", + }, + "parameters": { + "properties": { + "export_format": { + "description": "The export format of the file", + "example": "text/plain", "type": "string", }, - { - "location": "body", - "name": "start_half_day", + "format": { + "description": "The format to download the file in", + "example": "base64", + "type": "string", + }, + "id": { + "type": "string", + }, + "subResourceId": { + "type": "string", + }, + "x-account-id": { + "description": "The account identifier", "type": "string", }, + }, + "required": [ + "id", + "subResourceId", + ], + "type": "object", + }, + }, + "hris_get_benefit": { + "description": "Get Benefit", + "execute": { + "bodyType": "json", + "method": "GET", + "params": [ { - "location": "body", - "name": "end_half_day", + "location": "header", + "name": "x-account-id", "type": "string", }, { - "location": "body", - "name": "time_off_policy_id", + "location": "path", + "name": "id", "type": "string", }, { - "location": "body", - "name": "reason", - "type": "object", + "location": "query", + "name": "raw", + "type": "boolean", }, { - "location": "body", - "name": "passthrough", + "location": "query", + "name": "proxy", "type": "object", }, + { + "location": "query", + "name": "fields", + "type": "string", + }, ], - "url": "https://api.stackone.com/unified/hris/time_off", + "url": "https://api.stackone.com/unified/hris/benefits/{id}", }, "parameters": { "properties": { - "approver_id": { - "description": "The approver ID", - "example": "1687-4", + "fields": { + "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", + "example": "id,remote_id,name,benefit_type,provider,description,created_at,updated_at", "type": "string", }, - "employee_id": { - "description": "The employee ID", - "example": "1687-3", + "id": { "type": "string", }, - "end_date": { - "description": "The end date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "end_half_day": { - "description": "True if the end of the time off request ends half way through the day", - "example": true, - "oneOf": [ - { - "type": "boolean", - }, - { - "enum": [ - "true", - "false", - ], - "type": "string", - }, - ], - }, - "passthrough": { - "additionalProperties": true, - "description": "Value to pass through to the provider", - "example": { - "other_known_names": "John Doe", - }, - "type": "object", - }, - "reason": { - "properties": { - "id": { - "description": "Unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, - "name": { - "type": "string", - }, - "remote_id": { - "description": "Provider's unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, - }, - "type": "object", - }, - "start_date": { - "description": "The start date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "start_half_day": { - "description": "True if the start of the time off request begins half way through the day", - "example": true, - "oneOf": [ - { - "type": "boolean", - }, - { - "enum": [ - "true", - "false", - ], - "type": "string", - }, - ], - }, - "status": { - "description": "The status of the time off request", - "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], - }, - "value": { - "enum": [ - "approved", - "cancelled", - "rejected", - "pending", - "deleted", - "unmapped_value", - null, - ], - "type": "string", - }, - }, - "type": "object", - }, - "time_off_policy_id": { - "description": "The time off policy id associated with this time off request", - "example": "cx280928933", - "type": "string", - }, - "x-account-id": { - "description": "The account identifier", - "type": "string", - }, - }, - "required": undefined, - "type": "object", - }, - }, - "hris_download_employee_document": { - "description": "Download Employee Document", - "execute": { - "bodyType": "json", - "method": "GET", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "path", - "name": "id", - "type": "string", - }, - { - "location": "path", - "name": "subResourceId", - "type": "string", - }, - { - "location": "query", - "name": "format", - "type": "string", - }, - ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/documents/{subResourceId}/download", - }, - "parameters": { - "properties": { - "format": { - "description": "The format to download the file in", - "example": "base64", - "type": "string", - }, - "id": { - "type": "string", - }, - "subResourceId": { - "type": "string", - }, - "x-account-id": { - "description": "The account identifier", - "type": "string", - }, - }, - "required": [ - "id", - "subResourceId", - ], - "type": "object", - }, - }, - "hris_get_benefit": { - "description": "Get Benefit", - "execute": { - "bodyType": "json", - "method": "GET", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "path", - "name": "id", - "type": "string", - }, - { - "location": "query", - "name": "raw", - "type": "boolean", - }, - { - "location": "query", - "name": "proxy", - "type": "object", - }, - { - "location": "query", - "name": "fields", - "type": "string", - }, - ], - "url": "https://api.stackone.com/unified/hris/benefits/{id}", - }, - "parameters": { - "properties": { - "fields": { - "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,benefit_type,provider,description,created_at,updated_at", - "type": "string", - }, - "id": { - "type": "string", - }, - "proxy": { - "additionalProperties": true, - "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", - "type": "object", - }, - "raw": { - "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", - "type": "boolean", - }, - "x-account-id": { - "description": "The account identifier", + "proxy": { + "additionalProperties": true, + "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", + "type": "object", + }, + "raw": { + "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", + "type": "boolean", + }, + "x-account-id": { + "description": "The account identifier", "type": "string", }, }, @@ -6843,7 +6684,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", + "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, "id": { @@ -6986,7 +6827,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,benefits,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,employee_number,national_identity_number,national_identity_numbers,skills", + "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,benefits,employee_number,national_identity_number,national_identity_numbers,skills", "type": "string", }, "id": { @@ -7306,7 +7147,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "id": { @@ -7409,6 +7250,89 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, }, + "hris_get_employee_task": { + "description": "Get Employee Task", + "execute": { + "bodyType": "json", + "method": "GET", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "path", + "name": "id", + "type": "string", + }, + { + "location": "path", + "name": "subResourceId", + "type": "string", + }, + { + "location": "query", + "name": "raw", + "type": "boolean", + }, + { + "location": "query", + "name": "proxy", + "type": "object", + }, + { + "location": "query", + "name": "fields", + "type": "string", + }, + { + "location": "query", + "name": "expand", + "type": "string", + }, + ], + "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks/{subResourceId}", + }, + "parameters": { + "properties": { + "expand": { + "description": "The comma separated list of fields that will be expanded in the response", + "example": "attachments", + "type": "string", + }, + "fields": { + "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", + "example": "id,remote_id,employee_id,remote_employee_id,name,description,type,status,due_date,completion_date,assigned_by_employee_id,remote_assigned_by_employee_id,assigned_by_employee_name,link_to_task,extracted_links,next_task_id,remote_next_task_id,parent_process_name,comments,attachments,created_at,updated_at", + "type": "string", + }, + "id": { + "type": "string", + }, + "proxy": { + "additionalProperties": true, + "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", + "type": "object", + }, + "raw": { + "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", + "type": "boolean", + }, + "subResourceId": { + "type": "string", + }, + "x-account-id": { + "description": "The account identifier", + "type": "string", + }, + }, + "required": [ + "id", + "subResourceId", + ], + "type": "object", + }, + }, "hris_get_employee_time_off_balance": { "description": "Get Employee Time Off Balance", "execute": { @@ -7545,7 +7469,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", "type": "string", }, "id": { @@ -7696,7 +7620,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "id": { @@ -7760,7 +7684,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, "id": { @@ -7824,7 +7748,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, "id": { @@ -8154,7 +8078,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", "type": "string", }, "id": { @@ -8518,7 +8442,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", + "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, "filter": { @@ -8988,7 +8912,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "filter": { @@ -9133,6 +9057,115 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, }, + "hris_list_employee_tasks": { + "description": "List Employee Tasks", + "execute": { + "bodyType": "json", + "method": "GET", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "path", + "name": "id", + "type": "string", + }, + { + "location": "query", + "name": "raw", + "type": "boolean", + }, + { + "location": "query", + "name": "proxy", + "type": "object", + }, + { + "location": "query", + "name": "fields", + "type": "string", + }, + { + "location": "query", + "name": "filter", + "type": "object", + }, + { + "location": "query", + "name": "page_size", + "type": "string", + }, + { + "location": "query", + "name": "next", + "type": "string", + }, + { + "location": "query", + "name": "expand", + "type": "string", + }, + ], + "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks", + }, + "parameters": { + "properties": { + "expand": { + "description": "The comma separated list of fields that will be expanded in the response", + "example": "attachments", + "type": "string", + }, + "fields": { + "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", + "example": "id,remote_id,employee_id,remote_employee_id,name,description,type,status,due_date,completion_date,assigned_by_employee_id,remote_assigned_by_employee_id,assigned_by_employee_name,link_to_task,extracted_links,next_task_id,remote_next_task_id,parent_process_name,comments,attachments,created_at,updated_at", + "type": "string", + }, + "filter": { + "description": "Filter parameters that allow greater customisation of the list response", + "properties": { + "updated_after": { + "additionalProperties": false, + "description": "Use a string with a date to only select results updated after that given date", + "example": "2020-01-01T00:00:00.000Z", + "type": "string", + }, + }, + "type": "object", + }, + "id": { + "type": "string", + }, + "next": { + "description": "The unified cursor", + "type": "string", + }, + "page_size": { + "description": "The number of results per page (default value is 25)", + "type": "string", + }, + "proxy": { + "additionalProperties": true, + "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", + "type": "object", + }, + "raw": { + "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", + "type": "boolean", + }, + "x-account-id": { + "description": "The account identifier", + "type": "string", + }, + }, + "required": [ + "id", + ], + "type": "object", + }, + }, "hris_list_employee_time_off_balances": { "description": "List Employee Time Off Balances", "execute": { @@ -9307,8 +9340,37 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "string", }, "filter": { - "description": "Filter parameters that allow greater customisation of the list response", + "description": "HRIS Time-Off Policies filters", "properties": { + "type": { + "description": "Filter to select time-off policies by type", + "enum": [ + "sick", + "unmapped_value", + "vacation", + "long_term_disability", + "short_term_disability", + "absent", + "comp_time", + "training", + "annual_leave", + "leave_of_absence", + "break", + "child_care_leave", + "maternity_leave", + "jury_duty", + "sabbatical", + "accident", + "paid", + "unpaid", + "holiday", + "personal", + "in_lieu", + "bereavement", + null, + ], + "type": "string", + }, "updated_after": { "additionalProperties": false, "description": "Use a string with a date to only select results updated after that given date", @@ -9412,7 +9474,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", "type": "string", }, "filter": { @@ -9627,7 +9689,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,benefits,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,employee_number,national_identity_number,national_identity_numbers,skills", + "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,benefits,employee_number,national_identity_number,national_identity_numbers,skills", "type": "string", }, "filter": { @@ -9739,7 +9801,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "filter": { @@ -9828,7 +9890,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, "filter": { @@ -9917,7 +9979,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, "filter": { @@ -10294,8 +10356,37 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "string", }, "filter": { - "description": "Filter parameters that allow greater customisation of the list response", + "description": "HRIS Time-Off Policies filters", "properties": { + "type": { + "description": "Filter to select time-off policies by type", + "enum": [ + "sick", + "unmapped_value", + "vacation", + "long_term_disability", + "short_term_disability", + "absent", + "comp_time", + "training", + "annual_leave", + "leave_of_absence", + "break", + "child_care_leave", + "maternity_leave", + "jury_duty", + "sabbatical", + "accident", + "paid", + "unpaid", + "holiday", + "personal", + "in_lieu", + "bereavement", + null, + ], + "type": "string", + }, "updated_after": { "additionalProperties": false, "description": "Use a string with a date to only select results updated after that given date", @@ -10389,7 +10480,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", "type": "string", }, "filter": { @@ -10587,11 +10678,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "name": "work_phone_number", "type": "string", }, - { - "location": "body", - "name": "job_id", - "type": "string", - }, { "location": "body", "name": "job_title", @@ -10662,16 +10748,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "name": "start_date", "type": "string", }, - { - "location": "body", - "name": "employment_type", - "type": "object", - }, - { - "location": "body", - "name": "employment_contract_type", - "type": "object", - }, { "location": "body", "name": "employment_status", @@ -11190,7 +11266,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "date_of_birth": { "description": "The employee date_of_birth", - "example": "1990-01-01T00:00.000Z", + "example": "1990-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -11214,106 +11290,54 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "example": "125", "type": "string", }, - "employment": { - "description": "The employee employment", - "properties": { - "employment_contract_type": { - "description": "The employment work schedule type (e.g., full-time, part-time)", - "example": "full_time", - "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], - }, - "value": { - "enum": [ - "full_time", - "shifts", - "part_time", - "unmapped_value", - null, - ], - "type": "string", - }, - }, - "type": "object", - }, - "employment_type": { - "description": "The type of employment (e.g., contractor, permanent)", - "example": "permanent", - "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], + "employment": { + "description": "The employee employment", + "properties": { + "end_date": { + "description": "The end date of employment", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "grade": { + "description": "Represents the employeeโ€™s position within the organizational hierarchy.", + "properties": { + "description": { + "description": "description of the grade", + "example": "Mid-level employee demonstrating proficiency and autonomy.", + "type": "string", }, - "value": { - "enum": [ - "contractor", - "intern", - "permanent", - "apprentice", - "freelance", - "terminated", - "temporary", - "seasonal", - "volunteer", - "probation", - "internal", - "external", - "expatriate", - "employer_of_record", - "casual", - "Programme", - "unmapped_value", - null, - ], + "id": { + "description": "The reference id", + "example": "1687-3", + "type": "string", + }, + "name": { + "description": "The reference name", + "example": "1687-4", + "type": "string", + }, + "remote_id": { + "description": "Provider's unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", "type": "string", }, }, "type": "object", }, - "id": { - "description": "Unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, "job_title": { "description": "The job title of the employee", "example": "Software Engineer", "type": "string", }, + "passthrough": { + "additionalProperties": true, + "description": "Value to pass through to the provider", + "example": { + "other_known_names": "John Doe", + }, + "type": "object", + }, "pay_currency": { "description": "The currency used for pay", "example": "USD", @@ -11415,10 +11439,9 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "example": "40.00", "type": "string", }, - "time_worked": { - "description": "The time worked for the employee in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", + "payroll_code": { + "description": "The payroll code of the employee", + "example": "PC1", "type": "string", }, "unified_custom_fields": { @@ -11430,42 +11453,56 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "type": "object", }, - }, - "type": "object", - }, - "employment_contract_type": { - "description": "The employment work schedule type (e.g., full-time, part-time)", - "example": "full_time", - "properties": { - "source_value": { - "oneOf": [ - { + "work_time": { + "properties": { + "duration": { + "description": "The work time duration in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", "type": "string", }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { + "duration_unit": { + "description": "The duration unit of the work time", + "example": "month", + "properties": { + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], + }, + "value": { + "description": "The unified value for the period.", + "enum": [ + "day", + "week", + "month", + "year", + "unmapped_value", + null, + ], + "example": "month", + "type": "string", + }, + }, "type": "object", }, - { - "items": {}, - "type": "array", - }, - ], - }, - "value": { - "enum": [ - "full_time", - "shifts", - "part_time", - "unmapped_value", - null, - ], - "type": "string", + }, + "type": "object", }, }, "type": "object", @@ -11510,56 +11547,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "type": "object", }, - "employment_type": { - "description": "The employee employment type", - "example": "full_time", - "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], - }, - "value": { - "enum": [ - "contractor", - "intern", - "permanent", - "apprentice", - "freelance", - "terminated", - "temporary", - "seasonal", - "volunteer", - "probation", - "internal", - "external", - "expatriate", - "employer_of_record", - "casual", - "Programme", - "unmapped_value", - null, - ], - "type": "string", - }, - }, - "type": "object", - }, "ethnicity": { "description": "The employee ethnicity", "example": "white", @@ -11650,7 +11637,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "hire_date": { "description": "The employee hire date", - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -12020,13 +12007,8 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "id": { "type": "string", }, - "job_id": { - "description": "The employee job id", - "example": "R-6789", - "type": "string", - }, "job_title": { - "description": "The employee job title", + "description": "If the source of the job_title is the Employee's current Employment, and that Employment pertains exclusively to this Employee, then the active Employment job_title will also be written", "example": "Physicist", "type": "string", }, @@ -12581,7 +12563,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "preferred_language": { "description": "The employee preferred language", - "example": "en_US", + "example": "eng", "properties": { "source_value": { "oneOf": [ @@ -12621,6 +12603,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "cat", "cha", "ces", + "dan", "deu", "div", "dzo", @@ -12637,6 +12620,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "fra", "gle", "grn", + "guj", "glv", "heb", "hin", @@ -12667,6 +12651,8 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "mah", "mri", "mkd", + "mon", + "mar", "msa", "mlt", "mya", @@ -12681,15 +12667,18 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "pol", "pus", "por", + "que", "rar", "roh", "rup", "ron", "rus", "kin", + "sme", "sag", "sin", "slk", + "slv", "smo", "sna", "som", @@ -12699,11 +12688,24 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "swe", "swa", "tam", + "tel", "tgk", "tha", "tir", "tig", + "tuk", + "tsn", + "ton", + "tur", + "tso", + "ukr", + "urd", + "uzb", + "ven", + "vie", + "xho", "zho", + "zul", "unmapped_value", null, ], @@ -12715,7 +12717,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "start_date": { "description": "The employee start date", - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -13126,7 +13128,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "string", }, { - "location": "body", + "location": "path", "name": "id", "type": "string", }, @@ -13167,17 +13169,27 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, { "location": "body", - "name": "employment_type", + "name": "effective_date", + "type": "string", + }, + { + "location": "body", + "name": "end_date", + "type": "string", + }, + { + "location": "body", + "name": "grade", "type": "object", }, { "location": "body", - "name": "employment_contract_type", + "name": "work_time", "type": "object", }, { "location": "body", - "name": "time_worked", + "name": "payroll_code", "type": "string", }, { @@ -13190,96 +13202,45 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, "parameters": { "properties": { - "employment_contract_type": { - "description": "The employment work schedule type (e.g., full-time, part-time)", - "example": "full_time", + "effective_date": { + "description": "The effective date of the employment contract", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "end_date": { + "description": "The end date of employment", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "grade": { + "description": "Represents the employeeโ€™s position within the organizational hierarchy.", "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], + "description": { + "description": "description of the grade", + "example": "Mid-level employee demonstrating proficiency and autonomy.", + "type": "string", }, - "value": { - "enum": [ - "full_time", - "shifts", - "part_time", - "unmapped_value", - null, - ], + "id": { + "description": "The reference id", + "example": "1687-3", "type": "string", }, - }, - "type": "object", - }, - "employment_type": { - "description": "The type of employment (e.g., contractor, permanent)", - "example": "permanent", - "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], + "name": { + "description": "The reference name", + "example": "1687-4", + "type": "string", }, - "value": { - "enum": [ - "contractor", - "intern", - "permanent", - "apprentice", - "freelance", - "terminated", - "temporary", - "seasonal", - "volunteer", - "probation", - "internal", - "external", - "expatriate", - "employer_of_record", - "casual", - "Programme", - "unmapped_value", - null, - ], + "remote_id": { + "description": "Provider's unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", "type": "string", }, }, "type": "object", }, "id": { - "description": "Unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", "type": "string", }, "job_title": { @@ -13371,49 +13332,99 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "items": {}, "type": "array", }, - ], - }, - "value": { - "enum": [ - "hour", - "day", - "week", - "every_two_weeks", - "month", - "quarter", - "every_six_months", - "year", - "unmapped_value", - null, - ], - "type": "string", + ], + }, + "value": { + "enum": [ + "hour", + "day", + "week", + "every_two_weeks", + "month", + "quarter", + "every_six_months", + "year", + "unmapped_value", + null, + ], + "type": "string", + }, + }, + "type": "object", + }, + "pay_rate": { + "description": "The pay rate for the employee", + "example": "40.00", + "type": "string", + }, + "payroll_code": { + "description": "The payroll code of the employee", + "example": "PC1", + "type": "string", + }, + "subResourceId": { + "type": "string", + }, + "unified_custom_fields": { + "additionalProperties": true, + "description": "Custom Unified Fields configured in your StackOne project", + "example": { + "my_project_custom_field_1": "REF-1236", + "my_project_custom_field_2": "some other value", + }, + "type": "object", + }, + "work_time": { + "properties": { + "duration": { + "description": "The work time duration in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", + "type": "string", + }, + "duration_unit": { + "description": "The duration unit of the work time", + "example": "month", + "properties": { + "source_value": { + "oneOf": [ + { + "type": "string", + }, + { + "type": "number", + }, + { + "type": "boolean", + }, + { + "type": "object", + }, + { + "items": {}, + "type": "array", + }, + ], + }, + "value": { + "description": "The unified value for the period.", + "enum": [ + "day", + "week", + "month", + "year", + "unmapped_value", + null, + ], + "example": "month", + "type": "string", + }, + }, + "type": "object", }, }, "type": "object", }, - "pay_rate": { - "description": "The pay rate for the employee", - "example": "40.00", - "type": "string", - }, - "subResourceId": { - "type": "string", - }, - "time_worked": { - "description": "The time worked for the employee in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", - "type": "string", - }, - "unified_custom_fields": { - "additionalProperties": true, - "description": "Custom Unified Fields configured in your StackOne project", - "example": { - "my_project_custom_field_1": "REF-1236", - "my_project_custom_field_2": "some other value", - }, - "type": "object", - }, "x-account-id": { "description": "The account identifier", "type": "string", @@ -13447,11 +13458,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "name": "subResourceId", "type": "string", }, - { - "location": "body", - "name": "employee_id", - "type": "string", - }, { "location": "body", "name": "approver_id", @@ -13507,15 +13513,10 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "example": "1687-4", "type": "string", }, - "employee_id": { - "description": "The employee ID", - "example": "1687-3", - "type": "string", - }, "end_date": { - "description": "The end date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", + "description": "Inclusive end date of the time off request (ISO8601 date-time without timezone). The time off includes this day", + "example": "2021-01-01T01:01:01.000", + "format": "datetime-local", "type": "string", }, "end_half_day": { @@ -13564,9 +13565,9 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, "start_date": { - "description": "The start date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", + "description": "The start date of the time off request (ISO8601 date-time without timezone)", + "example": "2021-01-01T01:01:01.000", + "format": "datetime-local", "type": "string", }, "start_half_day": { @@ -13615,6 +13616,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "rejected", "pending", "deleted", + "draft", "unmapped_value", null, ], @@ -13757,7 +13759,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "description": "The file format of the file", "properties": { "source_value": { - "example": "abc", + "example": "application/pdf", "oneOf": [ { "type": "string", @@ -15368,6 +15370,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "driver_license", "birth_certificate", "other", + "unmapped_value", null, ], "type": "string", @@ -15376,12 +15379,12 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, "valid_from": { - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, "valid_to": { - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -15397,214 +15400,6 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "type": "object", }, }, - "hris_update_time_off_request": { - "description": "Update time off request", - "execute": { - "bodyType": "json", - "method": "PATCH", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "path", - "name": "id", - "type": "string", - }, - { - "location": "body", - "name": "employee_id", - "type": "string", - }, - { - "location": "body", - "name": "approver_id", - "type": "string", - }, - { - "location": "body", - "name": "status", - "type": "object", - }, - { - "location": "body", - "name": "start_date", - "type": "string", - }, - { - "location": "body", - "name": "end_date", - "type": "string", - }, - { - "location": "body", - "name": "start_half_day", - "type": "string", - }, - { - "location": "body", - "name": "end_half_day", - "type": "string", - }, - { - "location": "body", - "name": "time_off_policy_id", - "type": "string", - }, - { - "location": "body", - "name": "reason", - "type": "object", - }, - { - "location": "body", - "name": "passthrough", - "type": "object", - }, - ], - "url": "https://api.stackone.com/unified/hris/time_off/{id}", - }, - "parameters": { - "properties": { - "approver_id": { - "description": "The approver ID", - "example": "1687-4", - "type": "string", - }, - "employee_id": { - "description": "The employee ID", - "example": "1687-3", - "type": "string", - }, - "end_date": { - "description": "The end date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "end_half_day": { - "description": "True if the end of the time off request ends half way through the day", - "example": true, - "oneOf": [ - { - "type": "boolean", - }, - { - "enum": [ - "true", - "false", - ], - "type": "string", - }, - ], - }, - "id": { - "type": "string", - }, - "passthrough": { - "additionalProperties": true, - "description": "Value to pass through to the provider", - "example": { - "other_known_names": "John Doe", - }, - "type": "object", - }, - "reason": { - "properties": { - "id": { - "description": "Unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, - "name": { - "type": "string", - }, - "remote_id": { - "description": "Provider's unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, - }, - "type": "object", - }, - "start_date": { - "description": "The start date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "start_half_day": { - "description": "True if the start of the time off request begins half way through the day", - "example": true, - "oneOf": [ - { - "type": "boolean", - }, - { - "enum": [ - "true", - "false", - ], - "type": "string", - }, - ], - }, - "status": { - "description": "The status of the time off request", - "properties": { - "source_value": { - "oneOf": [ - { - "type": "string", - }, - { - "type": "number", - }, - { - "type": "boolean", - }, - { - "type": "object", - }, - { - "items": {}, - "type": "array", - }, - ], - }, - "value": { - "enum": [ - "approved", - "cancelled", - "rejected", - "pending", - "deleted", - "unmapped_value", - null, - ], - "type": "string", - }, - }, - "type": "object", - }, - "time_off_policy_id": { - "description": "The time off policy id associated with this time off request", - "example": "cx280928933", - "type": "string", - }, - "x-account-id": { - "description": "The account identifier", - "type": "string", - }, - }, - "required": [ - "id", - ], - "type": "object", - }, - }, "hris_upload_employee_document": { "description": "Upload Employee Document", "execute": { @@ -15648,12 +15443,12 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 }, { "location": "body", - "name": "category", + "name": "confidential", "type": "object", }, { "location": "body", - "name": "confidential", + "name": "category", "type": "object", }, ], @@ -15743,6 +15538,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "enum": [ "true", "false", + "unmapped_value", null, ], "example": "true", @@ -15760,7 +15556,7 @@ exports[`OpenAPIParser Snapshot Tests should parse all OpenAPI specs correctly 1 "description": "The file format of the file", "properties": { "source_value": { - "example": "abc", + "example": "application/pdf", "oneOf": [ { "type": "string", diff --git a/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap b/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap index 0653d380..0f54f112 100644 --- a/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap +++ b/src/toolsets/tests/__snapshots__/stackone.spec.ts.snap @@ -580,7 +580,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,benefits,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,employee_number,national_identity_number,national_identity_numbers,skills", + "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,benefits,employee_number,national_identity_number,national_identity_numbers,skills", "type": "string", }, "filter": { @@ -742,11 +742,6 @@ Tools { "name": "work_phone_number", "type": "string", }, - { - "location": "body", - "name": "job_id", - "type": "string", - }, { "location": "body", "name": "job_title", @@ -817,16 +812,6 @@ Tools { "name": "start_date", "type": "string", }, - { - "location": "body", - "name": "employment_type", - "type": "object", - }, - { - "location": "body", - "name": "employment_contract_type", - "type": "object", - }, { "location": "body", "name": "employment_status", @@ -1334,7 +1319,7 @@ Tools { }, "date_of_birth": { "description": "The employee date_of_birth", - "example": "1990-01-01T00:00.000Z", + "example": "1990-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -1361,63 +1346,51 @@ Tools { "employment": { "description": "The employee employment", "properties": { - "employment_contract_type": { - "description": "The employment work schedule type (e.g., full-time, part-time)", - "example": "full_time", + "end_date": { + "description": "The end date of employment", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "grade": { + "description": "Represents the employeeโ€™s position within the organizational hierarchy.", "properties": { - "value": { - "enum": [ - "full_time", - "shifts", - "part_time", - "unmapped_value", - null, - ], + "description": { + "description": "description of the grade", + "example": "Mid-level employee demonstrating proficiency and autonomy.", "type": "string", }, - }, - "type": "object", - }, - "employment_type": { - "description": "The type of employment (e.g., contractor, permanent)", - "example": "permanent", - "properties": { - "value": { - "enum": [ - "contractor", - "intern", - "permanent", - "apprentice", - "freelance", - "terminated", - "temporary", - "seasonal", - "volunteer", - "probation", - "internal", - "external", - "expatriate", - "employer_of_record", - "casual", - "Programme", - "unmapped_value", - null, - ], + "id": { + "description": "The reference id", + "example": "1687-3", + "type": "string", + }, + "name": { + "description": "The reference name", + "example": "1687-4", + "type": "string", + }, + "remote_id": { + "description": "Provider's unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", "type": "string", }, }, "type": "object", }, - "id": { - "description": "Unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, "job_title": { "description": "The job title of the employee", "example": "Software Engineer", "type": "string", }, + "passthrough": { + "additionalProperties": true, + "description": "Value to pass through to the provider", + "example": { + "other_known_names": "John Doe", + }, + "type": "object", + }, "pay_currency": { "description": "The currency used for pay", "example": "USD", @@ -1479,10 +1452,9 @@ Tools { "example": "40.00", "type": "string", }, - "time_worked": { - "description": "The time worked for the employee in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", + "payroll_code": { + "description": "The payroll code of the employee", + "example": "PC1", "type": "string", }, "unified_custom_fields": { @@ -1494,22 +1466,36 @@ Tools { }, "type": "object", }, - }, - "type": "object", - }, - "employment_contract_type": { - "description": "The employment work schedule type (e.g., full-time, part-time)", - "example": "full_time", - "properties": { - "value": { - "enum": [ - "full_time", - "shifts", - "part_time", - "unmapped_value", - null, - ], - "type": "string", + "work_time": { + "properties": { + "duration": { + "description": "The work time duration in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", + "type": "string", + }, + "duration_unit": { + "description": "The duration unit of the work time", + "example": "month", + "properties": { + "value": { + "description": "The unified value for the period.", + "enum": [ + "day", + "week", + "month", + "year", + "unmapped_value", + null, + ], + "example": "month", + "type": "string", + }, + }, + "type": "object", + }, + }, + "type": "object", }, }, "type": "object", @@ -1534,36 +1520,6 @@ Tools { }, "type": "object", }, - "employment_type": { - "description": "The employee employment type", - "example": "full_time", - "properties": { - "value": { - "enum": [ - "contractor", - "intern", - "permanent", - "apprentice", - "freelance", - "terminated", - "temporary", - "seasonal", - "volunteer", - "probation", - "internal", - "external", - "expatriate", - "employer_of_record", - "casual", - "Programme", - "unmapped_value", - null, - ], - "type": "string", - }, - }, - "type": "object", - }, "ethnicity": { "description": "The employee ethnicity", "example": "white", @@ -1614,7 +1570,7 @@ Tools { }, "hire_date": { "description": "The employee hire date", - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -1941,13 +1897,8 @@ Tools { }, "type": "object", }, - "job_id": { - "description": "The employee job id", - "example": "R-6789", - "type": "string", - }, "job_title": { - "description": "The employee job title", + "description": "If the source of the job_title is the Employee's current Employment, and that Employment pertains exclusively to this Employee, then the active Employment job_title will also be written", "example": "Physicist", "type": "string", }, @@ -2442,7 +2393,7 @@ Tools { }, "preferred_language": { "description": "The employee preferred language", - "example": "en_US", + "example": "eng", "properties": { "value": { "description": "The ISO639-2 Code of the language", @@ -2462,6 +2413,7 @@ Tools { "cat", "cha", "ces", + "dan", "deu", "div", "dzo", @@ -2478,6 +2430,7 @@ Tools { "fra", "gle", "grn", + "guj", "glv", "heb", "hin", @@ -2508,6 +2461,8 @@ Tools { "mah", "mri", "mkd", + "mon", + "mar", "msa", "mlt", "mya", @@ -2522,15 +2477,18 @@ Tools { "pol", "pus", "por", + "que", "rar", "roh", "rup", "ron", "rus", "kin", + "sme", "sag", "sin", "slk", + "slv", "smo", "sna", "som", @@ -2540,11 +2498,24 @@ Tools { "swe", "swa", "tam", + "tel", "tgk", "tha", "tir", "tig", + "tuk", + "tsn", + "ton", + "tur", + "tso", + "ukr", + "urd", + "uzb", + "ven", + "vie", + "xho", "zho", + "zul", "unmapped_value", null, ], @@ -2556,7 +2527,7 @@ Tools { }, "start_date": { "description": "The employee start date", - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -2966,11 +2937,6 @@ Tools { "name": "work_phone_number", "type": "string", }, - { - "location": "body", - "name": "job_id", - "type": "string", - }, { "location": "body", "name": "job_title", @@ -3041,16 +3007,6 @@ Tools { "name": "start_date", "type": "string", }, - { - "location": "body", - "name": "employment_type", - "type": "object", - }, - { - "location": "body", - "name": "employment_contract_type", - "type": "object", - }, { "location": "body", "name": "employment_status", @@ -3175,7 +3131,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,benefits,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,employee_number,national_identity_number,national_identity_numbers,skills", + "example": "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,benefits,employee_number,national_identity_number,national_identity_numbers,skills", "type": "string", }, "id": { @@ -3309,11 +3265,6 @@ Tools { "name": "work_phone_number", "type": "string", }, - { - "location": "body", - "name": "job_id", - "type": "string", - }, { "location": "body", "name": "job_title", @@ -3384,16 +3335,6 @@ Tools { "name": "start_date", "type": "string", }, - { - "location": "body", - "name": "employment_type", - "type": "object", - }, - { - "location": "body", - "name": "employment_contract_type", - "type": "object", - }, { "location": "body", "name": "employment_status", @@ -3874,7 +3815,7 @@ Tools { }, "date_of_birth": { "description": "The employee date_of_birth", - "example": "1990-01-01T00:00.000Z", + "example": "1990-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -3901,63 +3842,51 @@ Tools { "employment": { "description": "The employee employment", "properties": { - "employment_contract_type": { - "description": "The employment work schedule type (e.g., full-time, part-time)", - "example": "full_time", + "end_date": { + "description": "The end date of employment", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "grade": { + "description": "Represents the employeeโ€™s position within the organizational hierarchy.", "properties": { - "value": { - "enum": [ - "full_time", - "shifts", - "part_time", - "unmapped_value", - null, - ], + "description": { + "description": "description of the grade", + "example": "Mid-level employee demonstrating proficiency and autonomy.", "type": "string", }, - }, - "type": "object", - }, - "employment_type": { - "description": "The type of employment (e.g., contractor, permanent)", - "example": "permanent", - "properties": { - "value": { - "enum": [ - "contractor", - "intern", - "permanent", - "apprentice", - "freelance", - "terminated", - "temporary", - "seasonal", - "volunteer", - "probation", - "internal", - "external", - "expatriate", - "employer_of_record", - "casual", - "Programme", - "unmapped_value", - null, - ], + "id": { + "description": "The reference id", + "example": "1687-3", + "type": "string", + }, + "name": { + "description": "The reference name", + "example": "1687-4", + "type": "string", + }, + "remote_id": { + "description": "Provider's unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", "type": "string", }, }, "type": "object", }, - "id": { - "description": "Unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, "job_title": { "description": "The job title of the employee", "example": "Software Engineer", "type": "string", }, + "passthrough": { + "additionalProperties": true, + "description": "Value to pass through to the provider", + "example": { + "other_known_names": "John Doe", + }, + "type": "object", + }, "pay_currency": { "description": "The currency used for pay", "example": "USD", @@ -4019,10 +3948,9 @@ Tools { "example": "40.00", "type": "string", }, - "time_worked": { - "description": "The time worked for the employee in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", + "payroll_code": { + "description": "The payroll code of the employee", + "example": "PC1", "type": "string", }, "unified_custom_fields": { @@ -4034,22 +3962,36 @@ Tools { }, "type": "object", }, - }, - "type": "object", - }, - "employment_contract_type": { - "description": "The employment work schedule type (e.g., full-time, part-time)", - "example": "full_time", - "properties": { - "value": { - "enum": [ - "full_time", - "shifts", - "part_time", - "unmapped_value", - null, - ], - "type": "string", + "work_time": { + "properties": { + "duration": { + "description": "The work time duration in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", + "type": "string", + }, + "duration_unit": { + "description": "The duration unit of the work time", + "example": "month", + "properties": { + "value": { + "description": "The unified value for the period.", + "enum": [ + "day", + "week", + "month", + "year", + "unmapped_value", + null, + ], + "example": "month", + "type": "string", + }, + }, + "type": "object", + }, + }, + "type": "object", }, }, "type": "object", @@ -4074,36 +4016,6 @@ Tools { }, "type": "object", }, - "employment_type": { - "description": "The employee employment type", - "example": "full_time", - "properties": { - "value": { - "enum": [ - "contractor", - "intern", - "permanent", - "apprentice", - "freelance", - "terminated", - "temporary", - "seasonal", - "volunteer", - "probation", - "internal", - "external", - "expatriate", - "employer_of_record", - "casual", - "Programme", - "unmapped_value", - null, - ], - "type": "string", - }, - }, - "type": "object", - }, "ethnicity": { "description": "The employee ethnicity", "example": "white", @@ -4154,7 +4066,7 @@ Tools { }, "hire_date": { "description": "The employee hire date", - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -4484,13 +4396,8 @@ Tools { "id": { "type": "string", }, - "job_id": { - "description": "The employee job id", - "example": "R-6789", - "type": "string", - }, "job_title": { - "description": "The employee job title", + "description": "If the source of the job_title is the Employee's current Employment, and that Employment pertains exclusively to this Employee, then the active Employment job_title will also be written", "example": "Physicist", "type": "string", }, @@ -4985,7 +4892,7 @@ Tools { }, "preferred_language": { "description": "The employee preferred language", - "example": "en_US", + "example": "eng", "properties": { "value": { "description": "The ISO639-2 Code of the language", @@ -5005,6 +4912,7 @@ Tools { "cat", "cha", "ces", + "dan", "deu", "div", "dzo", @@ -5021,6 +4929,7 @@ Tools { "fra", "gle", "grn", + "guj", "glv", "heb", "hin", @@ -5051,6 +4960,8 @@ Tools { "mah", "mri", "mkd", + "mon", + "mar", "msa", "mlt", "mya", @@ -5065,15 +4976,18 @@ Tools { "pol", "pus", "por", + "que", "rar", "roh", "rup", "ron", "rus", "kin", + "sme", "sag", "sin", "slk", + "slv", "smo", "sna", "som", @@ -5083,11 +4997,24 @@ Tools { "swe", "swa", "tam", + "tel", "tgk", "tha", "tir", "tig", + "tuk", + "tsn", + "ton", + "tur", + "tso", + "ukr", + "urd", + "uzb", + "ven", + "vie", + "xho", "zho", + "zul", "unmapped_value", null, ], @@ -5099,7 +5026,7 @@ Tools { }, "start_date": { "description": "The employee start date", - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -5516,11 +5443,6 @@ Tools { "name": "work_phone_number", "type": "string", }, - { - "location": "body", - "name": "job_id", - "type": "string", - }, { "location": "body", "name": "job_title", @@ -5591,16 +5513,6 @@ Tools { "name": "start_date", "type": "string", }, - { - "location": "body", - "name": "employment_type", - "type": "object", - }, - { - "location": "body", - "name": "employment_contract_type", - "type": "object", - }, { "location": "body", "name": "employment_status", @@ -5802,7 +5714,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", "type": "string", }, "filter": { @@ -5923,11 +5835,6 @@ Tools { "name": "id", "type": "string", }, - { - "location": "body", - "name": "employee_id", - "type": "string", - }, { "location": "body", "name": "approver_id", @@ -5985,15 +5892,10 @@ Tools { "example": "1687-4", "type": "string", }, - "employee_id": { - "description": "The employee ID", - "example": "1687-3", - "type": "string", - }, "end_date": { - "description": "The end date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", + "description": "Inclusive end date of the time off request (ISO8601 date-time without timezone). The time off includes this day", + "example": "2021-01-01T01:01:01.000", + "format": "datetime-local", "type": "string", }, "end_half_day": { @@ -6042,9 +5944,9 @@ Tools { "type": "object", }, "start_date": { - "description": "The start date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", + "description": "The start date of the time off request (ISO8601 date-time without timezone)", + "example": "2021-01-01T01:01:01.000", + "format": "datetime-local", "type": "string", }, "start_half_day": { @@ -6073,6 +5975,7 @@ Tools { "rejected", "pending", "deleted", + "draft", "unmapped_value", null, ], @@ -6110,11 +6013,6 @@ Tools { "name": "id", "type": "string", }, - { - "location": "body", - "name": "employee_id", - "type": "string", - }, { "location": "body", "name": "approver_id", @@ -6219,7 +6117,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", "type": "string", }, "id": { @@ -6292,10 +6190,10 @@ Tools { }, }, StackOneTool { - "description": "Update Employee Time Off Request", + "description": "Cancel Employee Time Off Request", "executeConfig": { "bodyType": "json", - "method": "PATCH", + "method": "DELETE", "params": [ { "location": "header", @@ -6312,38 +6210,101 @@ Tools { "name": "subResourceId", "type": "string", }, - { - "location": "body", - "name": "employee_id", + ], + "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off/{subResourceId}", + }, + "experimental_preExecute": undefined, + "name": "hris_cancel_employee_time_off_request", + "parameters": { + "properties": { + "id": { "type": "string", }, - { - "location": "body", - "name": "approver_id", + "subResourceId": { "type": "string", }, + "x-account-id": undefined, + }, + "required": [ + "id", + "subResourceId", + ], + "type": "object", + }, + "requestBuilder": RequestBuilder { + "bodyType": "json", + "headers": { + "Authorization": "Basic dGVzdF9rZXk6", + }, + "method": "DELETE", + "params": [ { - "location": "body", - "name": "status", - "type": "object", - }, - { - "location": "body", - "name": "start_date", + "location": "header", + "name": "x-account-id", "type": "string", }, { - "location": "body", - "name": "end_date", + "location": "path", + "name": "id", "type": "string", }, { - "location": "body", - "name": "start_half_day", + "location": "path", + "name": "subResourceId", "type": "string", }, - { - "location": "body", + ], + "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off/{subResourceId}", + }, + }, + StackOneTool { + "description": "Update Employee Time Off Request", + "executeConfig": { + "bodyType": "json", + "method": "PATCH", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "path", + "name": "id", + "type": "string", + }, + { + "location": "path", + "name": "subResourceId", + "type": "string", + }, + { + "location": "body", + "name": "approver_id", + "type": "string", + }, + { + "location": "body", + "name": "status", + "type": "object", + }, + { + "location": "body", + "name": "start_date", + "type": "string", + }, + { + "location": "body", + "name": "end_date", + "type": "string", + }, + { + "location": "body", + "name": "start_half_day", + "type": "string", + }, + { + "location": "body", "name": "end_half_day", "type": "string", }, @@ -6374,15 +6335,10 @@ Tools { "example": "1687-4", "type": "string", }, - "employee_id": { - "description": "The employee ID", - "example": "1687-3", - "type": "string", - }, "end_date": { - "description": "The end date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", + "description": "Inclusive end date of the time off request (ISO8601 date-time without timezone). The time off includes this day", + "example": "2021-01-01T01:01:01.000", + "format": "datetime-local", "type": "string", }, "end_half_day": { @@ -6431,9 +6387,9 @@ Tools { "type": "object", }, "start_date": { - "description": "The start date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", + "description": "The start date of the time off request (ISO8601 date-time without timezone)", + "example": "2021-01-01T01:01:01.000", + "format": "datetime-local", "type": "string", }, "start_half_day": { @@ -6462,6 +6418,7 @@ Tools { "rejected", "pending", "deleted", + "draft", "unmapped_value", null, ], @@ -6508,11 +6465,6 @@ Tools { "name": "subResourceId", "type": "string", }, - { - "location": "body", - "name": "employee_id", - "type": "string", - }, { "location": "body", "name": "approver_id", @@ -6653,6 +6605,7 @@ Tools { "enum": [ "true", "false", + "unmapped_value", null, ], "example": "true", @@ -7983,12 +7936,12 @@ Tools { }, { "location": "body", - "name": "category", + "name": "confidential", "type": "object", }, { "location": "body", - "name": "confidential", + "name": "category", "type": "object", }, ], @@ -8054,6 +8007,7 @@ Tools { "enum": [ "true", "false", + "unmapped_value", null, ], "example": "true", @@ -9356,12 +9310,12 @@ Tools { }, { "location": "body", - "name": "category", + "name": "confidential", "type": "object", }, { "location": "body", - "name": "confidential", + "name": "category", "type": "object", }, ], @@ -9394,6 +9348,11 @@ Tools { "name": "format", "type": "string", }, + { + "location": "query", + "name": "export_format", + "type": "string", + }, ], "url": "https://api.stackone.com/unified/hris/employees/{id}/documents/{subResourceId}/download", }, @@ -9401,6 +9360,11 @@ Tools { "name": "hris_download_employee_document", "parameters": { "properties": { + "export_format": { + "description": "The export format of the file", + "example": "text/plain", + "type": "string", + }, "format": { "description": "The format to download the file in", "example": "base64", @@ -9447,6 +9411,11 @@ Tools { "name": "format", "type": "string", }, + { + "location": "query", + "name": "export_format", + "type": "string", + }, ], "url": "https://api.stackone.com/unified/hris/employees/{id}/documents/{subResourceId}/download", }, @@ -11728,6 +11697,7 @@ Tools { "driver_license", "birth_certificate", "other", + "unmapped_value", null, ], "type": "string", @@ -11736,12 +11706,12 @@ Tools { "type": "object", }, "valid_from": { - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, "valid_to": { - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -13571,6 +13541,7 @@ Tools { "driver_license", "birth_certificate", "other", + "unmapped_value", null, ], "type": "string", @@ -13579,12 +13550,12 @@ Tools { "type": "object", }, "valid_from": { - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, "valid_to": { - "example": "2021-01-01T00:00.000Z", + "example": "2021-01-01T00:00:00.000Z", "format": "date-time", "type": "string", }, @@ -14020,7 +13991,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "filter": { @@ -14158,7 +14129,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "id": { @@ -14286,7 +14257,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "filter": { @@ -14396,7 +14367,7 @@ Tools { "type": "string", }, { - "location": "body", + "location": "path", "name": "id", "type": "string", }, @@ -14432,17 +14403,32 @@ Tools { }, { "location": "body", - "name": "employment_type", + "name": "effective_date", + "type": "string", + }, + { + "location": "body", + "name": "end_date", + "type": "string", + }, + { + "location": "body", + "name": "grade", "type": "object", }, { "location": "body", - "name": "employment_contract_type", + "name": "work_time", "type": "object", }, { "location": "body", - "name": "time_worked", + "name": "payroll_code", + "type": "string", + }, + { + "location": "body", + "name": "job_id", "type": "string", }, { @@ -14457,56 +14443,50 @@ Tools { "name": "hris_create_employee_employment", "parameters": { "properties": { - "employment_contract_type": { - "description": "The employment work schedule type (e.g., full-time, part-time)", - "example": "full_time", + "effective_date": { + "description": "The effective date of the employment contract", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "end_date": { + "description": "The end date of employment", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "grade": { + "description": "Represents the employeeโ€™s position within the organizational hierarchy.", "properties": { - "value": { - "enum": [ - "full_time", - "shifts", - "part_time", - "unmapped_value", - null, - ], + "description": { + "description": "description of the grade", + "example": "Mid-level employee demonstrating proficiency and autonomy.", "type": "string", }, - }, - "type": "object", - }, - "employment_type": { - "description": "The type of employment (e.g., contractor, permanent)", - "example": "permanent", - "properties": { - "value": { - "enum": [ - "contractor", - "intern", - "permanent", - "apprentice", - "freelance", - "terminated", - "temporary", - "seasonal", - "volunteer", - "probation", - "internal", - "external", - "expatriate", - "employer_of_record", - "casual", - "Programme", - "unmapped_value", - null, - ], + "id": { + "description": "The reference id", + "example": "1687-3", + "type": "string", + }, + "name": { + "description": "The reference name", + "example": "1687-4", + "type": "string", + }, + "remote_id": { + "description": "Provider's unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", "type": "string", }, }, "type": "object", }, "id": { - "description": "Unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", + "type": "string", + }, + "job_id": { + "description": "The employee job id", + "example": "5290", "type": "string", }, "job_title": { @@ -14583,10 +14563,9 @@ Tools { "example": "40.00", "type": "string", }, - "time_worked": { - "description": "The time worked for the employee in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", + "payroll_code": { + "description": "The payroll code of the employee", + "example": "PC1", "type": "string", }, "unified_custom_fields": { @@ -14598,6 +14577,37 @@ Tools { }, "type": "object", }, + "work_time": { + "properties": { + "duration": { + "description": "The work time duration in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", + "type": "string", + }, + "duration_unit": { + "description": "The duration unit of the work time", + "example": "month", + "properties": { + "value": { + "description": "The unified value for the period.", + "enum": [ + "day", + "week", + "month", + "year", + "unmapped_value", + null, + ], + "example": "month", + "type": "string", + }, + }, + "type": "object", + }, + }, + "type": "object", + }, "x-account-id": undefined, }, "required": [ @@ -14618,7 +14628,7 @@ Tools { "type": "string", }, { - "location": "body", + "location": "path", "name": "id", "type": "string", }, @@ -14654,17 +14664,32 @@ Tools { }, { "location": "body", - "name": "employment_type", + "name": "effective_date", + "type": "string", + }, + { + "location": "body", + "name": "end_date", + "type": "string", + }, + { + "location": "body", + "name": "grade", "type": "object", }, { "location": "body", - "name": "employment_contract_type", + "name": "work_time", "type": "object", }, { "location": "body", - "name": "time_worked", + "name": "payroll_code", + "type": "string", + }, + { + "location": "body", + "name": "job_id", "type": "string", }, { @@ -14731,7 +14756,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,employment_type,employment_contract_type,time_worked,created_at,updated_at,start_date,end_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", + "example": "id,remote_id,employee_id,remote_employee_id,job_title,pay_rate,pay_period,pay_frequency,pay_currency,effective_date,end_date,employment_type,employment_contract_type,change_reason,grade,work_time,payroll_code,fte,created_at,updated_at,start_date,active,department,team,cost_center,cost_centers,division,job,type,contract_type,manager", "type": "string", }, "id": { @@ -14815,7 +14840,7 @@ Tools { "type": "string", }, { - "location": "body", + "location": "path", "name": "id", "type": "string", }, @@ -14856,17 +14881,27 @@ Tools { }, { "location": "body", - "name": "employment_type", + "name": "effective_date", + "type": "string", + }, + { + "location": "body", + "name": "end_date", + "type": "string", + }, + { + "location": "body", + "name": "grade", "type": "object", }, { "location": "body", - "name": "employment_contract_type", + "name": "work_time", "type": "object", }, { "location": "body", - "name": "time_worked", + "name": "payroll_code", "type": "string", }, { @@ -14881,56 +14916,45 @@ Tools { "name": "hris_update_employee_employment", "parameters": { "properties": { - "employment_contract_type": { - "description": "The employment work schedule type (e.g., full-time, part-time)", - "example": "full_time", + "effective_date": { + "description": "The effective date of the employment contract", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "end_date": { + "description": "The end date of employment", + "example": "2021-01-01T01:01:01.000Z", + "format": "date-time", + "type": "string", + }, + "grade": { + "description": "Represents the employeeโ€™s position within the organizational hierarchy.", "properties": { - "value": { - "enum": [ - "full_time", - "shifts", - "part_time", - "unmapped_value", - null, - ], + "description": { + "description": "description of the grade", + "example": "Mid-level employee demonstrating proficiency and autonomy.", "type": "string", }, - }, - "type": "object", - }, - "employment_type": { - "description": "The type of employment (e.g., contractor, permanent)", - "example": "permanent", - "properties": { - "value": { - "enum": [ - "contractor", - "intern", - "permanent", - "apprentice", - "freelance", - "terminated", - "temporary", - "seasonal", - "volunteer", - "probation", - "internal", - "external", - "expatriate", - "employer_of_record", - "casual", - "Programme", - "unmapped_value", - null, - ], + "id": { + "description": "The reference id", + "example": "1687-3", + "type": "string", + }, + "name": { + "description": "The reference name", + "example": "1687-4", + "type": "string", + }, + "remote_id": { + "description": "Provider's unique identifier", + "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", "type": "string", }, }, "type": "object", }, "id": { - "description": "Unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", "type": "string", }, "job_title": { @@ -15007,13 +15031,12 @@ Tools { "example": "40.00", "type": "string", }, - "subResourceId": { + "payroll_code": { + "description": "The payroll code of the employee", + "example": "PC1", "type": "string", }, - "time_worked": { - "description": "The time worked for the employee in ISO 8601 duration format", - "example": "P0Y0M0DT8H0M0S", - "format": "duration", + "subResourceId": { "type": "string", }, "unified_custom_fields": { @@ -15025,6 +15048,37 @@ Tools { }, "type": "object", }, + "work_time": { + "properties": { + "duration": { + "description": "The work time duration in ISO 8601 duration format", + "example": "P0Y0M0DT8H0M0S", + "format": "duration", + "type": "string", + }, + "duration_unit": { + "description": "The duration unit of the work time", + "example": "month", + "properties": { + "value": { + "description": "The unified value for the period.", + "enum": [ + "day", + "week", + "month", + "year", + "unmapped_value", + null, + ], + "example": "month", + "type": "string", + }, + }, + "type": "object", + }, + }, + "type": "object", + }, "x-account-id": undefined, }, "required": [ @@ -15046,7 +15100,7 @@ Tools { "type": "string", }, { - "location": "body", + "location": "path", "name": "id", "type": "string", }, @@ -15087,17 +15141,27 @@ Tools { }, { "location": "body", - "name": "employment_type", + "name": "effective_date", + "type": "string", + }, + { + "location": "body", + "name": "end_date", + "type": "string", + }, + { + "location": "body", + "name": "grade", "type": "object", }, { "location": "body", - "name": "employment_contract_type", + "name": "work_time", "type": "object", }, { "location": "body", - "name": "time_worked", + "name": "payroll_code", "type": "string", }, { @@ -15400,7 +15464,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", "type": "string", }, "filter": { @@ -15495,248 +15559,6 @@ Tools { "url": "https://api.stackone.com/unified/hris/time_off", }, }, - StackOneTool { - "description": "Creates a time off request", - "executeConfig": { - "bodyType": "json", - "method": "POST", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "body", - "name": "employee_id", - "type": "string", - }, - { - "location": "body", - "name": "approver_id", - "type": "string", - }, - { - "location": "body", - "name": "status", - "type": "object", - }, - { - "location": "body", - "name": "start_date", - "type": "string", - }, - { - "location": "body", - "name": "end_date", - "type": "string", - }, - { - "location": "body", - "name": "start_half_day", - "type": "string", - }, - { - "location": "body", - "name": "end_half_day", - "type": "string", - }, - { - "location": "body", - "name": "time_off_policy_id", - "type": "string", - }, - { - "location": "body", - "name": "reason", - "type": "object", - }, - { - "location": "body", - "name": "passthrough", - "type": "object", - }, - ], - "url": "https://api.stackone.com/unified/hris/time_off", - }, - "experimental_preExecute": undefined, - "name": "hris_create_time_off_request", - "parameters": { - "properties": { - "approver_id": { - "description": "The approver ID", - "example": "1687-4", - "type": "string", - }, - "employee_id": { - "description": "The employee ID", - "example": "1687-3", - "type": "string", - }, - "end_date": { - "description": "The end date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "end_half_day": { - "description": "True if the end of the time off request ends half way through the day", - "example": true, - "oneOf": [ - { - "type": "boolean", - }, - { - "enum": [ - "true", - "false", - ], - "type": "string", - }, - ], - }, - "passthrough": { - "additionalProperties": true, - "description": "Value to pass through to the provider", - "example": { - "other_known_names": "John Doe", - }, - "type": "object", - }, - "reason": { - "properties": { - "id": { - "description": "Unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, - "name": { - "type": "string", - }, - "remote_id": { - "description": "Provider's unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, - }, - "type": "object", - }, - "start_date": { - "description": "The start date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "start_half_day": { - "description": "True if the start of the time off request begins half way through the day", - "example": true, - "oneOf": [ - { - "type": "boolean", - }, - { - "enum": [ - "true", - "false", - ], - "type": "string", - }, - ], - }, - "status": { - "description": "The status of the time off request", - "properties": { - "value": { - "enum": [ - "approved", - "cancelled", - "rejected", - "pending", - "deleted", - "unmapped_value", - null, - ], - "type": "string", - }, - }, - "type": "object", - }, - "time_off_policy_id": { - "description": "The time off policy id associated with this time off request", - "example": "cx280928933", - "type": "string", - }, - "x-account-id": undefined, - }, - "required": undefined, - "type": "object", - }, - "requestBuilder": RequestBuilder { - "bodyType": "json", - "headers": { - "Authorization": "Basic dGVzdF9rZXk6", - }, - "method": "POST", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "body", - "name": "employee_id", - "type": "string", - }, - { - "location": "body", - "name": "approver_id", - "type": "string", - }, - { - "location": "body", - "name": "status", - "type": "object", - }, - { - "location": "body", - "name": "start_date", - "type": "string", - }, - { - "location": "body", - "name": "end_date", - "type": "string", - }, - { - "location": "body", - "name": "start_half_day", - "type": "string", - }, - { - "location": "body", - "name": "end_half_day", - "type": "string", - }, - { - "location": "body", - "name": "time_off_policy_id", - "type": "string", - }, - { - "location": "body", - "name": "reason", - "type": "object", - }, - { - "location": "body", - "name": "passthrough", - "type": "object", - }, - ], - "url": "https://api.stackone.com/unified/hris/time_off", - }, - }, StackOneTool { "description": "Get time off request", "executeConfig": { @@ -15787,7 +15609,7 @@ Tools { }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,duration,time_off_policy_id,remote_time_off_policy_id,reason,created_at,updated_at,policy", + "example": "id,remote_id,employee_id,remote_employee_id,approver_id,remote_approver_id,status,type,start_date,end_date,start_half_day,end_half_day,time_off_policy_id,remote_time_off_policy_id,reason,duration,created_at,updated_at,policy", "type": "string", }, "id": { @@ -15842,266 +15664,9 @@ Tools { "type": "string", }, { - "location": "query", - "name": "expand", - "type": "string", - }, - ], - "url": "https://api.stackone.com/unified/hris/time_off/{id}", - }, - }, - StackOneTool { - "description": "Update time off request", - "executeConfig": { - "bodyType": "json", - "method": "PATCH", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "path", - "name": "id", - "type": "string", - }, - { - "location": "body", - "name": "employee_id", - "type": "string", - }, - { - "location": "body", - "name": "approver_id", - "type": "string", - }, - { - "location": "body", - "name": "status", - "type": "object", - }, - { - "location": "body", - "name": "start_date", - "type": "string", - }, - { - "location": "body", - "name": "end_date", - "type": "string", - }, - { - "location": "body", - "name": "start_half_day", - "type": "string", - }, - { - "location": "body", - "name": "end_half_day", - "type": "string", - }, - { - "location": "body", - "name": "time_off_policy_id", - "type": "string", - }, - { - "location": "body", - "name": "reason", - "type": "object", - }, - { - "location": "body", - "name": "passthrough", - "type": "object", - }, - ], - "url": "https://api.stackone.com/unified/hris/time_off/{id}", - }, - "experimental_preExecute": undefined, - "name": "hris_update_time_off_request", - "parameters": { - "properties": { - "approver_id": { - "description": "The approver ID", - "example": "1687-4", - "type": "string", - }, - "employee_id": { - "description": "The employee ID", - "example": "1687-3", - "type": "string", - }, - "end_date": { - "description": "The end date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "end_half_day": { - "description": "True if the end of the time off request ends half way through the day", - "example": true, - "oneOf": [ - { - "type": "boolean", - }, - { - "enum": [ - "true", - "false", - ], - "type": "string", - }, - ], - }, - "id": { - "type": "string", - }, - "passthrough": { - "additionalProperties": true, - "description": "Value to pass through to the provider", - "example": { - "other_known_names": "John Doe", - }, - "type": "object", - }, - "reason": { - "properties": { - "id": { - "description": "Unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, - "name": { - "type": "string", - }, - "remote_id": { - "description": "Provider's unique identifier", - "example": "8187e5da-dc77-475e-9949-af0f1fa4e4e3", - "type": "string", - }, - }, - "type": "object", - }, - "start_date": { - "description": "The start date of the time off request", - "example": "2021-01-01T01:01:01.000Z", - "format": "date-time", - "type": "string", - }, - "start_half_day": { - "description": "True if the start of the time off request begins half way through the day", - "example": true, - "oneOf": [ - { - "type": "boolean", - }, - { - "enum": [ - "true", - "false", - ], - "type": "string", - }, - ], - }, - "status": { - "description": "The status of the time off request", - "properties": { - "value": { - "enum": [ - "approved", - "cancelled", - "rejected", - "pending", - "deleted", - "unmapped_value", - null, - ], - "type": "string", - }, - }, - "type": "object", - }, - "time_off_policy_id": { - "description": "The time off policy id associated with this time off request", - "example": "cx280928933", - "type": "string", - }, - "x-account-id": undefined, - }, - "required": [ - "id", - ], - "type": "object", - }, - "requestBuilder": RequestBuilder { - "bodyType": "json", - "headers": { - "Authorization": "Basic dGVzdF9rZXk6", - }, - "method": "PATCH", - "params": [ - { - "location": "header", - "name": "x-account-id", - "type": "string", - }, - { - "location": "path", - "name": "id", - "type": "string", - }, - { - "location": "body", - "name": "employee_id", - "type": "string", - }, - { - "location": "body", - "name": "approver_id", - "type": "string", - }, - { - "location": "body", - "name": "status", - "type": "object", - }, - { - "location": "body", - "name": "start_date", - "type": "string", - }, - { - "location": "body", - "name": "end_date", - "type": "string", - }, - { - "location": "body", - "name": "start_half_day", - "type": "string", - }, - { - "location": "body", - "name": "end_half_day", - "type": "string", - }, - { - "location": "body", - "name": "time_off_policy_id", - "type": "string", - }, - { - "location": "body", - "name": "reason", - "type": "object", - }, - { - "location": "body", - "name": "passthrough", - "type": "object", + "location": "query", + "name": "expand", + "type": "string", }, ], "url": "https://api.stackone.com/unified/hris/time_off/{id}", @@ -16867,7 +16432,7 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, "filter": { @@ -17133,7 +16698,7 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", + "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, "filter": { @@ -17389,7 +16954,7 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, "id": { @@ -17585,7 +17150,7 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", + "example": "id,remote_id,name,type,distribution_percentage,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, "id": { @@ -17791,7 +17356,7 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, "filter": { @@ -17914,7 +17479,7 @@ Tools { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids", + "example": "id,remote_id,name,type,parent_ids,remote_parent_ids,owner_ids,remote_owner_ids,company_id,remote_company_id", "type": "string", }, "id": { @@ -18188,6 +17753,7 @@ Tools { "3", "4", "5", + "unmapped_value", null, ], "type": "string", @@ -18220,6 +17786,7 @@ Tools { "3", "4", "5", + "unmapped_value", null, ], "type": "string", @@ -18312,15 +17879,284 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/skills/{subResourceId}", + "url": "https://api.stackone.com/unified/hris/employees/{id}/skills/{subResourceId}", + }, + "experimental_preExecute": undefined, + "name": "hris_get_employee_skill", + "parameters": { + "properties": { + "fields": { + "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", + "example": "id,remote_id,name,active,language,maximum_proficiency,minimum_proficiency", + "type": "string", + }, + "id": { + "type": "string", + }, + "proxy": { + "additionalProperties": true, + "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", + "type": "object", + }, + "raw": { + "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", + "type": "boolean", + }, + "subResourceId": { + "type": "string", + }, + "x-account-id": undefined, + }, + "required": [ + "id", + "subResourceId", + ], + "type": "object", + }, + "requestBuilder": RequestBuilder { + "bodyType": "json", + "headers": { + "Authorization": "Basic dGVzdF9rZXk6", + }, + "method": "GET", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "path", + "name": "id", + "type": "string", + }, + { + "location": "path", + "name": "subResourceId", + "type": "string", + }, + { + "location": "query", + "name": "raw", + "type": "boolean", + }, + { + "location": "query", + "name": "proxy", + "type": "object", + }, + { + "location": "query", + "name": "fields", + "type": "string", + }, + ], + "url": "https://api.stackone.com/unified/hris/employees/{id}/skills/{subResourceId}", + }, + }, + StackOneTool { + "description": "List Time Off Policies", + "executeConfig": { + "bodyType": "json", + "method": "GET", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "query", + "name": "raw", + "type": "boolean", + }, + { + "location": "query", + "name": "proxy", + "type": "object", + }, + { + "location": "query", + "name": "fields", + "type": "string", + }, + { + "location": "query", + "name": "filter", + "type": "object", + }, + { + "location": "query", + "name": "page_size", + "type": "string", + }, + { + "location": "query", + "name": "next", + "type": "string", + }, + ], + "url": "https://api.stackone.com/unified/hris/time_off_policies", + }, + "experimental_preExecute": undefined, + "name": "hris_list_time_off_policies", + "parameters": { + "properties": { + "fields": { + "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", + "example": "id,remote_id,name,description,type,duration_unit,reasons,updated_at,created_at", + "type": "string", + }, + "filter": { + "description": "HRIS Time-Off Policies filters", + "properties": { + "type": { + "description": "Filter to select time-off policies by type", + "enum": [ + "sick", + "unmapped_value", + "vacation", + "long_term_disability", + "short_term_disability", + "absent", + "comp_time", + "training", + "annual_leave", + "leave_of_absence", + "break", + "child_care_leave", + "maternity_leave", + "jury_duty", + "sabbatical", + "accident", + "paid", + "unpaid", + "holiday", + "personal", + "in_lieu", + "bereavement", + null, + ], + "type": "string", + }, + "updated_after": { + "additionalProperties": false, + "description": "Use a string with a date to only select results updated after that given date", + "example": "2020-01-01T00:00:00.000Z", + "type": "string", + }, + }, + "type": "object", + }, + "next": { + "description": "The unified cursor", + "type": "string", + }, + "page_size": { + "description": "The number of results per page (default value is 25)", + "type": "string", + }, + "proxy": { + "additionalProperties": true, + "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", + "type": "object", + }, + "raw": { + "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", + "type": "boolean", + }, + "x-account-id": undefined, + }, + "required": undefined, + "type": "object", + }, + "requestBuilder": RequestBuilder { + "bodyType": "json", + "headers": { + "Authorization": "Basic dGVzdF9rZXk6", + }, + "method": "GET", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "query", + "name": "raw", + "type": "boolean", + }, + { + "location": "query", + "name": "proxy", + "type": "object", + }, + { + "location": "query", + "name": "fields", + "type": "string", + }, + { + "location": "query", + "name": "filter", + "type": "object", + }, + { + "location": "query", + "name": "page_size", + "type": "string", + }, + { + "location": "query", + "name": "next", + "type": "string", + }, + ], + "url": "https://api.stackone.com/unified/hris/time_off_policies", + }, + }, + StackOneTool { + "description": "Get Time Off Policy", + "executeConfig": { + "bodyType": "json", + "method": "GET", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "path", + "name": "id", + "type": "string", + }, + { + "location": "query", + "name": "raw", + "type": "boolean", + }, + { + "location": "query", + "name": "proxy", + "type": "object", + }, + { + "location": "query", + "name": "fields", + "type": "string", + }, + ], + "url": "https://api.stackone.com/unified/hris/time_off_policies/{id}", }, "experimental_preExecute": undefined, - "name": "hris_get_employee_skill", + "name": "hris_get_time_off_policy", "parameters": { "properties": { "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,active,language,maximum_proficiency,minimum_proficiency", + "example": "id,remote_id,name,description,type,duration_unit,reasons,updated_at,created_at", "type": "string", }, "id": { @@ -18335,14 +18171,10 @@ Tools { "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", "type": "boolean", }, - "subResourceId": { - "type": "string", - }, "x-account-id": undefined, }, "required": [ "id", - "subResourceId", ], "type": "object", }, @@ -18363,11 +18195,6 @@ Tools { "name": "id", "type": "string", }, - { - "location": "path", - "name": "subResourceId", - "type": "string", - }, { "location": "query", "name": "raw", @@ -18384,11 +18211,11 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/skills/{subResourceId}", + "url": "https://api.stackone.com/unified/hris/time_off_policies/{id}", }, }, StackOneTool { - "description": "List Time Off Policies", + "description": "List Assigned Time Off Policies", "executeConfig": { "bodyType": "json", "method": "GET", @@ -18398,6 +18225,11 @@ Tools { "name": "x-account-id", "type": "string", }, + { + "location": "path", + "name": "id", + "type": "string", + }, { "location": "query", "name": "raw", @@ -18429,10 +18261,10 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/time_off_policies", + "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off_policies", }, "experimental_preExecute": undefined, - "name": "hris_list_time_off_policies", + "name": "hris_list_employee_time_off_policies", "parameters": { "properties": { "fields": { @@ -18441,8 +18273,37 @@ Tools { "type": "string", }, "filter": { - "description": "Filter parameters that allow greater customisation of the list response", + "description": "HRIS Time-Off Policies filters", "properties": { + "type": { + "description": "Filter to select time-off policies by type", + "enum": [ + "sick", + "unmapped_value", + "vacation", + "long_term_disability", + "short_term_disability", + "absent", + "comp_time", + "training", + "annual_leave", + "leave_of_absence", + "break", + "child_care_leave", + "maternity_leave", + "jury_duty", + "sabbatical", + "accident", + "paid", + "unpaid", + "holiday", + "personal", + "in_lieu", + "bereavement", + null, + ], + "type": "string", + }, "updated_after": { "additionalProperties": false, "description": "Use a string with a date to only select results updated after that given date", @@ -18452,6 +18313,9 @@ Tools { }, "type": "object", }, + "id": { + "type": "string", + }, "next": { "description": "The unified cursor", "type": "string", @@ -18471,7 +18335,9 @@ Tools { }, "x-account-id": undefined, }, - "required": undefined, + "required": [ + "id", + ], "type": "object", }, "requestBuilder": RequestBuilder { @@ -18486,6 +18352,11 @@ Tools { "name": "x-account-id", "type": "string", }, + { + "location": "path", + "name": "id", + "type": "string", + }, { "location": "query", "name": "raw", @@ -18517,11 +18388,11 @@ Tools { "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/time_off_policies", + "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off_policies", }, }, StackOneTool { - "description": "Get Time Off Policy", + "description": "List Employee Tasks", "executeConfig": { "bodyType": "json", "method": "GET", @@ -18551,21 +18422,66 @@ Tools { "name": "fields", "type": "string", }, + { + "location": "query", + "name": "filter", + "type": "object", + }, + { + "location": "query", + "name": "page_size", + "type": "string", + }, + { + "location": "query", + "name": "next", + "type": "string", + }, + { + "location": "query", + "name": "expand", + "type": "string", + }, ], - "url": "https://api.stackone.com/unified/hris/time_off_policies/{id}", + "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks", }, "experimental_preExecute": undefined, - "name": "hris_get_time_off_policy", + "name": "hris_list_employee_tasks", "parameters": { "properties": { + "expand": { + "description": "The comma separated list of fields that will be expanded in the response", + "example": "attachments", + "type": "string", + }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,description,type,duration_unit,reasons,updated_at,created_at", + "example": "id,remote_id,employee_id,remote_employee_id,name,description,type,status,due_date,completion_date,assigned_by_employee_id,remote_assigned_by_employee_id,assigned_by_employee_name,link_to_task,extracted_links,next_task_id,remote_next_task_id,parent_process_name,comments,attachments,created_at,updated_at", "type": "string", }, + "filter": { + "description": "Filter parameters that allow greater customisation of the list response", + "properties": { + "updated_after": { + "additionalProperties": false, + "description": "Use a string with a date to only select results updated after that given date", + "example": "2020-01-01T00:00:00.000Z", + "type": "string", + }, + }, + "type": "object", + }, "id": { "type": "string", }, + "next": { + "description": "The unified cursor", + "type": "string", + }, + "page_size": { + "description": "The number of results per page (default value is 25)", + "type": "string", + }, "proxy": { "additionalProperties": true, "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", @@ -18614,12 +18530,32 @@ Tools { "name": "fields", "type": "string", }, + { + "location": "query", + "name": "filter", + "type": "object", + }, + { + "location": "query", + "name": "page_size", + "type": "string", + }, + { + "location": "query", + "name": "next", + "type": "string", + }, + { + "location": "query", + "name": "expand", + "type": "string", + }, ], - "url": "https://api.stackone.com/unified/hris/time_off_policies/{id}", + "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks", }, }, StackOneTool { - "description": "List Assigned Time Off Policies", + "description": "Get Employee Task", "executeConfig": { "bodyType": "json", "method": "GET", @@ -18634,6 +18570,11 @@ Tools { "name": "id", "type": "string", }, + { + "location": "path", + "name": "subResourceId", + "type": "string", + }, { "location": "query", "name": "raw", @@ -18651,54 +18592,29 @@ Tools { }, { "location": "query", - "name": "filter", - "type": "object", - }, - { - "location": "query", - "name": "page_size", - "type": "string", - }, - { - "location": "query", - "name": "next", + "name": "expand", "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off_policies", + "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks/{subResourceId}", }, "experimental_preExecute": undefined, - "name": "hris_list_employee_time_off_policies", + "name": "hris_get_employee_task", "parameters": { "properties": { + "expand": { + "description": "The comma separated list of fields that will be expanded in the response", + "example": "attachments", + "type": "string", + }, "fields": { "description": "The comma separated list of fields that will be returned in the response (if empty, all fields are returned)", - "example": "id,remote_id,name,description,type,duration_unit,reasons,updated_at,created_at", + "example": "id,remote_id,employee_id,remote_employee_id,name,description,type,status,due_date,completion_date,assigned_by_employee_id,remote_assigned_by_employee_id,assigned_by_employee_name,link_to_task,extracted_links,next_task_id,remote_next_task_id,parent_process_name,comments,attachments,created_at,updated_at", "type": "string", }, - "filter": { - "description": "Filter parameters that allow greater customisation of the list response", - "properties": { - "updated_after": { - "additionalProperties": false, - "description": "Use a string with a date to only select results updated after that given date", - "example": "2020-01-01T00:00:00.000Z", - "type": "string", - }, - }, - "type": "object", - }, "id": { "type": "string", }, - "next": { - "description": "The unified cursor", - "type": "string", - }, - "page_size": { - "description": "The number of results per page (default value is 25)", - "type": "string", - }, "proxy": { "additionalProperties": true, "description": "Query parameters that can be used to pass through parameters to the underlying provider request by surrounding them with 'proxy' key", @@ -18708,10 +18624,14 @@ Tools { "description": "Indicates that the raw request result should be returned in addition to the mapped result (default value is false)", "type": "boolean", }, + "subResourceId": { + "type": "string", + }, "x-account-id": undefined, }, "required": [ "id", + "subResourceId", ], "type": "object", }, @@ -18732,6 +18652,11 @@ Tools { "name": "id", "type": "string", }, + { + "location": "path", + "name": "subResourceId", + "type": "string", + }, { "location": "query", "name": "raw", @@ -18749,21 +18674,105 @@ Tools { }, { "location": "query", - "name": "filter", - "type": "object", + "name": "expand", + "type": "string", + }, + ], + "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks/{subResourceId}", + }, + }, + StackOneTool { + "description": "Complete Employee Task", + "executeConfig": { + "bodyType": "json", + "method": "PATCH", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "path", + "name": "id", + "type": "string", + }, + { + "location": "path", + "name": "subResourceId", + "type": "string", }, { "location": "query", - "name": "page_size", + "name": "proxy", + "type": "string", + }, + { + "location": "body", + "name": "comment", + "type": "string", + }, + ], + "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks/{subResourceId}", + }, + "experimental_preExecute": undefined, + "name": "hris_complete_employee_task", + "parameters": { + "properties": { + "comment": { + "description": "Comment or note about the task completion", + "example": "All required documents have been submitted", + "type": "string", + }, + "id": { + "type": "string", + }, + "proxy": {}, + "subResourceId": { + "type": "string", + }, + "x-account-id": undefined, + }, + "required": [ + "id", + "subResourceId", + ], + "type": "object", + }, + "requestBuilder": RequestBuilder { + "bodyType": "json", + "headers": { + "Authorization": "Basic dGVzdF9rZXk6", + }, + "method": "PATCH", + "params": [ + { + "location": "header", + "name": "x-account-id", + "type": "string", + }, + { + "location": "path", + "name": "id", + "type": "string", + }, + { + "location": "path", + "name": "subResourceId", "type": "string", }, { "location": "query", - "name": "next", + "name": "proxy", + "type": "string", + }, + { + "location": "body", + "name": "comment", "type": "string", }, ], - "url": "https://api.stackone.com/unified/hris/employees/{id}/time_off_policies", + "url": "https://api.stackone.com/unified/hris/employees/{id}/tasks/{subResourceId}", }, }, ], From da52c4ee18abaeadf7af438b465db314af72e2c7 Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Tue, 17 Jun 2025 12:00:56 +0100 Subject: [PATCH 15/16] fix: lints --- examples/examples.spec.ts | 2 +- examples/planning.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/examples.spec.ts b/examples/examples.spec.ts index f369b818..f22bb477 100644 --- a/examples/examples.spec.ts +++ b/examples/examples.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'bun:test'; import { $ } from 'bun'; -import { directoryExists, listFilesInDirectory, joinPaths } from '../src/utils/file'; +import { directoryExists, joinPaths, listFilesInDirectory } from '../src/utils/file'; describe('Examples', () => { it( diff --git a/examples/planning.ts b/examples/planning.ts index 1cdb303b..b9bdd96c 100644 --- a/examples/planning.ts +++ b/examples/planning.ts @@ -6,9 +6,9 @@ * For example, onboard a new hire from your ATS to your HRIS. */ -import { StackOneToolSet } from '../src'; import { openai } from '@ai-sdk/openai'; import { generateText } from 'ai'; +import { StackOneToolSet } from '../src'; import { ACCOUNT_IDS } from './constants'; export const planningModule = async (): Promise => { From 638620da015118212facbd700e8589f56e2831a1 Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Tue, 17 Jun 2025 12:06:50 +0100 Subject: [PATCH 16/16] update readmes --- README.md | 95 ++++--- examples/README.md | 305 ++++++++++++++++++++++ examples/constants.ts | 19 -- scripts/rename-derivation-to-transform.ts | 111 -------- 4 files changed, 368 insertions(+), 162 deletions(-) create mode 100644 examples/README.md delete mode 100755 scripts/rename-derivation-to-transform.ts diff --git a/README.md b/README.md index 1eaa7eac..ceabd219 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ await generateText({ maxSteps: 3, }); ``` + > [!NOTE] > The workflow planner is in closed beta and only available to design partners. Apply for the waitlist [here](https://www.stackone.com/demo). @@ -275,50 +276,80 @@ const toolset = new StackOneToolSet({ baseUrl: "https://api.example-dev.com" }); [View full example](examples/custom-base-url.ts) -### Parameter Transformations +### Advanced Parameter Transformations + +**โš ๏ธ EXPERIMENTAL**: For advanced use cases, you can dynamically transform tool schemas and parameters using the experimental schema override and preExecute functionality. -You can derive multiple parameters from a single source parameter. +This two-stage transformation approach allows you to: -This is particularly useful for features like file uploads, where you can derive file content, name, and format from a file path, or for user data, where you can derive multiple user attributes from a user ID by doing a database lookup. +1. **Schema Override**: Change the tool's input schema at creation time +2. **PreExecute**: Transform parameters from the override schema back to the original API format at execution time -You can also define your own transformations for any type of parameter: +This is particularly powerful for document handling, where you can simplify complex file upload parameters: ```typescript -import { OpenAPIToolSet } from "@stackone/ai"; +import { StackOneToolSet } from "@stackone/ai"; +import type { + Experimental_SchemaOverride, + Experimental_PreExecuteFunction, +} from "@stackone/ai"; + +// 1. Schema Override: Simplify the input schema +const documentSchemaOverride: Experimental_SchemaOverride = ( + originalSchema +) => { + // Replace complex file parameters with simple doc_id + const newProperties = { ...originalSchema.properties }; + delete newProperties.content; + delete newProperties.name; + delete newProperties.file_format; + + newProperties.doc_id = { + type: "string", + description: "Document path or identifier", + }; + + return { ...originalSchema, properties: newProperties }; +}; -// Define a custom transformation configuration for user data -const userTransforms = { - transforms: { - first_name: (userId) => { - // Fetch user data and return first name - return getUserFirstName(userId); - }, - last_name: (userId) => { - // Fetch user data and return last name - return getUserLastName(userId); - }, - email: (userId) => { - // Fetch user data and return email - return getUserEmail(userId); - }, - }, - derivedParameters: ["first_name", "last_name", "email"], +// 2. PreExecute: Transform the simplified parameters back to API format +const documentPreExecute: Experimental_PreExecuteFunction = async (params) => { + const { doc_id, ...otherParams } = params; + + // Read file and convert to required API format + const fileContent = readFileSync(doc_id); + const base64Content = fileContent.toString("base64"); + const fileName = basename(doc_id); + const extension = extname(doc_id).slice(1); + + return { + ...otherParams, + content: base64Content, + name: fileName, + file_format: { value: extension }, + }; }; -// Initialize the toolset with custom transformation config -const toolset = new OpenAPIToolSet({ - filePath: "/path/to/openapi.json", - transformers: { - user_id: userTransforms, - }, +// Use the experimental transformation +const toolset = new StackOneToolSet(); +const tools = toolset.getStackOneTools("hris_*", "account_id"); + +const documentTool = tools.getTool("hris_upload_employee_document", { + experimental_schemaOverride: documentSchemaOverride, + experimental_preExecute: documentPreExecute, }); -// Execute with just the user_id parameter -// The first_name, last_name, and email will be derived automatically -const result = await tool.execute({ user_id: "user123" }); +// Now you can use the simplified schema +const result = await documentTool.execute({ + doc_id: "/path/to/document.pdf", // Simplified input + id: "employee_123", + category: { value: "shared" }, +}); ``` -[View full example](examples/openapi-transformations.ts) +โš ๏ธ **Important**: This is experimental functionality and the API may change in future versions. + +[View full example](examples/experimental-document-handling.ts) ### Testing with dryRun diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 00000000..0691be89 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,305 @@ +# StackOne AI SDK Examples + +This directory contains practical examples demonstrating how to use the StackOne AI SDK across different use cases and integrations. + +## Quick Start + +### Clone the repository + +```bash +git clone https://github.com/StackOneHQ/stackone-ai-node.git +``` + +### 2. Authentication + +Set your StackOne API key as an environment variable: + +```bash +export STACKONE_API_KEY=your_api_key_here +``` + +Or create a `.env` file in the project root: + +```env +STACKONE_API_KEY=your_api_key_here +``` + +Optional: Set an OpenAI API key as an environment variable: + +```bash +export OPENAI_API_KEY=your_api_key_here +``` + +Or create a `.env` file in the project root: + +```env +OPENAI_API_KEY=your_api_key_here +``` + +### 3. Configure Account IDs + +Update the account IDs in [`constants.ts`](./constants.ts) with your actual integration account IDs: + +```typescript +export const ACCOUNT_IDS = { + // Human Resources Information System + HRIS: "your_hris_account_id", + + // Applicant Tracking System + ATS: "your_ats_account_id", + + // Customer Relationship Management + CRM: "your_crm_account_id", + + // Document Management System + DOCUMENTS: "your_documents_account_id", + + // Test account IDs (used in examples that don't make real API calls) + TEST: { + VALID: "test_account_id", + OVERRIDE: "test_account_id_override", + DIRECT: "test_account_id_direct", + INVALID: "invalid_test_account_id", + }, +}; +``` + +## Running Examples + +### Run Individual Examples + +```bash +# Run a specific example +bun run examples/ai-sdk-integration.ts + +# Or with Node.js +npx tsx examples/ai-sdk-integration.ts +``` + +### Run All Examples + +```bash +# Test all examples +bun test examples/ +``` + +## Examples Overview + +### Core Integration Examples + +#### [`index.ts`](./index.ts) - Quickstart Guide + +Basic example showing how to initialize the toolset and make your first API call. + +- **Account ID**: HRIS +- **API Calls**: Yes +- **Key Features**: Basic tool usage, employee listing + +#### [`ai-sdk-integration.ts`](./ai-sdk-integration.ts) - AI SDK Integration + +Demonstrates integration with Vercel's AI SDK for building AI agents. + +- **Account ID**: HRIS +- **API Calls**: Via AI agent +- **Key Features**: AI SDK tools conversion, automated agent workflows + +#### [`openai-integration.ts`](./openai-integration.ts) - OpenAI Integration + +Shows how to use StackOne tools with OpenAI's function calling. + +- **Account ID**: HRIS +- **API Calls**: Via OpenAI function calls +- **Key Features**: OpenAI tools format, function calling + +### Configuration Examples + +#### [`account-id-usage.ts`](./account-id-usage.ts) - Account ID Management + +Demonstrates different ways to set and manage account IDs. + +- **Account ID**: TEST (multiple) +- **API Calls**: No (dry run) +- **Key Features**: Account ID precedence, override patterns + +#### [`custom-base-url.ts`](./custom-base-url.ts) - Custom Base URL + +Shows how to use custom base URLs for development or self-hosted instances. + +- **Account ID**: None +- **API Calls**: No (dry run) +- **Key Features**: Custom API endpoints, development setup + +### Advanced Features + +#### [`experimental-document-handling.ts`](./experimental-document-handling.ts) - Document Processing + +**โš ๏ธ EXPERIMENTAL**: Advanced document handling with schema overrides. + +- **Account ID**: HRIS +- **API Calls**: No (dry run) +- **Key Features**: Schema transformation, file processing, multi-source documents + +#### [`filters.ts`](./filters.ts) - Advanced Filtering + +Demonstrates complex filtering and query parameter serialization. + +- **Account ID**: TEST +- **API Calls**: No (dry run) +- **Key Features**: Deep object serialization, complex filters, proxy parameters + +#### [`human-in-the-loop.ts`](./human-in-the-loop.ts) - Human Validation + +Shows how to implement human-in-the-loop workflows for validation. + +- **Account ID**: HRIS +- **API Calls**: Conditional +- **Key Features**: Manual approval workflows, UI integration patterns + +### OpenAPI Toolset Examples + +#### [`openapi-toolset.ts`](./openapi-toolset.ts) - OpenAPI Integration + +Demonstrates loading and using OpenAPI specifications directly. + +- **Account ID**: None +- **API Calls**: No (dry run) +- **Key Features**: File loading, URL loading, OpenAPI parsing + +### Planning Module (Beta) + +#### [`planning.ts`](./planning.ts) - Workflow Planning + +**๐Ÿšง CLOSED BETA**: Advanced workflow planning with StackOne's planning agent. + +- **Account ID**: ATS, HRIS +- **API Calls**: Planning API +- **Key Features**: Multi-step workflows, caching, complex business processes + +### Error Handling + +#### [`error-handling.ts`](./error-handling.ts) - Error Management + +Comprehensive error handling patterns and best practices. + +- **Account ID**: TEST (invalid) +- **API Calls**: Intentionally failing calls +- **Key Features**: Error types, validation, graceful degradation + +## Example Categories + +### ๐ŸŸข Production Ready + +Examples that are stable and recommended for production use: + +- `index.ts` +- `ai-sdk-integration.ts` +- `openai-integration.ts` +- `account-id-usage.ts` +- `custom-base-url.ts` +- `filters.ts` +- `error-handling.ts` +- `openapi-toolset.ts` + +### ๐ŸŸก Advanced/Experimental + +Examples showcasing advanced or experimental features: + +- `experimental-document-handling.ts` (โš ๏ธ API may change) +- `human-in-the-loop.ts` + +### ๐Ÿ”ต Beta/Limited Access + +Examples requiring special access: + +- `planning.ts` (๐Ÿšง Closed beta only) + +## Common Patterns + +### Dry Run for Testing + +Most examples support dry run mode to inspect requests without making API calls: + +```typescript +const result = await tool.execute(params, { dryRun: true }); +console.log(result.url); // The URL that would be called +console.log(result.method); // HTTP method +console.log(result.headers); // Request headers +console.log(result.body); // Request body +``` + +### Error Handling + +All production examples include proper error handling: + +```typescript +try { + const result = await tool.execute(params); + // Handle success +} catch (error) { + if (error instanceof StackOneAPIError) { + console.error("API Error:", error.statusCode, error.responseBody); + } else { + console.error("Unexpected error:", error.message); + } +} +``` + +### Account ID Patterns + +Examples demonstrate different ways to provide account IDs: + +```typescript +// 1. At toolset initialization +const toolset = new StackOneToolSet({ accountId: "account_123" }); + +// 2. When getting tools +const tools = toolset.getStackOneTools("hris_*", "account_123"); + +// 3. Directly on individual tools +tool.setAccountId("account_123"); +``` + +## Testing Examples + +The examples include a comprehensive test suite: + +```bash +# Run all example tests +bun test examples/ + +# Run with verbose output +bun test examples/ --verbose + +# Run specific test +bun test examples/examples.spec.ts +``` + +## Troubleshooting + +### Common Issues + +1. **Authentication Errors**: Ensure `STACKONE_API_KEY` is set correctly +2. **Account ID Errors**: Update account IDs in `constants.ts` with your actual values +3. **Network Errors**: Check if you're behind a proxy or firewall +4. **TypeScript Errors**: Ensure you're using compatible Node.js and TypeScript versions + +### Getting Help + +- Check the [main README](../README.md) for general setup instructions +- Review the [StackOne documentation](https://docs.stackone.com) +- Open an issue on GitHub for bug reports or feature requests + +## Contributing + +When adding new examples: + +1. Follow the existing naming convention +2. Add the example to this README +3. Include proper error handling +4. Add TypeScript types +5. Test with the examples test suite +6. Update `constants.ts` if new account IDs are needed + +## License + +These examples are part of the StackOne AI SDK and are subject to the same license terms. diff --git a/examples/constants.ts b/examples/constants.ts index c0ee0c75..ae132d72 100644 --- a/examples/constants.ts +++ b/examples/constants.ts @@ -4,7 +4,6 @@ * These account IDs are organized by vertical and can be reused across examples. * Update these values with your actual account IDs for each integration. */ - export const ACCOUNT_IDS = { // Human Resources Information System HRIS: '46132201201510402136', @@ -25,21 +24,3 @@ export const ACCOUNT_IDS = { INVALID: 'invalid_test_account_id', }, } as const; - -/** - * Helper function to get account ID by vertical - */ -export const getAccountId = (vertical: keyof typeof ACCOUNT_IDS): string => { - const accountId = ACCOUNT_IDS[vertical]; - - if (typeof accountId === 'string') { - return accountId; - } - - // For TEST vertical, return VALID as default - if (vertical === 'TEST') { - return ACCOUNT_IDS.TEST.VALID; - } - - throw new Error(`Invalid vertical: ${vertical}`); -}; diff --git a/scripts/rename-derivation-to-transform.ts b/scripts/rename-derivation-to-transform.ts deleted file mode 100755 index 3927cab5..00000000 --- a/scripts/rename-derivation-to-transform.ts +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env bun - -/** - * Script to rename derivation terminology to parameter transformation terminology - * - * This script will: - * 1. Rename DerivationConfig to ParameterTransformer - * 2. Rename derivationFunctions to transforms - * 3. Rename deriveParameters to transformParameter - * 4. Rename derivationConfigs to transformers - * 5. Update all related variable names and comments - */ - -import { execSync } from 'node:child_process'; -import fs from 'node:fs'; -import path from 'node:path'; - -// Define the replacements -const replacements = [ - // Type and interface names - { from: /DerivationConfig/g, to: 'ParameterTransformer' }, - { from: /DerivationFunction/g, to: 'TransformFunction' }, - { from: /DerivationFunctions/g, to: 'TransformFunctions' }, - { from: /DerivationConfigMap/g, to: 'ParameterTransformerMap' }, - - // Property and method names - { from: /derivationFunctions/g, to: 'transforms' }, - { from: /derivationConfigs/g, to: 'transformers' }, - { from: /derivationConfig/g, to: 'transformer' }, - { from: /deriveParameters/g, to: 'transformParameter' }, - { from: /addDerivationConfig/g, to: 'addTransformer' }, - { from: /getDerivationConfig/g, to: 'getTransformer' }, - { from: /getDefaultDerivationConfigs/g, to: 'getDefaultTransformers' }, - - // Variable names - { from: /sourceParameter/g, to: 'sourceParameter' }, // Keep this the same - - // Comments and documentation - { from: /parameter derivation/g, to: 'parameter transformation' }, - { from: /Parameter Derivation/g, to: 'Parameter Transformation' }, - { from: /derived parameter/g, to: 'transformed parameter' }, - { from: /derive parameter/g, to: 'transform parameter' }, - { from: /Derive parameter/g, to: 'Transform parameter' }, -]; - -// Get all TypeScript files in the src directory -const getAllTsFiles = (dir: string): string[] => { - const files: string[] = []; - const items = fs.readdirSync(dir); - - for (const item of items) { - const fullPath = path.join(dir, item); - const stat = fs.statSync(fullPath); - - if (stat.isDirectory()) { - files.push(...getAllTsFiles(fullPath)); - } else if (item.endsWith('.ts')) { - files.push(fullPath); - } - } - - return files; -}; - -// Process a file with the replacements -const processFile = (filePath: string): void => { - console.log(`Processing ${filePath}...`); - let content = fs.readFileSync(filePath, 'utf-8'); - let changed = false; - - for (const replacement of replacements) { - const newContent = content.replace(replacement.from, replacement.to); - if (newContent !== content) { - content = newContent; - changed = true; - } - } - - if (changed) { - fs.writeFileSync(filePath, content); - console.log(`Updated ${filePath}`); - } -}; - -// Main function -const main = (): void => { - // Process src directory - const srcFiles = getAllTsFiles(path.join(process.cwd(), 'src')); - for (const file of srcFiles) { - processFile(file); - } - - // Process examples directory - const examplesFiles = getAllTsFiles(path.join(process.cwd(), 'examples')); - for (const file of examplesFiles) { - processFile(file); - } - - // Run tests to verify everything still works - console.log('\nRunning tests to verify changes...'); - try { - execSync('bun test', { stdio: 'inherit' }); - console.log('\nAll tests passed! The renaming was successful.'); - } catch (error) { - console.error('\nTests failed after renaming. Please check the errors above.'); - process.exit(1); - } -}; - -// Run the script -main(); \ No newline at end of file